|
@@ -156,7 +156,7 @@ public class LoginController {
|
|
|
@RequestMapping("/getOpenId")
|
|
|
@ResponseBody
|
|
|
public RestResponse getOpenId(@RequestBody UserRequest userRequest) {
|
|
|
- RestResponse restResponse = judgeAuthCode(userRequest, WxConstants.APPLET_LOGIN);
|
|
|
+ RestResponse restResponse = judgeAuthCode(userRequest, WxConstants.APPLET_SCAN_LOGIN);
|
|
|
if (restResponse == null) {
|
|
|
Map<String, String> openIdMap = new HashMap<>();
|
|
|
openIdMap.put("appletOpenId", userRequest.getWeChatOpenId());
|
|
@@ -320,10 +320,16 @@ public class LoginController {
|
|
|
}
|
|
|
//通过授权码获取用户openId
|
|
|
String openId = "";
|
|
|
- if (WxConstants.APPLET_LOGIN.equals(loginStyle)) {
|
|
|
- openId = WxUtil.getAppletOpenIdByAuthCode(authCode);
|
|
|
- } else {
|
|
|
- openId = WxUtil.getAppOpenIdByAuthCode(authCode);
|
|
|
+ switch (loginStyle) {
|
|
|
+ case WxConstants.APPLET_LOGIN:
|
|
|
+ openId = WxUtil.getAppletOpenIdByAuthCode(authCode);
|
|
|
+ break;
|
|
|
+ case WxConstants.APP_LOGIN:
|
|
|
+ openId = WxUtil.getAppOpenIdByAuthCode(authCode);
|
|
|
+ break;
|
|
|
+ case WxConstants.APPLET_SCAN_LOGIN:
|
|
|
+ openId = WxUtil.getAppletScanOpenIdByAuthCode(authCode);
|
|
|
+ break;
|
|
|
}
|
|
|
if (StringUtils.isBlank(openId)) {
|
|
|
return RestResponse.fail(ApiConstants.RESULT_ERROR, "授权码无效无法进行操作");
|