mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	1、增加卡券的api_ticket,区分jsapi_ticket,二者的获取逻辑不同;
2、增加小程序审核事件及审核事件推送消息SuccTime和Reason两个字段; 3、增加开放平台获取会员卡开卡插件参数接口。 4、增加开放平台手机端预授权接口实现;
This commit is contained in:
		| @ -25,6 +25,10 @@ public interface WxOpenComponentService { | ||||
|   String API_SET_AUTHORIZER_OPTION_URL = "https://api.weixin.qq.com/cgi-bin/component/api_set_authorizer_option"; | ||||
|  | ||||
|   String COMPONENT_LOGIN_PAGE_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s"; | ||||
|   /** | ||||
|    * 手机端打开授权链接 | ||||
|    */ | ||||
|   String COMPONENT_MOBILE_LOGIN_PAGE_URL = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&no_scan=1&auth_type=3&component_appid=%s&pre_auth_code=%s&redirect_uri=%s&auth_type=xxx&biz_appid=xxx$#wechat_redirect"; | ||||
|   String CONNECT_OAUTH2_AUTHORIZE_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=%s&state=%s&component_appid=%s#wechat_redirect"; | ||||
|  | ||||
|   /** | ||||
| @ -66,6 +70,26 @@ public interface WxOpenComponentService { | ||||
|    */ | ||||
|   String getPreAuthUrl(String redirectURI, String authType, String bizAppid) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * 获取预授权链接(手机端预授权) | ||||
|    * | ||||
|    * @param redirectURI | ||||
|    * @return | ||||
|    * @throws WxErrorException | ||||
|    */ | ||||
|   String getMobilePreAuthUrl(String redirectURI) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * 获取预授权链接(手机端预授权) | ||||
|    * | ||||
|    * @param redirectURI | ||||
|    * @param authType | ||||
|    * @param bizAppid | ||||
|    * @return | ||||
|    * @throws WxErrorException | ||||
|    */ | ||||
|   String getMobilePreAuthUrl(String redirectURI, String authType, String bizAppid) throws WxErrorException; | ||||
|  | ||||
|   String route(WxOpenXmlMessage wxMessage) throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|  | ||||
| @ -299,11 +299,10 @@ public interface WxOpenMaService extends WxMaService { | ||||
|   /** | ||||
|    * 查询最新一次提交的审核状态(仅供第三方代小程序调用) | ||||
|    * | ||||
|    * @param auditid | ||||
|    * @return | ||||
|    * @throws WxErrorException | ||||
|    */ | ||||
|   String getLatestAuditStatus(Long auditid) throws WxErrorException; | ||||
|   String getLatestAuditStatus() throws WxErrorException; | ||||
|  | ||||
|   /** | ||||
|    * 发布已通过审核的小程序(仅供第三方代小程序调用) | ||||
| @ -331,5 +330,5 @@ public interface WxOpenMaService extends WxMaService { | ||||
|    * @throws WxErrorException | ||||
|    */ | ||||
|   String undoCodeAudit() throws WxErrorException; | ||||
|    | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -181,25 +181,50 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService { | ||||
|     return getPreAuthUrl(redirectURI, null, null); | ||||
|   } | ||||
|  | ||||
|   @Override | ||||
|   public String getPreAuthUrl(String redirectURI, String authType, String bizAppid) throws WxErrorException { | ||||
|     return createPreAuthUrl(redirectURI, authType, bizAppid, false); | ||||
|   } | ||||
|  | ||||
|   public String getMobilePreAuthUrl(String redirectURI) throws WxErrorException { | ||||
|     return getMobilePreAuthUrl(redirectURI, null, null); | ||||
|   } | ||||
|  | ||||
|   public String getMobilePreAuthUrl(String redirectURI, String authType, String bizAppid) throws WxErrorException { | ||||
|     return createPreAuthUrl(redirectURI, authType, bizAppid, true); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * 创建预授权链接 | ||||
|    * | ||||
|    * @param redirectURI | ||||
|    * @param authType | ||||
|    * @param bizAppid | ||||
|    * @param isMobile    是否移动端预授权 | ||||
|    * @return | ||||
|    * @throws WxErrorException | ||||
|    */ | ||||
|   private String createPreAuthUrl(String redirectURI, String authType, String bizAppid, boolean isMobile) throws WxErrorException { | ||||
|     JsonObject jsonObject = new JsonObject(); | ||||
|     jsonObject.addProperty("component_appid", getWxOpenConfigStorage().getComponentAppId()); | ||||
|     String responseContent = post(API_CREATE_PREAUTHCODE_URL, jsonObject.toString()); | ||||
|     jsonObject = WxGsonBuilder.create().fromJson(responseContent, JsonObject.class); | ||||
|  | ||||
|     StringBuilder preAuthUrl = new StringBuilder(String.format(COMPONENT_LOGIN_PAGE_URL, | ||||
|     StringBuilder preAuthUrl = new StringBuilder(String.format((isMobile ? COMPONENT_MOBILE_LOGIN_PAGE_URL : COMPONENT_LOGIN_PAGE_URL), | ||||
|       getWxOpenConfigStorage().getComponentAppId(), | ||||
|       jsonObject.get("pre_auth_code").getAsString(), | ||||
|       URIUtil.encodeURIComponent(redirectURI))); | ||||
|     String preAuthUrlStr = preAuthUrl.toString(); | ||||
|     if (StringUtils.isNotEmpty(authType)) { | ||||
|       preAuthUrl.append("&auth_type=").append(authType); | ||||
|       preAuthUrlStr = preAuthUrlStr.replace("&auth_type=xxx", "&auth_type=" + authType); | ||||
|     } else { | ||||
|       preAuthUrlStr = preAuthUrlStr.replace("&auth_type=xxx", ""); | ||||
|     } | ||||
|     if (StringUtils.isNotEmpty(bizAppid)) { | ||||
|       preAuthUrl.append("&biz_appid=").append(bizAppid); | ||||
|       preAuthUrlStr = preAuthUrlStr.replace("&biz_appid=xxx", "&biz_appid=" + bizAppid); | ||||
|     } else { | ||||
|       preAuthUrlStr = preAuthUrlStr.replace("&biz_appid=xxx", ""); | ||||
|     } | ||||
|  | ||||
|     return preAuthUrl.toString(); | ||||
|     return preAuthUrlStr; | ||||
|   } | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -275,12 +275,11 @@ public class WxOpenMaServiceImpl extends WxMaServiceImpl implements WxOpenMaServ | ||||
|   /** | ||||
|    * 8. 查询最新一次提交的审核状态(仅供第三方代小程序调用) | ||||
|    * | ||||
|    * @param auditid | ||||
|    * @return | ||||
|    * @throws WxErrorException | ||||
|    */ | ||||
|   @Override | ||||
|   public String getLatestAuditStatus(Long auditid) throws WxErrorException { | ||||
|   public String getLatestAuditStatus() throws WxErrorException { | ||||
|     String response = get(API_GET_LATEST_AUDIT_STATUS, null); | ||||
|     return response; | ||||
|   } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 袁启勋
					袁启勋