|
|
@@ -61,11 +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); |
|
|
|
// } |
|
|
|
if(null != JSONObject.parseObject(openidResult).getInteger("errcode") || |
|
|
|
StringUtils.isNotEmpty(JSONObject.parseObject(openidResult).getString("errmsg"))){ |
|
|
|
return JsonResult.error(JSONObject.parseObject(openidResult).getInteger("errcode").intValue(), |
|
|
|
JSONObject.parseObject(openidResult).getString("errmsg")); |
|
|
|
} |
|
|
|
String openid = JSONObject.parseObject(openidResult).getString("openid"); |
|
|
|
if(StringUtils.isEmpty(openid)){ |
|
|
|
log.error("获取openid失败:",openidResult); |
|
|
@@ -81,6 +81,7 @@ public class WxServiceImpl implements IWxService { |
|
|
|
//查询出来openId数据入库 |
|
|
|
userAuthorize.setOpenId(openid); |
|
|
|
} |
|
|
|
userAuthorize.setUserId(userId); |
|
|
|
userAuthorize.setCreateTime(DateUtils.now()); |
|
|
|
if(StringUtils.isNotEmpty(userId)){ |
|
|
|
userAuthorize.setCreateUser(userId); |