Przeglądaj źródła

[游戏][修复]:C端接口问题修复

release_toaliyun_real
hupeng 7 lat temu
rodzic
commit
0d73019d06
3 zmienionych plików z 20 dodań i 21 usunięć
  1. +6
    -10
      mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java
  2. +12
    -10
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java
  3. +2
    -1
      mallinkService/src/main/resources/mapper/WxGameMapper.xml

+ 6
- 10
mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java Wyświetl plik

@@ -32,21 +32,17 @@ public class WxGameController extends BaseController {

@ApiOperation("蒙层/游戏入口获取游戏信息")
@GetMapping("getOne")
public ResultData getOne() {
WxGame wxGame = new WxGame();
public ResultData getOne(@ModelAttribute WxGame wxGame) {
if (wxGame == null) wxGame = new WxGame();
wxGame.setTenantId(getTenantId());
wxGame.setStatus(EnumGameStatus.STATUS_THROW_IN.getCode());
// 因为有算法要求,分成两步获取
WxGame wxGame1 = wxGameService.getOne(wxGame);
if (wxGame1 != null) {
WxGameTemplate gameTemplate = wxGameTemplateService.getById(wxGame1.getGameId());
if (gameTemplate != null) {
wxGame1.setGameTemplate(gameTemplate);
return new ResultData(wxGame1);
}
WxGame record = wxGameService.getOne(wxGame);
if (record == null) {
return new ResultData(ErrorCode.GAME_NOT_FOUND);
}

return new ResultData(ErrorCode.GAME_NOT_FOUND);
return new ResultData(record);
}

}

+ 12
- 10
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Wyświetl plik

@@ -59,24 +59,26 @@ public class WxGameServiceImpl implements WxGameService {
}

@Override
public WxGame getOne(WxGame record) {
WxGame wxGame = null;
public WxGame getOne(WxGame wxGame) {
WxGame record = null;
// get game's count
int countOfGame = wxGameMapper.selectCount(record);
int countOfGame = wxGameMapper.selectCount(wxGame);
if (countOfGame == 1){
wxGame = wxGameMapper.selectOne(record);
record = wxGameMapper.selectOne(wxGame);
} else if (countOfGame > 1){
// random
int pageNum = (int)(1+Math.random()*(countOfGame-1+1));
PageInfo<WxGame> gamePageInfo = PageHelper.startPage(pageNum, 1).doSelectPageInfo(() -> wxGameMapper.findList(record));
wxGame = gamePageInfo.getList().get(0);
PageInfo<WxGame> gamePageInfo =
PageHelper.startPage(pageNum, 1).doSelectPageInfo(() -> wxGameMapper.findList(wxGame));
record = gamePageInfo.getList().get(0);
}

if (wxGame != null) {
wxGame.setCouponIdsList(getParams(wxGame));
return wxGame;
if (record != null) {
record.setGameTemplate(wxGameTemplateService.getById(record.getGameId()));
record.setCouponIdsList(getParams(record));
}
return null;

return record;
}

private List<Object> getParams(WxGame record) {


+ 2
- 1
mallinkService/src/main/resources/mapper/WxGameMapper.xml Wyświetl plik

@@ -6,13 +6,14 @@
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
<result column="game_id" jdbcType="INTEGER" property="gameId" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="coupon_ids" jdbcType="VARCHAR" property="couponIds" />
<result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" />
<result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" />
<result column="triggle_action" jdbcType="INTEGER" property="triggleAction" />
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`game_id`,`status`,`valid_start_date`,`valid_end_date`,`triggle_action`
`id`,`tenant_id`,`game_id`,`status`,`coupon_ids`,`valid_start_date`,`valid_end_date`,`triggle_action`
</sql>

<sql id="dynamicWhereConditions">


Ładowanie…
Anuluj
Zapisz