uniapp广告完播规则修改
This commit is contained in:
@@ -4,25 +4,35 @@ import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.service.AdService;
|
||||
import com.sqx.modules.callback.service.UniAdCallbackRecordService;
|
||||
import com.sqx.modules.redisService.RedisService;
|
||||
import com.sqx.modules.sys.controller.AbstractController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/ad")
|
||||
public class AdController extends AbstractController {
|
||||
|
||||
private final UniAdCallbackRecordService callbackRecordService;
|
||||
private final AdService adService;
|
||||
private final RedisService redisService;
|
||||
|
||||
public AdController(UniAdCallbackRecordService callbackRecordService, AdService adService) {
|
||||
public AdController(UniAdCallbackRecordService callbackRecordService, AdService adService, RedisService redisService) {
|
||||
this.callbackRecordService = callbackRecordService;
|
||||
this.adService = adService;
|
||||
this.redisService = redisService;
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/state")
|
||||
public Result getAdState(@RequestParam String extraKey, @RequestAttribute Long userId) {
|
||||
return Result.success(callbackRecordService.getStateByExtraKey(userId, extraKey));
|
||||
HashMap<String, Integer> info = callbackRecordService.getStateByExtraKey(userId, extraKey);
|
||||
if (info.get("isEnded") == 0 && !redisService.isCanCash(userId)) {
|
||||
redisService.setCanCashFlag(userId, -1L);
|
||||
info.put("isEnded", 1);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Login
|
||||
|
||||
Reference in New Issue
Block a user