mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
新增 微信第三方平台 提交代码生成体验版小程序接口
This commit is contained in:
@@ -8,16 +8,17 @@ import com.jsowell.common.util.http.HttpUtils;
|
||||
import com.jsowell.common.util.wxplatform.AesException;
|
||||
import com.jsowell.common.util.wxplatform.WXBizMsgCrypt;
|
||||
import com.jsowell.common.util.wxplatform.WXXmlToMapUtil;
|
||||
import com.jsowell.pile.dto.GetComponentTokenDTO;
|
||||
import com.jsowell.pile.domain.agentDev.CategoryInfo;
|
||||
import com.jsowell.pile.dto.agentDev.CommitCodeDTO;
|
||||
import com.jsowell.pile.dto.agentDev.GetComponentTokenDTO;
|
||||
import com.jsowell.pile.vo.agentDev.AuthInfo;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -251,4 +252,43 @@ public class AgentDevService {
|
||||
return authInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提交代码并生成体验版小程序
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
public String commitCode(CommitCodeDTO dto) {
|
||||
String redisKey = CacheConstants.AUTHORIZER_ACCESS_TOKEN + dto.getAuthorizerAppid();
|
||||
String authAccessToken = redisCache.getCacheObject(redisKey);
|
||||
if (StringUtils.isBlank(authAccessToken)) {
|
||||
throw new RuntimeException("微信第三方平台 提交代码 error: authAccessToken为空");
|
||||
}
|
||||
// 提交代码 url
|
||||
String url = "https://api.weixin.qq.com/wxa/commit?access_token=" + authAccessToken;
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("template_id", dto.getTemplateId());
|
||||
jsonObject.put("ext_json", dto.getExtJson());
|
||||
jsonObject.put("user_version", dto.getUserVersion());
|
||||
jsonObject.put("user_desc", dto.getUserDesc());
|
||||
|
||||
String result = HttpUtils.sendPost(url, JSONObject.toJSONString(jsonObject));
|
||||
logger.info("获取第三方平台 使用授权码获取授权信息 请求参数:{}, 请求结果:{}", JSONObject.toJSONString(jsonObject), result);
|
||||
// 将返回结果转为json对象
|
||||
JSONObject resultJson = JSONObject.parseObject(result);
|
||||
|
||||
return resultJson.getString("errmsg");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public String submitAudit() {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user