Forráskód Böngészése

修复赛事赔率跳转异常

彭俊 6 éve
szülő
commit
d09a95f261

+ 1 - 2
app/Http/Controllers/Admin/SportsSoccerController.php

@@ -400,7 +400,7 @@ class SportsSoccerController extends Controller
     }
 
     /**
-     *赛事结果处理
+     *赛事结果处理1
      */
     public function dealwith(Req $req)
     {
@@ -588,7 +588,6 @@ class SportsSoccerController extends Controller
             return -1;
         }
         if (!$req->isMethod('post')) {
-
             $data = \App\Models\SoccerOdds::where('id', $id)->first();
             if (!$data) {
                 return -2;

+ 39 - 1
app/Http/Controllers/Admin/SportsbkController.php

@@ -117,7 +117,24 @@ class SportsbkController extends Controller {
 		return $array;
 	}
 
-	//结算
+    //查询赛事结果记录
+    function resultLog(Req $req){
+        $match_id = $req->match_id;
+        $list = \App\Models\Stlqresultlog::leftJoin('system_user', 'user_id', '=', 'system_user.id')
+            ->select('st_lq_result_log.*', 'system_user.loginname')->where('match_id', $match_id)->orderBy('id', 'asc')->get();
+        foreach ($list as $key=>$value){
+            $list[$key]['home_score'] = json_decode($value['home_score'], true);
+            $list[$key]['guest_score'] = json_decode($value['guest_score'], true);
+        }
+        $result =array(
+            'status' => 200,
+            'list' => $list
+        );
+        echo json_encode($result);die;
+    }
+
+
+    //结算
 	function Settlementlq(Req $req){
 		$jsurl = config('sconstant.url');//结算请求域名地址
 		$match_id = $req->match_id;
@@ -273,6 +290,27 @@ class SportsbkController extends Controller {
 		$newapp = new \App\Models\Stlqresult();
 		$newapp->updatestatus('match_id',$match_id,['status'=>2]);//修改结果状态
 
+        //添加赛事结果比较记录
+        $lastLog = \App\Models\Stlqresultlog::where([
+            ['match_id', $match_id],
+            ['type', 2]
+        ])->orderBy('id', 'desc')->first();
+
+        if(empty($lastLog) || !(
+                $lastLog['guest_score'] == $model->guest_score
+                && $lastLog['home_score'] == $model->home_score
+            )){
+            $logData = [
+                'guest_score' => $model->guest_score,
+                'home_score' => $model->home_score,
+                'type' => 2,
+                'match_id' => $match_id,
+                'user_id' => session('adminInfo.admin_id'),
+                'create_at' => now()
+            ];
+            \App\Models\Stlqresultlog::insert($logData);
+        }
+
 		return responseToJson(1); 
 	}
 

+ 2 - 2
app/Http/Controllers/Admin/SportsbqController.php

@@ -199,7 +199,7 @@ class SportsbqController extends Controller {
     function resultLog(Req $req){
         $match_id = $req->match_id;
         $list = \App\Models\Stbqresultlog::leftJoin('system_user', 'user_id', '=', 'system_user.id')
-            ->select('st_bq_result_log.*', 'system_user.loginname')->where('match_id', $match_id)->orderBy('id', 'desc')->get();
+            ->select('st_bq_result_log.*', 'system_user.loginname')->where('match_id', $match_id)->orderBy('id', 'asc')->get();
         foreach ($list as $key=>$value){
             $list[$key]['match_score_t'] = json_decode($value['match_score_t'], true);
         }
@@ -311,7 +311,7 @@ class SportsbqController extends Controller {
         $lastLog = \App\Models\Stbqresultlog::where([
             ['match_id', $match_id],
             ['type', 2]
-        ])->orderBy('id', 'asc')->first();
+        ])->orderBy('id', 'desc')->first();
 
         if(empty($lastLog) || !(
             $lastLog['u_home_score'] == $data['u_home_score']

+ 1 - 1
app/Http/Controllers/Admin/SportswqController.php

@@ -211,7 +211,7 @@ class SportswqController extends Controller {
     function resultLog(Req $req){
         $match_id = $req->match_id;
         $list = \App\Models\Stwqresultlog::leftJoin('system_user', 'user_id', '=', 'system_user.id')
-            ->select('st_wq_result_log.*', 'system_user.loginname')->where('match_id', $match_id)->orderBy('id', 'desc')->get();
+            ->select('st_wq_result_log.*', 'system_user.loginname')->where('match_id', $match_id)->orderBy('id', 'asc')->get();
         foreach ($list as $key=>$value){
             $list[$key]['inning'] = json_decode($value['inning'], true);
         }

+ 5 - 1
app/Models/Comendnotice.php

@@ -25,7 +25,11 @@ class Comendnotice extends BaseModel
     {
         $data = $this->where(['match_id' => $match_id, 'game_code' => $type])->first();
         if (!$data) {
-            $res = $this->insert(['game_code' => $type, 'status' => 0, 'pcount' => $pcount, 'game_start_time' => $game_start_time, 'match_id' => $match_id, 'ctime' => date('Y-m-d H:i:s')]);
+            $insertArr = ['game_code' => $type, 'status' => 0, 'pcount' => $pcount, 'match_id' => $match_id, 'ctime' => date('Y-m-d H:i:s')];
+            if($game_start_time){
+                $insertArr['game_start_time'] = $game_start_time;
+            }
+            $res = $this->insert($insertArr);
             if (!$res) {
                 return -6030001222;
             }

+ 78 - 0
resources/views/admin/sportsbk/outcome.blade.php

@@ -170,6 +170,7 @@
         @{{#if(d.status==4){ }}
         <span><li class="layui-btn layui-btn-sm  layui-btn-danger" onclick="lqrevoke(@{{d.match_id}})">已作废</li></span>
         @{{#} }}
+        <button onclick="resultLog(@{{d.match_id}})" class="layui-btn layui-btn-sm layui-btn-green set">赛事结果比分记录</button>
     </script>
     
     <script type="text/html" id="sectionone_two">
@@ -305,6 +306,26 @@
             </div>
     </div>
 
+    <style>
+
+        .log_title{
+
+        }
+
+        .log_head_div{
+            font-size: 17px;
+            margin-bottom: 5px;
+        }
+        .log_content_div td{
+            padding: 10px;
+            border: 1px solid #888888;
+        }
+
+        hr{
+            margin: 14px 0;
+        }
+    </style>
+
 	<script type="text/javascript">
         $(function () {
             $('body').on('click', 'a[eventtype="event-delete"]', function () {
@@ -525,6 +546,63 @@
             })
         }
 
+        //layer弹窗开始
+        let resultLogOpen = '';
+        function resultLog(match_id){
+            $.ajax({
+                type: 'POST',
+                dataType: 'json',
+                url: '/admin/Sportsbk/resultLog',
+                data: {match_id:match_id},
+                success: function(data) {
+                    let length = data.list.length;
+                    if(length <= 0){
+                        layer.alert('该赛事还没有赛事结果比分记录');
+                        return false;
+                    }
+
+                    let html = '';
+                    let info = '';
+                    for(let i=0; i<length; i++){
+                        info = data['list'][i];
+                        if(info.type == 2){ //比分
+
+                            html +='<div style="margin-left: 20px;"><div class="log_head_div"><span class="log_title">修改人</span>:'+info['loginname']+'&nbsp;&nbsp;&nbsp;<span class="log_title">添加时间:</span>'+info['create_at']+'&nbsp;&nbsp;&nbsp;<span class="log_title">添加类型</span>:赛事结果</div>'
+                                +'<div class="log_content_div"><table><tr>' +
+                                '<td>第一节比分(主/客)</td>' +
+                                '<td>第二节比分(主/客)</td>' +
+                                '<td>第三节比分(主/客)</td>' +
+                                '<td>第四节比分(主/客)</td>' +
+                                '</tr><tr>' +
+                                '<td>'+info['home_score'][1]+'&nbsp;/&nbsp;'+info['guest_score'][1]+'</td>' +
+                                '<td>'+info['home_score'][2]+'&nbsp;/&nbsp;'+info['guest_score'][2]+'</td>' +
+                                '<td>'+info['home_score'][3]+'&nbsp;/&nbsp;'+info['guest_score'][3]+'</td>' +
+                                '<td>'+info['home_score'][4]+'&nbsp;/&nbsp;'+info['guest_score'][4]+'</td>' +
+                                '</tr></table></div></div><hr>';
+                        }else{ //结果
+
+                        }
+                    }
+
+                    html += '<br><div style="margin:0px auto 10px;width: 112px;"><button class="layui-btn layui-btn-sm layui-btn-green set" id="buttonClick" onclick="rlClick()"><h3>确定</h3></button>&nbsp;<button onclick="rlClick()" class="layui-btn layui-btn-sm layui-btn-danger" id="reset"><h3>取消</h3></button></div></div>';
+
+                    resultLogOpen = layer.open({
+                        type: 1 //Page层类型
+                        ,area: ['640px', '500px']
+                        ,title: '<h2>赛事结果比分记录<h2>'
+                        ,shade: 0.6 //遮罩透明度
+                        ,maxmin: true //允许全屏最小化
+                        ,anim: 1 //0-6的动画形式,-1不开启
+                        ,content:html
+                    });
+                }
+            })
+        }
+
+        function rlClick() {
+            layer.close(resultLogOpen)
+        }
+
 	</script>
 @push('dataTableJS')
 /*var active = {

+ 2 - 0
resources/views/sports/base_odds_form.blade.php

@@ -96,6 +96,7 @@
     </form>
 
     <script>
+        /*
         function func(){
 
             alert(1);
@@ -111,6 +112,7 @@
                 parent.window.location.reload();
             },2500);
         }
+        */
     </script>
 
     <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>

+ 2 - 0
resources/views/sports/basket_odds_form.blade.php

@@ -96,6 +96,7 @@
     </form>
 
     <script>
+        /*
         function func(){
 
             alert(1);
@@ -111,6 +112,7 @@
                 parent.window.location.reload();
             },2500);
         }
+        */
     </script>
 
     <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>

+ 3 - 1
resources/views/sports/soccer_odds_form.blade.php

@@ -108,6 +108,7 @@
     </form>
 
     <script>
+        /*
         function func(){
 
             alert(1);
@@ -123,6 +124,7 @@
                 parent.window.location.reload();
             },2500);
         }
+        */
     </script>
 
     <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
@@ -139,7 +141,7 @@
                     url:'/admin/SportsSoccer/getoddscode',
                     data:{pcode:lgid},
                     dataType:'json',
-                    success:function(data){  //请求成功回调函数
+                    success:function(data){  //请求成功回调函数1
                         var option = '';
                         var dd = '';
                         option += '<option value></option>';

+ 2 - 0
resources/views/sports/tennis_odds_form.blade.php

@@ -96,6 +96,7 @@
     </form>
 
     <script>
+        /*
         function func(){
 
             alert(1);
@@ -111,6 +112,7 @@
                 parent.window.location.reload();
             },2500);
         }
+        */
     </script>
 
     <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>