@@ -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); |
@@ -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"); | |||
} | |||
@@ -26,12 +26,12 @@ spring: | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://192.168.11.13:3306/tuoheng_telecomumale?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: idontcare | |||
# url: jdbc:mysql://rm-uf6z740323e8053pj4o.mysql.rds.aliyuncs.com:3306/tuoheng_telecomumale?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
# url: jdbc:mysql://192.168.11.13:3306/tuoheng_telecomumale?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
# username: root | |||
# password: TH22#2022 | |||
# password: idontcare | |||
url: jdbc:mysql://rm-uf6z740323e8053pj4o.mysql.rds.aliyuncs.com:3306/tuoheng_telecomumale?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: TH22#2022 | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 |