彭俊 6 лет назад
Родитель
Сommit
d883d6e28e

+ 3 - 0
app/Http/Controllers/Admin/SportsbkController.php

@@ -155,14 +155,17 @@ class SportsbkController extends Controller {
 		}
 		if ($status != -1) {
 			$where[] = array('st_lq_result.status', '=', $status);
+			$orwhere[] = array('st_lq_result.status', '=', $status);
 		}
 		if (!empty($star_time)) {
             $star_time = date('Y-m-d H:i:s', strtotime($star_time));
             $where[] = array('st_lq_result.start_time', '>', $star_time);
+            $orwhere[] = array('st_lq_result.start_time', '>', $star_time);
         }
         if (!empty($end_time)) {
             $end_time = date('Y-m-d H:i:s', strtotime($end_time));
             $where[] = array('st_lq_result.start_time', '<', $end_time);
+            $orwhere[] = array('st_lq_result.start_time', '<', $end_time);
         }
 		$newapp = new \App\Models\Stlqresult();
 		$data = $newapp->resultbklist($list, $page, $where, $orwhere);

+ 14 - 1
app/Http/Controllers/Admin/SportsbqController.php

@@ -46,19 +46,32 @@ class SportsbqController extends Controller {
         $end_time = Request::get('end_time') ? Request::get('end_time').' 23:59:59' : '';
 
         $where = array();
+        $orwhere = array();
+        if (!empty($home_team)) {
+			if (empty($sureblur) || $sureblur == 'off') {
+				$where[] = array('st_bq_result.home_team', 'like', '%' . $home_team . '%');
+				$orwhere[] = array('st_bq_result.guest_team', 'like', '%' . $home_team . '%');
+			} else {
+				$where[] = array('st_bq_result.home_team', '=', $home_team);
+				$orwhere[] = array('st_bq_result.guest_team', '=', $home_team);
+			}
+		}
         if ($status != -1) {
 			$where[] = array('st_bq_result.status', '=', $status);
+			$orwhere[] = array('st_bq_result.status', '=', $status);
 		}
 		if (!empty($star_time)) {
 	            $star_time = date('Y-m-d H:i:s', strtotime($star_time));
 	            $where[] = array('st_bq_result.start_time', '>', $star_time);
+	            $orwhere[] = array('st_bq_result.start_time', '>', $star_time);
 	        }
 	    if (!empty($end_time)) {
 	        $end_time = date('Y-m-d H:i:s', strtotime($end_time));
 	        $where[] = array('st_bq_result.start_time', '<', $end_time);
+	        $orwhere[] = array('st_bq_result.start_time', '<', $end_time);
 	    }
 		$newapp = new \App\Models\Stbqresult();
-        $data = $newapp->getinfo($list, $page, $where);
+        $data = $newapp->getinfo($list, $page, $where,$orwhere);
         
         return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
 	}

+ 136 - 136
app/Http/Controllers/Admin/SportsfootController.php

@@ -14,68 +14,68 @@ use Request;
  */
 class SportsfootController extends Controller {
 
-	function Settlement(Req $req){
-		$jsurl = config('sconstant.url');//结算请求域名地址
-		$match_id = $req->match_id;
-		$type = $req->type;
-		$token = session('adminInfo.token');
-		$notice = \App\Models\Comendnotice::where('match_id', $match_id)->first();
-		$noticeid = $notice['id'];
-		//查询赛事单式是否有订单
-		$newapp = new \App\Models\MoneyBuyMatch();
-		$simplex_ids = array_column($newapp->allsimplexorder($match_id,'zq'),'order_id');
-		$str_ids = array_column($newapp->allstrorder($match_id),'order_id');
-
-		if($simplex_ids && $str_ids){
-			$requet = file_get_contents($jsurl."/WinFail?noticeid=".$noticeid."&token=".$token);
+	// function Settlement(Req $req){
+	// 	$jsurl = config('sconstant.url');//结算请求域名地址
+	// 	$match_id = $req->match_id;
+	// 	$type = $req->type;
+	// 	$token = session('adminInfo.token');
+	// 	$notice = \App\Models\Comendnotice::where('match_id', $match_id)->first();
+	// 	$noticeid = $notice['id'];
+	// 	//查询赛事单式是否有订单
+	// 	$newapp = new \App\Models\MoneyBuyMatch();
+	// 	$simplex_ids = array_column($newapp->allsimplexorder($match_id,'zq'),'order_id');
+	// 	$str_ids = array_column($newapp->allstrorder($match_id),'order_id');
+
+	// 	if($simplex_ids && $str_ids){
+	// 		$requet = file_get_contents($jsurl."/WinFail?noticeid=".$noticeid."&token=".$token);
 			
-			if(json_decode($requet,true)['status']==1){
-				//单式结算
-				if($simplex_ids){
-					$simplex = array(
-			            'token'=>$token,  
-			            'order_ids'=>'', //订单id字符串,用半角都好分隔
-			            'bettype'=>1, //结算类型  1单式  2串式 
-			            'settype'=>$type, //结算次数  1首次  2非首冷饮
-			            'game_code'=>'zq', //赛事类型  zq lq wq bq
-			            'match_id'=>$match_id, // 赛事ID
-			            'change_status'=>1   //是否改状态
-			        );
-			        $url=$jsurl.'/Settelement';
-			        $newapp = new \App\Models\Stzqresult();
-			        $simplex_res = $newapp->post_curls($url,$simplex);//返回json
-					$huawei_res = json_decode($simplex_res,true);
-				}
+	// 		if(json_decode($requet,true)['status']==1){
+	// 			//单式结算
+	// 			if($simplex_ids){
+	// 				$simplex = array(
+	// 		            'token'=>$token,  
+	// 		            'order_ids'=>'', //订单id字符串,用半角都好分隔
+	// 		            'bettype'=>1, //结算类型  1单式  2串式 
+	// 		            'settype'=>$type, //结算次数  1首次  2非首冷饮
+	// 		            'game_code'=>'zq', //赛事类型  zq lq wq bq
+	// 		            'match_id'=>$match_id, // 赛事ID
+	// 		            'change_status'=>1   //是否改状态
+	// 		        );
+	// 		        $url=$jsurl.'/Settelement';
+	// 		        $newapp = new \App\Models\Stzqresult();
+	// 		        $simplex_res = $newapp->post_curls($url,$simplex);//返回json
+	// 				$huawei_res = json_decode($simplex_res,true);
+	// 			}
 
-				//串式结算
-				if($str_ids){
-					$tandem = array(
-			            'token'=>$token,  
-			            'order_ids'=>'', //订单id字符串,用半角都好分隔
-			            'bettype'=>2, //结算类型  1单式  2串式 
-			            'settype'=>$type, //结算次数  1首次  2非首冷饮
-			            'game_code'=>'zq', //赛事类型  zq lq wq bq
-			            'match_id'=>$match_id,  // 赛事ID
-			            'change_status'=>1  //是否改状态
-			        );
-			        $url=$jsurl.'/Settelement';
-			        $tandem_res = $newapp->post_curls($url,$tandem);//返回json
-					$tandem_res = json_decode($tandem_res,true);
-				}
-				if($huawei_res['status']==1 || $tandem_res['status']==1){
-					return json_encode(['status'=>1,'msg'=>'结算成功']);
-				}else{
-					return json_encode(['status'=>3,'msg'=>'结算有误,请联系管理员!!!']);//结算错误
-				}
-			}else{
-				return json_encode(['status'=>2,'msg'=>'结算有错,请联系管理员!!!']);;//输赢错误
-			}
-		}else{
-			$res = \App\Models\Stzqresult::where ('match_id', $match_id)->update(['status' =>3]);
-			$res = \App\Models\SportsSoccer::where ('match_id', $match_id)->update(['status' =>3]);
-            return json_encode(['status'=>4,'msg'=>'该赛事没有任何订单,将会结束该赛事!!!']);
-		}
-	}
+	// 			//串式结算
+	// 			if($str_ids){
+	// 				$tandem = array(
+	// 		            'token'=>$token,  
+	// 		            'order_ids'=>'', //订单id字符串,用半角都好分隔
+	// 		            'bettype'=>2, //结算类型  1单式  2串式 
+	// 		            'settype'=>$type, //结算次数  1首次  2非首冷饮
+	// 		            'game_code'=>'zq', //赛事类型  zq lq wq bq
+	// 		            'match_id'=>$match_id,  // 赛事ID
+	// 		            'change_status'=>1  //是否改状态
+	// 		        );
+	// 		        $url=$jsurl.'/Settelement';
+	// 		        $tandem_res = $newapp->post_curls($url,$tandem);//返回json
+	// 				$tandem_res = json_decode($tandem_res,true);
+	// 			}
+	// 			if($huawei_res['status']==1 || $tandem_res['status']==1){
+	// 				return json_encode(['status'=>1,'msg'=>'结算成功']);
+	// 			}else{
+	// 				return json_encode(['status'=>3,'msg'=>'结算有误,请联系管理员!!!']);//结算错误
+	// 			}
+	// 		}else{
+	// 			return json_encode(['status'=>2,'msg'=>'结算有错,请联系管理员!!!']);;//输赢错误
+	// 		}
+	// 	}else{
+	// 		$res = \App\Models\Stzqresult::where ('match_id', $match_id)->update(['status' =>3]);
+	// 		$res = \App\Models\SportsSoccer::where ('match_id', $match_id)->update(['status' =>3]);
+ //            return json_encode(['status'=>4,'msg'=>'该赛事没有任何订单,将会结束该赛事!!!']);
+	// 	}
+	// }
 
 	//足球结果列表
 	function outcome(Req $req) {
@@ -167,86 +167,86 @@ class SportsfootController extends Controller {
 	}
 
 	//结算 allhalf全场1,半场0
-	// function Settlement(Req $req){
-	// 	$allhalf = $req->allhalf?$req->allhalf:'';
-	// 	if(intval($allhalf)){
-	// 		//赛事id
-	// 		$id = $req->input('id');
-	// 		if (empty($id)) {
-	// 			return responseToJson(-2001); //
-	// 		}
-	// 		$ids = explode(',', $id);
-	// 		if (!is_array($ids) && intval($ids) < 0) {
-	// 			return responseToJson(-2002); //
-	// 		}
-	// 		if (is_array($ids) && count($ids) > 0) {
-	// 			foreach ($ids as $k => $v) {
-	// 				if (intval($v) < 1) {
-	// 					unset($ids[$k]);
-	// 				}
-	// 			}
-	// 		}
-	// 		for ($i=0; $i < count($ids); $i++) { 
-	// 			$model = \App\Models\Stzqresult::where('id', $ids[$i])->select("match_id","status")->first();
-	// 			//查询赛事下所有订单
-	// 			$ssid = $model['match_id'];//赛事id
-	// 			if($model['status']==2){
-	// 				$type = 1;;//是否再结算1,首次结算2,再次结算
-	// 			}else{
-	// 				$type = 2;
-	// 			}
+	function Settlement(Req $req){
+		$allhalf = $req->allhalf?$req->allhalf:'';
+		if(intval($allhalf)){
+			//赛事id
+			$id = $req->input('id');
+			if (empty($id)) {
+				return responseToJson(-2001); //
+			}
+			$ids = explode(',', $id);
+			if (!is_array($ids) && intval($ids) < 0) {
+				return responseToJson(-2002); //
+			}
+			if (is_array($ids) && count($ids) > 0) {
+				foreach ($ids as $k => $v) {
+					if (intval($v) < 1) {
+						unset($ids[$k]);
+					}
+				}
+			}
+			for ($i=0; $i < count($ids); $i++) { 
+				$model = \App\Models\Stzqresult::where('id', $ids[$i])->select("match_id","status")->first();
+				//查询赛事下所有订单
+				$ssid = $model['match_id'];//赛事id
+				if($model['status']==2){
+					$type = 1;;//是否再结算1,首次结算2,再次结算
+				}else{
+					$type = 2;
+				}
 				
-	// 			$newapp = new \App\Models\MoneyBuyMatch();
-	// 			$simplex_ids = array_column($newapp->allsimplexorder($ssid,'zq'),'order_id');
-	// 			$str_ids = array_column($newapp->allstrorder($ssid),'order_id');
-
-	// 			$data = \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->first();
-	// 			if($data){
-	// 				$tapp = new \App\Lib\Settlement\SettlementWinFail();
-	// 	            \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>0]);
-	// 				$ret = $tapp->doRun($data->toArray()['id']);
-	// 				$ret2 =$data->toArray()['id'];
-	// 	            if ($ret2['status']==1){
-	// 	                \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>4]);
-	// 	            }
-	// 	        }
+				$newapp = new \App\Models\MoneyBuyMatch();
+				$simplex_ids = array_column($newapp->allsimplexorder($ssid,'zq'),'order_id');
+				$str_ids = array_column($newapp->allstrorder($ssid),'order_id');
+
+				$data = \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->first();
+				if($data){
+					$tapp = new \App\Lib\Settlement\SettlementWinFail();
+		            \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>0]);
+					$ret = $tapp->doRun($data->toArray()['id']);
+					$ret2 =$data->toArray()['id'];
+		            if ($ret2['status']==1){
+		                \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>4]);
+		            }
+		        }
 				
-	// 			$SettlementOrder = new SettlementOrder();
-	// 		    $SettlementOrder->reSettlement($str_ids, 2,$type,'zq',$ssid,$allhalf);//串式
-	// 		    $data = $SettlementOrder->reSettlement($simplex_ids, 1,$type,'zq',$ssid,$allhalf);//单式注单
-	// 		}
-	// 		return responseToJson(1);
-	// 	}else{
-	// 		//查询赛事下所有订单
-	// 		$ssid = $req->match_id;//赛事id
-	// 		$type = $req->type;//是否再结算1,首次结算2,再次结算
+				$SettlementOrder = new SettlementOrder();
+			    $SettlementOrder->reSettlement($str_ids, 2,$type,'zq',$ssid,$allhalf);//串式
+			    $data = $SettlementOrder->reSettlement($simplex_ids, 1,$type,'zq',$ssid,$allhalf);//单式注单
+			}
+			return responseToJson(1);
+		}else{
+			//查询赛事下所有订单
+			$ssid = $req->match_id;//赛事id
+			$type = $req->type;//是否再结算1,首次结算2,再次结算
 			
-	// 		$newapp = new \App\Models\MoneyBuyMatch();
-	// 		$simplex_ids = array_column($newapp->allsimplexorder($ssid,'zq'),'order_id');
-	// 		$str_ids = array_column($newapp->allstrorder($ssid),'order_id');
-
-	// 		$data = \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->first();
-	// 		if($data){
-	// 			$tapp = new \App\Lib\Settlement\SettlementWinFail();
-	//             \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>0]);
-	// 			$ret = $tapp->doRun($data->toArray()['id']);
+			$newapp = new \App\Models\MoneyBuyMatch();
+			$simplex_ids = array_column($newapp->allsimplexorder($ssid,'zq'),'order_id');
+			$str_ids = array_column($newapp->allstrorder($ssid),'order_id');
+
+			$data = \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->first();
+			if($data){
+				$tapp = new \App\Lib\Settlement\SettlementWinFail();
+	            \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>0]);
+				$ret = $tapp->doRun($data->toArray()['id']);
 			
-	// 			$ret2 =$data->toArray()['id'];
-	//             if ($ret2['status']==1){
-	//                 \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>4]);
-	//             }
-
-	//             if($ret['status']==1){
-	// 				$SettlementOrder = new SettlementOrder();
-	// 		        $SettlementOrder->reSettlement($str_ids, 2,$type,'zq',$ssid);//串式
-	// 		        $nda = $SettlementOrder->reSettlement($simplex_ids, 1,$type,'zq',$ssid);//单式注单
-	// 		        return responseToJson($nda);
-	// 		    }else{
-	// 		    	return responseToJson($ret);
-	// 		    }
-	//         }
-	//     }
-	// }
+				$ret2 =$data->toArray()['id'];
+	            if ($ret2['status']==1){
+	                \App\Models\Comendnotice::where(['match_id'=>$ssid,'game_code'=>'zq'])->update(['status'=>4]);
+	            }
+
+	            if($ret['status']==1){
+					$SettlementOrder = new SettlementOrder();
+			        $SettlementOrder->reSettlement($str_ids, 2,$type,'zq',$ssid);//串式
+			        $nda = $SettlementOrder->reSettlement($simplex_ids, 1,$type,'zq',$ssid);//单式注单
+			        return responseToJson($nda);
+			    }else{
+			    	return responseToJson($ret);
+			    }
+	        }
+	    }
+	}
 
 	//作废
 	function revokeft(Req $req){

+ 8 - 4
app/Http/Controllers/Admin/SportswqController.php

@@ -57,26 +57,30 @@ class SportswqController extends Controller {
 		$orwhere = array();
 		if (!empty($home_team)) {
 			if (empty($sureblur) || $sureblur == 'off') {
-				$where[] = array('st_wq_result.home_team', 'like', '%' . $home_team . '%');
-				$orwhere[] = array('st_wq_result.guest_team', 'like', '%' . $home_team . '%');
+				$where[] = array('st_wq_result.home_player_name', 'like', '%' . $home_team . '%');
+				$orwhere[] = array('st_wq_result.guest_player_name', 'like', '%' . $home_team . '%');
 			} else {
-				$where[] = array('st_wq_result.home_team', '=', $home_team);
-				$orwhere[] = array('st_wq_result.guest_team', '=', $home_team);
+				$where[] = array('st_wq_result.home_player_name', '=', $home_team);
+				$orwhere[] = array('st_wq_result.guest_player_name', '=', $home_team);
 			}
 		}
 		if ($status != -1) {
 			$where[] = array('st_wq_result.status', '=', $status);
+			$orwhere[] = array('st_wq_result.status', '=', $status);
 		}
 		if (!empty($name_chinese)) {
 			$where[] = array('st_wq_result.name_chinese', '=', $name_chinese);
+			$orwhere[] = array('st_wq_result.name_chinese', '=', $name_chinese);
 		}
 		if (!empty($star_time)) {
             $star_time = date('Y-m-d H:i:s', strtotime($star_time));
             $where[] = array('st_wq_result.start_time', '>', $star_time);
+            $orwhere[] = array('st_wq_result.start_time', '>', $star_time);
         }
         if (!empty($end_time)) {
             $end_time = date('Y-m-d H:i:s', strtotime($end_time));
             $where[] = array('st_wq_result.start_time', '<', $end_time);
+            $orwhere[] = array('st_wq_result.start_time', '<', $end_time);
         }
         $newapp = new \App\Models\Stwqresult();
         $data = $newapp->resultlist($list, $page, $where, $orwhere);

+ 1 - 1
app/Models/Stbqresult.php

@@ -11,7 +11,7 @@ class Stbqresult extends BaseModel {
     protected $table = "st_bq_result";
     public $timestamps = false;
 
-    function getinfo($list = 10, $page, $where = '')
+    function getinfo($list = 10, $page, $where = '',$whereor = '')
     {
     	if (is_array ($where) && count ($where) > 0) {
             $data = $this->join('st_bq_league','st_bq_result.lg_id','=','st_bq_league.id')->join('st_bq_competition','st_bq_competition.id','=','st_bq_result.match_id')->select($this->table.'.id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.match_id','st_bq_result.guest_team','st_bq_result.home_rate','st_bq_result.guest_rate','st_bq_result.first_score','st_bq_result.status','st_bq_result.last_score','st_bq_result.match_score','st_bq_result.match_winer','st_bq_result.update_time','st_bq_competition.match_time','st_bq_result.match_process',$this->table.'.home_score',$this->table.'.guest_score',$this->table.'.u_guest_score',$this->table.'.u_home_score',$this->table.'.start_time','st_bq_league.name_chinese as saisname')->orderby('st_bq_result.id','desc')->where($where)->paginate ($list);

+ 2 - 2
app/Models/Stwqresult.php

@@ -9,10 +9,10 @@ class Stwqresult extends Model
     protected $table = 'st_wq_result';
     public $timestamps = false;
 
-    function resultlist($list = 10, $page, $where = '')
+    function resultlist($list = 10, $page, $where = '', $orwhere = '')
     {
         if (is_array ($where) && count ($where) > 0) {
-            $data = $this->join('st_wq_league','st_wq_result.lg_id','=','st_wq_league.id')->join('st_wq_competition','st_wq_competition.id','=','st_wq_result.match_id')->select($this->table.'.id',$this->table.'.home_player_name',$this->table.'.guest_player_name',$this->table.'.match_id','st_wq_result.first_score_player','st_wq_result.status','st_wq_result.last_score_player','st_wq_result.match_score','st_wq_result.update_time','st_wq_competition.match_time','st_wq_result.match_process',$this->table.'.home_player_score',$this->table.'.guest_player_score',$this->table.'.start_time','st_wq_league.name_chinese as saisname')->orderby('st_wq_result.id','desc')->where($where)->paginate ($list);
+            $data = $this->join('st_wq_league','st_wq_result.lg_id','=','st_wq_league.id')->join('st_wq_competition','st_wq_competition.id','=','st_wq_result.match_id')->select($this->table.'.id',$this->table.'.home_player_name',$this->table.'.guest_player_name',$this->table.'.match_id','st_wq_result.first_score_player','st_wq_result.status','st_wq_result.last_score_player','st_wq_result.match_score','st_wq_result.update_time','st_wq_competition.match_time','st_wq_result.match_process',$this->table.'.home_player_score',$this->table.'.guest_player_score',$this->table.'.start_time','st_wq_league.name_chinese as saisname')->orderby('st_wq_result.id','desc')->where($where)->orwhere($orwhere)->paginate ($list);
         } else {   
             $data = $this->join('st_wq_league','st_wq_result.lg_id','=','st_wq_league.id')->join('st_wq_competition','st_wq_competition.id','=','st_wq_result.match_id')->select($this->table.'.id',$this->table.'.home_player_name',$this->table.'.guest_player_name',$this->table.'.match_id','st_wq_result.first_score_player','st_wq_result.status','st_wq_result.last_score_player','st_wq_result.match_score','st_wq_result.update_time','st_wq_competition.match_time','st_wq_result.match_process',$this->table.'.home_player_score',$this->table.'.guest_player_score',$this->table.'.start_time','st_wq_league.name_chinese as saisname')->orderby('st_wq_result.id','desc')->paginate ($list); 
         }