Browse Source

游戏配置

dos 2 months ago
parent
commit
4726807013

+ 13 - 0
game-business/src/main/java/com/game/business/controller/AppGameMoneyController.java

@@ -3,6 +3,7 @@ package com.game.business.controller;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
+import com.game.common.core.domain.HttpRetArr;
 import com.game.common.core.domain.R;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -112,4 +113,16 @@ public class AppGameMoneyController extends BaseController
     {
         return R.ok(appGameMoneyService.deleteAppGameMoneyByIds(ids));
     }
+
+
+    /**
+     * 查询游戏投注金额列表
+     */
+    @GetMapping("/moneyList")
+    @ApiOperation(value = "查询游戏投注选项", notes = "查询游戏投注选项")
+    public HttpRetArr<AppGameMoney> moneyList(AppGameMoney appGameMoney)
+    {
+        List<AppGameMoney> list = appGameMoneyService.selectAppGameMoneyList(appGameMoney);
+        return HttpRetArr.success("查询成功",list);
+    }
 }

+ 2 - 2
game-business/src/main/java/com/game/business/domain/AppGameMoney.java

@@ -34,8 +34,8 @@ private static final long serialVersionUID=1L;
     /** 游戏id */
     @ApiModelProperty(value = "游戏id")
     @Excel(name = "游戏id")
-    @TableField(value = "app_game")
-    private Long appGame;
+    @TableField(value = "app_game_id")
+    private Long appGameId;
 
     /** 投注金额 */
     @ApiModelProperty(value = "投注金额")

+ 6 - 6
game-business/src/main/resources/mapper/business/AppGameMoneyMapper.xml

@@ -6,20 +6,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <resultMap type="com.game.business.domain.AppGameMoney" id="AppGameMoneyResult">
         <result property="id"    column="id"    />
-        <result property="appGame"    column="app_game"    />
+        <result property="appGameId"    column="app_game_id"    />
         <result property="bettingMoney"    column="betting_money"    />
         <result property="delFlag"    column="del_flag"    />
     </resultMap>
 
     <sql id="selectAppGameMoneyVo">
-        select id, app_game, betting_money, del_flag from app_game_money
+        select id, app_game_id, betting_money, del_flag from app_game_money
     </sql>
 
     <select id="selectAppGameMoneyList" parameterType="com.game.business.domain.AppGameMoney" resultMap="AppGameMoneyResult">
         <include refid="selectAppGameMoneyVo"/>
         <where>
             del_flag = 0
-            <if test="appGame != null "> and app_game = #{appGame}</if>
+            <if test="appGameId != null "> and app_game_id = #{appGameId}</if>
             <if test="bettingMoney != null "> and betting_money = #{bettingMoney}</if>
         </where>
     </select>
@@ -32,12 +32,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <insert id="insertAppGameMoney" parameterType="com.game.business.domain.AppGameMoney" useGeneratedKeys="true" keyProperty="id">
         insert into app_game_money
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="appGame != null">app_game,</if>
+            <if test="appGameId != null">app_game_id,</if>
             <if test="bettingMoney != null">betting_money,</if>
             <if test="delFlag != null">del_flag,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="appGame != null">#{appGame},</if>
+            <if test="appGameId != null">#{appGameId},</if>
             <if test="bettingMoney != null">#{bettingMoney},</if>
             <if test="delFlag != null">#{delFlag},</if>
          </trim>
@@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateAppGameMoney" parameterType="com.game.business.domain.AppGameMoney">
         update app_game_money
         <trim prefix="SET" suffixOverrides=",">
-            <if test="appGame != null">app_game = #{appGame},</if>
+            <if test="appGameId != null">app_game_id = #{appGame},</if>
             <if test="bettingMoney != null">betting_money = #{bettingMoney},</if>
             <if test="delFlag != null">del_flag = #{delFlag},</if>
         </trim>

+ 41 - 13
game-ui/src/views/business/game/index.vue

@@ -92,7 +92,7 @@
       </el-table-column>
       <el-table-column label="游戏当前期号" align="center" prop="gameDate" />
       <el-table-column label="游戏当前倒计时" align="center" prop="gameTime" />
-      <el-table-column label="上次中奖选项" align="center" prop="upItem" />
+<!--      <el-table-column label="上次中奖选项" align="center" prop="upItem" />-->
       <el-table-column label="logo" align="center" prop="logoUrl">
         <template slot-scope="scope">
           <image-preview :src="scope.row.logoUrl" :width="50" :height="50"/>
@@ -109,21 +109,26 @@
         </template>
       </el-table-column>
       <el-table-column label="游戏路径" align="center" prop="gamePath" />
-      <el-table-column label="状态" align="center" prop="status">
+      <el-table-column label="是否上架" align="center" prop="status">
         <template slot-scope="scope">
           <dict-tag :options="dict.type.app_status" :value="scope.row.status"/>
         </template>
       </el-table-column>
+      <el-table-column label="是否启用投注" align="center" prop="enable">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.app_game_betting_enable" :value="scope.row.enable"/>
+        </template>
+      </el-table-column>
       <el-table-column label="排序" align="center" prop="orderno" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
+<!--          <el-button
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['business:game:edit']"
-          >查看开奖记录</el-button>
+          >查看开奖记录</el-button>-->
           <el-button
             size="mini"
             type="text"
@@ -151,27 +156,34 @@
     />
 
     <!-- 添加或修改游戏配置对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+    <el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="20%">
         <el-form-item label="名称" prop="name">
           <el-input v-model="form.name" placeholder="请输入名称" />
         </el-form-item>
-        <el-form-item label="所属分类id" prop="classifyId">
-          <el-input v-model="form.classifyId" placeholder="请输入所属分类id" />
+        <el-form-item label="所属分类" prop="classifyId">
+          <el-select v-model="form.classifyId" placeholder="请选择分类">
+            <el-option
+              v-for="dict in typeList"
+              :key="dict.value"
+              :label="dict.label"
+              :value="parseInt(dict.value)"
+            ></el-option>
+          </el-select>
         </el-form-item>
         <el-form-item label="logo" prop="logoUrl">
-          <el-input v-model="form.logoUrl" placeholder="请输入logo" />
+            <image-preview :src="form.logoUrl" :width="50" :height="50"/>
         </el-form-item>
         <el-form-item label="直播间图片" prop="liveImgUrl">
-          <el-input v-model="form.liveImgUrl" placeholder="请输入直播间图片" />
+          <image-preview :src="form.liveImgUrl" :width="50" :height="50"/>
         </el-form-item>
         <el-form-item label="我的页面图片" prop="myImgUrl">
-          <el-input v-model="form.myImgUrl" placeholder="请输入我的页面图片" />
+          <image-preview :src="form.myImgUrl" :width="50" :height="50"/>
         </el-form-item>
         <el-form-item label="游戏路径" prop="gamePath">
           <el-input v-model="form.gamePath" placeholder="请输入游戏路径" />
         </el-form-item>
-        <el-form-item label="状态" prop="status">
+        <el-form-item label="是否上架" prop="status">
           <el-select v-model="form.status" placeholder="请选择状态">
             <el-option
               v-for="dict in dict.type.app_status"
@@ -181,6 +193,19 @@
             ></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="是否启用投注" prop="enable">
+          <el-select v-model="form.enable" placeholder="请选择状态">
+            <el-option
+              v-for="dict in dict.type.app_game_betting_enable"
+              :key="dict.value"
+              :label="dict.label"
+              :value="parseInt(dict.value)"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="每期投注上限次数" prop="bettingCount">
+          <el-input type="number" @input="handleInput" v-model="form.bettingCount" placeholder="请输入整数" />
+        </el-form-item>
         <el-form-item label="排序" prop="orderno">
           <el-input v-model="form.orderno" placeholder="请输入排序" />
         </el-form-item>
@@ -198,7 +223,7 @@ import { listGame, getGame, delGame, addGame, updateGame,listClassifyGame } from
 
 export default {
   name: "Game",
-  dicts: ['app_status'],
+  dicts: ['app_status','app_game_betting_enable'],
   data() {
     return {
       // 遮罩层
@@ -371,6 +396,9 @@ export default {
       this.download('business/game/export', {
         ...this.queryParams
       }, `game_${new Date().getTime()}.xlsx`)
+    },
+    handleInput() {
+      this.form.bettingCount = this.form.bettingCount.replace(/\D/g, '');
     }
   }
 };

+ 5 - 1
game-ui/src/views/business/game_item/index.vue

@@ -82,6 +82,7 @@
       <el-table-column label="选项名称" align="center" prop="itemName" />
       <el-table-column label="选项倍数" align="center" prop="itemMultiple" />
       <el-table-column label="选项值" align="center" prop="itemLocation" />
+      <el-table-column label="每期投注上限" align="center" prop="bettingMoney" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -112,7 +113,7 @@
 
     <!-- 添加或修改游戏选项对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+      <el-form ref="form" :model="form" :rules="rules" label-width="30%">
         <el-form-item label="游戏ID" prop="gameId">
           <el-input v-model="form.gameId" placeholder="请输入游戏ID" />
         </el-form-item>
@@ -125,6 +126,9 @@
         <el-form-item label="选项值" prop="itemLocation">
           <el-input v-model="form.itemLocation" placeholder="请输入选项值" />
         </el-form-item>
+        <el-form-item label="每期投注上限金额" prop="bettingMoney">
+          <el-input v-model="form.bettingMoney" placeholder="请输入" />
+        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>

+ 56 - 28
game-ui/src/views/business/money/index.vue

@@ -1,21 +1,15 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="游戏id" prop="appGame">
-        <el-input
-          v-model="queryParams.appGame"
-          placeholder="请输入游戏id"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="投注金额" prop="bettingMoney">
-        <el-input
-          v-model="queryParams.bettingMoney"
-          placeholder="请输入投注金额"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+      <el-form-item label="游戏" prop="appGameId">
+        <el-select v-model="queryParams.appGameId" placeholder="请选择">
+          <el-option
+            v-for="item in typeList"
+            :key="item.value"
+            :label="item.label"
+            :value="item.value"
+          ></el-option>
+        </el-select>
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -71,9 +65,13 @@
 
     <el-table v-loading="loading" :data="moneyList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="${comment}" align="center" prop="id" />
-      <el-table-column label="游戏id" align="center" prop="appGame" />
-      <el-table-column label="投注金额" align="center" prop="bettingMoney" />
+      <el-table-column label="id" align="center" prop="id" />
+      <el-table-column label="游戏" align="center" prop="appGameId">
+        <template slot-scope="scope">
+          <span>{{ getTypeName(scope.row.appGameId) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="金额" align="center" prop="bettingMoney" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -93,7 +91,7 @@
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -105,15 +103,19 @@
     <!-- 添加或修改游戏投注金额对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="游戏id" prop="appGame">
-          <el-input v-model="form.appGame" placeholder="请输入游戏id" />
+        <el-form-item label="游戏" prop="appGameId">
+          <el-select v-model="form.appGameId" placeholder="请选择">
+            <el-option
+              v-for="item in typeList"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            ></el-option>
+          </el-select>
         </el-form-item>
-        <el-form-item label="投注金额" prop="bettingMoney">
+        <el-form-item label="金额" prop="bettingMoney">
           <el-input v-model="form.bettingMoney" placeholder="请输入投注金额" />
         </el-form-item>
-        <el-form-item label="删除状态 0:未删除(默认) 1:已删除" prop="delFlag">
-          <el-input v-model="form.delFlag" placeholder="请输入删除状态 0:未删除(默认) 1:已删除" />
-        </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -125,6 +127,7 @@
 
 <script>
 import { listMoney, getMoney, delMoney, addMoney, updateMoney } from "@/api/business/money";
+import { allGameList } from "@/api/business/game_item";
 
 export default {
   name: "Money",
@@ -148,24 +151,49 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      typeList:[],
+      typeMap:{},
       // 查询参数
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        appGame: null,
+        appGameId: null,
         bettingMoney: null,
       },
       // 表单参数
       form: {},
       // 表单校验
       rules: {
+        appGameId: [
+          { required: true, message: "请选择游戏", trigger: "blur" }
+        ],
+        bettingMoney: [
+          { required: true, message: "请选择输入金额", trigger: "blur" }
+        ]
       }
     };
   },
   created() {
-    this.getList();
+    var that = this;
+    allGameList().then(response => {
+      if(response.data){
+        for(var i in response.data){
+          var item = response.data[i];
+          that.typeMap[item.id.toString()] = item.name;
+          that.typeList.push({
+            value:item.id,
+            label:item.name
+          })
+        }
+      }
+      that.getList();
+
+    })
   },
   methods: {
+    getTypeName(id) {
+      return this.typeMap[id.toString()];
+    },
     /** 查询游戏投注金额列表 */
     getList() {
       this.loading = true;
@@ -184,7 +212,7 @@ export default {
     reset() {
       this.form = {
         id: null,
-        appGame: null,
+        appGameId: null,
         bettingMoney: null,
         delFlag: null
       };