|
@@ -7,6 +7,7 @@ import java.util.Comparator;
|
|
|
import java.util.List;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.game.business.domain.*;
|
|
|
import com.game.business.dto.AppGameItemDTO;
|
|
|
import com.game.business.service.IAppGameClassifyService;
|
|
@@ -234,4 +235,59 @@ public class AppGameItemController extends BaseController
|
|
|
}
|
|
|
return R.ok("同步成功");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ * 获取游戏选项
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取游戏选项", notes = "获取游戏选项")
|
|
|
+ @PostMapping("/getSynItem")
|
|
|
+ public R getSynItem(@RequestBody AppGameItemDTO appGameItemDTO)
|
|
|
+ {
|
|
|
+ if(StringUtils.isBlank(appGameItemDTO.getClassId())){
|
|
|
+ return R.fail("平台ID为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ AppGameClassify appGameClassify = appGameClassifyService.getByCode(appGameItemDTO.getClassId());
|
|
|
+
|
|
|
+ if(appGameClassify == null){
|
|
|
+ return R.fail("平台ID不正确");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(appGameItemDTO.getGameId())){
|
|
|
+ return R.fail("平台不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ AppGame appGame = appGameService.selectAppGameByClassIdAndCode(appGameClassify.getId(), appGameItemDTO.getGameId());
|
|
|
+
|
|
|
+ if(appGame == null){
|
|
|
+ return R.fail("游戏不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(appGameItemDTO.getConfig())){
|
|
|
+ return R.fail("游戏赔率配置为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ AppGameItem appGameItem = new AppGameItem();
|
|
|
+ appGameItem.setGameId(appGame.getId());
|
|
|
+ List<AppGameItem> itemList = appGameItemService.selectAppGameItemList(appGameItem);
|
|
|
+ if(itemList == null || itemList.isEmpty()){
|
|
|
+ return R.fail("游戏未配置选项设置");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Collections.sort(itemList, Comparator.comparing(AppGameItem::getItemLocation));
|
|
|
+ String config = "";
|
|
|
+ for (int i = 0; i < itemList.size(); i++) {
|
|
|
+ AppGameItem gameItem = itemList.get(i);
|
|
|
+ if(StringUtils.isBlank(config)){
|
|
|
+ config = gameItem.getItemMultiple() + "";
|
|
|
+ }else{
|
|
|
+ config = config + "," + gameItem.getItemMultiple() + "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("config", config);
|
|
|
+ return R.ok(jsonObject);
|
|
|
+ }
|
|
|
}
|