Просмотр исходного кода

[游戏][修改]:详情返回所有信息

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
f05ae3a261
4 измененных файлов: 18 добавлений и 42 удалений
  1. +0
    -13
      mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java
  2. +8
    -6
      mallinkService/src/main/java/com/iformall/domain/po/WxGame.java
  3. +0
    -7
      mallinkService/src/main/java/com/iformall/service/WxGameService.java
  4. +10
    -16
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java

+ 0
- 13
mallinkCApi/src/main/java/com/iformall/controller/WxGameController.java Просмотреть файл

@@ -49,17 +49,4 @@ public class WxGameController extends BaseController {
return new ResultData(ErrorCode.GAME_NOT_FOUND);
}

@ApiOperation("获取游戏参数(id,gameId必填)")
@GetMapping("getParams")
public ResultData getParams(@ModelAttribute WxGame wxGame) {
if (null == wxGame) wxGame = new WxGame();
wxGame.setTenantId(getTenantId());
wxGame.setStatus(EnumGameStatus.STATUS_THROW_IN.getCode());
WxGame wxGame1 = wxGameService.getParams(wxGame);
if (wxGame1 != null) {
return new ResultData(wxGame1);
}
return new ResultData(ErrorCode.GAME_NOT_FOUND);
}

}

+ 8
- 6
mallinkService/src/main/java/com/iformall/domain/po/WxGame.java Просмотреть файл

@@ -176,12 +176,14 @@ public class WxGame implements Serializable {
}

public void setGameTemplate(WxGameTemplate gameTemplate) {
this.imgUrl = gameTemplate.getImgUrl();
this.url = gameTemplate.getUrl();
this.name = gameTemplate.getName();
this.optionLimit = gameTemplate.getOptionLimit();
this.rules = gameTemplate.getRules();
this.type = gameTemplate.getType();
if (gameTemplate != null) {
this.imgUrl = gameTemplate.getImgUrl();
this.url = gameTemplate.getUrl();
this.name = gameTemplate.getName();
this.optionLimit = gameTemplate.getOptionLimit();
this.rules = gameTemplate.getRules();
this.type = gameTemplate.getType();
}
}

public static enum Field {


+ 0
- 7
mallinkService/src/main/java/com/iformall/service/WxGameService.java Просмотреть файл

@@ -22,13 +22,6 @@ public interface WxGameService {
*/
WxGame getOne(WxGame record);

/**
* 获取用户要玩的游戏参数
* @param record
* @return
*/
WxGame getParams(WxGame record);

/**
* 根据Id获得实体
*


+ 10
- 16
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Просмотреть файл

@@ -73,20 +73,13 @@ public class WxGameServiceImpl implements WxGameService {
}

if (wxGame != null) {
wxGame.setCouponIdsList(getParams(wxGame));
return wxGame;
}
return null;
}

@Override
public WxGame getParams(WxGame record) {
WxGame wxGame = null;
try {
wxGame = wxGameMapper.selectOne(record);
} catch (Exception e) {
logger.error(e.getMessage());
return null;
}
private List<Object> getParams(WxGame record) {
// 获取已上架的CouponChannel
WxCouponChannel couponChannelQ = new WxCouponChannel();
couponChannelQ.setTenantId(record.getTenantId());
@@ -101,7 +94,7 @@ public class WxGameServiceImpl implements WxGameService {

// get game's coupon
List couponIdsList = new ArrayList();
JSONArray couponChannelIds = JSON.parseArray(wxGame.getCouponIds());
JSONArray couponChannelIds = JSON.parseArray(record.getCouponIds());
for(int i=0; i<couponChannelIds.size();i++) {
JSONObject couponChanObj = (JSONObject) couponChannelIds.get(i);
Long couponId = couponChanObj.getLong("couponId");
@@ -114,17 +107,18 @@ public class WxGameServiceImpl implements WxGameService {
couponIdsList.add(couponChanObj);
}
}
if (couponIdsList.size() > 0) {
wxGame.setCouponIdsList(couponIdsList);
return wxGame;
}

return null;
return couponIdsList;
}

@Override
public WxGame getById(Long id) {
return wxGameMapper.selectByPrimaryKey(id);
WxGame game = wxGameMapper.selectByPrimaryKey(id);
if (game != null) {
game.setGameTemplate(wxGameTemplateService.getById(game.getGameId()));
game.setCouponIdsList(getParams(game));
}
return game;
}

@Override


Загрузка…
Отмена
Сохранить