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

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

@@ -72,6 +72,7 @@ class SoccerNoteListController extends Controller
         $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
         $type = Request::has('type') ? Request::get('type') : 'zq';
         $where = array();
+        // $where[] = array('money_buy_simplex.is_champion', '=', 0);
         if (!empty($account)) {
             if (empty($sureblur) || $sureblur == 'off') {
                 $where[] = array('money_buy_simplex.account_name', 'like', '%' . $account . '%');

+ 50 - 10
app/Http/Controllers/Admin/SportsbqController.php

@@ -175,12 +175,10 @@ class SportsbqController extends Controller {
 		$match_id = $req->match_id;
 		$newapp = \App\Models\Stbqresult::where('match_id', $match_id)->first();
 
-		$array =array(
-			// 'corner_ball' => json_decode($newapp['corner_ball'],true),
-			// 'penalty_card' => json_decode($newapp['penalty_card'],true),
-			'bqresult' => $newapp,
+		$jieguo =array(
+			'bqresult' => json_decode($newapp['match_score_t'],true),
 		);
-		return $array;
+		return $jieguo;
 	}
 
 	function onlyresult(Req $req){
@@ -191,12 +189,54 @@ class SportsbqController extends Controller {
 
 	//结果添加
 	function addend(Req $req){
-		$match_id = $req->matchid;
+		$match_id = $req->match_id;
 		$model = \App\Models\Stbqresult::where('match_id', $match_id)->first();
-		$model->first_score = $req->firstscoreplayer?$req->firstscoreplayer:0;
-		$model->last_score = $req->lastscoreplayer?$req->lastscoreplayer:0;
-		$model->match_winer = $req->matchwinerplayer?$req->matchwinerplayer:0;
-        $model->save();
+
+		$uscore = array(
+            "1" => array(
+                'home' => intval($req->homea)?intval($req->homea):1,
+                'guest' => intval($req->guesta)?intval($req->guesta):0,
+            ),
+            "2" => array(
+                'home' => intval($req->homeb)?intval($req->homeb):0,
+                'guest' => intval($req->guestb)?intval($req->guestb):0,
+            ),
+            "3" => array(
+                'home' => intval($req->homec)?intval($req->homec):0,
+                'guest' => intval($req->guestc)?intval($req->guestc):0,
+            ),
+            "4" => array(
+                'home' => intval($req->homed)?intval($req->homed):0,
+                'guest' => intval($req->guestd)?intval($req->guestd):0,
+            ),
+            "5" => array(
+                'home' => intval($req->homee)?intval($req->homee):0,
+                'guest' => intval($req->gueste)?intval($req->gueste):0,
+            ),
+            "6" => array(
+                'home' => intval($req->homef)?intval($req->homef):0,
+                'guest' => intval($req->guestf)?intval($req->guestf):0,
+            ),
+            "7" => array(
+                'home' => intval($req->homeg)?intval($req->homeg):0,
+                'guest' => intval($req->guestg)?intval($req->guestg):0,
+            ),
+            "8" => array(
+                'home' => intval($req->homeh)?intval($req->homeh):0,
+                'guest' => intval($req->guesth)?intval($req->guesth):0,
+            ),
+            "9" => array(
+                'home' => intval($req->homei)?intval($req->homei):0,
+                'guest' => intval($req->guesti)?intval($req->guesti):0,
+            ),
+            "other" => array(
+                'home' => intval($req->homej)?intval($req->homej):0,
+                'guest' => intval($req->guestj)?intval($req->guestj):0,
+            ),
+        );
+
+		\App\Models\Stbqresult::where('match_id', $match_id)->update(["match_score_t"=>json_encode($uscore)]);
+       
         return responseToJson(1);
 	}
 

+ 27 - 6
app/Http/Controllers/Admin/SportswqController.php

@@ -184,11 +184,11 @@ class SportswqController extends Controller {
 
 	//查询赛事结果 
 	function Matchresult(Req $req){
-		$match_id = $req->match_id;
+		$match_id = $req->match_id;//14
 		$newapp = \App\Models\Stwqresult::where('match_id', $match_id)->first();
 
 		$array =array(
-			'wqresult' => $newapp,
+			'wqresult' => json_decode($newapp['inning'],true),
 		);
 		return $array;
 	}
@@ -203,11 +203,32 @@ class SportswqController extends Controller {
 	function addend(Req $req){
 		$match_id = $req->matchid;
 		$model = \App\Models\Stwqresult::where('match_id', $match_id)->first();
-		$model->first_score_player = $req->first_score_player?$req->first_score_player:0;
-		$model->last_score_player = $req->last_score_player?$req->last_score_player:0;
-		$model->match_winer_player = $req->match_winer_player?$req->match_winer_player:0;
 
-        $model->save();
+		$data = array(
+			"1" => array(
+				'home' => intval($req->homeo)?intval($req->homeo):0,
+				'guest' => intval($req->guesto)?intval($req->guesto):0,
+			),
+			"2" => array(
+				'home' => intval($req->homet)?intval($req->homet):0,
+				'guest' => intval($req->guestt)?intval($req->guestt):0,
+			),
+			"3" => array(
+				'home' => intval($req->homes)?intval($req->homes):0,
+				'guest' => intval($req->guests)?intval($req->guests):0,
+			),
+			"4" => array(
+				'home' => intval($req->homef)?intval($req->homef):0,
+				'guest' => intval($req->guestf)?intval($req->guestf):0,
+			),
+			"5" => array(
+				'home' => intval($req->homee)?intval($req->homee):0,
+				'guest' => intval($req->gueste)?intval($req->gueste):0,
+			),
+		);
+
+		\App\Models\Stwqresult::where('match_id', $match_id)->update(["inning"=>json_encode($data)]);
+
         return responseToJson(1);
 	}
 

+ 12 - 7
app/Http/Controllers/Api/SettlementController.php

@@ -5,7 +5,7 @@ namespace App\Http\Controllers\Api;
 use App\Http\Model\StSettlementMiddleDetail;
 use App\Lib\Settlement\Adapter\RulePlus;
 use App\Lib\Settlement\SettlementOrder;
-use App\Lib\Settlement\Adapter\ZqRule;
+use App\Lib\Settlement\Adapter\WqRule;
 
 
 use App\Lib\Settlement\SettlementWinFail;
@@ -35,17 +35,22 @@ class SettlementController extends Controller
     {
 
         $match = DB::table('money_buy_match')->where(['batch_id' => '156741065534'])->first();
-        $result = DB::table('st_zq_result')->where(['match_id' => '605'])->get();
-        $rule = new  ZqRule();
+        //$result = DB::table('st_zq_result')->where(['match_id' => '605'])->get();
+        $result = DB::table('st_wq_result')->where(['id' => '20'])->get();
+        $rule = new  WqRule();
 
-        print_r([$match,$result]);
+        //print_r([$match, $result]);
+        // return ;
 
-        $result = $rule->flbfh($match, $result, []);
-        print_r($result);
+        //$resultb = $rule->bq_getResultBySn($result, 1,1);
+        //print_r($resultb);
+        //return;
 
+        $resultb = $rule->wq_scoreDatas($result);
+        print_r($resultb);
 
-        exit;
 
+        exit;
 
 
         return;

+ 0 - 6
app/Http/Model/StZqResult.php

@@ -178,12 +178,6 @@ class StZqResult extends Model
                         }                   
                     }
                 }
-                /*
-                if(!empty($set_match_r)){
-                    $ret = $model['model_result']::insert($set_match_r);
-                    if($ret != true) throw new \Exception( Response::generate('',Response::ADD_MATCH_R_ERROR));
-                }
-                */
             }
         }
 

+ 44 - 25
app/Lib/Settlement/Adapter/BqRule.php

@@ -12,7 +12,9 @@ class BqRule
 {
     use RulePlus;
 
-    public function concede($model, $resultModels, $resultRecords)
+
+    //让球
+    public function CO($model, $resultModels, $resultRecords)
     {
         $stand_Datas = $this->bq_scoreDatas($resultModels);
         $odds_code = $model->odds_code;
@@ -24,26 +26,27 @@ class BqRule
         $condition = $model->condition;
 
         switch ($odds_code) {
-            case 'concede_home':
+            case 'coh':
                 $return = $this->zq_letball($home - $guest, $condition, $home . '-' . $guest . '(全场)');
                 break;
-            case 'concede_guest':
+            case 'cog':
                 $return = $this->zq_letball($guest - $home, $condition, $home . '-' . $guest . '(全场)');
                 break;
-            case 'five_concede_guest':
+            case 'cog_5':
                 $return = $this->zq_letball($home_half - $guest_half, $condition, $home_half . '-' . $guest_half . '(半场)');
                 break;
-            case 'five_concede_home':
+            case 'coh_5':
                 $return = $this->zq_letball($home_half - $guest_half, $condition, $home_half . '-' . $guest_half . '(半场)');
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
                 break;
         }
         return $return;
     }
 
-    public function total_size($model, $resultModels, $resultRecords)
+    //总得分大小
+    public function TN($model, $resultModels, $resultRecords)
     {
         $stand_Datas = $this->bq_scoreDatas($resultModels);
         $odds_code = $model->odds_code;
@@ -55,26 +58,28 @@ class BqRule
         $condition = $model->condition;
 
         switch ($odds_code) {
-            case 'total_size_big':
+            case 'tnb':
                 $return = $this->zq_inball_bigsmall($home + $guest, $condition, 2, $home . '-' . $guest . '(全场)');
                 break;
-            case 'total_size_small':
+            case 'tns':
                 $return = $this->zq_inball_bigsmall($home + $guest, $condition, 1, $home . '-' . $guest . '(全场)');
                 break;
-            case 'five_total_size_big':
+            case 'tnb_5':
                 $return = $this->zq_inball_bigsmall($home_half + $guest_half, $condition, 2, $home_half . '-' . $guest_half . '(半场)');
                 break;
-            case 'five_total_size_small':
+            case 'tns_5':
                 $return = $this->zq_inball_bigsmall($home_half + $guest_half, $condition, 1, $home_half . '-' . $guest_half . '(半场)');
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
                 break;
         }
         return $return;
     }
 
-    public function two_sides($model, $resultModels, $resultRecords)
+
+    //单双
+    public function TS($model, $resultModels, $resultRecords)
     {
         $stand_Datas = $this->bq_scoreDatas($resultModels);
         $odds_code = $model->odds_code;
@@ -84,21 +89,23 @@ class BqRule
         $condition = $model->condition;
 
         switch ($odds_code) {
-            case 'two_sides_single':
+            case 'tss':
                 $return = $this->zq_doublesing($home + $guest, $condition, $home . '-' . $guest . '(全场)');
                 break;
-            case 'two_sides_double':
+            case 'tsd':
                 $return = $this->zq_doublesing($home + $guest, $condition, $home . '-' . $guest . '(全场)');
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
                 break;
         }
         return $return;
 
     }
 
-    public function capot($model, $resultModels, $resultRecords)
+
+    //独赢
+    public function C($model, $resultModels, $resultRecords)
     {
         $stand_Datas = $this->bq_scoreDatas($resultModels);
         $odds_code = $model->odds_code;
@@ -108,7 +115,7 @@ class BqRule
 
 
         switch ($odds_code) {
-            case 'capot_home':
+            case 'ch':
                 if ($home > $guest) {
                     $return['result'] = 1;
                 } else {
@@ -117,7 +124,7 @@ class BqRule
                 $return['matchResult'] = $home . '-' . $guest . '(全场)';
 
                 break;
-            case 'capot_guest':
+            case 'cg':
                 if ($guest > $home) {
                     $return['result'] = 1;
                 } else {
@@ -136,14 +143,26 @@ class BqRule
     //棒球 type ==1 返回第$sn节   ==2返回上下节,sn=1上半场,sn=2下半场    type==4全部按节数的数组
     public function bq_getResultBySn($recoreModesArray, $type = 4, $sn = 1)
     {
+        if (!isset($recoreModesArray['0']) || empty($recoreModesArray['0'])) {
+            throw new  \Exception("网球结果不能为空");
+            return;
+        }
+        $RecoedModel = $recoreModesArray['0'];
+
+        $imatch_id = $RecoedModel->match_id;
+        $all_datas = json_decode($RecoedModel->match_score_t, true);
+
         $return = [];
-        foreach ($recoreModesArray as $key => $val) {
-            $nowsn = intval($val->match_process);
-            $return[$nowsn] = $val;
+        foreach ($all_datas as $key => $val) {
+            $tt = clone $RecoedModel;
+            $tmpobj = json_decode(json_encode($tt, 256), true);
+            $tmpobj['home_score'] = $all_datas[$key]['home'];
+            $tmpobj['guest_score'] = $all_datas[$key]['guest'];
+            $return[$key] = json_decode(json_encode($tmpobj, 256));
         }
 
-        if (count($return)!=9 || !empty(array_diff([1,2,3,4,5,6,7,8,9],array_keys($return)))){
-            throw new  \Exception("棒球球结果不为9的数组,或match_process有错");
+        if (count($return) != 10 || !empty(array_diff([1, 2, 3, 4, 5, 6, 7, 8, 9, 'other'], array_keys($return)))) {
+            throw new  \Exception("棒球球结果不为10的数组,或match_process有错");
         }
 
         if ($type == 4) {
@@ -188,7 +207,7 @@ class BqRule
             $return['all']['home'] += $tmp_home;
             $return['all']['guest'] += $tmp_guest;
 
-            if (in_array($key,[1,2,3,4,5])) {
+            if (in_array($key, [1, 2, 3, 4, 5])) {
                 $return['half']['home'] += $tmp_home;
                 $return['half']['guest'] += $tmp_guest;
             } else {

+ 1 - 1
app/Lib/Settlement/Adapter/RulePlus.php

@@ -6,7 +6,7 @@ namespace App\Lib\Settlement\Adapter;
 trait RulePlus
 {
 
-    public $return_he = ['result' => '2', 'matchResult' => '无规则和'];
+    public $return_he = ['result' => '2', 'matchResult' => 'error无规则和'];
     public $return_fail = ['result' => '-1', 'matchResult' => ''];
     public $return_error = ['result' => '100', 'matchResult' => '无胜负判断规则'];
 

+ 78 - 59
app/Lib/Settlement/Adapter/WqRule.php

@@ -14,19 +14,19 @@ class WqRule
     use RulePlus;
 
     //冠军
-    public function kemp($model, $resultModel, $resultRecords)
+    public function C($model, $resultModel, $resultRecords)
     {
         $odds_code = $model->odds_code;
         $home_team = trim($model->home_team);
         $guest_team = trim($model->guest_team);
 
-        if (in_array($odds_code, ['kemp_home', 'kemp_guest'])) {
+        if (in_array($odds_code, ['ch', 'cg'])) {
             $resultModel = DB::table('st_wq_league_result')->where(['lg_id' => $model->lg_id, 'status' => 1])->first();
             $all_winner = trim($resultModel->result);
             if (!$resultModel) {
                 throw new  \Exception("没有找到冠军数据-" . $model->lg_id);
             }
-            if ($odds_code == 'kemp_home') {
+            if ($odds_code == 'ch') {
                 return $this->wq_gj_all($all_winner, $home_team);
             } else {
                 return $this->wq_gj_all($all_winner, $guest_team);
@@ -35,20 +35,20 @@ class WqRule
 
         $stand_datas = $this->wq_scoreDatas($resultModel);
         switch ($odds_code) {
-            case 'one_kemp_home':
+            case 'ch_1':
                 $return = $this->wq_gj_sine($home_team, $guest_team, $stand_datas['list']['1'], 1);
                 break;
-            case 'one_kemp_guest':
+            case 'cg_1':
                 $return = $this->wq_gj_sine($home_team, $guest_team, $stand_datas['list']['1'], 2);
                 break;
-            case 'two_kemp_home':
+            case 'ch_2':
                 $return = $this->wq_gj_sine($home_team, $guest_team, $stand_datas['list']['2'], 1);
                 break;
-            case 'two_kemp_guest':
+            case 'cg_2':
                 $return = $this->wq_gj_sine($home_team, $guest_team, $stand_datas['list']['2'], 2);
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
                 break;
         }
         return $return;
@@ -87,7 +87,7 @@ class WqRule
 
 
     //让盘
-    public function dishes($model, $resultModel, $resultRecords)
+    public function LD($model, $resultModel, $resultRecords)
     {
         $odds_code = $model->odds_code;
         $stand_datas = $this->wq_scoreDatas($resultModel);
@@ -96,21 +96,21 @@ class WqRule
         $guest_score = $stand_datas['all']['guest'];
 
         switch ($odds_code) {
-            case 'dishes_home':
+            case 'ldh':
                 $return = $this->zq_letball($home_score - $guest_score, $condition, $guest_score . '-' . $guest_score . ('总盘'));
                 break;
-            case 'dishes_guest':
+            case 'ldg':
                 $return = $this->zq_letball($guest_score - $home_score, $condition, $guest_score . '-' . $guest_score . ('总盘'));
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
                 break;
         }
         return $return;
     }
 
     //让局
-    public function bureau($model, $resultModel, $resultRecords)
+    public function LB($model, $resultModel, $resultRecords)
     {
         $odds_code = $model->odds_code;
         $condition = $model->condition;
@@ -119,20 +119,20 @@ class WqRule
         $all_guest = $stand_datas['allinning']['guest'];
 
         switch ($odds_code) {
-            case 'bureau_home':
+            case 'lbh':
                 $return = $this->zq_letball($all_home - $all_guest, $condition, $all_home . '-' . $all_guest . ('总局数'));
                 break;
-            case 'bureau_guest':
+            case 'lbg':
                 $return = $this->zq_letball($all_guest - $all_home, $condition, $all_home . '-' . $all_guest . ('总局数'));
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
         }
         return $return;
     }
 
     //总局数:大/小
-    public function total_number($model, $resultModel, $resultRecords)
+    public function TN($model, $resultModel, $resultRecords)
     {
         $odds_code = $model->odds_code;
         $condition = $model->condition;
@@ -141,32 +141,46 @@ class WqRule
         $all_guest = $stand_datas['allinning']['guest'];
         $all = $all_home + $all_guest;
 
-        $one_home = $stand_datas['oneinning']['home'];
-        $one_guest = $stand_datas['oneinning']['guest'];
-        $one_all = $one_home + $one_guest;
-
         switch ($odds_code) {
-            case 'total_number_big':
+            case 'tnb':
                 $return = $this->zq_inball_bigsmall($all, $condition, 2, $all . '(总局数)');
                 break;
-            case 'total_number_small':
+            case 'tns':
                 $return = $this->zq_inball_bigsmall($all, $condition, 1, $all . '(总局数)');
                 break;
-            case 'one_total_number_big':
-                $return = $this->zq_inball_bigsmall($one_all, $condition, 2, $all . '(第1盘局数)');
+            case 'tnb_1':
+                $tmpall = intval($stand_datas['list']['1']->home_score) + intval($stand_datas['list']['1']->guest_score);
+                $return = $this->zq_inball_bigsmall($tmpall, $condition, 2, $tmpall . '(第1盘局数)');
+                break;
+            case 'tns_1':
+                $tmpall = intval($stand_datas['list']['1']->home_score) + intval($stand_datas['list']['1']->guest_score);
+                $return = $this->zq_inball_bigsmall($tmpall, $condition, 1, $tmpall . '(第1盘局数)');
+                break;
+            case 'tnb_2':
+                $tmpall = intval($stand_datas['list']['2']->home_score) + intval($stand_datas['list']['2']->guest_score);
+                $return = $this->zq_inball_bigsmall($tmpall, $condition, 2, $tmpall . '(第2盘局数)');
+                break;
+            case 'tns_2':
+                $tmpall = intval($stand_datas['list']['2']->home_score) + intval($stand_datas['list']['2']->guest_score);
+                $return = $this->zq_inball_bigsmall($tmpall, $condition, 1, $tmpall . '(第2盘局数)');
                 break;
-            case 'one_total_number_small':
-                $return = $this->zq_inball_bigsmall($one_all, $condition, 1, $all . '(第1盘局数)');
+            case 'tnb_3':
+                $tmpall = intval($stand_datas['list']['3']->home_score) + intval($stand_datas['list']['3']->guest_score);
+                $return = $this->zq_inball_bigsmall($tmpall, $condition, 2, $tmpall . '(第3盘局数)');
+                break;
+            case 'tns_3':
+                $tmpall = intval($stand_datas['list']['3']->home_score) + intval($stand_datas['list']['3']->guest_score);
+                $return = $this->zq_inball_bigsmall($tmpall, $condition, 1, $tmpall . '(第3盘局数)');
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
         }
         return $return;
 
     }
 
     //总局数:单/双
-    public function two_game_sides($model, $resultModel, $resultRecords)
+    public function TS($model, $resultModel, $resultRecords)
     {
         $odds_code = $model->odds_code;
         $condition = $model->condition;
@@ -176,19 +190,19 @@ class WqRule
         $all = $all_home + $all_guest;
 
         switch ($odds_code) {
-            case 'two_sides_single':
-            case 'two_sides_double':
+            case 'tss':
+            case 'tsd':
                 $return = $this->zq_doublesing($all, $condition, $all . '(总局数)');
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
         }
         return $return;
 
     }
 
     //波胆
-    public function bodan($model, $resultModel, $resultRecords)
+    public function B($model, $resultModel, $resultRecords)
     {
         $odds_code = $model->odds_code;
         $stand_datas = $this->wq_scoreDatas($resultModel);
@@ -197,20 +211,20 @@ class WqRule
         $word = $all_home . '-' . $all_guest . '(比分)';
 
         switch ($odds_code) {
-            case 'three_bodan_home_two_zero':
+            case 'b20_3':
                 $return = $this->bodan_fun($all_home, $all_guest, '2-0', $word);
                 break;
-            case 'three_bodan_home_two_one':
+            case 'b21_3':
                 $return = $this->bodan_fun($all_home, $all_guest, '2-1', $word);
                 break;
-            case 'three_bodan_guest_zero_two':
+            case 'b02_3':
                 $return = $this->bodan_fun($all_home, $all_guest, '0-2', $word);
                 break;
-            case 'three_bodan_gueste_one_two':
+            case 'b12_3':
                 $return = $this->bodan_fun($all_home, $all_guest, '1-2', $word);
                 break;
             default:
-                $return = $this->return_error;
+                $return = $this->return_he;
         }
         return $return;
     }
@@ -231,22 +245,29 @@ class WqRule
 
     public function wq_getResultBySn($recoreModesArray, $type = 4, $sn = 1)
     {
-        $return = [];
-        foreach ($recoreModesArray as $key => $val) {
-            $nowsn = intval($val->match_process);
-            $return[$nowsn] = $val;
+        if (!isset($recoreModesArray['0']) || empty($recoreModesArray['0'])) {
+            throw new  \Exception("网球结果不能为空");
+            return;
         }
+        $RecoedModel = $recoreModesArray['0'];
 
-        //网球只能为三盘或5盘
-        if (count($return) != 3 || count($return) != 5) {
-            throw new  \Exception("网球球结果不为3或5的数组,或match_process有错");
-        } else {
-            if (count($return) == 3 && !empty(array_diff([1, 2, 3], array_keys($return)))) {
-                throw new  \Exception("网球球结果不为3的数组,或match_process有错");
-            }
-            if (count($return) == 5 && !empty(array_diff([1, 2, 3, 4, 5], array_keys($return)))) {
-                throw new  \Exception("网球球结果不为5的数组,或match_process有错");
-            }
+        $imatch_id = $RecoedModel->match_id;
+        $all_datas = json_decode($RecoedModel->inning, true);
+
+        $panlen = count($all_datas);
+        if (empty($all_datas) || !in_array($panlen, [3, 5])) {
+            throw new  \Exception("篮球结果数据不正确,( matchid= $imatch_id 主客结果)不能为空或数据量不为3,5");
+            return;
+        }
+
+        $return = [];
+        for ($i = 1; $i <= $panlen; $i++) {
+            $tt = clone $RecoedModel;
+            $tmpobj = json_decode(json_encode($tt, 256), true);
+            $tmpobj['home_score'] = $all_datas[$i]['home'];
+            $tmpobj['guest_score'] = $all_datas[$i]['guest'];
+            $tmpobj['winner'] = ($all_datas[$i]['home'] > $all_datas[$i]['guest']) ? 'home' : 'guest';
+            $return[$i] = json_decode(json_encode($tmpobj, 256));
         }
 
         if ($type == 4) {
@@ -275,16 +296,14 @@ class WqRule
             $tmp_home = intval($val->home_score);
             $tmp_guest = intval($val->guest_score);
 
-            $return['all']['home'] += $tmp_home;
-            $return['all']['guest'] += $tmp_guest;
+            ($tmp_home > $tmp_guest) ? ($return['all']['home']++) : ($return['all']['guest']++);
 
-            $juinfo = $this->wq_JuInfo($val);
-            $return['allinning']['home'] += $juinfo['all']['home'];
-            $return['allinning']['guest'] += $juinfo['all']['guest'];
+            $return['allinning']['home'] += $tmp_home;
+            $return['allinning']['guest'] += $tmp_guest;
 
             if ($key == 1) {
-                $return['oneinning']['home'] = $juinfo['all']['home'];
-                $return['oneinning']['guest'] = $juinfo['all']['guest'];
+                $return['oneinning']['home'] = $tmp_home;
+                $return['oneinning']['guest'] = $tmp_guest;
             }
         }
         return $return;

+ 16 - 8
app/Models/SportsNoteList.php

@@ -16,15 +16,16 @@ class SportsNoteList extends BaseModel {
         $data = $this
             ->join('money_details','money_details.info_identity','=','money_buy_simplex.info_identity')
             ->join('st_'.$type.'_competition','st_'.$type.'_competition.id','=','money_buy_simplex.match_id')
-            ->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.id')
-            ->select('money_buy_simplex.id','money_buy_simplex.account_name','money_buy_simplex.account_identity','money_buy_simplex.order_id','money_buy_simplex.money','money_buy_simplex.prize_money','money_buy_simplex.status','money_buy_simplex.money_time','money_buy_simplex.settle_status','money_buy_simplex.gain_money','money_buy_simplex.game_code','money_buy_simplex.match_id','money_buy_simplex.game_status','st_'.$type.'_competition.home_team','st_'.$type.'_competition.guest_team','st_'.$type.'_competition.match_date','st_'.$type.'_competition.match_time','st_'.$type.'_competition.lg_id','st_'.$type.'_competition.status as match_status','money_details.money_cash','money_buy_simplex.batch_id','st_'.$type.'_league.name_chinese','st_'.$type.'_league.last_time')
+            // ->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.id')
+            ->join('st_'.$type.'_league','money_buy_simplex.lg_id','=','st_'.$type.'_league.id')
+
+            ->select('money_buy_simplex.id','money_buy_simplex.account_name','money_buy_simplex.is_champion','money_buy_simplex.account_identity','money_buy_simplex.order_id','money_buy_simplex.money','money_buy_simplex.prize_money','money_buy_simplex.status','money_buy_simplex.money_time','money_buy_simplex.settle_status','money_buy_simplex.gain_money','money_buy_simplex.game_code','money_buy_simplex.match_id','money_buy_simplex.game_status','st_'.$type.'_competition.home_team','st_'.$type.'_competition.guest_team','st_'.$type.'_competition.match_date','st_'.$type.'_competition.match_time','st_'.$type.'_competition.lg_id','st_'.$type.'_competition.status as match_status','money_details.money_cash','money_buy_simplex.batch_id','st_'.$type.'_league.name_chinese','st_'.$type.'_league.last_time')
             ->where($where)
             ->orderby('money_buy_simplex.money_time','desc')
             ->paginate ($list);
         if (!$data < 0) {
             return -2021052003; //
         }
-
         //反水
         $water_return_money = \App\Models\Money_details::where('trade_type','7')->get();
 
@@ -55,7 +56,7 @@ class SportsNoteList extends BaseModel {
         }
 
         //玩法
-        $result = \App\Models\Matchcode::where('game_code','zq')->get();
+        $result = \App\Models\Matchcode::where('game_code',$type)->get();
         //$result = \App\Model\Matchcode::get();
 
 
@@ -96,9 +97,16 @@ class SportsNoteList extends BaseModel {
 
             $data[$i]->league = $data[$i]->name_chinese;
 
-            $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
-            $data[$i]->time = '开赛:'.$data[$i]->match_date.' '.$data[$i]->match_time;
-            $data[$i]->money_match_time = '下注:'.$data[$i]->money_time.'<br>'.$data[$i]->time;
+
+            if($data[$i]->is_champion == 0){
+                $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
+                $data[$i]->time = '开赛:'.$data[$i]->match_date.' '.$data[$i]->match_time;
+            }else{
+                $data[$i]->home_guest = '冠军联赛投注';
+                $data[$i]->time = '结束:'.$data[$i]->last_time;
+
+            }
+            $data[$i]->money_match_time = '下注:'.$data[$i]->money_time.$data[$i]->time;
 
             //反水
             $data[$i]->water_return = -1;
@@ -324,7 +332,7 @@ class SportsNoteList extends BaseModel {
         }
 
         //玩法
-        $result = \App\Models\Matchcode::where('game_code','zq')->get();
+        $result = \App\Models\Matchcode::where('game_code',$type)->get();
         //$result = \App\Model\Matchcode::get();
 
 

Разница между файлами не показана из-за своего большого размера
+ 7 - 244
resources/views/admin/Sportsbq/outcome.blade.php


+ 37 - 301
resources/views/admin/Sportswq/outcome.blade.php

@@ -3,124 +3,7 @@
     网球赛事
 @endsection
 @section('content')
-    <style>
-        .layui-laydate-range {
-            width: auto;
-        }
-
-        .layui-form-switch em {
-            width: auto;
-        }
-
-        .layui-form-switch {
-            width: 44px;
-            line-height: 23px;
-        }
-
-        .layui-form-item .checkbox {
-            width: auto;
-        }
-    </style>
-
-    <!-- 样式 -->
-<style type="text/css">
-    /* 弹窗 (background) */
-    .modal {
-        display: none; /* 默认隐藏 */
-        /*生成绝对定位的元素,相对于浏览器窗口进行定位。*/
-        position: fixed; 
-        z-index: 1; 
-        left: 0;
-        top: 0;
-        /*设置弹窗位置*/
-        padding-top: 100px;
-        padding-bottom: 200px;
-        /*浮在全屏上*/
-        width: 100%; 
-        height:  100%; 
-        /*overflow:auto;如果内容被修剪,则浏览器会显示滚动条,以便查看其余内容。*/
-        overflow: auto; 
-        background-color: rgb(0,0,0); 
-        background-color: rgba(0,0,0,0.4);
-        text-align: right;
-    }
-
-    /* 弹窗内容 */
-    .modal-content {
-        /*position: relative;*/
-        /*弹窗背景色设置*/
-        background-color: #fefefe;
-        margin: auto;
-        padding: 260px auto;
-        width: 800px;
-        box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
-        -webkit-animation-name: animatetop;
-        -webkit-animation-duration: 0.4s;
-        animation-name: animatetop;
-        animation-duration: 0.4s;
-        border-radius: 10px;
-       }
-
-    /* 添加动画 */
-    @-webkit-keyframes animatetop {
-        from {top:-200px; opacity:0} 
-        to {top:0; opacity:1}
-    }
-
-    @keyframes animatetop {
-        from {top:-200px; opacity:0}
-        to {top:0; opacity:1}
-    }
-
-    /* 关闭按钮 */
-    .close {
-        color: white;
-        float: right;
-        font-size: 28px;
-        font-weight: bold;
-    }
-
-    .close:hover, .close:focus {
-        color: #000;
-        text-decoration: none;
-        cursor: pointer;
-    }
-
-    .modal-header {
-        display: block;
-        line-height: 30px;
-        padding: 2px 10px;
-        background-color: #AEAEAE;
-        color: white;
-        text-align: left;
-        border-radius: 5px 5px 0 0;
-    }
-
-    .modal-body {
-        padding: 2px 16px;
-        font-size: 18px;
-        /*height: 200px;*/
-    }
-
-    .modal-footer {
-        display: flex;
-        justify-content: space-around;
-        align-items: center;
-        width: 720px;
-        padding: 0 40px;
-        height: 50px;
-       border-radius:0 0 5px 5px;
-        display: block;
-        line-height: 39px;
-        background-color: #AEAEAE;
-        color: white;
-    }
-    .ok,.no{
-        width: 100px;
-        height: 40px;
-    }
-</style>
-    
+   
     <script type="text/html" id="newtime">
       @{{#if(d.match_id!=null){ }}
         <span>@{{ d.match_id}}</span>
@@ -159,7 +42,7 @@
     </script>
 
     <script type="text/html" id="operation">
-        <!-- <button onclick="addResult(@{{d.match_id}})" class="layui-btn layui-btn-sm layui-btn-green set">赛事结果</button> -->
+        <button onclick="addResult(@{{d.match_id}})" class="layui-btn layui-btn-sm layui-btn-green set">赛事结果</button>
         @{{#if(d.status==2 || d.status==3){ }}
             @{{#if(d.status==2){ }}
                 <span><li class="layui-btn layui-btn-sm layui-btn-green set" onclick="settlement(@{{d.match_id}},1)">结算</li></span>
@@ -235,106 +118,7 @@
             </form>
         </div>
     </div>
-
-    <!-- 弹窗隐藏区域 -->
-    <div id="myModal" class="modal">
-            <input type="hidden" id="matchid" name="matchid" value="">
-            <div class="modal-content">
-                <div class="modal-header">
-                    <span class="close">&times;</span>
-                    <h2>赛事结果添加</h2>
-                </div>
-                <div class="modal-body">
-                    <p style="text-align:left;color:#5f7788;">请认真填写赛事结果,将会按照改结果结算</p><br>
-                    <div style="text-align:left;">
-                        
-                        <div style="display: flex;">
-                            <li>最先得分队员:</li>
-                            <select name="firstscoreplayer" id="firstscoreplayer">
-                            </select>
-                        </div>
-                        <div style="display: flex;">
-                            <li>最后得分队员:</li>
-                            <select name="lastscoreplayer" id="lastscoreplayer">
-                            </select>
-                        </div>
-                        <div style="display: flex;">
-                            <li>获胜球队队员:</li>
-                            <select name="matchwinerplayer" id="matchwinerplayer">
-                            </select>
-                        </div>
-
-                        <!-- <div style="display:flex">
-                            <li style="width: 110px;">第一局获胜队</li>
-                            <div id="onegame">
-                                <input type="radio" name="onegame" value="" checked>主队
-                                <input type="radio" name="onegame" value="" >客队
-                            </div>
-                        </div>
-                        <div style="display:flex">
-                            <li style="width: 110px;">第二局获胜队</li>
-                            <div id="twogame">
-                                <input type="radio" name="twogame" value="1" checked>主队
-                                <input type="radio" name="twogame" value="0" >客队
-                            </div>
-                        </div>
-                        <div style="display:flex">
-                            <li style="width: 110px;">第三局获胜队</li>
-                            <div id="threegame">
-                                <input type="radio" name="threegame" value="1" checked>主队
-                                <input type="radio" name="threegame" value="0" >客队
-                            </div>
-                        </div>
-                        <div style="display:flex">
-                            <li style="width: 110px;">第四局获胜队</li>
-                            <div id="fourgame">
-                                <input type="radio" name="fourgame" id="fourgame" eventType="event-query" value="1" checked>主队
-                                <input type="radio" name="fourgame" id="fourgame" eventType="event-query" value="0" >客队
-                            </div>
-                        </div>
-                        <div style="display:flex">
-                            <li style="width: 110px;">第五局获胜队</li>
-                            <div id="fourgame">
-                                <input type="radio" name="fivegame" id="fivegame" eventType="event-query" value="1" checked>主队
-                                <input type="radio" name="fivegame" id="fivegame" eventType="event-query" value="0" >客队
-                            </div>
-                        </div>
-                        <div style="display:flex">
-                            <li style="width: 110px;">第六局获胜队</li>
-                            <div id="sixgame">
-                                <input type="radio" name="sixgame" value="1" checked>主队
-                                <input type="radio" name="sixgame" value="0" >客队
-                            </div>
-                        </div>
-                        <div style="display:flex">
-                            <li style="width: 110px;">第七局获胜队</li>
-                            <div id="sevengame">
-                                <input type="radio" name="sevengame" value="1" checked>主队
-                                <input type="radio" name="sevengame" value="0" >客队
-                            </div>
-                        </div>
-                        <div style="display:flex">
-                            <li style="width: 110px;">第八局获胜队</li>
-                            <div id="eightgame">
-                                <input type="radio" name="eightgame" value="1" checked>主队
-                                <input type="radio" name="eightgame" value="0" >客队
-                            </div>
-                        </div>
-                        <div style="display:flex">
-                            <li style="width: 110px;">第九局获胜队</li>
-                            <div id="ninegame">
-                                <input type="radio" name="ninegame" value="1" checked>主队
-                                <input type="radio" name="ninegame" value="0" >客队
-                            </div>
-                        </div> -->
-
-                    </div>
-                </div>
-                <div class="modal-footer">
-                    <button class="ok" onchange="buttonClick()"><h3>确定</h3></button>&nbsp;<button class="no"><h3>取消</h3></button>
-                </div>
-            </div>
-        </div>        
+     
 	<script>
         $(function () {
             $('body').on('click', 'a[eventtype="event-delete"]', function () {
@@ -351,104 +135,56 @@
             	}
             })
         })
-
-        function addResult($match_id){
-            $(":input",$("#myModal")).each(function(i){  $(this).val('');});
-            var match_id = $match_id;//alert(match_id);
-            document.getElementById("matchid").value=$match_id;//赋值个弹窗
-            
+        
+        //layer弹窗开始
+        let conttxt = '';
+        let layerOpen = '';
+        function addResult(match_id){
             $.ajax({
                 type: 'POST',
                 dataType: 'json',
                 url: '/admin/Sportswq/Matchresult',
                 data: {match_id:match_id},
                 success: function(data) {
-                    // alert(data.wqresult);
-                    // document.getElementById("matchwiner").value=data.newapp.match_winer;
-                    // document.getElementById("homeallcard").value=data.penalty_card.home;
-                    // document.getElementById("guestallcard").value=data.penalty_card.guest;
-                    // document.getElementById("homehalfcard").value=data.penalty_card.home_half;
-                    // document.getElementById("guesthalfcard").value=data.penalty_card.guest_half;
-                    // document.getElementById("homeallcorner").value=data.corner_ball.home;
-                    // document.getElementById("guestallcorner").value=data.corner_ball.guest;
-                    // document.getElementById("homehalfcorner").value=data.corner_ball.home_half;
-                    // document.getElementById("guesthalfcorner").value=data.corner_ball.guest_half;
-
-                    firstscoreplayer = "<option value='"+data.wqresult.first_score_player+"' selected=''>";
-                    if (data.wqresult.first_score_player != 0){
-                        firstscoreplayer += data.wqresult.first_score_player;
-                    }else{
-                        firstscoreplayer += '请选择最先进球';
-                    }
-                    firstscoreplayer += "</option><option value=" + data.wqresult.home_player_name + ">" + data.wqresult.home_player_name + "</option><option value=" + data.wqresult.guest_player_name + ">" + data.wqresult.guest_player_name + "</option>";
-                    $("#firstscoreplayer").html(firstscoreplayer);
-
-                    lastscoreplayer = "<option value='"+data.wqresult.last_score_player+"' selected=''>";
-                    if (data.wqresult.last_score_player  != 0){
-                        lastscoreplayer += data.wqresult.last_score_player;
-                    }else{
-                        lastscoreplayer += '请选择最后进球';
-                    }
-                    lastscoreplayer += "</option><option value=" + data.wqresult.home_player_name + ">" + data.wqresult.home_player_name + "</option><option value=" + data.wqresult.guest_player_name + ">" + data.wqresult.guest_player_name + "</option>";
-                    $("#lastscoreplayer").html(lastscoreplayer);
-
-                    matchwinerplayer = "<option value='"+data.wqresult.match_winer_player+"' selected=''>";
-                    if (data.wqresult.match_winer_player  != 0){
-                        matchwinerplayer += data.wqresult.match_winer_player;
-                    }else{
-                        matchwinerplayer += '请选择最后胜利队员';
-                    }
-                    matchwinerplayer += "</option><option value=" + data.wqresult.home_player_name + ">" + data.wqresult.home_player_name + "</option><option value=" + data.wqresult.guest_player_name + ">" + data.wqresult.guest_player_name + "</option>";
-                    $("#matchwinerplayer").html(matchwinerplayer);
+                    conttxt ='<div style="margin-left:80px;margin-top:20px;font-size:18px;line-height:150%;"><input type="hidden" id="matchid" name="matchid" value="'+match_id+'" /><div style="display: flex;"><li>第一局比分(主/客):</li><input style="width:50px;" type="text" id="homeo" name="homeo" value="'+data.wqresult[1]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guesto" name="guesto" value="'+data.wqresult[1]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第二局比分(主/客):</li><input style="width:50px;" type="text" id="homet" name="homet" value="'+data.wqresult[2]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestt" name="guestt" value="'+data.wqresult[2]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第三局比分(主/客):</li><input style="width:50px;" type="text" id="homes" name="homes" value="'+data.wqresult[3]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guests" name="guests" value="'+data.wqresult[3]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第四局比分(主/客):</li><input style="width:50px;" type="text" id="homef" name="homef" value="'+data.wqresult[4]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="guestf" name="guestf" value="'+data.wqresult[4]['guest']+'" autocomplete="off"></div><div style="display: flex;"><li>第五局比分(主/客):</li><input style="width:50px;" type="text" id="homee" name="homee" value="'+data.wqresult[5]['home']+'" autocomplete="off">&nbsp;/&nbsp;<input style="width:50px;" type="text" id="gueste" name="gueste" value="'+data.wqresult[5]['guest']+'" autocomplete="off"></div>';
+                    
+                    conttxt += '<br><div style="margin-left:230px;"><button class="layui-btn layui-btn-sm layui-btn-green set" onclick="buttonClick()"><h3>确定</h3></button>&nbsp;<button onclick="czClick()" class="layui-btn layui-btn-sm layui-btn-danger" id="reset"><h3>取消</h3></button></div></div>';
+                
+                layerOpen = layer.open({
+                  type: 1 //Page层类型
+                  ,area: ['500px', '300px']
+                  ,title: '<h2>赛事结果添加<h2>'
+                  ,shade: 0.6 //遮罩透明度
+                  ,maxmin: true //允许全屏最小化
+                  ,anim: 1 //0-6的动画形式,-1不开启
+                  ,content:conttxt
+                }); 
                 }
             }) 
-
-            //获取弹窗得div
-            var modal = document.getElementById('myModal');
-            // 获取 <span> 元素,用于关闭弹窗 (X)
-            var span = document.getElementsByClassName("close")[0];
-            //获取弹窗中得确定按钮
-            var ok=document.getElementsByClassName("ok")[0];
-            //获取弹窗中得取消按钮
-            var no=document.getElementsByClassName("no")[0];
-            //窗体弹出
-            modal.style.display = "block";
-            //点击窗体ok
-            ok.onclick=function(){
-                //执行弹出窗体得确定后得操作
-                alert("执行确定按钮点击得操作");
-                //关闭窗口
-                modal.style.display = "none";
-                buttonClick();
-            }
-            //点击窗体取消按钮
-            no.onclick=function(){
-                //直接关闭窗口
-                modal.style.display = "none";
-            }
-            // 点击 <span> (x), 关闭弹窗
-            span.onclick = function() {
-                //直接关闭窗口
-                modal.style.display = "none";
-            }
-            // 在用户点击其他地方时,关闭弹窗
-            window.onclick = function(event) {
-                //点击窗口外内容,关闭窗口
-                if (event.target == modal) modal.style.display = "none";
-            }
         }
-        
+        function czClick() {
+            layer.close(layerOpen)
+        }
+        //layer弹窗结束
+
         function buttonClick(){
             var matchid = $("#matchid").val();
-            var first_score_player = $("#firstscoreplayer").val();
-            var last_score_player = $("#lastscoreplayer").val();
-            var match_winer_player = $("#matchwinerplayer").val();
+            var homeo = $("#homeo").val();
+            var guesto = $("#guesto").val();
+            var homet = $("#homet").val();
+            var guestt = $("#guestt").val();
+            var homes = $("#homes").val();
+            var guests = $("#guests").val();
+            var homef = $("#homef").val();
+            var guestf = $("#guestf").val();
+            var homee = $("#homee").val();
+            var gueste = $("#gueste").val();
 
             $.ajax({
                 type: 'POST',
                 dataType: 'json',
                 url: '/admin/Sportswq/addend',
-                data: {matchid:matchid,first_score_player:first_score_player,last_score_player:last_score_player,match_winer_player:match_winer_player},
+                data: {matchid:matchid,homeo:homeo,guesto:guesto,homet:homet,guestt:guestt,homes:homes,guests:guests,homef:homef,guestf:guestf,homee:homee,gueste:gueste},
                 success: function(data) {
                     layer.msg(data.msg);
                     location. reload()//刷新当前页面

Некоторые файлы не были показаны из-за большого количества измененных файлов