提交 7d1f591b 作者: zhenjie

消息模板调试

上级 5b31eede
package com.mmc.iuav.user.controller;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.vo.WxMsgVO;
import com.mmc.iuav.user.service.WxService;
import com.mmc.iuav.user.util.WxApiUtil;
import io.swagger.annotations.*;
......@@ -76,6 +77,13 @@ public class WxController extends BaseController {
out.println(msg);
}
@ApiOperation(value = "发送消息")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = String.class)})
@PostMapping("send")
public ResultBody send(@RequestBody WxMsgVO ws) {
return wxService.sendSubTemplateMsg(ws);
}
@ApiOperation(value = "生成小程序码")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("getAppletQRCode")
......
......@@ -182,19 +182,14 @@ public class WxServiceImpl implements WxService {
}
private void updateWXUserInfo(String openid) {
log.info("start updateWXUserInfo");
String accessToken = this.getSubAccessToken();
if (StringUtils.isBlank(accessToken)) {
log.info("accessToken is blank");
return;
}
log.info("start updateWXUserInfo");
try {
String InfoUrl = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" + accessToken + "&openid=" + openid
+ "&lang=zh_CN";
// String jsonStr = HttpsOpenUtil.httpSendGet(InfoUrl, "GET");// 错误:{"errcode":40013,"errmsg":"invalid appid"}
String jsonStr = HttpsRequestUtil.httpsGet(InfoUrl, null);
// String jsonStr = HttpsRequestUtil.httpsRequest(InfoUrl, "GET", null, null);
log.info("updateWXUserInfo:{}", jsonStr);
JSONObject obj = JSONObject.parseObject(jsonStr);
// 用户是否订阅该公众号标识,值为0时,代表此用户没有关注该公众号,拉取不到其余信息。
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论