release: 任务获取积分拆分两个接口

release-2024-08-08
huangyw 4 months ago
parent 9c7c078432
commit 0a39ea0975

@ -130,21 +130,35 @@ public class PointController {
return Result.success(taskPointService.getTaskPointList(page, size));
}
@ApiOperation(value = "2.1. 用户根据任务获取积分", notes = "仅限app用户调用")
@PostMapping("/log/earn/task")
@ApiOperation(value = "2.1. 用户根据新手任务获取积分", notes = "仅限app用户调用")
@PostMapping("/log/earn/task/new")
@GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "taskPointId", value = "任务积分配置id", required = true, dataType = "String", paramType = "body")
})
public Result<Void> addLog(
public Result<Void> addLogNew(
@RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody String taskPointId) {
userPointLogService.addByTask(taskPointId, authorization);
userPointLogService.addByTaskNew(taskPointId, authorization);
return Result.success();
}
@ApiOperation(value = "2.2.用户积分日志列表", notes = "用户积分日志列表")
@ApiOperation(value = "2.2. 用户根据新手任务获取积分", notes = "仅限app用户调用")
@PostMapping("/log/earn/task/daily")
@GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "taskPointId", value = "任务积分配置id", required = true, dataType = "String", paramType = "body")
})
public Result<Void> addLogDaily(
@RequestHeader(value = "Authorization", required = true) String authorization,
@RequestBody String taskPointId) {
userPointLogService.addByTaskDaily(taskPointId, authorization);
return Result.success();
}
@ApiOperation(value = "2.3.用户积分日志列表", notes = "用户积分日志列表")
@PostMapping("/log/list/{page}/{size}")
@GlobalInterceptor(checkAppUserLogin = true)
public Result<PageResult<UserPointLog>> getUserPointLogList(

@ -67,6 +67,24 @@ public class UserPointLogService {
this.userInfoService = userInfoService;
}
/**
*
*
* @param taskPointId ID
* @param token tokenID
*/
public void addByTaskNew(String taskPointId, String token) {
UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token);
// 新手任务,只触发一次
if (!userPointLogDao.findUserPointLogByUserIdAndTaskPointId(userLoginDto.getUserId(),
taskPointId).isEmpty()) {
return;
}
addByTask(taskPointId, userLoginDto);
}
/**
*
* <p>
@ -76,16 +94,14 @@ public class UserPointLogService {
* @param taskPointId ID
* @param token tokenID
*/
public void addByTask(String taskPointId, String token) {
public void addByTaskDaily(String taskPointId, String token) {
UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token);
// 新手任务,只触发一次
if (!userPointLogDao.findUserPointLogByUserIdAndTaskPointId(userLoginDto.getUserId(),
taskPointId).isEmpty()) {
return;
addByTask(taskPointId, userLoginDto);
}
private void addByTask(String taskPointId, UserLoginDto userLoginDto) {
TaskPoint taskPoint = taskPointDao.findById(taskPointId).get();
UserPointLog userPointLog = UserPointLog.builder()

Loading…
Cancel
Save