Browse Source

Merge branch 'develop' of gitadmin/tuoheng_telecomumale into release

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
65fb162a52
2 changed files with 6 additions and 0 deletions
  1. +5
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WxServiceImpl.java
  2. +1
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/utils/GetOpenIdUtil.java

+ 5
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WxServiceImpl.java View File

@@ -61,6 +61,11 @@ public class WxServiceImpl implements IWxService {
public JsonResult openid(String code) {
String userId = CurrentUserUtil.getUserId();
String openidResult = GetOpenIdUtil.getopenid(code, CommonConfig.appId, CommonConfig.appSecret);
int errcode = JSONObject.parseObject(openidResult).getInteger("errcode");
String errmsg = JSONObject.parseObject(openidResult).getString("errmsg");
if(0 != errcode){
return JsonResult.error(errcode,errmsg);
}
String openid = JSONObject.parseObject(openidResult).getString("openid");
if(StringUtils.isEmpty(openid)){
log.error("获取openid失败:",openidResult);

+ 1
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/utils/GetOpenIdUtil.java View File

@@ -18,6 +18,7 @@ public class GetOpenIdUtil {
System.out.println("openid:" + openidJson);
JSONObject jsonObject = JSONObject.parseObject(openidJson);
String openid = jsonObject.getString("openid");
System.out.println("openid:" + openid);
System.out.println("end");
}


Loading…
Cancel
Save