Browse Source

界面调整

Tree 3 days ago
parent
commit
40d57af4ea

+ 19 - 95
app/Http/Controllers/Admin/GlobalController.php

@@ -1179,39 +1179,25 @@ class GlobalController extends Controller
     }
 
 
-    //用户单控系统-详细用户列表 修改
+    //用户单控系统-详细用户列表 修改(简化版:只控制金额和整体概率)
     public function dk_userlist_edit(Request $request)
     {
         $UserID = $request->UserID ?? '';
-        $TempID = $request->TempID ?? '';
-
-        $ControlModel = new Control();
         $build_sql = DB::connection('write')->table('QPTreasureDB.dbo.UserScoreControl');
 
         if ($request->isMethod('post')) {
 
             $post = $request->post();
 
-            if (!empty($post['Template'])) {
-                $cc=new ControlController();
-                $Template=(array)$cc->getConfigByID($post['Template']);
-                $post = array_merge($Template, $post);
-            }
-
+            $ControlScore = (float)($post['ControlScore'] ?? 0);
+            $Probability = (float)($post['Probability'] ?? 0);
+            $Remarks = $post['Remarks'] ?? '';
 
-//            if (!empty($post['TPBai']) && empty($post['TpBaiGear'])) {
-//                return apiReturnFail('TP百人额度未设置');
-//            }
-//            if (!empty($post['ABBai']) && empty($post['ABBaiGear'])) {
-//                return apiReturnFail('A&B额度未设置');
-//            }
-//            if (empty($post['Template']) && empty($post['TP']) && empty($post['TPAK47']) && empty($post['TPJOKER']) && empty($post['Rummy5']) && empty($post['Rummy2'])) {
-//                return apiReturnFail('概率没有配置,无法提交!');
-//            }
-            DB::connection('write')->table('QPTreasureDB.dbo.UserControlServer')->where('UserID', $UserID)->delete();
+            // 概率范围 0-100
+            if ($Probability < 0 || $Probability > 100) {
+                return apiReturnFail('概率必须在0-100之间');
+            }
 
-            $ControlScore = $post['ControlScore'];
-            $Remarks = $post['Remarks'];
             $admin_id = session('admin')->id;
             $admin_user = DB::connection('read')->table('agent.dbo.admin_users')->where('id', $admin_id)->first();
             /*管理员彩金控制*/
@@ -1220,37 +1206,21 @@ class GlobalController extends Controller
                 AdminScore::add_score($admin_user, abs($ControlScore), 2);
             }
 
-            /*用户单控记录添加*/
-            $GameData = (new Control())->GameData;
-            foreach ($post as $key => &$value) {
-                if ($key == 'ABBaiGear') {
-                    continue;
-                }
-                if (!isset($GameData[$key])) {
-                    unset($post[$key]);
-                }
-            }
-
-            // 控制分数
+            // 记录单控操作(只记金额和总体概率)
             $prefix = $ControlScore < 0 ? '输' : '赢';
-            // 概率
-            $str = '';
-            foreach ($post as $key => $value) {
-                $str .= $key . ':' . number_float($value) . '% ,';
-            }
-            $content = $prefix . $ControlScore . '/' . rtrim($str, ',');
+            $content = $prefix . $ControlScore . '/ 概率:' . number_float($Probability) . '%';
             $score = DB::connection('read')->table('QPTreasureDB.dbo.GameScoreInfo')->where('UserID', $UserID)->select('Score')->first()->Score ?? 0;
             ControlRecord::record_add($UserID, $admin_id, $content, $score);
-            // 用户控制游戏和场次
-            $ControlModel->userControl($post, $UserID);
+
             $data = [
                 'ControlScore' => (int)($ControlScore * NumConfig::NUM_VALUE),
                 'EffectiveScore' => 0,
                 'ControlKindID' => -1,
                 'Remarks' => $Remarks,
                 'InsertDate' => date('Y-m-d H:i:s'),
-                'ControlRadian' => 0,
-                'UserID'=>$UserID
+                // 概率直接写入 ControlRadian,不再区分游戏
+                'ControlRadian' => $Probability,
+                'UserID' => $UserID
             ];
 
             $build_sql->updateOrInsert(['UserID' => $UserID], $data);
@@ -1263,59 +1233,13 @@ class GlobalController extends Controller
             return $this->json(200, "修改成功");
         }
 
-        $ControlScore = $build_sql->where('UserID', $UserID)->first()->ControlScore ?? '0';
-
-        $GameKindItem = DB::connection('read')->table('QPPlatformDB.dbo.GameKindItem')->pluck('KindID')->toArray();
-
-        $UserControlKind = DB::connection('write')->table('QPTreasureDB.dbo.UserControlKind')
-            ->where('UserID', $UserID)
-            ->selectRaw('(ControlRadian) ControlRadian,KindID')
-            ->pluck('ControlRadian', 'KindID')->toArray();
-
-        $GameData = array_flip($ControlModel->GameData);
-
-
-        foreach ($GameKindItem as $value) {
-            if (!empty($GameData[$value] ?? '')) $UserControlKind[$GameData[$value]] = $UserControlKind[$value] ?? '';
-        }
-
-
-//        $TPBai = $UserControlKind['TPBai'];
-//        $ABBai = $UserControlKind['ABBai'];
-
-//        $substr = substr($TPBai, -3);
-//        $UserControlKind['TPBai'] = (int)$substr;
-//        $UserControlKind['TPBaiGear'] = !empty($TPBai) ? ($TPBai - $substr) / 1000 : '';
-
-//        $substr = substr($ABBai, -3);
-//        $UserControlKind['ABBai'] = (int)$substr;
-//        $UserControlKind['ABBaiGear'] = !empty($ABBai) ? ($ABBai - $substr) / 1000 : '';
-
-        $amount = DB::connection('write')->table('agent.dbo.order')
-                ->where('user_id', $UserID)
-                ->where('pay_status', 1)
-                ->orderByDesc('pay_at')
-                ->first()->amount ?? '';
-
-
-        !empty($amount) && $amount = (int)($amount / 100);
-//        $ControlScore = empty($ControlScore) ? $amount : $ControlScore / NumConfig::NUM_VALUE;
-        $ControlScore =  $ControlScore / NumConfig::NUM_VALUE;
-
-
-//        $list = DB::connection('write')->table('agent.dbo.ControlConfig')->get();
-        $cc=new ControlController();
-        $list=$cc->getList();
-
-
-//        $TpBaiGear = DB::connection('write')->table('agent.dbo.ControlGear')->where('KindID', 2010)->get();
-        $ABBai = DB::connection('write')->table('agent.dbo.ControlGear')->where('KindID', 2012)->get();
-
-        $ControlModel = new Control();
+        $row = $build_sql->where('UserID', $UserID)->first();
+        $ControlScore = $row->ControlScore ?? 0;
+        $Probability = $row->ControlRadian ?? 0;
 
-        $GameDataText=$ControlModel->GameDataText;
+        $ControlScore = $ControlScore / NumConfig::NUM_VALUE;
 
-        $data = compact('UserID', 'UserControlKind', 'ControlScore', 'list', 'TempID', 'ABBai','GameDataText');
+        $data = compact('UserID', 'ControlScore', 'Probability');
 
         return view('admin.global.dk_userlist_edit', $data);
 

+ 9 - 111
resources/views/admin/global/dk_userlist_edit.blade.php

@@ -15,43 +15,20 @@
                                     <label>{{ __('auto.控制金额') }}</label>
                                     <input type="number" class="form-control required"
                                            value="{{$ControlScore ?? '0'}}" name="ControlScore">
-
                                 </div>
 
                                 <div class="form-group" style="width: 48%;float: right">
-                                    <label for="">{{ __('auto.控制概率请选择使用模板:') }}</label>
-                                    <select name="Template" id="Template" class="form-control"
-                                            onchange="gradeChange(this.options[this.options.selectedIndex].value)">
-                                        <option value="">{{ __('auto.请选择模板') }}</option>
-                                        @foreach($list as $val)
-                                            <option value="{{$val->ID}}"
-                                                    @if($TempID==$val->ID) selected @endif>{{$val->Name}}</option>
-                                        @endforeach
-                                    </select>
-                                    <button class="btn-sm btn btn-gradient-dark"
-                                            onclick="ControlConfigFunc();return false;">{{ __('auto.配置模板') }}
-                                    </button>
-                                </div>
-
-                                <div >
-                                    <label for="">{{ __('auto.当前生效概率:') }}</label> <br>
-                                @foreach($GameDataText as $gamekey=>$gamename)
-                                    <div style="width: 48%;float: left">
-                                        <label for="">{{$gamename}}:</label>
-                                        <input type="number" class="form-control" name="{{$gamekey}}"
-                                               id="{{$gamekey}}" value="{{$UserControlKind[$gamekey] ?? ''}}">
-                                    </div>
-                                @endforeach
-
+                                    <label>{{ __('auto.控制概率(0-100)') }}</label>
+                                    <input type="number" class="form-control required"
+                                           value="{{$Probability ?? '0'}}" name="Probability" min="0" max="100">
                                 </div>
 
                                 <div style="clear: both"></div>
                                 <br>
-                                <div class="form-group" style="">
+                                <div class="form-group">
                                     <label>{{ __('auto.备注信息') }}</label>
                                     <textarea id="Remarks" name="Remarks" class="form-control"
-                                              rows="3">{{$info->Remarks ?? ''}}</textarea>
-
+                                              rows="3"></textarea>
                                 </div>
 
                                 <input type="hidden" name="UserID" value="{{$UserID ?? ''}}">
@@ -79,95 +56,16 @@
         </div>
     </div>
     <script>
-
-
-        function add(KindID, TpBaiGear) {
-            var page = layer.open({
-                type: 2,
-                title: '{{ __('auto.修改配置') }}',
-                shadeClose: true,
-                shade: 0.8,
-                area: ['70%', '60%'],
-                content: '/admin/Control/ControlConfigGear?KindID=' + KindID,
-                btn: '{{ __('auto.确定') }}',
-                yes: function (index, layero) {
-                    var obj = $(layero).find("iframe")[0].contentWindow; //obj可以调用子页面的任何方法
-                    Value = obj.gearVal()
-                    layer.close(index);
-                    $('#' + TpBaiGear).html('')
-                    html = ''
-                    var arr = Value.split(',');
-                    for (var i in arr) {
-                        val = parseInt(arr[i])
-
-                        if (val > 0) {
-                            html += '<input type="radio" name=' + TpBaiGear + ' value="' + val + '">' + val + '&nbsp;&nbsp;';
-                        }
-                    }
-
-                    $('#' + TpBaiGear).append(html)
-
-                    myRequest("/admin/Control/ControlConfigGearAdd", "post", {Value, KindID}, function (res) {
-
-                    });
-                }
-            });
-
-        }
-
-        function gradeChange(ID) {
-            myRequest('/admin/Control/gradeChange/' + ID, 'post', {}, function (response) {
-                data = response.data
-                @foreach($GameDataText as $gamekey=>$gamename)
-                $('#{{$gamekey}}').val(data.{{$gamekey}})
-                @endforeach
-
-            })
-        }
-
-        function ControlConfigFunc() {
-
-            var page = layer.open({
-                type: 2,
-                title: '{{ __('auto.修改配置') }}',
-                shadeClose: true,
-                shade: 0.8,
-                area: ['70%', '90%'],
-                content: '/admin/Control/ControlConfig',
-                end: function () {
-                    myRequest("/admin/Control/getConfig", "post", {}, function (res) {
-                        var data = res.data
-                        var html = ''
-                        for (var i of data) {
-                            html += '<option value=' + i['ID'] + '>' + i['Name'] + '</option>'
-                        }
-
-                        $("#Template").html(html)
-                    });
-                }
-            });
-
-        }
-
         function commit(id) {
 
             if (!checkForm()) {
                 return false;
             }
             var data = $("#form").serializeObject();
-            var verifyData = $("#form").serializeArray();
-            for (let val of verifyData) {
-                var name = val.name;
-                if (name != 'ControlScore' && name != 'Template' && name != 'UserID' && name != 'Remarks' && name != 'ABBaiGear' && name != 'TpBaiGear') {
-                    if (val.value == '' || parseInt(val.value) < 0 || parseInt(val.value) > 100) {
-                        layer.msg('{{ __('auto.控制等级区间') }}0-100');
-                        return false;
-                    }
-                }
-            }
-
-            if (data.Template == '' && (data.TP || data.TPAK47 || data.TPJOKER || data.Rummy5 || data.Rummy2) == '') {
-                layer.msg('{{ __('auto.概率没有配置,无法提交') }}');
+            // 概率校验 0-100
+            var prob = parseFloat(data.Probability || 0);
+            if (isNaN(prob) || prob < 0 || prob > 100) {
+                layer.msg('概率必须在0-100之间');
                 return false;
             }
 

+ 6 - 22
resources/views/admin/global/id_list.blade.php

@@ -326,31 +326,15 @@
                                 <th>{{ __('auto.对局数') }}</th>
                             </tr>
                             @foreach($gameCount as $key => $value)
-                            <tr>
-                                <td>{{ $key }}</td>
-                                <td>{{ $value }} </td>
-                            </tr>
-                            @endforeach
-                        </table>
-
-                        <table class="table table-bordered" style="margin-left:5px;width: 20%;float: left">
-
-                            <tr>
-                                <td width="5%" colspan="2">三方数据信息</td>
-                            </tr>
-                            <tr>
-                                <th>平台</th>
-                                <th>输赢(当天/总)</th>
-                            </tr>
-                            @foreach($platformData as $key => $value)
-                                <tr>
-                                    <td>{{ $key }}</td>
-                                    <td>{{ $value['today'] }} / {{ $value['total'] }}</td>
-                                </tr>
+                                @if($value > 0)
+                                    <tr>
+                                        <td>{{ $key }}</td>
+                                        <td>{{ $value }}</td>
+                                    </tr>
+                                @endif
                             @endforeach
                         </table>
 
-
                     </div>
 
                     <div>{{ __('auto.用户控制:') }}