Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

快速创建小程序接口 #1555

Merged
merged 34 commits into from
Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
8ddc50e
Merge pull request #15 from JeffreySu/master
mc7246 Aug 26, 2018
526f4eb
Merge pull request #16 from JeffreySu/master
mc7246 Sep 6, 2018
f6a9085
Merge pull request #17 from JeffreySu/master
mc7246 Oct 20, 2018
8f425f7
开放平台由nuget修改为引用项目
mc7246 Oct 20, 2018
639b737
Merge pull request #1515 from JeffreySu/Developer
JeffreySu Dec 17, 2018
27dac69
Merge pull request #1516 from JeffreySu/Developer
JeffreySu Dec 17, 2018
2f0a860
Merge pull request #1517 from JeffreySu/Developer
JeffreySu Dec 17, 2018
c57f489
Merge pull request #1518 from JeffreySu/Developer
JeffreySu Dec 18, 2018
27f8dd7
Merge pull request #1519 from JeffreySu/Developer
JeffreySu Dec 18, 2018
8db61d4
Merge pull request #1520 from JeffreySu/Developer
JeffreySu Dec 18, 2018
642dc8f
Merge pull request #1522 from JeffreySu/Developer
JeffreySu Dec 23, 2018
5362fa9
Merge pull request #1523 from JeffreySu/Developer
JeffreySu Dec 24, 2018
2d5c8f0
Merge pull request #1524 from JeffreySu/Developer
JeffreySu Dec 25, 2018
00f5d0b
Merge pull request #1527 from JeffreySu/Developer
JeffreySu Dec 26, 2018
507a23a
Merge pull request #1528 from JeffreySu/Developer
JeffreySu Dec 26, 2018
e1f6798
Merge pull request #1529 from JeffreySu/Developer
JeffreySu Dec 27, 2018
96bb487
Merge pull request #1530 from JeffreySu/Developer
JeffreySu Dec 27, 2018
550edc6
Merge pull request #1531 from JeffreySu/Developer
JeffreySu Dec 27, 2018
8497dd6
Merge pull request #1533 from JeffreySu/Developer
JeffreySu Dec 27, 2018
0f7e8b2
Merge pull request #1534 from JeffreySu/Developer
JeffreySu Dec 27, 2018
faab936
Merge pull request #1535 from JeffreySu/Developer
JeffreySu Dec 28, 2018
ca2adae
Merge pull request #1536 from JeffreySu/Developer
JeffreySu Dec 28, 2018
c1b150a
Merge pull request #1537 from JeffreySu/Developer
JeffreySu Dec 29, 2018
61314f3
Merge pull request #1538 from JeffreySu/Developer
JeffreySu Dec 29, 2018
6fcb214
Merge pull request #1539 from JeffreySu/Developer
JeffreySu Dec 29, 2018
d454493
Merge pull request #1540 from JeffreySu/Developer
JeffreySu Dec 29, 2018
f6d8036
Merge pull request #1541 from JeffreySu/Developer
JeffreySu Dec 29, 2018
810538b
Merge pull request #1543 from JeffreySu/Developer
JeffreySu Dec 29, 2018
12c53ea
Merge pull request #1545 from JeffreySu/Developer
JeffreySu Dec 30, 2018
3919839
Merge pull request #1546 from JeffreySu/Developer
JeffreySu Dec 30, 2018
66b7340
Merge pull request #1547 from JeffreySu/Developer
JeffreySu Dec 30, 2018
a52ac19
Merge pull request #1551 from JeffreySu/Developer
JeffreySu Jan 2, 2019
e525ad0
1
mc7246 Jan 3, 2019
0c067db
快速创建小程序接口
mc7246 Jan 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,56 @@ public static JsApiTicketResult GetJsApiTicket(string authorizerAccessToken, str
JsApiTicketResult result = Get.GetJson<JsApiTicketResult>(url);
return result;
}

/// <summary>
/// 文档:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21538208049W8uwq&token=&lang=zh_CN
/// 创建(查询)小程序接口
/// </summary>
/// <param name="componentAccessToken"></param>
/// <param name="entName">企业名(需与工商部门登记信息一致)</param>
/// <param name="legalPersonaWechat">法人微信号</param>
/// <param name="legalPersonaName">法人姓名(绑定银行卡)</param>
/// <param name="action">动作类型:create或search,当为search时,entCode,codeType,componentPhone可不传参</param>
/// <param name="entCode">企业代码</param>
/// <param name="codeType">企业代码类型 1:统一社会信用代码(18位) 2:组织机构代码(9位xxxxxxxx-x) 3:营业执照注册号(15位)</param>
/// <param name="componentPhone">第三方联系电话(方便法人与第三方联系)</param>
/// <param name="timeOut"></param>
/// <returns></returns>
[ApiBind(NeuChar.PlatformType.WeChat_Open, "ComponentApi.FastRegisterWeApp", true)]
public static WxJsonResult FastRegisterWeApp(string componentAccessToken, string entName, string legalPersonaWechat, string legalPersonaName, string action ="create", string entCode="", CodeType codeType = CodeType.统一社会信用代码, string componentPhone = "", int timeOut = Config.TIME_OUT)
{
var url = string.Format(
Config.ApiMpHost + "/cgi-bin/component/fastregisterweapp?action={0}&component_access_token={1}",
action.AsUrlData(),
componentAccessToken.AsUrlData());

//var data;
object data;
if (action == "create")
{
data = new
{
name = entName,
code = entCode,
code_type = codeType,
legal_persona_wechat = legalPersonaWechat,
legal_persona_name = legalPersonaName,
component_phone = componentPhone
};
}
else
{
data = new
{
name = entName,
legal_persona_wechat = legalPersonaWechat,
legal_persona_name = legalPersonaName,
};
}

return CommonJsonSend.Send<WxJsonResult>(null, url, data, CommonJsonSendType.POST, timeOut);
}

#endregion

#if !NET35 && !NET40
Expand Down Expand Up @@ -535,6 +585,55 @@ public static async Task<JsApiTicketResult> GetJsApiTicketAsync(string authorize
JsApiTicketResult result = await Get.GetJsonAsync<JsApiTicketResult>(url);
return result;
}

/// <summary>
/// 文档:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21538208049W8uwq&token=&lang=zh_CN
/// 创建小程序接口
/// </summary>
/// <param name="componentAccessToken"></param>
/// <param name="entName">企业名(需与工商部门登记信息一致)</param>
/// <param name="entCode">企业代码</param>
/// <param name="codeType">企业代码类型 1:统一社会信用代码(18位) 2:组织机构代码(9位xxxxxxxx-x) 3:营业执照注册号(15位)</param>
/// <param name="legalPersonaWechat">法人微信号</param>
/// <param name="legalPersonaName">法人姓名(绑定银行卡)</param>
/// <param name="componentPhone">第三方联系电话(方便法人与第三方联系)</param>
/// <param name="timeOut"></param>
/// <returns></returns>
[ApiBind(NeuChar.PlatformType.WeChat_Open, "ComponentApi.FastRegisterWeAppAsync", true)]
public static async Task<WxJsonResult> FastRegisterWeAppAsync(string componentAccessToken, string entName, string legalPersonaWechat, string legalPersonaName, string action ="create", string entCode="", CodeType codeType = CodeType.统一社会信用代码, string componentPhone = "", int timeOut = Config.TIME_OUT)
{
var url = string.Format(
Config.ApiMpHost + "/cgi-bin/component/fastregisterweapp?action={0}&component_access_token={1}",
action.AsUrlData(),
componentAccessToken.AsUrlData());

//var data;
object data;
if (action == "create")
{
data = new
{
name = entName,
code = entCode,
code_type = codeType,
legal_persona_wechat = legalPersonaWechat,
legal_persona_name = legalPersonaName,
component_phone = componentPhone
};
}
else
{
data = new
{
name = entName,
legal_persona_wechat = legalPersonaWechat,
legal_persona_name = legalPersonaName,
};
}

return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync<WxJsonResult>(null, url, data, CommonJsonSendType.POST, timeOut);
}

#endregion
#endif
//////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*----------------------------------------------------------------
Copyright (C) 2018 Senparc

文件名:RequestMessageThirdFasteRegister.cs
文件功能描述:注册审核事件推送


创建标识:Senparc - 20190103
----------------------------------------------------------------*/

using System;

namespace Senparc.Weixin.Open
{
/// <summary>
/// 注册审核事件推送
/// </summary>
public class RequestMessageThirdFasteRegister : RequestMessageBase
{
public override RequestInfoType InfoType
{
get { return RequestInfoType.notify_third_fasteregister; }
}

/// <summary>
/// 创建小程序appid
/// </summary>
public string appid { get; set; }

public ReturnCode status { get; set; }
/// <summary>
/// 第三方授权码
/// </summary>
public string auth_code { get; set; }

public string msg { get; set; }

/// <summary>
/// 注册时提交的资料
/// </summary>
public info info {get;set;}
}

/// <summary>
/// 注册时提交的资料信息
/// </summary>
public class info
{
/// <summary>
/// 企业名称
/// </summary>
public string name { get; set; }

/// <summary>
/// 企业代码
/// </summary>
public string code { get; set; }
/// <summary>
/// 企业代码类型
/// </summary>
public CodeType code_type { get; set; }
/// <summary>
/// 法人微信号
/// </summary>
public string legal_persona_wechat { get; set; }
/// <summary>
/// 法人姓名
/// </summary>
public string legal_persona_name { get; set; }
/// <summary>
/// 第三方联系电话
/// </summary>
public string component_phone { get; set; }
}
}
16 changes: 15 additions & 1 deletion src/Senparc.Weixin.Open/Senparc.Weixin.Open/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ public enum RequestInfoType
/// <summary>
/// 授权成功通知
/// </summary>
authorized
authorized,
/// <summary>
/// 小程序注册审核事件推送
/// </summary>
notify_third_fasteregister
}

/// <summary>
Expand Down Expand Up @@ -269,4 +273,14 @@ public enum LoginAuthType
仅展示小程序 = 2,
表示公众号和小程序都展示 = 3
}

/// <summary>
/// 企业代码类型 1:统一社会信用代码(18位) 2:组织机构代码(9位xxxxxxxx-x) 3:营业执照注册号(15位)
/// </summary>
public enum CodeType
{
统一社会信用代码 =1,
组织机构代码=2,
营业执照注册号=3
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ public void Execute()
ResponseMessageText = OnUpdateAuthorizedRequest(requestMessage);
}
break;
case RequestInfoType.notify_third_fasteregister:
{
var requestMessage = RequestMessage as RequestMessageThirdFasteRegister;
ResponseMessageText = OnThirdFasteRegisterRequest(requestMessage);
}
break;
default:
throw new UnknownRequestMsgTypeException("未知的InfoType请求类型", null);
}
Expand Down Expand Up @@ -199,5 +205,13 @@ public virtual string OnUpdateAuthorizedRequest(RequestMessageUpdateAuthorized r
{
return "success";
}

public virtual string OnThirdFasteRegisterRequest(RequestMessageThirdFasteRegister requestMessage)
{
return "success";
}



}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ public static IRequestMessageBase GetRequestEntity(XDocument doc, PostModel post
case RequestInfoType.updateauthorized:
requestMessage = new RequestMessageUpdateAuthorized();
break;

case RequestInfoType.notify_third_fasteregister:
requestMessage = new RequestMessageThirdFasteRegister();
break;
default:
throw new UnknownRequestMsgTypeException(string.Format("InfoType:{0} 在RequestMessageFactory中没有对应的处理程序!", infoType), new ArgumentOutOfRangeException());//为了能够对类型变动最大程度容错(如微信目前还可以对公众账号suscribe等未知类型,但API没有开放),建议在使用的时候catch这个异常
}
Expand Down
20 changes: 20 additions & 0 deletions src/Senparc.Weixin/Senparc.Weixin/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,26 @@ public enum ReturnCode
//开放平台

该公众号_小程序已经绑定了开放平台帐号 = 89000,//account has bound open,该公众号/小程序已经绑定了开放平台帐号
该主体已有任务执行中_距上次任务24h后再试 = 89249,// task running
内部错误= 89247,// inner error
无效微信号 = 86004,// invalid wechat
法人姓名与微信号不一致= 61070,// name, wechat name not in accordance
企业代码类型无效_请选择正确类型填写= 89248,// invalid code type
未找到该任务= 89250,// task not found
待法人人脸核身校验= 89251,// legal person checking
法人_企业信息一致性校验中= 89252,// front checking
缺少参数= 89253,// lack of some params
第三方权限集不全_补全权限集全网发布后生效= 89254,// lack of some component rights
已下发的模板消息法人并未确认且已超时_24h_未进行身份证校验= 100001,
已下发的模板消息法人并未确认且已超时_24h_未进行人脸识别校验 = 100002,
已下发的模板消息法人并未确认且已超时_24h= 100003,
工商数据返回_企业已注销=101,
工商数据返回_企业不存在或企业信息未更新=102,
工商数据返回_企业法定代表人姓名不一致= 103,
工商数据返回_企业法定代表人身份证号码不一致=104,
法定代表人身份证号码_工商数据未更新_请5_15个工作日之后尝试= 105,
工商数据返回_企业信息或法定代表人信息不一致=1000,


//小程序代码管理返回码
不是由第三方代小程序进行调用 = 86000,
Expand Down