|
|
|
|
|
|
|
|
public JsonResult openid(String code) { |
|
|
public JsonResult openid(String code) { |
|
|
String userId = CurrentUserUtil.getUserId(); |
|
|
String userId = CurrentUserUtil.getUserId(); |
|
|
String openidResult = GetOpenIdUtil.getopenid(code, CommonConfig.appId, CommonConfig.appSecret); |
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 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"); |
|
|
String openid = JSONObject.parseObject(openidResult).getString("openid"); |
|
|
if(StringUtils.isEmpty(openid)){ |
|
|
if(StringUtils.isEmpty(openid)){ |
|
|
log.error("获取openid失败:",openidResult); |
|
|
log.error("获取openid失败:",openidResult); |