提现必须观看广告激励
This commit is contained in:
parent
c9b9bb1a58
commit
6ab171aa28
|
|
@ -97,6 +97,7 @@ public class UniAdCallbackRecordServiceImpl extends ServiceImpl<UniAdCallbackRec
|
||||||
return respData;
|
return respData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
UserEntity userEntity = userDao.selectById(callBackDTO.getUser_id());
|
UserEntity userEntity = userDao.selectById(callBackDTO.getUser_id());
|
||||||
if (userEntity == null) {
|
if (userEntity == null) {
|
||||||
callbackRecord.setErrMsg("用户不存在");
|
callbackRecord.setErrMsg("用户不存在");
|
||||||
|
|
@ -106,16 +107,22 @@ public class UniAdCallbackRecordServiceImpl extends ServiceImpl<UniAdCallbackRec
|
||||||
return respData;
|
return respData;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommonInfo info = commonInfoDao.findOne(921);
|
if (!callBackDTO.getExtra().contains("cash")) {
|
||||||
if (info == null || StrUtil.isBlank(info.getValue())){
|
CommonInfo info = commonInfoDao.findOne(921);
|
||||||
callbackRecord.setErrMsg("CommonInfo时长时间未配置");
|
if (info == null || StrUtil.isBlank(info.getValue())){
|
||||||
log.warn(getBaseErrInfo(callbackRecord));
|
callbackRecord.setErrMsg("CommonInfo时长时间未配置");
|
||||||
save(callbackRecord);
|
log.warn(getBaseErrInfo(callbackRecord));
|
||||||
respData.put("isValid", false);
|
save(callbackRecord);
|
||||||
return respData;
|
respData.put("isValid", false);
|
||||||
|
return respData;
|
||||||
|
}
|
||||||
|
|
||||||
|
redisService.setFreeWatchTime(callbackRecord.getUserId(), Integer.parseInt(info.getValue()) * 60, true);
|
||||||
|
}else {
|
||||||
|
redisService.setCanCashFlag(userEntity.getUserId(), callbackRecord.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
redisService.setFreeWatchTime(callbackRecord.getUserId(), Integer.parseInt(info.getValue()) * 60, true);
|
|
||||||
save(callbackRecord);
|
save(callbackRecord);
|
||||||
respData.put("isValid", true);
|
respData.put("isValid", true);
|
||||||
return respData;
|
return respData;
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||||
import com.sqx.modules.pay.entity.CashOut;
|
import com.sqx.modules.pay.entity.CashOut;
|
||||||
import com.sqx.modules.pay.service.CashOutService;
|
import com.sqx.modules.pay.service.CashOutService;
|
||||||
import com.sqx.modules.pay.service.PayDetailsService;
|
import com.sqx.modules.pay.service.PayDetailsService;
|
||||||
|
import com.sqx.modules.redisService.RedisService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
@ -24,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
@Api(value = "提现", tags = {"提现"})
|
@Api(value = "提现", tags = {"提现"})
|
||||||
@RequestMapping(value = "/app/cash")
|
@RequestMapping(value = "/app/cash")
|
||||||
public class AppCashController {
|
public class AppCashController {
|
||||||
|
private final RedisService redisService;
|
||||||
/**
|
/**
|
||||||
* 提现记录
|
* 提现记录
|
||||||
*/
|
*/
|
||||||
|
|
@ -35,6 +36,10 @@ public class AppCashController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserMoneyDetailsService userMoneyDetailsService;
|
private UserMoneyDetailsService userMoneyDetailsService;
|
||||||
|
|
||||||
|
public AppCashController(RedisService redisService) {
|
||||||
|
this.redisService = redisService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Login
|
@Login
|
||||||
@GetMapping(value = "/cashMoney")
|
@GetMapping(value = "/cashMoney")
|
||||||
|
|
@ -43,11 +48,21 @@ public class AppCashController {
|
||||||
return cashOutService.cashMoney(userId, money);
|
return cashOutService.cashMoney(userId, money);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Login
|
||||||
|
@GetMapping("/canCash")
|
||||||
|
public Result canCash(@RequestAttribute("userId") Long userId) {
|
||||||
|
return Result.success().put("data", redisService.isCanCash(userId));
|
||||||
|
}
|
||||||
|
|
||||||
@Login
|
@Login
|
||||||
@GetMapping(value = "/withdraw")
|
@GetMapping(value = "/withdraw")
|
||||||
@Debounce(interval = 3000, value = "#userId")
|
@Debounce(interval = 3000, value = "#userId")
|
||||||
@ApiOperation("发起提现 余额 金钱")
|
@ApiOperation("发起提现 余额 金钱")
|
||||||
public Result withdraw(@RequestAttribute("userId") Long userId, Double amount) {
|
public Result withdraw(@RequestAttribute("userId") Long userId, Double amount) {
|
||||||
|
boolean canCash = redisService.isCanCash(userId);
|
||||||
|
if (!canCash) {
|
||||||
|
return Result.error("您未观看激励广告,清先观看");
|
||||||
|
}
|
||||||
return cashOutService.withdraw(userId, amount, null, false);
|
return cashOutService.withdraw(userId, amount, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,4 +65,5 @@ public interface CashOutService {
|
||||||
Map<String,Object> alipayTransferSummaryQuery(String alipayAccountName);
|
Map<String,Object> alipayTransferSummaryQuery(String alipayAccountName);
|
||||||
|
|
||||||
Result batchCashOutOrder(Double maxMoney, Integer count);
|
Result batchCashOutOrder(Double maxMoney, Integer count);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -735,6 +735,7 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void batchSendCashMoney(List<Long> userIds, Double maxMoney, Integer count, int len) {
|
private void batchSendCashMoney(List<Long> userIds, Double maxMoney, Integer count, int len) {
|
||||||
if (CollUtil.isEmpty(userIds)) {
|
if (CollUtil.isEmpty(userIds)) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -27,4 +27,7 @@ public interface RedisService {
|
||||||
int getCourseWeekPayCount(long courseId);
|
int getCourseWeekPayCount(long courseId);
|
||||||
|
|
||||||
|
|
||||||
|
void setCanCashFlag(Long userId, Long id);
|
||||||
|
|
||||||
|
boolean isCanCash(Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -329,4 +329,17 @@ public class RedisServiceImpl implements RedisService {
|
||||||
redisUtils.set(key, i, -1);
|
redisUtils.set(key, i, -1);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCanCashFlag(Long userId, Long id) {
|
||||||
|
String key = "cash:canCash:" + userId;
|
||||||
|
redisUtils.set(key, id, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCanCash(Long userId) {
|
||||||
|
String key = "cash:canCash:" + userId;
|
||||||
|
String s = redisUtils.get(key);
|
||||||
|
return StrUtil.isNotBlank(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue