|
@@ -1,5 +1,6 @@
|
|
|
package com.miaxis.app.controller.wechat;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.miaxis.common.aliyunOSS.AliyunConfig;
|
|
|
import com.miaxis.common.aliyunOSS.AliyunUpload;
|
|
|
import com.miaxis.common.constant.Constants;
|
|
@@ -54,17 +55,17 @@ public class WxController extends BaseController{
|
|
|
*/
|
|
|
@GetMapping(value = "/openid")
|
|
|
@ApiOperation("获取用户openid")
|
|
|
- public Response<String> getInfo(
|
|
|
- @ApiParam(name = "jscode", value = "jscode", required = true)
|
|
|
- String jscode
|
|
|
- ){
|
|
|
- WxResult wxInfo = wxService.getWxInfo(appid, secret, jscode);
|
|
|
- if (wxInfo.getErrcode() == 0){
|
|
|
- return Response.success(wxInfo.getOpenid()) ;
|
|
|
+ public Response<String> getInfo(String jscode){
|
|
|
+ String result = wxService.getWxInfo(appid, secret, jscode,"authorization_code");
|
|
|
+ JSONObject jsonString = JSONObject.parseObject(result);
|
|
|
+ WxResult wxResult = JSONObject.toJavaObject(jsonString, WxResult.class);
|
|
|
+ if (wxResult.getErrcode() == 0){
|
|
|
+ return Response.success(wxResult.getOpenid()) ;
|
|
|
}
|
|
|
else{
|
|
|
- return Response.error(500,wxInfo.getErrmsg());
|
|
|
+ return Response.error(500,wxResult.getErrmsg());
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|