彭俊 6 роки тому
батько
коміт
92b7712fea

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

@@ -255,9 +255,10 @@ class SoccerNoteListController extends Controller
     function moneycount()
     {
         $where = Request::has('where') ? Request::get('where') : '';
+        $type = Request::has('type') ? Request::get('type') : 'zq';
         $db = new \App\Models\SportsNoteList;
 
-        $data = $db->MoneyCount($where);
+        $data = $db->MoneyCount($where,$type);
         return responseToJson($data);
     }
 

+ 3 - 1
app/Lib/Settlement/SettlementWinFail.php

@@ -53,10 +53,12 @@ class SettlementWinFail
             if (!$ComendNoticModel) {
                 return  $this->makeData(1,'没有要处理的数据,直接退出');
             }
-            $this->writeStatusBegin($ComendNoticModel);
+
 
             DB::beginTransaction ();
 
+            $this->writeStatusBegin($ComendNoticModel);
+
             $allmatchs = DB::table('money_buy_match')->where(['game_code'=>$ComendNoticModel->game_code,'match_id'=>$ComendNoticModel->match_id,'result'=>0])->get();
              if (empty($allmatchs)) {
                 $this->writeStatusEndOk($ComendNoticModel);

+ 42 - 8
app/Models/SportsBase.php

@@ -13,6 +13,41 @@ class SportsBase extends BaseModel {
 
     function getinfo($list = 10, $page, $where = '',$orwhere = '')
     {
+        $bqmatch = $this->get();
+        for($b=0;$b<count($bqmatch);$b++){
+            if($bqmatch[$b]->status == 0 || $bqmatch[$b]->status == 1){
+                if($bqmatch[$b]->match_date < date("Y-m-d",time()) && strtotime($bqmatch[$b]->match_time.' '.$bqmatch[$b]->match_time)+10800 < time()){
+                    \App\Models\SportsBase::where('match_id',$bqmatch[$b]->match_id)->update(['status'=>'2']);
+                    \App\Models\Stbqresultrecord::where('match_id',$bqmatch[$b]->match_id)->update(['status'=>'2']);
+                    $comendnotice = \App\Models\Comendnotice::where('match_id',$bqmatch[$b]->match_id)->first();
+                    if(empty($comendnotice)){
+                        $db = new \App\Models\Comendnotice();
+                        $db->status = 0;
+                        $db->game_code = 'bq';
+                        $db->match_id = $bqmatch[$b]->match_id;
+                        $db->done_time = date("Y-m-d h:i:s", time());
+                        $db->ctime = date("Y-m-d h:i:s", time());
+                        $db->save();
+                    }
+                }
+                if($bqmatch[$b]->match_date == date("Y-m-d",time()) && strtotime($bqmatch[$b]->match_date.' '.$bqmatch[$b]->match_time)+10800 < time()){
+                    \App\Models\SportsBase::where('match_id',$bqmatch[$b]->match_id)->update(['status'=>'2']);
+                    \App\Models\Stbqresultrecord::where('match_id',$bqmatch[$b]->match_id)->update(['status'=>'2']);
+                    $comendnotice = \App\Models\Comendnotice::where('match_id',$bqmatch[$b]->match_id)->first();
+                    if(empty($comendnotice)){
+                        $db = new \App\Models\Comendnotice();
+                        $db->status = 0;
+                        $db->game_code = 'bq';
+                        $db->match_id = $bqmatch[$b]->match_id;
+                        $db->done_time = date("Y-m-d h:i:s", time());
+                        $db->ctime = date("Y-m-d h:i:s", time());
+                        $db->save();
+                    }
+                }
+            }
+        }
+        
+        $where[] = array('st_bq_league.name_chinese','<>','');
 
 //        $source = \App\Models\Setinfo::where('id','1000')->first();
 //        if($source->infocontent != '混合数据'){
@@ -86,22 +121,21 @@ class SportsBase extends BaseModel {
             }
 
             //赛事结果状态
+            $data[$i]->result_status = -1;
+            $data[$i]->result_id = -1;
             if(!empty($result)){
                 for($j=0;$j<count($result);$j++){
                     if($data[$i]->match_id == $result[$j]->match_id){
                         $data[$i]->result_status = $result[$j]->status;
-                    }else{
-                        $data[$i]->result_status = null;
+                        $data[$i]->result_id = $result[$j]->id;
                     }
                 }
-            }else{
-                $data[$i]->result_status = null;
             }
-            if($data[$i]->result_status != null){
-                if($data[$i]->result_status == '0'){
-                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsBase/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsBase/dealwith/?id='.$result->id.'\');" style="background-color: #FF5722;"> 处理 </a>';
+            if($data[$i]->result_status != -1){
+                if($data[$i]->result_status == 0){
+                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsBase/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsBase/dealwith/?id='.$data[$i]->result_id.'\');" style="background-color: #FF5722;"> 处理 </a>';
                 }else{
-                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 已处理 </a>';
+                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已处理 </a>';
                 }
             }else{
                 $data[$i]->result = '<a class="layui-btn layui-btn-sm audit" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 处理 </a>';

+ 43 - 8
app/Models/SportsBasket.php

@@ -13,6 +13,42 @@ class SportsBasket extends BaseModel {
 
     function getinfo($list = 10, $page, $where = '',$orwhere = '')
     {
+        $lqmatch = $this->get();
+        for($b=0;$b<count($lqmatch);$b++){
+            if($lqmatch[$b]->status == 0 || $lqmatch[$b]->status == 1){
+                if($lqmatch[$b]->match_date < date("Y-m-d",time()) && strtotime($lqmatch[$b]->match_time.' '.$lqmatch[$b]->match_time)+4200 < time()){
+                    \App\Models\SportsBasket::where('id',$lqmatch[$b]->id)->update(['status'=>'2']);
+                    \App\Models\Stlqresultrecord::where('match_id',$lqmatch[$b]->match_id)->update(['status'=>'2']);
+                    $comendnotice = \App\Models\Comendnotice::where('match_id',$lqmatch[$b]->match_id)->first();
+                    if(empty($comendnotice)){
+                        $db = new \App\Models\Comendnotice();
+                        $db->status = 0;
+                        $db->game_code = 'lq';
+                        $db->match_id = $lqmatch[$b]->match_id;
+                        $db->done_time = date("Y-m-d h:i:s", time());
+                        $db->ctime = date("Y-m-d h:i:s", time());
+                        $db->save();
+                    }
+                }
+                if($lqmatch[$b]->match_date == date("Y-m-d",time()) && strtotime($lqmatch[$b]->match_date.' '.$lqmatch[$b]->match_time)+4200 < time()){
+                    \App\Models\SportsBasket::where('id',$lqmatch[$b]->id)->update(['status'=>'2']);
+                    \App\Models\Stlqresultrecord::where('match_id',$lqmatch[$b]->match_id)->update(['status'=>'2']);
+                    $comendnotice = \App\Models\Comendnotice::where('match_id',$lqmatch[$b]->match_id)->first();
+                    if(empty($comendnotice)){
+                        $db = new \App\Models\Comendnotice();
+                        $db->status = 0;
+                        $db->game_code = 'lq';
+                        $db->match_id = $lqmatch[$b]->match_id;
+                        $db->done_time = date("Y-m-d h:i:s", time());
+                        $db->ctime = date("Y-m-d h:i:s", time());
+                        $db->save();
+                    }
+                }
+            }
+        }
+
+        $where[] = array('st_lq_league.name_chinese','<>','');
+
 //        $source = \App\Models\Setinfo::where('id','1000')->first();
 //        if($source->infocontent != '混合数据'){
 //            $where[] = array('st_lq_local_match.source', '=', $source->infocontent);
@@ -85,22 +121,21 @@ class SportsBasket extends BaseModel {
             }
 
             //赛事结果状态
+            $data[$i]->result_status = -1;
+            $data[$i]->result_id = -1;
             if(!empty($result)){
                 for($j=0;$j<count($result);$j++){
                     if($data[$i]->match_id == $result[$j]->match_id){
                         $data[$i]->result_status = $result[$j]->status;
-                    }else{
-                        $data[$i]->result_status = null;
+                        $data[$i]->result_id = $result[$j]->id;
                     }
                 }
-            }else{
-                $data[$i]->result_status = null;
             }
-            if($data[$i]->result_status != null){
-                if($data[$i]->result_status == '0'){
-                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsBasket/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsBasket/dealwith/?id='.$result->id.'\');" style="background-color: #FF5722;"> 处理 </a>';
+            if($data[$i]->result_status != -1){
+                if($data[$i]->result_status == 0){
+                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsBasket/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsBasket/dealwith/?id='.$data[$i]->result_id.'\');" style="background-color: #FF5722;"> 处理 </a>';
                 }else{
-                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 已处理 </a>';
+                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已处理 </a>';
                 }
             }else{
                 $data[$i]->result = '<a class="layui-btn layui-btn-sm audit" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 处理 </a>';

+ 89 - 27
app/Models/SportsNoteList.php

@@ -28,6 +28,10 @@ class SportsNoteList extends BaseModel {
         //反水
         $water_return_money = \App\Models\Money_details::where('trade_type','7')->get();
 
+        //订单投注的玩法
+        $content = \App\Models\MoneyBuyMatch::where('bet_type','1')->get();
+
+
         for($i=0;$i<count($data);$i++){
             if($data[$i]->settle_status==1){
                 $data[$i]->settle_status = '未结算';
@@ -51,35 +55,62 @@ class SportsNoteList extends BaseModel {
             $data[$i]->money_match_time = '投注:'.$data[$i]->money_time.'<br>'.$data[$i]->match_time;
 
             //反水
-            $data[$i]->water_return = '0';
-//            for($a=0;$a<count($water_return_money);$a++){
-//                if($data[$i]->order_id == $water_return_money[$a]->trade_id){
-//                    $data[$i]->water_return = $water_return_money[$a]->money;
-//                    //用户投注后账户金额
-//                    $data[$i]->frozen_cash = $water_return_money[$a]->money_cash;
-//                }
-//            }
-//            if($data[$i]->water_return == '0'){
-//                $data[$i]->frozen_cash = $data[$i]->money_cash;
-//            }
-
-            $water_return_money = \App\Models\Money_details::where('trade_id',$data[$i]->order_id)->where('trade_type','7')->first();
-            if(!empty($water_return_money)){
-                $data[$i]->water_return = $water_return_money->money;
-                //用户投注后账户金额
-                $data[$i]->frozen_cash = $water_return_money->money_cash;
-            }else{
+            $data[$i]->water_return = -1;
+            for($a=0;$a<count($water_return_money);$a++){
+                if($data[$i]->order_id == $water_return_money[$a]->trade_id){
+                    $data[$i]->water_return = $water_return_money[$a]->money;
+                    //用户投注后账户金额
+                    $data[$i]->frozen_cash = $water_return_money[$a]->money_cash;
+                }
+            }
+            if($data[$i]->water_return == -1){
+                $data[$i]->water_return == 0;
                 //用户投注后账户金额
                 $data[$i]->frozen_cash = $data[$i]->money_cash;
             }
-            $data[$i]->result = $data[$i]->water_return+$data[$i]->gain_money;
 
+//            $water_return_money = \App\Models\Money_details::where('trade_id',$data[$i]->order_id)->where('trade_type','7')->first();
+//            if(!empty($water_return_money)){
+//                $data[$i]->water_return = $water_return_money->money;
+//                //用户投注后账户金额
+//                $data[$i]->frozen_cash = $water_return_money->money_cash;
+//            }else{
+//                //用户投注后账户金额
+//                $data[$i]->frozen_cash = $data[$i]->money_cash;
+//            }
+
+            $data[$i]->result = $data[$i]->water_return+$data[$i]->gain_money;
 
             //用户投注前账户金额
             $data[$i]->available_cash = $data[$i]->money_cash;
 
             $data[$i]->account = $data[$i]->available_cash.'<br><span>'.$data[$i]->account_name.'</span><br>'.$data[$i]->frozen_cash;
 
+//            $data[$i]->str = 0;
+//            for($b=0;$b<count($content);$b++){
+//                if($data[$i]->match_id == $content[$b]->match_id && $data[$i]->batch_id == $content[$b]->batch_id){
+//                    if($content[$b]->result == '0'){
+//                        $data[$i]->str = 1;
+//                    }else{
+//                        if($data[$i]->game_status == '未处理'){
+//                            $data[$i]->str = 2;
+//                        }else{
+//                            $data[$i]->str = 3;
+//                        }
+//                    }
+//                }
+//            }
+//            if($data[$i]->str == 1){
+//                $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm audit" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 结算 </a>';
+//            }
+//            if($data[$i]->str == 2){
+//                $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm settlement" lay-event="detail" pid="id" uri="/admin/SoccerNoteList/settlement/?id=" href="javascript:settlement(\'/admin/SoccerNoteList/settlement/?id='.$data[$i]->id.'\');"> 结算 </a>';
+//            }
+//            if($data[$i]->str == 3){
+//                $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm resettlement" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已结算 </a>';
+//            }
+
+
             $content = \App\Models\MoneyBuyMatch::where('batch_id',$data[$i]->batch_id)->where('match_id',$data[$i]->match_id)->where('bet_type','1')->get();
             if($content[0]->result == '0'){
                 $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm audit" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 结算 </a>';
@@ -100,7 +131,7 @@ class SportsNoteList extends BaseModel {
                 }else{
                     $odds_name = $odds_code;
                 }
-                $data[$i]->content = $data[$i]->content.$odds_name.  '¥'.$content[$j]->bet_money.'@'.$content[$j]->odds.'<br>';
+                $data[$i]->content = $data[$i]->content.$odds_name.$content[$j]->condition.' ¥'.$content[$j]->bet_money.'@'.$content[$j]->odds.'<br>';
 
             }
 
@@ -110,15 +141,46 @@ class SportsNoteList extends BaseModel {
     }
 
     //投注金额汇总统计
-    function MoneyCount($where = '') {
+    function MoneyCount($where = '',$type) {
         $data = array();
-        $data['all_money'] = $this->sum('money');
-        $data['all_prize_money'] = $this->sum('prize_money');
-        $data['alraedy_prize_money'] = $this->where('settle_status','2')->sum('gain_money');
+//        $data['all_money'] = $this->sum('money');
+//        $data['all_prize_money'] = $this->sum('prize_money');
+//        $data['alraedy_prize_money'] = $this->where('settle_status','2')->sum('gain_money');
+        $data['all_money'] = 0;
+        $data['all_prize_money'] = 0;
+        $data['alraedy_prize_money'] = 0;
+        $all_money = $this->join('money_details','money_details.info_identity','=','money_buy_simplex.info_identity')->join('st_'.$type.'_competition','st_'.$type.'_competition.match_id','=','money_buy_simplex.match_id')->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.lg_id')->select('money_buy_simplex.money','money_buy_simplex.prize_money','money_buy_simplex.gain_money')->get();
+        for($a=0;$a<count($all_money);$a++){
+            $data['all_money'] = $data['all_money']+$all_money[$a]->money;
+        }
+        $all_prize_money = $this->join('money_details','money_details.info_identity','=','money_buy_simplex.info_identity')->join('st_'.$type.'_competition','st_'.$type.'_competition.match_id','=','money_buy_simplex.match_id')->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.lg_id')->select('money_buy_simplex.money','money_buy_simplex.prize_money','money_buy_simplex.gain_money')->get();
+        for($a=0;$a<count($all_prize_money);$a++){
+            $data['all_prize_money'] = $data['all_money']+$all_prize_money[$a]->prize_money;
+        }
+        $alraedy_prize_money = $this->join('money_details','money_details.info_identity','=','money_buy_simplex.info_identity')->join('st_'.$type.'_competition','st_'.$type.'_competition.match_id','=','money_buy_simplex.match_id')->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.lg_id')->select('money_buy_simplex.money','money_buy_simplex.prize_money','money_buy_simplex.gain_money')->where('money_buy_simplex.settle_status','2')->get();
+        for($a=0;$a<count($alraedy_prize_money);$a++){
+            $data['alraedy_prize_money'] = $data['all_money']+$alraedy_prize_money[$a]->gain_money;
+        }
+
         if (!empty($where) && is_array($where)) {
-            $data['all_money'] = $this->where($where)->sum('money');
-            $data['all_prize_money'] = $this->where($where)->sum('prize_money');
-            $data['alraedy_prize_money'] = $this->where($where)->where('settle_status','2')->sum('gain_money');
+            $data['all_money'] = 0;
+            $data['all_prize_money'] = 0;
+            $data['alraedy_prize_money'] = 0;
+            //$data['all_money'] = $this->where($where)->sum('money');
+//            $data['all_prize_money'] = $this->where($where)->sum('prize_money');
+//            $data['alraedy_prize_money'] = $this->where($where)->where('settle_status','2')->sum('gain_money');
+            $all_money = $this->join('money_details','money_details.info_identity','=','money_buy_simplex.info_identity')->join('st_zq_competition','st_zq_competition.match_id','=','money_buy_simplex.match_id')->join('st_zq_league','st_zq_competition.lg_id','=','st_zq_league.lg_id')->select('money_buy_simplex.money','money_buy_simplex.prize_money','money_buy_simplex.gain_money')->where($where)->get();
+            for($a=0;$a<count($all_money);$a++){
+                $data['all_money'] = $data['all_money']+$all_money[$a]->money;
+            }
+            $all_prize_money = $this->join('money_details','money_details.info_identity','=','money_buy_simplex.info_identity')->join('st_'.$type.'_competition','st_'.$type.'_competition.match_id','=','money_buy_simplex.match_id')->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.lg_id')->select('money_buy_simplex.money','money_buy_simplex.prize_money','money_buy_simplex.gain_money')->where($where)->get();
+            for($a=0;$a<count($all_prize_money);$a++){
+                $data['all_prize_money'] = $data['all_prize_money']+$all_prize_money[$a]->prize_money;
+            }
+            $alraedy_prize_money = $this->join('money_details','money_details.info_identity','=','money_buy_simplex.info_identity')->join('st_'.$type.'_competition','st_'.$type.'_competition.match_id','=','money_buy_simplex.match_id')->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.lg_id')->select('money_buy_simplex.money','money_buy_simplex.prize_money','money_buy_simplex.gain_money')->where('money_buy_simplex.settle_status','2')->where($where)->get();
+            for($a=0;$a<count($alraedy_prize_money);$a++){
+                $data['alraedy_prize_money'] = $data['alraedy_prize_money']+$alraedy_prize_money[$a]->gain_money;
+            }
         }
 
         return $data;

+ 50 - 26
app/Models/SportsSoccer.php

@@ -13,6 +13,42 @@ class SportsSoccer extends BaseModel {
 
     function getinfo($list = 10, $page, $where = '',$orwhere = '')
     {
+        $zqmatch = $this->get();
+        for($b=0;$b<count($zqmatch);$b++){
+            if($zqmatch[$b]->status == 0 || $zqmatch[$b]->status == 1){
+                if($zqmatch[$b]->match_date < date("Y-m-d",time()) && strtotime($zqmatch[$b]->match_time.' '.$zqmatch[$b]->match_time)+7200 < time()){
+                    \App\Models\SportsSoccer::where('id',$zqmatch[$b]->id)->update(['status'=>'2']);
+                    \App\Models\Stzqresultrecord::where('match_id',$zqmatch[$b]->match_id)->update(['status'=>'2']);
+                    $comendnotice = \App\Models\Comendnotice::where('match_id',$zqmatch[$b]->match_id)->first();
+                    if(empty($comendnotice)){
+                        $db = new \App\Models\Comendnotice();
+                        $db->status = 0;
+                        $db->game_code = 'zq';
+                        $db->match_id = $zqmatch[$b]->match_id;
+                        $db->done_time = date("Y-m-d h:i:s", time());
+                        $db->ctime = date("Y-m-d h:i:s", time());
+                        $db->save();
+                    }
+                }
+                if($zqmatch[$b]->match_date == date("Y-m-d",time()) && strtotime($zqmatch[$b]->match_date.' '.$zqmatch[$b]->match_time)+7200 < time()){
+                    \App\Models\SportsSoccer::where('id',$zqmatch[$b]->id)->update(['status'=>'2']);
+                    \App\Models\Stzqresultrecord::where('match_id',$zqmatch[$b]->match_id)->update(['status'=>'2']);
+                    $comendnotice = \App\Models\Comendnotice::where('match_id',$zqmatch[$b]->match_id)->first();
+                    if(empty($comendnotice)){
+                        $db = new \App\Models\Comendnotice();
+                        $db->status = 0;
+                        $db->game_code = 'zq';
+                        $db->match_id = $zqmatch[$b]->match_id;
+                        $db->done_time = date("Y-m-d h:i:s", time());
+                        $db->ctime = date("Y-m-d h:i:s", time());
+                        $db->save();
+                    }
+                }
+            }
+        }
+        
+        $where[] = array('st_zq_league.name_chinese','<>','');
+
 //        $source = \App\Models\Setinfo::where('id','1000')->first();
 //        if($source->infocontent != '混合数据'){
 //            $where[] = array('st_zq_local_match.source', '=', $source->infocontent);
@@ -70,7 +106,7 @@ class SportsSoccer extends BaseModel {
                 $data[$i]->match_date = $datetime[0];
                 $data[$i]->match_time = $datetime[1];
             }
-
+            
             if($data[$i]->status==0){
                 $data[$i]->status = '未开始';
             }else if($data[$i]->status==1){
@@ -85,38 +121,26 @@ class SportsSoccer extends BaseModel {
                 $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
             }
 
-            $result = \App\Models\Comendnotice::where('game_code','zq')->where('match_id',$data[$i]->match_id)->first();
+            //赛事结果状态
+            $data[$i]->result_status = -1;
+            $data[$i]->result_id = -1;
             if(!empty($result)){
-                if($result->status == '0'){
-                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsSoccer/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsSoccer/dealwith/?id='.$result->id.'\');" style="background-color: #FF5722;"> 处理 </a>';
+                for($j=0;$j<count($result);$j++){
+                    if($data[$i]->match_id == $result[$j]->match_id){
+                        $data[$i]->result_status = $result[$j]->status;
+                        $data[$i]->result_id = $result[$j]->id;
+                    }
+                }
+            }
+            if($data[$i]->result_status != -1){
+                if($data[$i]->result_status == 0){
+                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsSoccer/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsSoccer/dealwith/?id='.$data[$i]->result_id.'\');" style="background-color: #FF5722;"> 处理 </a>';
                 }else{
                     $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已处理 </a>';
                 }
             }else{
                 $data[$i]->result = '<a class="layui-btn layui-btn-sm audit" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 处理 </a>';
             }
-
-            //赛事结果状态
-//            if(!empty($result)){
-//                for($j=0;$j<count($result);$j++){
-//                    if($data[$i]->match_id == $result[$j]->match_id){
-//                        $data[$i]->result_status = $result[$j]->status;
-//                    }else{
-//                        $data[$i]->result_status = null;
-//                    }
-//                }
-//            }else{
-//                $data[$i]->result_status = null;
-//            }
-//            if($data[$i]->result_status != null){
-//                if($data[$i]->result_status == '0'){
-//                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsSoccer/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsSoccer/dealwith/?id='.$result->id.'\');" style="background-color: #FF5722;"> 处理 </a>';
-//                }else{
-//                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 已处理 </a>';
-//                }
-//            }else{
-//                $data[$i]->result = '<a class="layui-btn layui-btn-sm audit" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 处理 </a>';
-//            }
         }
         return $data->toArray();
     }

+ 43 - 8
app/Models/SportsTennis.php

@@ -13,6 +13,42 @@ class SportsTennis extends BaseModel {
 
     function getinfo($list = 10, $page, $where = '',$orwhere = '')
     {
+        $wqmatch = $this->get();
+        for($b=0;$b<count($wqmatch);$b++){
+            if($wqmatch[$b]->status == 0 || $wqmatch[$b]->status == 1){
+                if($wqmatch[$b]->match_date < date("Y-m-d",time()) && strtotime($wqmatch[$b]->match_time.' '.$wqmatch[$b]->match_time)+10800 < time()){
+                    \App\Models\SportsTennis::where('match_id',$wqmatch[$b]->match_id)->update(['status'=>'2']);
+                    \App\Models\Stwqresultrecord::where('match_id',$wqmatch[$b]->match_id)->update(['status'=>'2']);
+                    $comendnotice = \App\Models\Comendnotice::where('match_id',$wqmatch[$b]->match_id)->first();
+                    if(empty($comendnotice)){
+                        $db = new \App\Models\Comendnotice();
+                        $db->status = 0;
+                        $db->game_code = 'wq';
+                        $db->match_id = $wqmatch[$b]->match_id;
+                        $db->done_time = date("Y-m-d h:i:s", time());
+                        $db->ctime = date("Y-m-d h:i:s", time());
+                        $db->save();
+                    }
+                }
+                if($wqmatch[$b]->match_date == date("Y-m-d",time()) && strtotime($wqmatch[$b]->match_date.' '.$wqmatch[$b]->match_time)+10800 < time()){
+                    \App\Models\SportsTennis::where('match_id',$wqmatch[$b]->match_id)->update(['status'=>'2']);
+                    \App\Models\Stwqresultrecord::where('match_id',$wqmatch[$b]->match_id)->update(['status'=>'2']);
+                    $comendnotice = \App\Models\Comendnotice::where('match_id',$wqmatch[$b]->match_id)->first();
+                    if(empty($comendnotice)){
+                        $db = new \App\Models\Comendnotice();
+                        $db->status = 0;
+                        $db->game_code = 'wq';
+                        $db->match_id = $wqmatch[$b]->match_id;
+                        $db->done_time = date("Y-m-d h:i:s", time());
+                        $db->ctime = date("Y-m-d h:i:s", time());
+                        $db->save();
+                    }
+                }
+            }
+        }
+        
+        $where[] = array('st_wq_league.name_chinese','<>','');
+
 //        $source = \App\Models\Setinfo::where('id','1000')->first();
 //        if($source->infocontent != '混合数据'){
 //            $where[] = array('st_wq_local_match.source', '=', $source->infocontent);
@@ -85,22 +121,21 @@ class SportsTennis extends BaseModel {
             }
 
             //赛事结果状态
+            $data[$i]->result_status = -1;
+            $data[$i]->result_id = -1;
             if(!empty($result)){
                 for($j=0;$j<count($result);$j++){
                     if($data[$i]->match_id == $result[$j]->match_id){
                         $data[$i]->result_status = $result[$j]->status;
-                    }else{
-                        $data[$i]->result_status = null;
+                        $data[$i]->result_id = $result[$j]->id;
                     }
                 }
-            }else{
-                $data[$i]->result_status = null;
             }
-            if($data[$i]->result_status != null){
-                if($data[$i]->result_status == '0'){
-                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsTennis/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsTennis/dealwith/?id='.$result->id.'\');" style="background-color: #FF5722;"> 处理 </a>';
+            if($data[$i]->result_status != -1){
+                if($data[$i]->result_status == 0){
+                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="/admin/SportsTennis/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsTennis/dealwith/?id='.$data[$i]->result_id.'\');" style="background-color: #FF5722;"> 处理 </a>';
                 }else{
-                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 已处理 </a>';
+                    $data[$i]->result = '<a class="layui-btn layui-btn-sm dealwith" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已处理 </a>';
                 }
             }else{
                 $data[$i]->result = '<a class="layui-btn layui-btn-sm audit" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 处理 </a>';

+ 15 - 0
app/Models/Stbqresultrecord.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Stbqresultrecord extends Model
+{
+    protected $table = 'st_zq_result_record';
+    public $timestamps = false;
+
+
+}
+
+?>

+ 15 - 0
app/Models/Stlqresultrecord.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Stlqresultrecord extends Model
+{
+    protected $table = 'st_zq_result_record';
+    public $timestamps = false;
+
+
+}
+
+?>

+ 15 - 0
app/Models/Stwqresultrecord.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Stwqresultrecord extends Model
+{
+    protected $table = 'st_zq_result_record';
+    public $timestamps = false;
+
+
+}
+
+?>

+ 15 - 0
app/Models/Stzqresultrecord.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Stzqresultrecord extends Model
+{
+    protected $table = 'st_zq_result_record';
+    public $timestamps = false;
+
+
+}
+
+?>