Procházet zdrojové kódy

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

release_toaliyun_real
hupeng před 7 roky
rodič
revize
f05ae3a261
4 změnil soubory, kde provedl 18 přidání a 42 odebrání
  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 Zobrazit soubor

@@ -49,17 +49,4 @@ public class WxGameController extends BaseController {
return new ResultData(ErrorCode.GAME_NOT_FOUND); 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 Zobrazit soubor

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


public void setGameTemplate(WxGameTemplate gameTemplate) { 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 { public static enum Field {


+ 0
- 7
mallinkService/src/main/java/com/iformall/service/WxGameService.java Zobrazit soubor

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


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

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


+ 10
- 16
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Zobrazit soubor

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


if (wxGame != null) { if (wxGame != null) {
wxGame.setCouponIdsList(getParams(wxGame));
return wxGame; return wxGame;
} }
return null; 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 // 获取已上架的CouponChannel
WxCouponChannel couponChannelQ = new WxCouponChannel(); WxCouponChannel couponChannelQ = new WxCouponChannel();
couponChannelQ.setTenantId(record.getTenantId()); couponChannelQ.setTenantId(record.getTenantId());
@@ -101,7 +94,7 @@ public class WxGameServiceImpl implements WxGameService {


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


return null;
return couponIdsList;
} }


@Override @Override
public WxGame getById(Long id) { 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 @Override


Načítá se…
Zrušit
Uložit