Browse Source

获取用户视频广告数据

master
nili 6 months ago
parent
commit
79480d8f1e
  1. 2
      game-service/src/main/java/awesome/group/game/service/bo/MatrixAdvRecordSimple.java
  2. 26
      game-service/src/main/java/awesome/group/game/service/citrus/UserService.java
  3. 3
      game-service/src/main/java/awesome/group/game/service/util/Constants.java
  4. 8
      game-web/src/main/java/awesome/group/game/web/rest/citrus/UserController.java

2
game-service/src/main/java/awesome/group/game/service/bo/MatrixAdvRecordSimple.java

@ -7,6 +7,7 @@ public class MatrixAdvRecordSimple {
public Integer platform;//1穿山甲,2腾讯,3百度联盟,4 Mintegral,5 快手,6游可赢,7 Sigmob,8 Admob
public Integer advType;//1横幅,2插页,3激励视频
public Long ecpm;//单位:分
public Long ecpmReal;//单位:分
public Long createdAt;
public MatrixAdvRecordSimple() {
@ -17,6 +18,7 @@ public class MatrixAdvRecordSimple {
this.platform = r.getPlatform();
this.advType = r.getAdvType();
this.ecpm = r.getEcpm();
this.ecpmReal = r.getEcpmReal();
this.createdAt = r.getCreatedAt().getTime();
}
}

26
game-service/src/main/java/awesome/group/game/service/citrus/UserService.java

@ -1,14 +1,20 @@
package awesome.group.game.service.citrus;
import awesome.group.game.dao.bean.MatrixAdvRecord;
import awesome.group.game.dao.bean.MatrixApp;
import awesome.group.game.dao.bean.MatrixMoneyRecord;
import awesome.group.game.dao.bean.MatrixUser;
import awesome.group.game.dao.mapper.MatrixAdvRecordMapper;
import awesome.group.game.dao.mapper.MatrixAppMapper;
import awesome.group.game.dao.mapper.MatrixMoneyRecordMapper;
import awesome.group.game.dao.mapper.MatrixUserMapper;
import awesome.group.game.service.SmsService;
import awesome.group.game.service.UMengService;
import awesome.group.game.service.bo.citrus.*;
import awesome.group.game.service.bo.MatrixAdvRecordSimple;
import awesome.group.game.service.bo.citrus.CashRecord;
import awesome.group.game.service.bo.citrus.LoginReq;
import awesome.group.game.service.bo.citrus.TeamBo;
import awesome.group.game.service.bo.citrus.UserBo;
import awesome.group.game.service.bo.matrix.AppNormalConfig;
import awesome.group.game.service.bo.matrix.UmengConfigBo;
import awesome.group.game.service.common.exception.PaganiException;
@ -53,6 +59,9 @@ public class UserService {
@Autowired
private UMengService uMengService;
@Autowired
private MatrixAdvRecordMapper advRecordMapper;
public static final int STATUS_WAITING = 0;//等审核
public static final int STATUS_AUDIT_PASS = 1;//已审核通过
@ -103,7 +112,7 @@ public class UserService {
UmengConfigBo configBo = gson.fromJson(app.getUmeng(), UmengConfigBo.class);
String mobile = uMengService.getMobile(token, configBo);
MatrixUser user = userMapper.selectByAppIdAndMobile(app.getId(), mobile);
if(user != null && user.getStatus() == Constants.USER_BANNED) {
if (user != null && user.getStatus() == Constants.USER_BANNED) {
throw new PaganiException(PaganiExceptionCode.GENERAL_ERROR, "账号异常,无法登录");
}
MatrixUser upUser = null;
@ -164,6 +173,19 @@ public class UserService {
userMapper.updateEnv(uid, env);
}
public List<MatrixAdvRecordSimple> getAdvList(Integer userId, Integer lastId) {
if (lastId == null) {
lastId = Integer.MAX_VALUE;
}
LambdaQueryWrapper<MatrixAdvRecord> query = Wrappers.lambdaQuery();
query.eq(MatrixAdvRecord::getUserId, userId);
query.lt(MatrixAdvRecord::getId, lastId);
query.eq(MatrixAdvRecord::getAdvType, Constants.VIDEO);
query.last("limit 20");
List<MatrixAdvRecord> data = advRecordMapper.selectList(query);
return data.stream().map(MatrixAdvRecordSimple::new).toList();
}
public void applyMoney(Integer uid, Integer cent) {
Assert.isTrue(cent >= 10, "至少提0.1元");
MatrixUser u = userMapper.selectById(uid);

3
game-service/src/main/java/awesome/group/game/service/util/Constants.java

@ -2,5 +2,8 @@ package awesome.group.game.service.util;
public class Constants {
public static final int USER_BANNED = -1;
public static final int BANNER = 1;
public static final int POP_UP = 2;
public static final int VIDEO = 3;
}

8
game-web/src/main/java/awesome/group/game/web/rest/citrus/UserController.java

@ -1,6 +1,7 @@
package awesome.group.game.web.rest.citrus;
import awesome.group.game.service.bo.MatrixAdvRecordEditBo;
import awesome.group.game.service.bo.MatrixAdvRecordSimple;
import awesome.group.game.service.bo.citrus.AdvResponse;
import awesome.group.game.service.bo.citrus.CashRecord;
import awesome.group.game.service.bo.citrus.TeamBo;
@ -12,7 +13,6 @@ import awesome.group.game.service.common.response.R;
import awesome.group.game.web.RequestContext;
import awesome.group.game.web.aop.RestApi;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -85,4 +85,10 @@ public class UserController {
userService.updateEnv(RequestContext.getCitrusUid(), env);
return new R<>(null);
}
@GetMapping("/advList")
@RestApi
public R<List<MatrixAdvRecordSimple>> getAdvList(@RequestParam(required = false) Integer lastId) {
return new R<>(userService.getAdvList(RequestContext.getCitrusUid(), lastId));
}
}

Loading…
Cancel
Save