1.修改用户模块返回,配置功能返回
This commit is contained in:
@@ -8,9 +8,11 @@ import vvpkassistant.Data.ResponseInfo;
|
||||
import vvpkassistant.Data.WxChatParam;
|
||||
import vvpkassistant.User.mapper.UserDao;
|
||||
import vvpkassistant.User.model.UserModel;
|
||||
import vvpkassistant.common.ErrorCode;
|
||||
import vvpkassistant.config.FunctionConfigHolder;
|
||||
import vvpkassistant.Tools.VVRequester;
|
||||
import vvpkassistant.Tools.VVTools;
|
||||
import vvpkassistant.exception.BusinessException;
|
||||
import vvpkassistant.pk.mapper.PkInfoDao;
|
||||
import vvpkassistant.pk.model.PkInfoModel;
|
||||
import vvpkassistant.pk.model.PkRecordDetail;
|
||||
@@ -46,11 +48,11 @@ public class UserController {
|
||||
public ResponseData<Object> inputUserInfo(@RequestBody Map<String,Object> param) {
|
||||
|
||||
if (!param.containsKey("code")) {
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(), "code不能为空");
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR,"code不能为空");
|
||||
}
|
||||
|
||||
if (!param.containsKey("id")) {
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(), "id不能为空");
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR,"id不能为空");
|
||||
}
|
||||
|
||||
//获取前端传递过来的code
|
||||
@@ -64,23 +66,23 @@ public class UserController {
|
||||
Integer errcode = Integer.valueOf(wx_result.get("errcode").toString());
|
||||
|
||||
if (errcode == 45011) {
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(), "API 调用太频繁,请稍候再试。");
|
||||
throw new BusinessException(ErrorCode.WX_API_CALL_TOO_FREQUENT);
|
||||
}
|
||||
|
||||
if (errcode == 40029) {
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(), "js_code 无效");
|
||||
throw new BusinessException(ErrorCode.WX_INVALID_JSCODE);
|
||||
}
|
||||
|
||||
if (errcode == 40226) {
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(), "该账号为风险用户。禁止登录小程序");
|
||||
throw new BusinessException(ErrorCode.WX_RISK_ACCOUNT);
|
||||
}
|
||||
|
||||
if (errcode == -1) {
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(), "系统繁忙");
|
||||
throw new BusinessException(ErrorCode.WX_SYSTEM_BUSY);
|
||||
}
|
||||
|
||||
if (!wx_result.containsKey("openid")) {
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(), "获取用户信息失败,请稍后再试。");
|
||||
throw new BusinessException(ErrorCode.WX_GET_USER_INFO_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +113,7 @@ public class UserController {
|
||||
return ResponseData.success(result);
|
||||
}
|
||||
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(),"未知错误");
|
||||
return ResponseData.error(ErrorCode.SYSTEM_ERROR.getCode(),"未知错误");
|
||||
}
|
||||
|
||||
// 手机号登录 / 注册
|
||||
@@ -119,14 +121,13 @@ public class UserController {
|
||||
public ResponseData<Object> loginWithPhoneNumber(@RequestBody Map<String,Object> param) {
|
||||
|
||||
if (!param.containsKey("code")) {
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(),"code不能为空");
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR,"code不能为空");
|
||||
}
|
||||
|
||||
String code = param.get("code").toString();
|
||||
String phoneNumber = vvRequester.queryPhoneNumber(code);
|
||||
|
||||
if (phoneNumber.isEmpty()) {
|
||||
return ResponseData.error(ResponseInfo.ERROR.getCode(),"手机号码无法查询");
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR,"手机号码无法查询");
|
||||
}
|
||||
|
||||
// 查询是否存在用户。如果用户存在直接返回 如果用户不存在则新建用户
|
||||
@@ -165,6 +166,8 @@ public class UserController {
|
||||
|
||||
}
|
||||
|
||||
//todo 修改用户返回结果
|
||||
|
||||
// 修改用户信息
|
||||
@PostMapping("updateUserInfo")
|
||||
public ResponseData<Object> updateUserInfo(@RequestBody Map<String,Object> map) {
|
||||
|
||||
Reference in New Issue
Block a user