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

+ 8 - 0
app/Http/Controllers/Admin/SportsbqController.php

@@ -7,6 +7,7 @@ use Illuminate\Http\Request as Req;
 use Illuminate\Support\Facades\DB;
 use App\Models;
 use Request;
+use App\Lib\Biz\Sport\Common as commonFunction;
 
 /**
  *棒球结果结算
@@ -224,6 +225,8 @@ class SportsbqController extends Controller {
 	function addend(Req $req){
 		$match_id = $req->match_id;
 		$model = \App\Models\Stbqresult::where('match_id', $match_id)->first();
+		$match = \App\Models\SportsBase::where('id', $match_id)->first();
+		$match_status = $match->status;
 
 		$uscore = array(
             "1" => array(
@@ -268,6 +271,11 @@ class SportsbqController extends Controller {
             ),
         );
 
+		//赛事下注单作废 处理
+		if(in_array(-1,$uscore)){
+			commonFunction::HandleInvalid($uscore,$match_id,$match_status,'bq');
+		}
+
 		\App\Models\Stbqresult::where('match_id', $match_id)->update(["match_score_t"=>json_encode($uscore)]);
 
 		//添加赛事结果记录

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

@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\DB;
 Use App\Lib\Settlement\SettlementOrder;
 use App\Models;
 use Request;
+use App\Lib\Biz\Sport\Common as commonFunction;
 
 /**
  *
@@ -235,6 +236,8 @@ class SportswqController extends Controller {
 	function addend(Req $req){
 		$match_id = $req->matchid;
 		$model = \App\Models\Stwqresult::where('match_id', $match_id)->first();
+		$match = \App\Models\SportsTennis::where('id', $match_id)->first();
+		$match_status = $match->status;
 
 		$data = array(
 			"1" => array(
@@ -259,6 +262,11 @@ class SportswqController extends Controller {
 			),
 		);
 
+		//赛事下注单作废 处理
+		if(in_array(-1,$data)){
+			commonFunction::HandleInvalid($data,$match_id,$match_status,'wq');
+		}
+
 		\App\Models\Stwqresult::where('match_id', $match_id)->update(["inning"=>json_encode($data)]);
 
         //添加赛事结果记录

+ 23 - 1
app/Http/Controllers/Api/WriteSportsController.php

@@ -436,6 +436,28 @@ class WriteSportsController extends BaseController
                     foreach ($match_uuids as $kk => $match_identity) {
                         if ($v['match_identity'] == $match_identity) {
                             $data = $v;
+                            /*
+                            //===追加查询 该赛事 本地是否存在 同联赛同球队 记录
+                            //查询赛事
+                            $matchData = $models['model_match']::where(['home_team' => $data['home_team'],'guest_team' => $data['guest_team'],'identity'=>$data['uuid']])->first();
+                            //如果已存在,删除
+                            if($matchData->id){
+                                //删除赔率 记录
+                                $del_odds_r =  $models['model_odds_record']::where(['match_id' => $matchData->id])->delete();
+                                //删除赔率
+                                $del_odds =  $models['model_odds']::where(['match_id' => $matchData->id])->delete();
+                                //删除赛事结果记录
+                                $del_result_record =  $models['model_result_record']::where(['match_id' => $matchData->id])->delete();
+                                //删除赛事结果
+                                $del_result =  $models['model_result']::where(['match_id' => $matchData->id])->delete();
+                                //删除中间表记录
+                                $del_local_match =  $models['model_local_match']::where(['match_id' => $matchData->id])->delete();
+                                //
+                                $models['model_match']::where(['id' => $matchData->id])->delete();
+                            }
+                            */
+
+                            //===end===
                             $half_match_id = $v['half_match_id'];
                             //获取 本地 联赛 ID
                             //验证本赛事是否有数据源lg_id
@@ -2715,7 +2737,7 @@ class WriteSportsController extends BaseController
             if(!empty($match_r_data)){
                 foreach($match_r_data as $k=>$v){
                     //删除已存在
-                    // $del = $models['model_result_express']::where('match_id',$v['match_id'])->delete();
+                    $del = $models['model_result_express']::where('match_id',$v['match_id'])->delete();
                     //==处理 赛事时间==
                     // dd($v['match_date'].' '.$v['match_time']);
                     $match_time_o = strtotime ($v['match_date'].' '.$v['match_time']);//原始美东时间 时间戳

+ 61 - 0
app/Lib/Biz/Sport/Common.php

@@ -1523,13 +1523,74 @@ class Common
 
         //===网球===
         if($game_code == 'wq'){
+            //第一盘
+            $matchOdds_o = [];
+            //第二盘
+            $matchOdds_t = [];
+            //第三盘
+            $matchOdds_s = [];
+            //第四盘
+            $matchOdds_fo = [];
+            //第五盘
+            $matchOdds_fi = [];
+            //全场
+            $matchOdds_ff = [];
+
+            foreach($match_order as $k=>$v){
+                //第一盘条件
+                if($data[1]['home'] == -1 and $data[1]['guest'] == -1){
+                    $matchOdds_o[] = self::getOrderJC('一盘',$v);
+                }
+                //第二盘条件
+                if($data[2]['home'] == -1 and $data[2]['guest'] == -1){
+                    $matchOdds_t[] = self::getOrderJC('二盘',$v);
+                }
+                //第三盘条件
+                if($data[3]['home'] == -1 and $data[3]['guest'] == -1){
+                    $matchOdds_s[] = self::getOrderJC('三盘',$v);
+                }
+                //第四盘条件
+                if($data[4]['home'] == -1 and $data[4]['guest'] == -1){
+                    $matchOdds_fo[] = self::getOrderJC('四盘',$v);
+                }
+                //第五盘条件
+                if($data[5]['home'] == -1 and $data[5]['guest'] == -1){
+                    $matchOdds_fi[] = self::getOrderJC('五盘',$v);
+                }
+                //全场条件
+                if($data[1]['home'] == -1 and $data[1]['guest'] == -1 and $data[2]['home'] == -1 and $data[2]['guest'] == -1 and $data[3]['home'] == -1 and $data[3]['guest'] == -1 and $data[4]['home'] == -1 and $data[4]['guest'] == -1 and $data[5]['home'] == -1 and $data[5]['guest'] == -1){
+                    $matchOdds_ff[] = self::getOrderJC('让盘',$v);
+                    $matchOdds_ff[] = self::getOrderJC('让局',$v);
+                    $matchOdds_ff[] = self::getOrderJC('总局数',$v);
+                    $matchOdds_ff[] = self::getOrderJC('冠军',$v);
+                }
 
+            }
+            //合并待处理 注单
+            $orderData = array_merge($matchOdds_o,$matchOdds_t,$matchOdds_s,$matchOdds_fo,$matchOdds_fi,$matchOdds_ff);
         }
         //===end===
 
         //===棒球===
         if($game_code == 'bq'){
+            //前五局
+            $matchOdds_five = [];
+            //全场
+            $matchOdds_ff = [];
+
+            foreach($match_order as $k=>$v){
+                //前五局条件
+                if($data[1]['home'] == -1 and $data[1]['guest'] == -1 and $data[2]['home'] == -1 and $data[2]['guest'] == -1 and $data[3]['home'] == -1 and $data[3]['guest'] == -1 and $data[4]['home'] == -1 and $data[4]['guest'] == -1 and $data[5]['home'] == -1 and $data[5]['guest'] == -1){
+                    $matchOdds_five[] = self::getOrderJC('前5局',$v);
+                }
+                //全场条件
+                if($data[1]['home'] == -1 and $data[1]['guest'] == -1 and $data[2]['home'] == -1 and $data[2]['guest'] == -1 and $data[3]['home'] == -1 and $data[3]['guest'] == -1 and $data[4]['home'] == -1 and $data[4]['guest'] == -1 and $data[5]['home'] == -1 and $data[5]['guest'] == -1 and $data[6]['home'] == -1 and $data[6]['guest'] == -1 and $data[7]['home'] == -1 and $data[7]['guest'] == -1 and $data[8]['home'] == -1 and $data[8]['guest'] == -1 and $data[9]['home'] == -1 and $data[9]['guest'] == -1 and $data['other']['home'] == -1 and $data['other']['guest'] == -1){
+                    $matchOdds_ff[] = self::getOrderJC('全场',$v);
+                }
 
+            }
+            //合并待处理 注单
+            $orderData = array_merge($matchOdds_five,$matchOdds_ff);
         }
         //===end===