|
|
|
@@ -545,16 +545,47 @@ public class WxUserStructureController extends BaseController { |
|
|
|
} |
|
|
|
|
|
|
|
// 成长值扣除 |
|
|
|
@ApiOperation("用户成长值扣减") |
|
|
|
@ApiOperation(value = "用户成长值扣减", notes = "{\"userId\":\"Long\", \"reason\":\"String\", \"score\":\"Integer\"}") |
|
|
|
@PostMapping("/scoreReduce") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "reason", value = "扣减理由", dataType = "String", required = true), |
|
|
|
@ApiImplicitParam(name = "score", value = "扣减分数", dataType = "int", required = true)}) |
|
|
|
public ResultData scoreReduce(@ModelAttribute WxCUserBasicInfo basicInfo, String reason, Integer score) { |
|
|
|
public ResultData scoreReduce(@RequestBody Map<String, String> params) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxUserStructureController::scoreReduce"); |
|
|
|
|
|
|
|
String userIdStr = params.get("userId"); |
|
|
|
String reason = params.get("reason"); |
|
|
|
String scoreStr = params.get("score"); |
|
|
|
if (StringUtils.isBlank(userIdStr)) { |
|
|
|
logger.error("userId为空:" + userIdStr); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "userId为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(reason)) { |
|
|
|
logger.error("reason为空:" + reason); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "reason为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(scoreStr)) { |
|
|
|
logger.error("score为空:" + scoreStr); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "score为空"); |
|
|
|
} |
|
|
|
|
|
|
|
Long userId = null; |
|
|
|
Integer score = null; |
|
|
|
|
|
|
|
try { |
|
|
|
userId = Long.valueOf(userIdStr); |
|
|
|
score = Integer.valueOf(scoreStr); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
} |
|
|
|
if(userId == null || userId == 0) { |
|
|
|
logger.error(ErrorCode.USER_IS_EMPTY.getMessage()); |
|
|
|
return new ResultData(ErrorCode.USER_IS_EMPTY); |
|
|
|
} |
|
|
|
if(score == null ) { |
|
|
|
logger.error(ErrorCode.SYS_PARAMETER_NOT_NULL.getMessage()); |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "score不能为空"); |
|
|
|
} |
|
|
|
|
|
|
|
// 1. 检查用户积分 |
|
|
|
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(basicInfo.getId()); |
|
|
|
WxCUserBasicInfo info = wxCUserBasicInfoService.getById(userId); |
|
|
|
if(info == null) { |
|
|
|
logger.error(ErrorCode.USER_IS_EMPTY.getMessage()); |
|
|
|
return new ResultData(ErrorCode.USER_IS_EMPTY); |
|
|
|
|