mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-28 11:08:12 +08:00
新增 微信第三方平台 发布已通过审核的小程序接口
This commit is contained in:
@@ -233,4 +233,24 @@ public class AgentDevController extends BaseController {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布已通过审核的小程序
|
||||||
|
* @param authorizerAppid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/releaseProcedure")
|
||||||
|
public RestApiResponse<?> releaseProcedure(@PathVariable("authorizerAppid") String authorizerAppid) {
|
||||||
|
logger.info("发布已通过审核的小程序 params:{}", authorizerAppid);
|
||||||
|
RestApiResponse<?> response = null;
|
||||||
|
try {
|
||||||
|
String result = agentDevService.releaseProcedure(authorizerAppid);
|
||||||
|
response = new RestApiResponse<>(result);
|
||||||
|
} catch (Exception e){
|
||||||
|
logger.error("发布已通过审核的小程序 error, ", e);
|
||||||
|
response = new RestApiResponse<>(e);
|
||||||
|
}
|
||||||
|
logger.info("发布已通过审核的小程序 result:{}", response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -465,6 +465,28 @@ public class AgentDevService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布已通过审核的小程序 调用本接口可以发布最后一个审核通过的小程序代码版本
|
||||||
|
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/code-management/release.html
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String releaseProcedure(String authorizerAppid){
|
||||||
|
// 获取用户接口调用令牌
|
||||||
|
String redisKey = CacheConstants.AUTHORIZER_ACCESS_TOKEN + authorizerAppid;
|
||||||
|
String authAccessToken = redisCache.getCacheObject(redisKey);
|
||||||
|
if (StringUtils.isBlank(authAccessToken)) {
|
||||||
|
throw new RuntimeException("微信第三方平台 发布已通过审核的小程序 error: authAccessToken为空");
|
||||||
|
}
|
||||||
|
String url = "https://api.weixin.qq.com/wxa/release?access_token=" + authAccessToken;
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
String result = HttpUtils.sendPost(url, JSONObject.toJSONString(jsonObject));
|
||||||
|
// 将返回结果转为json对象
|
||||||
|
JSONObject resultJson = JSONObject.parseObject(result);
|
||||||
|
// int errCode = (int) resultJson.get("errcode");
|
||||||
|
|
||||||
|
return resultJson.getString("errmsg");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
JSONArray array = new JSONArray();
|
JSONArray array = new JSONArray();
|
||||||
|
|||||||
Reference in New Issue
Block a user