Pārlūkot izejas kodu

追加推送 5/23

彭俊 6 gadi atpakaļ
vecāks
revīzija
fec81d2265

+ 10 - 5
app/Http/Controllers/Admin/BaseSetController.php

@@ -44,6 +44,7 @@ class BaseSetController extends SystemController {
         $info = $db->getInfo(1024); //分享注册页面信息设置
         $startup = $db->getInfo(1111); //启动页设置设置
         $fsnum = $db->getInfo(1001); //启动页设置设置
+        $stsource = $db->getInfo(1002); //启动页设置设置
         $wsport = $db->getInfo(9501);//websocket聊天服务器ip 端口设置
         $jnd = $db->getInfo(40);//加拿大28维护
         $playtest = $db->getInfo(2000);//试玩账号设置
@@ -56,6 +57,10 @@ class BaseSetController extends SystemController {
         $updateOdds = $db->getInfo(1911);//是否更新赔率
         $updateTime = $db->getInfo(1912);//缓存更新时间
         $paymentCate = $db->getInfo(20060);//充值排序设置
+        $source = \App\Models\Stzqlocalleague::select('source')->groupby('source')->get()->toArray();//体育比分数据源设置
+        if(count($source)>1){
+            $source[] = Array("source" => "混合数据");
+        }
         if (!empty($jnd['extinfo'])) {
             $jnd['extinfo'] = explode('~', $jnd['extinfo']);
         }
@@ -75,10 +80,10 @@ class BaseSetController extends SystemController {
             'agent' => $agent, 'plat' => $plat, 'game' => $game, 'run' => $run, 'two' => $two,
             'url' => $url, 'reg' => $reg, 'add_token' => $add_token, 'agent_box' => $agent_box,
             'quickUl' => $quickUrl, 'ip' => $ipLimit, 'net' => $net, 'agentUrl' => $agentUrl,
-            'extension' => $extension,'fsnum'=>$fsnum, 'open' => $open, 'nagentFxUrl' => $nagentFxUrl, 'regInfo' => $info,
+            'extension' => $extension,'fsnum'=>$fsnum,'stsource'=>$stsource, 'open' => $open, 'nagentFxUrl' => $nagentFxUrl, 'regInfo' => $info,
             'startup' => $startup, 'wsport' => $wsport, 'jnd' => $jnd, 'playtest' => $playtest,
             'oggame' => $oggame, 'liao' => $liao, 'word' => $word, 'imglink' => $imglink, 'H5ShareLink' => $H5ShareLink,
-            'tokentime' => $tokentime, 'updateOdds' => $updateOdds, 'updateTime' => $updateTime,'paymentCate'=>$paymentCate]);
+            'tokentime' => $tokentime, 'updateOdds' => $updateOdds, 'updateTime' => $updateTime,'paymentCate'=>$paymentCate,'source'=>$source]);
     }
 
     function info() {
@@ -189,12 +194,12 @@ class BaseSetController extends SystemController {
                         $res = $db->addInfo($keywordsdata);
                         $res = $db->addInfo($descdata);
                     }else{*/
-	
+
 				//showhome //前台默认模板
 				$showhome = $netdata;
 				$showhome['infocontent'] = $data['showhome'];
 				$showhome['remarks'] = 'showhome';
-				
+
                 $res = $db->checkdata($quicklypay, $data['quicklypayid']);
                 $res = $db->checkdata($appdownload, $data['appdownloadid']);
                 $res = $db->checkdata($logourl, $data['logourlid']);
@@ -205,7 +210,7 @@ class BaseSetController extends SystemController {
                 $res = $db->checkdata($descdata, $data['netdescid']);
                 $res = $db->checkdata($realperson, $data['realpersonid']); //真人网址
                 $res = $db->checkdata($showhome, $data['showhomeid']);
-	
+
 
                 /*}*/
             } else if ($type == 33) {

+ 5 - 0
app/Http/Controllers/Admin/LoginController.php

@@ -12,6 +12,11 @@ class LoginController extends Controller {
 
     function _init(){
 
+    }
+
+    function aa() {
+        $zqRuleModel = new \App\Lib\Settlement\SettlementOrder;
+        $zqRuleModel -> ChuanOrder('20190507134301713489765');
     }
 
 	function index(Request $req) {

+ 14 - 9
app/Http/Controllers/Admin/MatchcodeController.php

@@ -15,14 +15,15 @@ class MatchcodeController extends Controller {
 
 	function index(Req $req) {
 		$request=array();
-		$request['game_type'] = isset($req->game_type) ? trim($req->game_type) : null;
+		$request['odds_code'] = isset($req->odds_code) ? trim($req->odds_code) : null;
 		$request['sureblurs'] = isset($req->sureblurs) ? $req->sureblurs : 'on';
+		$request['game_code'] = isset($req->game_code) ? trim($req->game_code) : -1;
 
 		$dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/matchcode/info');
         $dt->setLang('matchcode');
         $dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
-        $dt->addColsFields('game_type', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
+        $dt->addColsFields('game_code', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
         $dt->addColsFields('odds_code', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('odds_name', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('p_id', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
@@ -40,17 +41,21 @@ class MatchcodeController extends Controller {
 	function info(){
 		$page = Request::has('page') ? Request::get('page') : '';
 		$list = Request::has('limit') ? Request::get('limit') : 10;
-		$game_type = Request::has('game_type') ? Request::get('game_type') : '';
+		$odds_code = Request::has('odds_code') ? Request::get('odds_code') : '';
 		$sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
+		$game_code = Request::has('game_code') ? Request::get('game_code') : '';
 
 		$where = array();
-		if (!empty($game_type)) {
+		if (!empty($odds_code)) {
 			if (empty($sureblur) || $sureblur == 'off') {
-				$where[] = array('game_type', 'like', '%' . $game_type . '%');
+				$where[] = array('odds_code', 'like', '%' . $odds_code . '%');
 			} else {
-				$where[] = array('game_type', '=', $game_type);
+				$where[] = array('odds_code', '=', $odds_code);
 			}
 		}
+		if (!empty($game_code)) {
+			$where[] = array('game_code', '=', $game_code);
+		}
 		$newapp = new \App\Models\Matchcode();
         $data = $newapp->matchcodelist($list, $page, $where);
         
@@ -66,10 +71,10 @@ class MatchcodeController extends Controller {
 			return view('admin.matchcode/addmatchcode',['data'=>$djid]);
 		} else {
 			$model = new \App\Models\Matchcode();
-			$model->game_type = trim($req->input('game_type'));
 			$model->odds_code = trim($req->input('odds_code'));
 			$model->odds_name = trim($req->input('odds_name'));
-			$model->p_id = trim($req->input('p_id'))?trim($req->input('p_id')):0;
+			$model->game_code = trim($req->input('game_code'));
+			$model->p_id = trim($req->input('p_id'));
 			$model->type = 1;
 
 			$model->save();
@@ -96,9 +101,9 @@ class MatchcodeController extends Controller {
 			return view('admin.matchcode/edit', ['data' => $data, 'djid' => $djid]);
 		} else {
 			$model = \App\Models\Matchcode::where('id', $id)->first();
-			$model->game_type = $req->input('game_type');
 			$model->odds_code = $req->input('odds_code');
 			$model->odds_name = $req->input('odds_name');
+			$model->game_code = $req->input('game_code');
 			$model->p_id = $req->input('p_id');
 			
 			$model->save();

+ 5 - 5
app/Http/Controllers/Admin/SoccerNoteListController.php

@@ -113,7 +113,7 @@ class SoccerNoteListController extends Controller
         if (intval($id) < 1) {
             return -1;
         }
-        $order = DB::table('money_buy_simplex')->where('id', $id)->first();
+        $order = \App\Models\SportsNoteList::where('id', $id)->first();
         $order_ids = array($order->order_id);
         //return $order_ids;
         $SettlementOrder = new SettlementOrder();
@@ -131,7 +131,7 @@ class SoccerNoteListController extends Controller
         if (intval($id) < 1) {
             return -1;
         }
-        $order = DB::table('money_buy_simplex')->where('id',$id)->first();
+        $order = \App\Models\SportsNoteList::where('id',$id)->first();
         $order_ids = array($order->order_id);
         //return $order_ids;
         $SettlementOrder = new SettlementOrder();
@@ -140,7 +140,7 @@ class SoccerNoteListController extends Controller
         return $data;
 
         //获取此订单下包含的赛事玩法
-        $matchs = DB::table('money_buy_match')->where('batch_id',$order->batch_id)->where('match_id',$order->match_id)->where('bet_type','1')->get()->toArray();
+        $matchs = \App\Models\MoneyBuyMatch::where('batch_id',$order->batch_id)->where('match_id',$order->match_id)->where('bet_type','1')->get()->toArray();
         $win_money = 0;
 
         //减本金
@@ -202,10 +202,10 @@ class SoccerNoteListController extends Controller
      *单式注单批量结算
      */
     public function batchsettlement(){
-        $orders = DB::table('money_buy_simplex')->where('settle_status','1')->get();
+        $orders = \App\Models\SportsNoteList::where('settle_status','1')->get();
         $order_ids = array();
         for($i=0;$i<count($orders);$i++){
-            $result = DB::table('money_buy_match')->where('batch_id',$orders[$i]->batch_id)->where('match_id',$orders[$i]->match_id)->get();
+            $result = \App\Models\MoneyBuyMatch::where('batch_id',$orders[$i]->batch_id)->where('match_id',$orders[$i]->match_id)->get();
             $res = array();
             for($j=0;$j<count($result);$j++){
                 $res[] = $result[$j]->result;

+ 5 - 5
app/Http/Controllers/Admin/SoccerStringNoteListController.php

@@ -136,7 +136,7 @@ class SoccerStringNoteListController extends Controller
         if (intval($id) < 1) {
             return -1;
         }
-        $order = DB::table('money_buy_str')->where('id', $id)->first();
+        $order = \App\Models\MoneyBuyStr::where('id', $id)->first();
         $order_ids = array($order->order_id);
         //return $order_ids;
         $SettlementOrder = new SettlementOrder();
@@ -154,7 +154,7 @@ class SoccerStringNoteListController extends Controller
         if (intval($id) < 1) {
             return -1;
         }
-        $order = DB::table('money_buy_str')->where('id',$id)->first();
+        $order = \App\Models\MoneyBuyStr::where('id',$id)->first();
         $order_ids = array($order->order_id);
         //return $order_ids;
         $SettlementOrder = new SettlementOrder();
@@ -164,7 +164,7 @@ class SoccerStringNoteListController extends Controller
 
         $m = explode('串',$order->str_type);
         //获取此订单下包含的赛事
-        $matchs = DB::table('money_buy_match')->where('batch_id',$order->batch_id)->where('bet_type',2)->get()->toArray();
+        $matchs = \App\Models\MoneyBuyMatch::where('batch_id',$order->batch_id)->where('bet_type',2)->get()->toArray();
         function combination($a, $m) {
             $r = array();
             $n = count($a);
@@ -230,10 +230,10 @@ class SoccerStringNoteListController extends Controller
      */
     public function batchsettlement(){
         $bet_type = 2; //串关注单
-        $orders = DB::table('money_buy_str')->where('settle_status','1')->get();
+        $orders = \App\Models\MoneyBuyStr::where('settle_status','1')->get();
         $order_ids = array();
         for($i=0;$i<count($orders);$i++){
-            $result = DB::table('money_buy_match')->where('batch_id',$orders[$i]->batch_id)->get();
+            $result = \App\Models\MoneyBuyMatch::where('batch_id',$orders[$i]->batch_id)->get();
             $res = array();
             for($j=0;$j<count($result);$j++){
                 $res[] = $result[$j]->result;

+ 4 - 69
app/Http/Controllers/Admin/SportsBasketController.php

@@ -30,8 +30,6 @@ class SportsBasketController extends Controller {
 		$dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
 		$dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
 		$dt->addColsFields('home_guest', array('templet' => '#userdetail', 'sort' => false, 'width' => 260));
-//        $dt->addColsFields('home_team', array('templet' => '#userdetail', 'sort' => false, 'width' => 130));
-//        $dt->addColsFields('guest_team', array('templet' => '#userdetail', 'sort' => false, 'width' => 130));
 		$dt->addColsFields('match_date', array('templet' => '#userdetail', 'sort' => true, 'width' => 130));
 		$dt->addColsFields('match_time', array('templet' => '#userdetail', 'sort' => true, 'width' => 130));
 		$dt->addColsFields('recommend', array('templet' => '#recommend', 'sort' => false, 'width' => 120,'align' => 'center'));
@@ -75,76 +73,13 @@ class SportsBasketController extends Controller {
 				$orwhere[] = array('st_lq_competition.guest_team', '=', $home_team);
 			}
 		}
-//		if (!empty($match_date)) {
-////            $where[] = array('st_lq_competition.match_date', '=', '2019-04-13');
-//			$where[] = array('st_lq_competition.match_date', '=', $match_date);
-//		}
-//		if ($status != -1) {
-//			$where[] = array('st_lq_competition.status', '=', $status);
-//		}
-		if(!empty($match_date) && $status != -1){
-			if($match_date > date('Y-m-d',time())){
-				if ($status == 0) {
-					$where[] = array('st_lq_competition.match_date', '=', $match_date);
-				}
-				if ($status == 1) {
-					$where[] = array('st_lq_competition.match_date', '<', $match_date);
-					$where[] = array('st_lq_competition.match_date', '>', $match_date);
-				}
-				if ($status == 2) {
-					$where[] = array('st_lq_competition.match_date', '<', $match_date);
-					$where[] = array('st_lq_competition.match_date', '>', $match_date);
-				}
-			}
-			if($match_date == date('Y-m-d',time())){
-				if ($status == 0) {
-					$where[] = array('st_lq_competition.match_date', '=', $match_date);
-					$where[] = array('st_lq_competition.match_time', '>', date('H:i:s',time()));
-				}
-				if ($status == 1) {
-					$where[] = array('st_lq_competition.match_date', '=', $match_date);
-					$where[] = array('st_lq_competition.match_time', '<', date('H:i:s',time()));
-					$where[] = array('st_lq_competition.match_time', '>', date('H:i:s',time()-5400));
-				}
-				if ($status == 2) {
-					$where[] = array('st_lq_competition.match_date', '=', $match_date);
-					$where[] = array('st_lq_competition.match_time', '<', date('H:i:s',time()-5400));
-				}
-			}
-			if($match_date < date('Y-m-d',time())){
-				if ($status == 0) {
-					$where[] = array('st_lq_competition.match_date', '<', $match_date);
-					$where[] = array('st_lq_competition.match_date', '>', $match_date);
-				}
-				if ($status == 1) {
-					$where[] = array('st_lq_competition.match_date', '<', $match_date);
-					$where[] = array('st_lq_competition.match_date', '>', $match_date);
-				}
-				if ($status == 2) {
-					$where[] = array('st_lq_competition.match_date', '=', $match_date);
-				}
-			}
-		}
-		if(!empty($match_date) && $status == -1){
+		if (!empty($match_date)) {
 			$where[] = array('st_lq_competition.match_date', '=', $match_date);
 		}
-		if(empty($match_date) && $status != -1){
-			if ($status == 0) {
-				$where[] = array('st_lq_competition.match_date', '=', date('Y-m-d',time()));
-				$where[] = array('st_lq_competition.match_time', '>', date('H:i:s',time()));
-				$orwhere[] = array('st_lq_competition.match_date', '>', date('Y-m-d',time()));
-			}
-			if ($status == 1) {
-				$where[] = array('st_lq_competition.match_date', '=', date('Y-m-d',time()));
-				$where[] = array('st_lq_competition.match_time', '<', date('H:i:s',time()));
-				$where[] = array('st_lq_competition.match_time', '>', date('H:i:s',time()-2400));
-			}
-			if ($status == 2) {
-				$where[] = array('st_lq_competition.match_date', '=', date('Y-m-d',time()));
-				$where[] = array('st_lq_competition.match_time', '<', date('H:i:s',time()-2400));
-				$orwhere[] = array('st_lq_competition.match_date', '<', date('Y-m-d',time()));
-			}
+		if ($status != -1) {
+			$where[] = array('st_lq_competition.status', '=', $status);
 		}
+
 		$newapp = new \App\Models\SportsBasket();
 		$data = $newapp->getinfo($list, $page, $where,$orwhere);
 		return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);

+ 23 - 74
app/Http/Controllers/Admin/SportsSoccerController.php

@@ -21,7 +21,16 @@ class SportsSoccerController extends Controller {
         $request['recommend'] = isset($req->recommend) ? trim($req->recommend) : '';
         $request['status'] = isset($req->status) ? trim($req->status) : '-1';
         $request['sureblurs'] = isset($req->sureblurs) ? $req->sureblurs : 'on';
+
+//        $source = \App\Models\Setinfo::where('id','1000')->first();
+//        if($source->infocontent != '混合数据'){
+//            $data = \App\Models\SoccerLeague::join('st_zq_local_league','st_zq_league.id','=','st_zq_local_league.lg_id')->select('st_zq_league.id','st_zq_league.name_chinese')->where('st_zq_local_league.source',$source->infocontent)->get();
+//        }else{
+//            $data = \App\Models\SoccerLeague::select('id','name_chinese')->get();
+//        }
+
         $data = \App\Models\SoccerLeague::select('id','lg_id','name_chinese')->get();
+
         $request['league'] = $data;
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/SportsSoccer/info');
@@ -30,14 +39,11 @@ class SportsSoccerController extends Controller {
         $dt->addColsFields('lg_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
         $dt->addColsFields('name_chinese', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('home_guest', array('templet' => '#userdetail', 'sort' => false, 'width' => 260));
-//        $dt->addColsFields('home_team', array('templet' => '#userdetail', 'sort' => false, 'width' => 130));
-//        $dt->addColsFields('guest_team', array('templet' => '#userdetail', 'sort' => false, 'width' => 130));
         $dt->addColsFields('match_date', array('templet' => '#userdetail', 'sort' => true, 'width' => 130));
         $dt->addColsFields('match_time', array('templet' => '#userdetail', 'sort' => true, 'width' => 130));
         $dt->addColsFields('recommend', array('templet' => '#recommend', 'sort' => false, 'width' => 120,'align' => 'center'));
         $dt->addColsFields('status', array('templet' => '#userdetail', 'sort' => false, 'width' => 100));
         $dt->addColsFields('result', array( 'sort' => false, 'width' => 100));
-        //$arr[] = 'view';
         if (checkRriv('/admin/SportsSoccer/edit')) {
             $arr[] = 'edit';
         }
@@ -55,10 +61,6 @@ class SportsSoccerController extends Controller {
         $name_chinese = Request::has('name_chinese') ? Request::get('name_chinese') : '';
         $home_team = Request::has('home_team') ? Request::get('home_team') : '';
         $match_date = Request::has('match_date') ? Request::get('match_date') : '';
-        //$match_date = $req->input('match_date');
-//        if(!empty($match_date)){
-//            return 2;
-//        }
         $status = Request::has('status') ? Request::get('status') : '';
         $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
         $where = array();
@@ -75,75 +77,12 @@ class SportsSoccerController extends Controller {
                 $orwhere[] = array('st_zq_competition.guest_team', '=', $home_team);
             }
         }
-//        if (!empty($match_date)) {
-////            $where[] = array('st_zq_competition.match_date', '=', '2019-04-13');
-//            $where[] = array('st_zq_competition.match_date', '=', $match_date);
-//        }
-//        if ($status != -1) {
-//            $where[] = array('st_zq_competition.status', '=', $status);
-//        }
-        if(!empty($match_date) && $status != -1){
-            if($match_date > date('Y-m-d',time())){
-                if ($status == 0) {
-                    $where[] = array('st_zq_competition.match_date', '=', $match_date);
-                }
-                if ($status == 1) {
-                    $where[] = array('st_zq_competition.match_date', '<', $match_date);
-                    $where[] = array('st_zq_competition.match_date', '>', $match_date);
-                }
-                if ($status == 2) {
-                    $where[] = array('st_zq_competition.match_date', '<', $match_date);
-                    $where[] = array('st_zq_competition.match_date', '>', $match_date);
-                }
-            }
-            if($match_date == date('Y-m-d',time())){
-                if ($status == 0) {
-                    $where[] = array('st_zq_competition.match_date', '=', $match_date);
-                    $where[] = array('st_zq_competition.match_time', '>', date('H:i:s',time()));
-                }
-                if ($status == 1) {
-                    $where[] = array('st_zq_competition.match_date', '=', $match_date);
-                    $where[] = array('st_zq_competition.match_time', '<', date('H:i:s',time()));
-                    $where[] = array('st_zq_competition.match_time', '>', date('H:i:s',time()-5400));
-                }
-                if ($status == 2) {
-                    $where[] = array('st_zq_competition.match_date', '=', $match_date);
-                    $where[] = array('st_zq_competition.match_time', '<', date('H:i:s',time()-5400));
-                }
-            }
-            if($match_date < date('Y-m-d',time())){
-                if ($status == 0) {
-                    $where[] = array('st_zq_competition.match_date', '<', $match_date);
-                    $where[] = array('st_zq_competition.match_date', '>', $match_date);
-                }
-                if ($status == 1) {
-                    $where[] = array('st_zq_competition.match_date', '<', $match_date);
-                    $where[] = array('st_zq_competition.match_date', '>', $match_date);
-                }
-                if ($status == 2) {
-                    $where[] = array('st_zq_competition.match_date', '=', $match_date);
-                }
-            }
-        }
-        if(!empty($match_date) && $status == -1){
+
+        if(!empty($match_date)){
             $where[] = array('st_zq_competition.match_date', '=', $match_date);
         }
-        if(empty($match_date) && $status != -1){
-            if ($status == 0) {
-                $where[] = array('st_zq_competition.match_date', '=', date('Y-m-d',time()));
-                $where[] = array('st_zq_competition.match_time', '>', date('H:i:s',time()));
-                $orwhere[] = array('st_zq_competition.match_date', '>', date('Y-m-d',time()));
-            }
-            if ($status == 1) {
-                $where[] = array('st_zq_competition.match_date', '=', date('Y-m-d',time()));
-                $where[] = array('st_zq_competition.match_time', '<', date('H:i:s',time()));
-                $where[] = array('st_zq_competition.match_time', '>', date('H:i:s',time()-5400));
-            }
-            if ($status == 2) {
-                $where[] = array('st_zq_competition.match_date', '=', date('Y-m-d',time()));
-                $where[] = array('st_zq_competition.match_time', '<', date('H:i:s',time()-5400));
-                $orwhere[] = array('st_zq_competition.match_date', '<', date('Y-m-d',time()));
-            }
+        if($status != -1){
+            $where[] = array('st_zq_competition.status', '=', $status);
         }
 
         $newapp = new \App\Models\SportsSoccer();
@@ -170,7 +109,15 @@ class SportsSoccerController extends Controller {
      *获取所有足球联赛信息
      */
     function getParent() {
+//        $source = \App\Models\Setinfo::where('id','1000')->first();
+//        if($source->infocontent != '混合数据'){
+//            $data = \App\Models\SoccerLeague::join('st_zq_local_league','st_zq_league.id','=','st_zq_local_league.lg_id')->select('st_zq_league.id','st_zq_league.name_chinese')->where('st_zq_local_league.source',$source->infocontent)->get();
+//        }else{
+//            $data = \App\Models\SoccerLeague::select('id','name_chinese')->get();
+//        }
+
         $data = \App\Models\SoccerLeague::select('id','lg_id','name_chinese')->get();
+
         if (!$data) {
             return;
         }
@@ -222,6 +169,7 @@ class SportsSoccerController extends Controller {
             return view('sports.soccer_form', $data);
         } else {
             $model = new \App\Models\SportsSoccer();
+            // $model->id = $req->input('parent_id');
             $model->home_team = $req->input('home_team');
             $model->guest_team = $req->input('guest_team');
             $model->lg_id = $req->input('parent_id');
@@ -229,6 +177,7 @@ class SportsSoccerController extends Controller {
             $model->match_time = $req->input('match_time');
             $model->status = $req->input('status');
             $model->match_id = time() ;
+            $model->m_match_id = $model->match_id ;
             $model->ctime = date('Y-m-d H:i:s',time());
             $model->utime = date('Y-m-d H:i:s',time());
             $model->tag = mt_rand(0,100) ;

+ 5 - 5
app/Lib/Settlement/SettlementOrder.php

@@ -109,7 +109,7 @@ class SettlementOrder extends SettlementBase
         // 修改投注表状态及盈亏
         DB :: table('money_buy_simplex')
             -> where(['order_id' => $order_id])
-            -> update(['settle_status' => 2, 'game_status' => $game_status, 'gain_money' => $returnMoney]);
+            -> update(['settle_status' => 2, 'game_status' => $game_status, 'gain_money' => $returnMoney, 'settlementTime' => date('Y-m-d H:i:s')]);
         $this -> insertData(
             $order_id,
             $returnMoney,
@@ -155,7 +155,7 @@ class SettlementOrder extends SettlementBase
             'money_time' => $money_time,
             'money_type' => 1,
             'money_cash' => $available_cash,
-            'trade_type' => 1,
+            'trade_type' => 4,
             'trade_desc' => $trade_desc,
             'reason' => $reason,
             'sysetem_user' => '系统',
@@ -211,7 +211,7 @@ class SettlementOrder extends SettlementBase
                        if (!$ret){ throw  new \Exception('更新数据出错1!');   }
                        $ret = DB::update('update money_buy_str  set settle_status=2,game_status=3,gain_money=0  where batch_id = ?', [$batch_id]);
                        */
-                       DB::table('money_buy_str')->where('batch_id',$batch_id)->update(['wait_match_num'=>0,'prize_note'=>0,'game_status'=>3,'settle_status'=>2,'gain_money'=>0]);
+                       DB::table('money_buy_str')->where('batch_id',$batch_id)->update(['wait_match_num'=>0,'prize_note'=>0,'game_status'=>3,'settle_status'=>2,'gain_money'=>0,'settlementTime'=>date('Y-m-d H:i:s')]);
                        //if(!($ret || $ret===0)){        throw  new \Exception('更新数据出错2!');      }
                        return true ;
                   }
@@ -222,8 +222,8 @@ class SettlementOrder extends SettlementBase
                $chuanNum = intval(substr($this->BuyDatasMainModel->str_type,0,1));
                $lasPeilv  = $this->stringComputing([$in_array,$chuanNum]);
                $money = floatPointDigit($this->BuyDatasMainModel->money *  $lasPeilv ) ;
-
-               $ret = DB::update('update money_buy_str  set settle_status=2 , game_status=1 , gain_money=?  where order_id = ?', [$money,$order_id]);
+               $newTime = date('Y-m-d H:i:s');
+               $ret = DB::update('update money_buy_str  set settle_status=2 , game_status=1 , "settlementTime"=? , gain_money=?  where order_id = ?', [$newTime,$money,$order_id]);
                if(!($ret || $ret===0)){                     throw  new \Exception('更新数据出错3!');             }
 
                $this->insertData($order_id,$money,$this->BuyDatasMainModel->account_identity,2,$val->game_code,$this->BuyDatasMainModel->info_identity,$money);

+ 2 - 2
app/Models/BaseOdds.php

@@ -32,13 +32,13 @@ class BaseOdds extends BaseModel
             }else if($data[$i]['status']==-1){
                 $data[$i]['status'] = '禁用';
             }
-            $odds_name = DB::table('st_odds_code')->where('odds_code',$data[$i]['odds_code'])->first();
+            $odds_name = \App\Models\Matchcode::where('odds_code',$data[$i]['odds_code'])->first();
             if(!empty($odds_name)){
                 $data[$i]['odds_code_cn'] = $odds_name->odds_name;
             }else{
                 $data[$i]['odds_code_cn'] = $data[$i]['odds_code'];
             }
-            $p_name = DB::table('st_odds_code')->where('odds_code',$data[$i]['p_code'])->first();
+            $p_name = \App\Models\Matchcode::where('odds_code',$data[$i]['p_code'])->first();
             if(!empty($p_name)){
                 $data[$i]['p_code_cn'] = $p_name->odds_name;
             }else{

+ 2 - 2
app/Models/BasketOdds.php

@@ -32,13 +32,13 @@ class BasketOdds extends BaseModel
             }else if($data[$i]['status']==-1){
                 $data[$i]['status'] = '禁用';
             }
-            $odds_name = DB::table('st_odds_code')->where('odds_code',$data[$i]['odds_code'])->first();
+            $odds_name = \App\Models\Matchcode::where('odds_code',$data[$i]['odds_code'])->first();
             if(!empty($odds_name)){
                 $data[$i]['odds_code_cn'] = $odds_name->odds_name;
             }else{
                 $data[$i]['odds_code_cn'] = $data[$i]['odds_code'];
             }
-            $p_name = DB::table('st_odds_code')->where('odds_code',$data[$i]['p_code'])->first();
+            $p_name = \App\Models\Matchcode::where('odds_code',$data[$i]['p_code'])->first();
             if(!empty($p_name)){
                 $data[$i]['p_code_cn'] = $p_name->odds_name;
             }else{

+ 9 - 7
app/Models/MoneyBuyStr.php

@@ -58,7 +58,7 @@ class MoneyBuyStr extends BaseModel {
 
             //反水
             $data[$i]->water_return = '0';
-            $water_return_money = DB::table('money_details')->where('trade_id',$data[$i]->order_id)->where('trade_type','7')->first();
+            $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;
             }
@@ -66,13 +66,15 @@ class MoneyBuyStr extends BaseModel {
 
             $data[$i]->money_match_time = '投注:'.$data[$i]->money_time;
 
-            $data[$i]->frozen_cash = $data[$i]->money_cash;
-            $data[$i]->available_cash = $data[$i]->money_cash+$data[$i]->money.'.00';
+            //用户投注后账户金额
+            $data[$i]->frozen_cash = $water_return_money->money_cash;;
+            //用户投注前账户金额
+            $data[$i]->available_cash = $data[$i]->money_cash+$data[$i]->money;
             $data[$i]->account = $data[$i]->available_cash.' <span>'.$data[$i]->account_name.' </span> '.$data[$i]->frozen_cash;
 
             if($data[$i]->settle_status == '未结算'){
                 $result = array();
-                $matchs = DB::table('money_buy_match')->where('batch_id',$data[$i]->batch_id)->where('bet_type','2')->get();
+                $matchs = \App\Models\MoneyBuyMatch::where('batch_id',$data[$i]->batch_id)->where('bet_type','2')->get();
                 for($j=0;$j<count($matchs);$j++){
                     $result[] = $matchs[$j]->result;
                 }
@@ -110,8 +112,8 @@ class MoneyBuyStr extends BaseModel {
     //获取串关注单详情信息
     function getdetailinfo($id) {
         $res = $this->where('id',$id)->first();
-        $data = DB::table('money_buy_match')->where('batch_id',$res->batch_id)->where('bet_type','2')->get();
-        $game_type = DB::table('st_game_type')->get();
+        $data = \App\Models\MoneyBuyMatch::where('batch_id',$res->batch_id)->where('bet_type','2')->get();
+        $game_type = \App\Models\StGameType::get();
         for($i=0;$i<count($data);$i++){
             $league = DB::table('st_'.$data[$i]->game_code.'_league')->where('lg_id',$data[$i]->lg_id)->first();
             if(!empty($league)){
@@ -120,7 +122,7 @@ class MoneyBuyStr extends BaseModel {
                 $data[$i]->league = $data[$i]->lg_id;
             }
 
-            $odds_code = DB::table('st_odds_code')->where('odds_code',$data[$i]->odds_code)->first();
+            $odds_code = \App\Models\Matchcode::where('odds_code',$data[$i]->odds_code)->first();
             if(!empty($odds_code)){
                 $data[$i]->odds_code = $odds_code->odds_name;
             }

+ 2 - 2
app/Models/SoccerOdds.php

@@ -32,13 +32,13 @@ class SoccerOdds extends BaseModel
             }else if($data[$i]['status']==-1){
                 $data[$i]['status'] = '禁用';
             }
-            $odds_name = DB::table('st_odds_code')->where('odds_code',$data[$i]['odds_code'])->first();
+            $odds_name = \App\Models\Matchcode::where('odds_code',$data[$i]['odds_code'])->first();
             if(!empty($odds_name)){
                 $data[$i]['odds_code_cn'] = $odds_name->odds_name;
             }else{
                 $data[$i]['odds_code_cn'] = $data[$i]['odds_code'];
             }
-            $p_name = DB::table('st_odds_code')->where('odds_code',$data[$i]['p_code'])->first();
+            $p_name = \App\Models\Matchcode::where('odds_code',$data[$i]['p_code'])->first();
             if(!empty($p_name)){
                 $data[$i]['p_code_cn'] = $p_name->odds_name;
             }else{

+ 1 - 1
app/Models/SportsBase.php

@@ -63,7 +63,7 @@ class SportsBase extends BaseModel {
             }else{
                 $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
             }
-            $result = DB::table('comendnotice')->where('match_id',$data[$i]->match_id)->where('game_code','bq')->first();
+            $result = \App\Models\Comendnotice::where('match_id',$data[$i]->match_id)->where('game_code','bq')->first();
             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/SportsBase/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsBase/dealwith/?id='.$result->id.'\');" style="background-color: #FF5722;"> 处理 </a>';

+ 56 - 24
app/Models/SportsBasket.php

@@ -13,9 +13,37 @@ class SportsBasket extends BaseModel {
 
     function getinfo($list = 10, $page, $where = '',$orwhere = '')
     {
+//        $source = \App\Models\Setinfo::where('id','1000')->first();
+//        if($source->infocontent != '混合数据'){
+//            $where[] = array('st_lq_local_match.source', '=', $source->infocontent);
+//            $where[] = array('st_lq_local_league.source', '=', $source->infocontent);
+//        }
+//
+//        if (is_array ($where) && count ($where) > 0) {
+//            $data = $this->join('st_lq_league','st_lq_competition.lg_id','=','st_lq_league.id')
+//                ->join('st_lq_local_match','st_lq_competition.id','=','st_lq_local_match.match_id')
+//                ->join('st_lq_local_league','st_lq_league.id','=','st_lq_local_league.lg_id')
+//                ->select('st_lq_competition.id','st_lq_local_match.match_id','st_lq_local_league.lg_id','st_lq_league.name_chinese','st_lq_league.last_time','st_lq_competition.home_team','st_lq_competition.guest_team','st_lq_competition.match_date','st_lq_competition.match_time','st_lq_competition.status','st_lq_competition.recommend')
+//                ->orderby('st_lq_competition.match_date','desc')
+//                ->orderby('st_lq_competition.match_time','desc')
+//                ->where($where)
+//                ->orwhere($orwhere)
+//                ->paginate ($list);
+//        } else {
+//            $data = $this->join('st_lq_league','st_lq_competition.lg_id','=','st_lq_league.id')
+//                ->join('st_lq_local_match','st_lq_competition.id','=','st_lq_local_match.match_id')
+//                ->join('st_lq_local_league','st_lq_league.id','=','st_lq_local_league.lg_id')
+//                ->select('st_lq_competition.id','st_lq_local_match.match_id','st_lq_local_league.lg_id','st_lq_league.name_chinese','st_lq_league.last_time','st_lq_competition.home_team','st_lq_competition.guest_team','st_lq_competition.match_date','st_lq_competition.match_time','st_lq_competition.status','st_lq_competition.recommend')
+//                ->orderby('st_lq_competition.match_date','desc')
+//                ->orderby('st_lq_competition.match_time','desc')
+//                ->paginate ($list);
+//        }
+
+
+
         if (is_array ($where) && count ($where) > 0) {
             $data = $this->join('st_lq_league','st_lq_competition.lg_id','=','st_lq_league.lg_id')
-                ->select('st_lq_competition.id','st_lq_competition.match_id','st_lq_competition.lg_id','st_lq_league.name_chinese','st_lq_competition.home_team','st_lq_competition.guest_team','st_lq_competition.match_date','st_lq_competition.match_time','st_lq_competition.status','st_lq_competition.recommend')
+                ->select('st_lq_competition.id','st_lq_competition.match_id','st_lq_competition.lg_id','st_lq_league.name_chinese','st_lq_league.last_time','st_lq_competition.home_team','st_lq_competition.guest_team','st_lq_competition.match_date','st_lq_competition.match_time','st_lq_competition.status','st_lq_competition.recommend')
                 ->orderby('st_lq_competition.match_date','desc')
                 ->orderby('st_lq_competition.match_time','desc')
                 ->where($where)
@@ -23,7 +51,7 @@ class SportsBasket extends BaseModel {
                 ->paginate ($list);
         } else {
             $data = $this->join('st_lq_league','st_lq_competition.lg_id','=','st_lq_league.lg_id')
-                ->select('st_lq_competition.id','st_lq_competition.match_id','st_lq_competition.lg_id','st_lq_league.name_chinese','st_lq_competition.home_team','st_lq_competition.guest_team','st_lq_competition.match_date','st_lq_competition.match_time','st_lq_competition.status','st_lq_competition.recommend')
+                ->select('st_lq_competition.id','st_lq_competition.match_id','st_lq_competition.lg_id','st_lq_league.name_chinese','st_lq_league.last_time','st_lq_competition.home_team','st_lq_competition.guest_team','st_lq_competition.match_date','st_lq_competition.match_time','st_lq_competition.status','st_lq_competition.recommend')
                 ->orderby('st_lq_competition.match_date','desc')
                 ->orderby('st_lq_competition.match_time','desc')
                 ->paginate ($list);
@@ -31,24 +59,16 @@ class SportsBasket extends BaseModel {
         if (!$data < 0) {
             return -2021052003; //
         }
+
+        //赛事结果处理状态查询
+        $result = \App\Models\Comendnotice::where('game_code','lq')->get();
+
         for($i=0;$i<count($data);$i++){
-            if($data[$i]->match_date < date('Y-m-d',time())){
-                $data[$i]->status = '2';
-                //$this->where('id', $data[$i]->id)->update(['status' => 2]);
-            }else if($data[$i]->match_date == date('Y-m-d',time()) && strtotime($data[$i]->match_time)+2400 <= strtotime(date('H:i:s',time()))){
-                $data[$i]->status = '2';
-                //$this->where('id', $data[$i]->id)->update(['status' => 2]);
-            }
-            else if($data[$i]->match_date == date('Y-m-d',time()) && strtotime($data[$i]->match_time) < strtotime(date('H:i:s',time())) && strtotime(date('H:i:s',time())) < strtotime($data[$i]->match_time)+2400){
-                $data[$i]->status = '1';
-                //$this->where('id', $data[$i]->id)->update(['status' => 1]);
-            }else if($data[$i]->match_date == date('Y-m-d',time()) && strtotime($data[$i]->match_time) > strtotime(date('H:i:s',time()))){
-                $data[$i]->status = '0';
-                //$this->where('id', $data[$i]->id)->update(['status' => 0]);
-            }
-            else if($data[$i]->match_date > date('Y-m-d',time())){
-                $data[$i]->status = '0';
-                //$this->where('id', $data[$i]->id)->update(['status' => 0]);
+
+            if($data[$i]->match_date == '' && $data[$i]->last_time != ''){
+                $datetime = explode(' ',$data[$i]->last_time);
+                $data[$i]->match_date = $datetime[0];
+                $data[$i]->match_time = $datetime[1];
             }
 
             if($data[$i]->status==0){
@@ -63,10 +83,22 @@ class SportsBasket extends BaseModel {
             }else{
                 $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
             }
-            $result = DB::table('comendnotice')->where('match_id',$data[$i]->match_id)->where('game_code','lq')->first();
+
+            //赛事结果状态
             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/SportsBasket/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsBasket/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;
+                    }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>';
                 }
@@ -75,7 +107,6 @@ class SportsBasket extends BaseModel {
             }
         }
         return $data->toArray();
-
     }
 
     //更新设置
@@ -97,7 +128,9 @@ class SportsBasket extends BaseModel {
 
     //篮球赛事联赛查询
     function allcompetition($lg_id){
+
         $data = $this->where('lg_id',$lg_id)->select('lg_id','home_team')->get();
+
         if (!$data) {
             return -5040000102; //无相关信息
         }
@@ -105,5 +138,4 @@ class SportsBasket extends BaseModel {
     }
 
 
-
 }

+ 8 - 5
app/Models/SportsNoteList.php

@@ -37,13 +37,15 @@ class SportsNoteList extends BaseModel {
                 $data[$i]->game_status = '赢';
             }else if($data[$i]->game_status==2){
                 $data[$i]->game_status = '输';
+            }else if($data[$i]->game_status==3){
+                $data[$i]->game_status = '平';
             }
             $data[$i]->match_id_order = '<span>'.$data[$i]->match_id.'</span><br>'.$data[$i]->order_id;
             $data[$i]->league = $data[$i]->name_chinese;
 
             //反水
             $data[$i]->water_return = '0';
-            $water_return_money = DB::table('money_details')->where('trade_id',$data[$i]->order_id)->where('trade_type','7')->first();
+            $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;
             }
@@ -54,12 +56,13 @@ class SportsNoteList extends BaseModel {
             $data[$i]->money_match_time = '投注:'.$data[$i]->money_time.'<br>'.$data[$i]->match_time;
 
             //用户投注后账户金额
-            $data[$i]->frozen_cash = $data[$i]->money_cash;
+            $data[$i]->frozen_cash = $water_return_money->money_cash;
             //用户投注前账户金额
-            $data[$i]->available_cash = $data[$i]->money+$data[$i]->money_cash.'.00';
+            $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;
 
-            $content = DB::table('money_buy_match')->where('batch_id',$data[$i]->batch_id)->where('match_id',$data[$i]->match_id)->where('bet_type','1')->get();
+            $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>';
             }else{
@@ -73,7 +76,7 @@ class SportsNoteList extends BaseModel {
 
             for($j=0;$j<count($content);$j++){
                 $odds_code = $content[$j]->odds_code;
-                $result = DB::table('st_odds_code')->where('odds_code',$odds_code)->first();
+                $result = \App\Models\Matchcode::where('odds_code',$odds_code)->first();
                 if(!empty($result)){
                     $odds_name = $result->odds_name;
                 }else{

+ 54 - 24
app/Models/SportsSoccer.php

@@ -13,9 +13,36 @@ class SportsSoccer extends BaseModel {
 
     function getinfo($list = 10, $page, $where = '',$orwhere = '')
     {
+//        $source = \App\Models\Setinfo::where('id','1000')->first();
+//        if($source->infocontent != '混合数据'){
+//            $where[] = array('st_zq_local_match.source', '=', $source->infocontent);
+//            $where[] = array('st_zq_local_league.source', '=', $source->infocontent);
+//        }
+//        if (is_array ($where) && count ($where) > 0) {
+//            $data = $this->join('st_zq_league','st_zq_competition.lg_id','=','st_zq_league.id')
+//                ->join('st_zq_local_match','st_zq_competition.id','=','st_zq_local_match.match_id')
+//                ->join('st_zq_local_league','st_zq_league.id','=','st_zq_local_league.lg_id')
+//                ->select('st_zq_competition.id','st_zq_local_match.match_id','st_zq_local_league.lg_id','st_zq_league.name_chinese','st_zq_league.last_time','st_zq_competition.home_team','st_zq_competition.guest_team','st_zq_competition.match_date','st_zq_competition.match_time','st_zq_competition.status','st_zq_competition.recommend')
+//                ->orderby('st_zq_competition.match_date','desc')
+//                ->orderby('st_zq_competition.match_time','desc')
+//                ->where($where)
+//                ->orwhere($orwhere)
+//                ->paginate ($list);
+//        } else {
+//            $data = $this->join('st_zq_league','st_zq_competition.lg_id','=','st_zq_league.id')
+//                ->join('st_zq_local_match','st_zq_competition.id','=','st_zq_local_match.match_id')
+//                ->join('st_zq_local_league','st_zq_league.id','=','st_zq_local_league.lg_id')
+//                ->select('st_zq_competition.id','st_zq_local_match.match_id','st_zq_local_league.lg_id','st_zq_league.name_chinese','st_zq_league.last_time','st_zq_competition.home_team','st_zq_competition.guest_team','st_zq_competition.match_date','st_zq_competition.match_time','st_zq_competition.status','st_zq_competition.recommend')
+//                ->orderby('st_zq_competition.match_date','desc')
+//                ->orderby('st_zq_competition.match_time','desc')
+//                ->paginate ($list);
+//        }
+
+
+
         if (is_array ($where) && count ($where) > 0) {
             $data = $this->join('st_zq_league','st_zq_competition.lg_id','=','st_zq_league.lg_id')
-                ->select('st_zq_competition.id','st_zq_competition.match_id','st_zq_competition.lg_id','st_zq_league.name_chinese','st_zq_competition.home_team','st_zq_competition.guest_team','st_zq_competition.match_date','st_zq_competition.match_time','st_zq_competition.status','st_zq_competition.recommend')
+                ->select('st_zq_competition.id','st_zq_competition.match_id','st_zq_competition.lg_id','st_zq_league.name_chinese','st_zq_league.last_time','st_zq_competition.home_team','st_zq_competition.guest_team','st_zq_competition.match_date','st_zq_competition.match_time','st_zq_competition.status','st_zq_competition.recommend')
                 ->orderby('st_zq_competition.match_date','desc')
                 ->orderby('st_zq_competition.match_time','desc')
                 ->where($where)
@@ -23,32 +50,25 @@ class SportsSoccer extends BaseModel {
                 ->paginate ($list);
         } else {
             $data = $this->join('st_zq_league','st_zq_competition.lg_id','=','st_zq_league.lg_id')
-                ->select('st_zq_competition.id','st_zq_competition.match_id','st_zq_competition.lg_id','st_zq_league.name_chinese','st_zq_competition.home_team','st_zq_competition.guest_team','st_zq_competition.match_date','st_zq_competition.match_time','st_zq_competition.status','st_zq_competition.recommend')
+                ->select('st_zq_competition.id','st_zq_competition.match_id','st_zq_competition.lg_id','st_zq_league.name_chinese','st_zq_league.last_time','st_zq_competition.home_team','st_zq_competition.guest_team','st_zq_competition.match_date','st_zq_competition.match_time','st_zq_competition.status','st_zq_competition.recommend')
                 ->orderby('st_zq_competition.match_date','desc')
                 ->orderby('st_zq_competition.match_time','desc')
                 ->paginate ($list);
         }
+
         if (!$data < 0) {
             return -2021052003; //
         }
+
+        //赛事结果处理状态查询
+        $result = \App\Models\Comendnotice::where('game_code','zq')->get();
+
         for($i=0;$i<count($data);$i++){
-            if($data[$i]->match_date < date('Y-m-d',time())){
-                $data[$i]->status = '2';
-                //$this->where('id', $data[$i]->id)->update(['status' => 2]);
-            }else if($data[$i]->match_date == date('Y-m-d',time()) && strtotime($data[$i]->match_time)+5400 <= strtotime(date('H:i:s',time()))){
-                $data[$i]->status = '2';
-                //$this->where('id', $data[$i]->id)->update(['status' => 2]);
-            }
-            else if($data[$i]->match_date == date('Y-m-d',time()) && strtotime($data[$i]->match_time) < strtotime(date('H:i:s',time())) && strtotime(date('H:i:s',time())) < strtotime($data[$i]->match_time)+5400){
-                $data[$i]->status = '1';
-                //$this->where('id', $data[$i]->id)->update(['status' => 1]);
-            }else if($data[$i]->match_date == date('Y-m-d',time()) && strtotime($data[$i]->match_time) > strtotime(date('H:i:s',time()))){
-                $data[$i]->status = '0';
-                //$this->where('id', $data[$i]->id)->update(['status' => 0]);
-            }
-            else if($data[$i]->match_date > date('Y-m-d',time())){
-                $data[$i]->status = '0';
-                //$this->where('id', $data[$i]->id)->update(['status' => 0]);
+
+            if($data[$i]->match_date == '' && $data[$i]->last_time != ''){
+                $datetime = explode(' ',$data[$i]->last_time);
+                $data[$i]->match_date = $datetime[0];
+                $data[$i]->match_time = $datetime[1];
             }
 
             if($data[$i]->status==0){
@@ -58,14 +78,27 @@ class SportsSoccer extends BaseModel {
             }else if($data[$i]->status==2){
                 $data[$i]->status = '已结束';
             }
+
             if($data[$i]->guest_team == ''){
                 $data[$i]->home_guest = $data[$i]->home_team;
             }else{
                 $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
             }
-            $result = DB::table('comendnotice')->where('match_id',$data[$i]->match_id)->where('game_code','zq')->first();
+
+            //赛事结果状态
             if(!empty($result)){
-                if($result->status == '0'){
+                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>';
@@ -73,10 +106,8 @@ class SportsSoccer extends BaseModel {
             }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();
-
     }
 
     //更新设置
@@ -97,5 +128,4 @@ class SportsSoccer extends BaseModel {
     }
 
 
-
 }

+ 1 - 1
app/Models/SportsTennis.php

@@ -63,7 +63,7 @@ class SportsTennis extends BaseModel {
             }else{
                 $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
             }
-            $result = DB::table('comendnotice')->where('match_id',$data[$i]->match_id)->where('game_code','wq')->first();
+            $result = \App\Models\Comendnotice::where('match_id',$data[$i]->match_id)->where('game_code','wq')->first();
             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/SportsTennis/dealwith/?id=" href="javascript:dealwith(\'/admin/SportsTennis/dealwith/?id='.$result->id.'\');" style="background-color: #FF5722;"> 处理 </a>';

+ 15 - 0
app/Models/Stzqlocalleague.php

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

+ 15 - 0
app/Models/Stzqlocalmatch.php

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

+ 2 - 2
app/Models/TennisOdds.php

@@ -32,13 +32,13 @@ class TennisOdds extends BaseModel
             }else if($data[$i]['status']==-1){
                 $data[$i]['status'] = '禁用';
             }
-            $odds_name = DB::table('st_odds_code')->where('odds_code',$data[$i]['odds_code'])->first();
+            $odds_name = \App\Models\Matchcode::where('odds_code',$data[$i]['odds_code'])->first();
             if(!empty($odds_name)){
                 $data[$i]['odds_code_cn'] = $odds_name->odds_name;
             }else{
                 $data[$i]['odds_code_cn'] = $data[$i]['odds_code'];
             }
-            $p_name = DB::table('st_odds_code')->where('odds_code',$data[$i]['p_code'])->first();
+            $p_name = \App\Models\Matchcode::where('odds_code',$data[$i]['p_code'])->first();
             if(!empty($p_name)){
                 $data[$i]['p_code_cn'] = $p_name->odds_name;
             }else{

+ 10 - 0
resources/lang/zh-cn/matchcode.php

@@ -8,5 +8,15 @@ return array(
     'type' => '类型',
     'sousuo' => '搜索',
     'choice' => '请选择上级',
+    'game_code' => '球类类型',
+    'choice_type' => '请选择所属球类',
+
+    'choice_onlyt' =>array(
+    	'' => '请选择所属球类',
+    	'zq' => '足球',
+    	'lq' => '篮球',
+    	'wq' => '网球',
+    	'bq' => '棒球',
+    ),
 
 );

+ 27 - 0
resources/views/admin/baseSet/index.blade.php

@@ -162,6 +162,33 @@
         </div>
     </div>
 
+    <div class="layui-colla-item">
+        <h2 class="layui-colla-title" data-type="{{$stsource['infotype']}}">体育比分数据源设置<span
+                    style="font-size: 10px;"></span></h2>
+        <div class="layui-colla-content">
+            <form class="layui-form" action="">
+                <input type="hidden" name="id" value="1000">
+                <input type="hidden" name="type" value="{{$stsource['infotype']}}">
+                <input type="hidden" name="infoname" value="体育比分数据源设置">
+                <div class="layui-form-item">
+                    <label class="layui-form-label">数据源设置</label>
+                    <div class="layui-input-block">
+                        <select name="infocontent" >
+                            <option value></option>
+                            @if(isset($source))
+                                @foreach($source as $k=>$v)
+                                    <option value="{{ $v['source'] }}"  @if(isset($stsource)&&$stsource['infocontent']==$v['source'])  selected @endif>
+                                        @if(isset($lange[$v['source']]))  {{$lange[trim($v['source'])]}} @else {{$v['source']}}   @endif
+                                    </option>
+                                @endforeach
+                            @endif
+                        </select>
+                    </div>
+                </div>
+            </form>
+        </div>
+    </div>
+
     <!--新版弹窗设置-->
     <div class="layui-colla-item">
         <h2 class="layui-colla-title" data-type="33">APP版弹窗设置[33]</h2>

+ 11 - 8
resources/views/admin/matchcode/addmatchcode.blade.php

@@ -4,12 +4,6 @@
 <form class="layui-form" action="{{ url()->full() }}" id="submitForm" name="submitForm" method="post" eventType=eventAjaxForm>
 {!! csrf_field() !!}
 
-			<div class="layui-form-item">
-                <label class="layui-form-label">{{ trans('matchcode.game_type') }}:</label>
-                <div class="layui-input-block">
-                <input type="text" name="game_type"   id="game_type"  required  lay-verify="" placeholder="" autocomplete="off" value="@isset($game_type) {{ $matchcode['game_type'] }} @endisset" class="layui-input">
-                </div>
-            </div>
 			<div class="layui-form-item">
                 <label class="layui-form-label">{{ trans('matchcode.odds_code') }}:</label>
                 <div class="layui-input-block">
@@ -22,7 +16,6 @@
                 <textarea  name="odds_name"   id="odds_name"    lay-verify="" placeholder="" autocomplete="off" class="layui-input" >@isset($matchcode) {{ $matchcode['odds_name'] }} @endisset </textarea>
                 </div>
             </div>
-
             <div class="layui-form-item layui-form">
                 <label class="layui-form-label">{{ trans('matchcode.p_id') }}:</label>
                     <div class="layui-input-block">
@@ -34,7 +27,17 @@
                     </select>
                 </div>
             </div>
-
+            <div class="layui-form-item layui-form">
+                <label class="layui-form-label">{{ trans('matchcode.game_code') }}:</label>
+                    <div class="layui-input-block">
+                    <select name="game_code"  id="game_code" lay-filter = 'sect'  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
+                        <option value="">{{ trans('matchcode.choice_type') }}</option>
+                        @foreach(trans('matchcode.choice_onlyt') as $k=>$v):
+                            <option value="{{$k}}">{{$v}}</option>
+                        @endforeach
+                    </select>
+                </div>
+            </div>
 
     @if(S('ACTION')!='view')
       <div class="layui-form-item">

+ 18 - 6
resources/views/admin/matchcode/edit.blade.php

@@ -2,12 +2,6 @@
 @section('content')
 <form class="layui-form" action="{{ url()->full() }}" id="submitForm" name="submitForm" method="post" eventType=eventAjaxForm>
 {!! csrf_field() !!}
-  <div class="layui-form-item">
-    <label class="layui-form-label">球类代码</label>
-    <div class="layui-input-block">
-      <input type="text" name="game_type" required  lay-verify="required" placeholder="请输入主动名称" autocomplete="off" value="{{ isset($data['game_type'])?$data['game_type']:'' }}" class="layui-input">
-    </div>
-  </div>
   <div class="layui-form-item">
     <label class="layui-form-label">赔率玩法代码</label>
     <div class="layui-input-block">
@@ -20,6 +14,24 @@
     <input type="text" name="odds_name"   lay-verify="" placeholder="请输入客队让球数" autocomplete="off" class="layui-input"  value="{{ isset($data['odds_name'])?$data['odds_name']:'' }}" >
     </div>
   </div>
+
+  <div class="layui-form-item">
+    <label class="layui-form-label">{{ trans('matchcode.game_code') }}:</label>
+      <div class="layui-input-block">
+        <select name="game_code"  id="game_code" lay-filter = 'sect'  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
+          <option value="@if($data['game_code']) {{$data['game_code']}} @else 0 @endif "> {{ trans('matchcode.choice') }}</option>
+            @foreach(trans('matchcode.choice_onlyt') as $k=>$v):
+              @if($data['game_code']==$k)
+                <option value={{$v}} selected>{{$v}}</option>
+              @else
+                <option value="{{$k}}">{{$v}}</option>
+              @endif
+            @endforeach
+        </select>
+    </div>
+  </div>
+
+
   <div class="layui-form-item">
     <label class="layui-form-label">{{ trans('matchcode.p_id') }}:</label>
       <div class="layui-input-block">

+ 17 - 1
resources/views/admin/matchcode/index.blade.php

@@ -33,7 +33,7 @@
                     <div class="layui-inline">
                         <label class="layui-form-label">{{ trans('matchcode.sousuo') }}</label>
                         <div class="layui-input-inline">
-                            <input type="text" name="game_type" id="game_type" eventType="event-query"  value="{{ $game_type }}" lay-verify="required" autocomplete="off" class="layui-input">
+                            <input type="text" name="odds_code" id="odds_code" eventType="event-query"  value="{{ $odds_code }}" lay-verify="required" autocomplete="off" class="layui-input">
                         </div>
                         <div class="layui-input-inline checkbox">
                             <input type="checkbox" name="sureblur" id="form_sureblur" lay-skin="switch" lay-text="精确|模糊" @if(!isset($sureblurs) || $sureblurs=='on') checked @endif  class="layui-input" eventType=event-query>
@@ -41,6 +41,22 @@
                         </div>
                     </div>
 
+                    <div class="layui-inline">
+                        <label class="layui-form-label">{{ trans('matchcode.game_code') }}</label>
+                        <div class="layui-input-inline" style="width: 200px">
+                            <select name="game_code"  id="game_code"  lay-verify="" autocomplete="off" class="layui-input"  eventType=event-query>
+                                
+                                @foreach(trans('matchcode.choice_onlyt') as $k=>$v):
+                                  @if($game_code==$k)
+                                    <option value={{$k}} selected>{{$v}}</option>
+                                  @else
+                                    <option value="{{$k}}">{{$v}}</option>
+                                  @endif
+                                @endforeach
+                            </select>
+                        </div>
+                   </div>
+
                     <div class="layui-inline">
                         <a class="layui-btn layui-btn-sm lay-btn-diy"   data-type="reload" eventType="event-query-submit" style="opacity: 1; pointer-events: auto;">提交</a>
                         <a  class="layui-btn   layui-btn-sm layui-btn-normal reset" data-type="reload" style="opacity: 1; pointer-events: auto;">重置</a>