|
|
@@ -86,10 +86,15 @@ public class WxInfoController extends BaseController { |
|
|
Map<String, String> retMap = getOpenIdInfo(appId, code); |
|
|
Map<String, String> retMap = getOpenIdInfo(appId, code); |
|
|
String openId = retMap.get("openId"); |
|
|
String openId = retMap.get("openId"); |
|
|
MallUserInfo user = mallUserInfoService.getByOpenId(openId); |
|
|
MallUserInfo user = mallUserInfoService.getByOpenId(openId); |
|
|
|
|
|
if(user == null) { |
|
|
|
|
|
return new ResultData(ErrorCode.USER_NO_PERMISSION, retMap); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(!user.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { |
|
|
if(!user.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { |
|
|
return new ResultData(ErrorCode.USER_NOT_ADMIN, retMap); |
|
|
return new ResultData(ErrorCode.USER_NOT_ADMIN, retMap); |
|
|
} |
|
|
} |
|
|
|
|
|
retMap.put("phone", user.getPhone()); |
|
|
|
|
|
retMap.put("msg", "领导来了,欢迎"); |
|
|
|
|
|
|
|
|
return new ResultData(retMap); |
|
|
return new ResultData(retMap); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
@@ -192,9 +197,16 @@ public class WxInfoController extends BaseController { |
|
|
resultMap.put("phone", phone); |
|
|
resultMap.put("phone", phone); |
|
|
|
|
|
|
|
|
MallUserInfo user = mallUserInfoService.getByPhone(phone); |
|
|
MallUserInfo user = mallUserInfoService.getByPhone(phone); |
|
|
|
|
|
if(user == null) { |
|
|
|
|
|
return new ResultData(ErrorCode.USER_NO_PERMISSION, resultMap); |
|
|
|
|
|
} |
|
|
if (user.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { |
|
|
if (user.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { |
|
|
resultMap.put("phone", user.getPhone()); |
|
|
resultMap.put("phone", user.getPhone()); |
|
|
resultMap.put("admin", "1"); |
|
|
resultMap.put("admin", "1"); |
|
|
|
|
|
|
|
|
|
|
|
user.setOpenId(openId); |
|
|
|
|
|
mallUserInfoService.saveOrUpdate(user); |
|
|
|
|
|
|
|
|
return new ResultData(resultMap); |
|
|
return new ResultData(resultMap); |
|
|
} else { |
|
|
} else { |
|
|
return new ResultData(ErrorCode.USER_NOT_ADMIN, resultMap); |
|
|
return new ResultData(ErrorCode.USER_NOT_ADMIN, resultMap); |
|
|
|