新增获取openid接口
This commit is contained in:
@@ -52,6 +52,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
"/api/login-alipay/*",
|
"/api/login-alipay/*",
|
||||||
"/api/wx-login/loginByMpWxPhone",
|
"/api/wx-login/loginByMpWxPhone",
|
||||||
"/api/wx-login/loginByOpenId",
|
"/api/wx-login/loginByOpenId",
|
||||||
|
"/api/wx-login/getWxOpenIdOnly",
|
||||||
"/api/system/wx-native-pay/**",
|
"/api/system/wx-native-pay/**",
|
||||||
"/api/system/wx-pay/**",
|
"/api/system/wx-pay/**",
|
||||||
"/api/wxWorkQrConnect",
|
"/api/wxWorkQrConnect",
|
||||||
|
|||||||
@@ -325,6 +325,24 @@ public class WxLoginController extends BaseController {
|
|||||||
return success("获取成功", jsonObject);
|
return success("获取成功", jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("仅获取微信openId")
|
||||||
|
@PostMapping("/getWxOpenIdOnly")
|
||||||
|
public ApiResult<?> getWxOpenIdOnly(@RequestBody UserParam userParam) {
|
||||||
|
|
||||||
|
String apiUrl = "https://api.weixin.qq.com/sns/jscode2session";
|
||||||
|
final HashMap<String, Object> map = new HashMap<>();
|
||||||
|
final JSONObject setting = settingService.getBySettingKey("mp-weixin");
|
||||||
|
final String appId = setting.getString("appId");
|
||||||
|
final String appSecret = setting.getString("appSecret");
|
||||||
|
map.put("appid", appId);
|
||||||
|
map.put("secret", appSecret);
|
||||||
|
map.put("js_code", userParam.getCode());
|
||||||
|
map.put("grant_type", "authorization_code");
|
||||||
|
final String response = HttpUtil.get(apiUrl, map);
|
||||||
|
final JSONObject jsonObject = JSONObject.parseObject(response);
|
||||||
|
return success("获取成功", jsonObject);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("获取微信小程序码-用户ID")
|
@ApiOperation("获取微信小程序码-用户ID")
|
||||||
@GetMapping("/getUserQRCode")
|
@GetMapping("/getUserQRCode")
|
||||||
public ApiResult<?> getQRCode() {
|
public ApiResult<?> getQRCode() {
|
||||||
|
|||||||
Reference in New Issue
Block a user