Explorar el Código

追加推送 5/27

彭俊 hace 6 años
padre
commit
1bbd439877

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

@@ -36,9 +36,9 @@ class SoccerNoteListController extends Controller
         $dt->setLang('sportsnotelist');
         //$dt->addColsFields('id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
         $dt->addColsFields('match_id_order', array('templet' => '#userdetail', 'sort' => true, 'width' => 200));
-        $dt->addColsFields('league', array('templet' => '#userdetail', 'sort' => false, 'width' => 130));
+        $dt->addColsFields('league', array('templet' => '#userdetail', 'sort' => false, 'width' => 120));
         $dt->addColsFields('home_guest', array('templet' => '#userdetail', 'sort' => false, 'width' => 120));
-        $dt->addColsFields('content', array('templet' => '#userdetail', 'sort' => false, 'width' => 230));
+        $dt->addColsFields('content', array('templet' => '#userdetail', 'sort' => false, 'width' => 240));
         $dt->addColsFields('money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
         $dt->addColsFields('water_return', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
         $dt->addColsFields('prize_money', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));

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

@@ -40,7 +40,7 @@ class SoccerStringNoteListController extends Controller
         $dt->addColsFields('water_return', array('templet' => '#userdetail', 'sort' => false, 'width' => 90));
         $dt->addColsFields('prize_money', array('templet' => '#userdetail', 'sort' => false, 'width' => 90));
         $dt->addColsFields('result', array('templet' => '#userdetail', 'sort' => false, 'width' => 90));
-        $dt->addColsFields('money_match_time', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
+        $dt->addColsFields('money_time', array('templet' => '#userdetail', 'sort' => false, 'width' => 200));
         $dt->addColsFields('account', array('templet' => '#userdetail', 'sort' => false, 'width' => 240));
         $dt->addColsFields('settle_status', array('sort' => false, 'width' => 100));
 //        if (checkRriv('/admin/SoccerStringNoteList/edit')) {
@@ -107,12 +107,11 @@ class SoccerStringNoteListController extends Controller
         $dt->setDataSource('/admin/SoccerStringNoteList/detailinfo?id='.$id.'');
         $dt->setLang('sportsnotelist');
         $dt->addColsFields('match_id', array('templet' => '#userdetail', 'sort' => true, 'width' => 80));
-        $dt->addColsFields('league', array('templet' => '#userdetail', 'sort' => false, 'width' => 150));
+        $dt->addColsFields('league', array('templet' => '#userdetail', 'sort' => false, 'width' => 120));
         $dt->addColsFields('home_guest', array('templet' => '#userdetail', 'sort' => false, 'width' => 180));
+        $dt->addColsFields('content', array('templet' => '#userdetail', 'sort' => false, 'width' => 180));
         $dt->addColsFields('game_type', array('templet' => '#userdetail', 'sort' => false, 'width' => 90));
-        $dt->addColsFields('odds_code', array('templet' => '#userdetail', 'sort' => false, 'width' => 180));
-        $dt->addColsFields('condition', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
-        $dt->addColsFields('odds', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
+        $dt->addColsFields('time', array('templet' => '#userdetail', 'sort' => false, 'width' => 180));
         $dt->addColsFields('status', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
         $dt->addColsFields('result', array('templet' => '#userdetail', 'sort' => false, 'width' => 80));
         $dt->enableCheckBox();

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

@@ -311,9 +311,9 @@ class SportsBaseController extends Controller {
         }
         $request['match_id'] = isset($match_id) ? trim($match_id) : null;
 
-        $data = \App\Models\Matchcode::where('p_id','0')->get();
+        //$data = \App\Models\Matchcode::where('p_id','0')->get();
 
-        //$data = \App\Models\Matchcode::where('p_id','0')->where('game_type','bq')->get();
+        $data = \App\Models\Matchcode::where('p_id','0')->where('game_code','bq')->get();
         $request['pcode'] = $data;
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/SportsBase/oddsinfo?match_id='.$match_id.'');
@@ -384,9 +384,9 @@ class SportsBaseController extends Controller {
      */
     function addodds(Req $req) {
 
-        $pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
+        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
 
-        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','bq')->get();
+        $pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_code','bq')->get();
         for($i=0;$i<count($pcodedata);$i++){
             $pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
         }
@@ -461,7 +461,7 @@ class SportsBaseController extends Controller {
 
         $pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
 
-        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','bq')->get();
+        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_code','bq')->get();
         for($i=0;$i<count($pcodedata);$i++){
             $pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
         }

+ 6 - 6
app/Http/Controllers/Admin/SportsBasketController.php

@@ -312,8 +312,8 @@ class SportsBasketController extends Controller {
 			$match_id = $newapp->match_id;
 		}
 		$request['match_id'] = isset($match_id) ? trim($match_id) : null;
-		$data = \App\Models\Matchcode::where('p_id','0')->get();
-		//$data = \App\Models\Matchcode::where('p_id','0')->where('game_type','lq')->get();
+		//$data = \App\Models\Matchcode::where('p_id','0')->get();
+		$data = \App\Models\Matchcode::where('p_id','0')->where('game_code','lq')->get();
 		$request['pcode'] = $data;
 		$dt = \App\Lib\DataTable\DataTable::init();
 		$dt->setDataSource('/admin/SportsBasket/oddsinfo?match_id='.$match_id.'');
@@ -383,8 +383,8 @@ class SportsBasketController extends Controller {
 	 *添加赔率
 	 */
 	function addodds(Req $req) {
-		$pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
-		//$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','lq')->get();
+		//$pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
+		$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_code','lq')->get();
 		for($i=0;$i<count($pcodedata);$i++){
 			$pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
 		}
@@ -456,8 +456,8 @@ class SportsBasketController extends Controller {
 	 *修改赔率
 	 */
 	function oddsedit(Req $req) {
-		$pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
-		//$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','lq')->get();
+		//$pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
+		$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_code','lq')->get();
 		for($i=0;$i<count($pcodedata);$i++){
 			$pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
 		}

+ 6 - 6
app/Http/Controllers/Admin/SportsSoccerController.php

@@ -310,8 +310,8 @@ class SportsSoccerController extends Controller {
             $match_id = $newapp->match_id;
         }
         $request['match_id'] = isset($match_id) ? trim($match_id) : null;
-        //$data = \App\Models\Matchcode::where('p_id','0')->where('game_type','zq')->get();
-        $data = \App\Models\Matchcode::where('p_id','0')->get();
+        $data = \App\Models\Matchcode::where('p_id','0')->where('game_code','zq')->get();
+        //$data = \App\Models\Matchcode::where('p_id','0')->get();
         $request['pcode'] = $data;
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/SportsSoccer/oddsinfo?match_id='.$match_id.'');
@@ -381,8 +381,8 @@ class SportsSoccerController extends Controller {
      *添加赔率
      */
     function addodds(Req $req) {
-        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','zq')->get();
-        $pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
+        $pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_code','zq')->get();
+        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
         for($i=0;$i<count($pcodedata);$i++){
             $pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
         }
@@ -455,8 +455,8 @@ class SportsSoccerController extends Controller {
      */
     function oddsedit(Req $req) {
         $lange = trans('sportsoddscode');
-        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','zq')->get();
-        $pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
+        $pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_code','zq')->get();
+        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
         for($i=0;$i<count($pcodedata);$i++){
             $pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
         }

+ 6 - 8
app/Http/Controllers/Admin/SportsTennisController.php

@@ -311,10 +311,8 @@ class SportsTennisController extends Controller {
             $match_id = $newapp->match_id;
         }
         $request['match_id'] = isset($match_id) ? trim($match_id) : null;
-
-        $data = \App\Models\Matchcode::where('p_id','0')->get();
-
-        //$data = \App\Models\Matchcode::where('p_id','0')->where('game_type','wq')->get();
+        //$data = \App\Models\Matchcode::where('p_id','0')->get();
+        $data = \App\Models\Matchcode::where('p_id','0')->where('game_code','wq')->get();
         $request['pcode'] = $data;
         $dt = \App\Lib\DataTable\DataTable::init();
         $dt->setDataSource('/admin/SportsTennis/oddsinfo?match_id='.$match_id.'');
@@ -385,9 +383,9 @@ class SportsTennisController extends Controller {
      */
     function addodds(Req $req) {
 
-        $pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
+        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
 
-        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','wq')->get();
+        $pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_code','wq')->get();
         for($i=0;$i<count($pcodedata);$i++){
             $pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
         }
@@ -460,9 +458,9 @@ class SportsTennisController extends Controller {
      */
     function oddsedit(Req $req) {
 
-        $pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
+        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->get();
 
-        //$pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_type','wq')->get();
+        $pcodedata = \App\Models\Matchcode::where('p_id','0')->where('game_code','wq')->get();
         for($i=0;$i<count($pcodedata);$i++){
             $pcodedata[$i]->p_code = $pcodedata[$i]->odds_code;
         }

+ 1 - 1
app/Http/Controllers/Api/SettlementController.php

@@ -10,7 +10,7 @@ class SettlementController extends Controller{
     public function index(){
         $dd = new ZqRule();
 
-        dd($dd->bodan(1,2,1));
+        dd($dd->half_full(1,2,1));
     }
     public function dd(){
         $obj = new SettlementOrder();

+ 432 - 89
app/Lib/Settlement/Adapter/LqRule.php

@@ -75,7 +75,9 @@ class LqRule
         // 分差 - 主 :客
         $difference = $homeScore - $guestScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(全场)";
+        return $data;
     }
 
     /**
@@ -93,7 +95,9 @@ class LqRule
         // 分差 - 客 :主
         $difference = $guestScore - $homeScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(全场)";
+        return $data;
     }
 
     /**
@@ -113,7 +117,9 @@ class LqRule
         // 分差 - 主 :客
         $difference = $homeScore - $guestScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(上半场)";
+        return $data;
     }
 
     /**
@@ -133,7 +139,9 @@ class LqRule
         // 分差 - 客 :主
         $difference = $guestScore - $homeScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(上半场)";
+        return $data;
     }
 
     /**
@@ -153,7 +161,9 @@ class LqRule
         // 分差 - 主 :客
         $difference = $homeScore - $guestScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(第一节)";
+        return $data;
     }
 
     /**
@@ -173,7 +183,9 @@ class LqRule
         // 分差 - 客 :主
         $difference = $guestScore - $homeScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(第一节)";
+        return $data;
     }
 
     /**
@@ -194,7 +206,9 @@ class LqRule
         // 分差 - 主 :客
         $difference = $homeScore - $guestScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(第二节)";
+        return $data;
     }
 
     /**
@@ -215,7 +229,9 @@ class LqRule
         // 分差 - 客 :主
         $difference = $guestScore - $homeScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(第二节)";
+        return $data;
     }
 
     /**
@@ -236,7 +252,9 @@ class LqRule
         // 分差 - 主 :客
         $difference = $homeScore - $guestScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(第三节)";
+        return $data;
     }
 
     /**
@@ -257,7 +275,9 @@ class LqRule
         // 分差 - 客 :主
         $difference = $guestScore - $homeScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(第三节)";
+        return $data;
     }
 
     /**
@@ -278,7 +298,9 @@ class LqRule
         // 分差 - 主 :客
         $difference = $homeScore - $guestScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(第四节)";
+        return $data;
     }
 
     /**
@@ -299,7 +321,9 @@ class LqRule
         // 分差 - 客 :主
         $difference = $guestScore - $homeScore;
 
-        return $this -> concedeCommon($model, $difference);
+        $data['result'] = $this -> concedeCommon($model, $difference);
+        $data['matchResult'] = "$homeScore-$guestScore(第四节)";
+        return $data;
     }
 
     /**
@@ -310,9 +334,15 @@ class LqRule
      * @return string 1:赢  -1:输  2:平  3:赢半平半  4:输半平半
      */
     public function lq_total_sizes_big($model, $resultModel, $resultRecords){
+        // 主队得分
+        $homeScore = intval($resultModel -> home_score);
+        // 客队得分
+        $guestScore = intval($resultModel -> guest_score);
         // 总进球数
-        $allGoal = intval($resultModel -> home_score) + intval($resultModel -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, 1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, 1);
+        $data['matchResult'] = "$homeScore-$guestScore(全场)";
+        return $data;
     }
 
     /**
@@ -323,9 +353,15 @@ class LqRule
      * @return string 1:赢  -1:输  2:平  3:赢半平半  4:输半平半
      */
     public function lq_total_sizes_small($model, $resultModel, $resultRecords){
+        // 主队得分
+        $homeScore = intval($resultModel -> home_score);
+        // 客队得分
+        $guestScore = intval($resultModel -> guest_score);
         // 总进球数
-        $allGoal = intval($resultModel -> home_score) + intval($resultModel -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, -1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, -1);
+        $data['matchResult'] = "$homeScore-$guestScore(全场)";
+        return $data;
     }
 
     /**
@@ -338,9 +374,15 @@ class LqRule
     public function lq_half_total_sizes_big($model, $resultModel, $resultRecords){
         $newResultRecords = array_reverse($resultRecords);
         $upResultKey = array_search('第二节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$upResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$upResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$upResultKey] -> home_score) + intval($newResultRecords[$upResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, 1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, 1);
+        $data['matchResult'] = "$homeScore-$guestScore(上半场)";
+        return $data;
     }
 
     /**
@@ -353,9 +395,15 @@ class LqRule
     public function lq_half_total_sizes_small($model, $resultModel, $resultRecords){
         $newResultRecords = array_reverse($resultRecords);
         $upResultKey = array_search('第二节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$upResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$upResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$upResultKey] -> home_score) + intval($newResultRecords[$upResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, -1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, -1);
+        $data['matchResult'] = "$homeScore-$guestScore(上半场)";
+        return $data;
     }
 
     /**
@@ -368,9 +416,15 @@ class LqRule
     public function lq_one_total_sizes_big($model, $resultModel, $resultRecords){
         $newResultRecords = array_reverse($resultRecords);
         $oneResultKey = array_search('第一节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$oneResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$oneResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$oneResultKey] -> home_score) + intval($newResultRecords[$oneResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, 1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, 1);
+        $data['matchResult'] = "$homeScore-$guestScore(第一节)";
+        return $data;
     }
 
     /**
@@ -383,9 +437,15 @@ class LqRule
     public function lq_one_total_sizes_small($model, $resultModel, $resultRecords){
         $newResultRecords = array_reverse($resultRecords);
         $oneResultKey = array_search('第一节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$oneResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$oneResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$oneResultKey] -> home_score) + intval($newResultRecords[$oneResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, -1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, -1);
+        $data['matchResult'] = "$homeScore-$guestScore(第一节)";
+        return $data;
     }
 
     /**
@@ -399,10 +459,15 @@ class LqRule
         $newResultRecords = array_reverse($resultRecords);
         $oneResultKey = array_search('第一节', array_column($newResultRecords, 'match_process'));
         $twoResultKey = array_search('第二节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$twoResultKey] -> home_score) - intval($newResultRecords[$oneResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$twoResultKey] -> guest_score) - intval($newResultRecords[$oneResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$twoResultKey] -> home_score) + intval($newResultRecords[$twoResultKey] -> guest_score)
-            - intval($newResultRecords[$oneResultKey] -> home_score) - intval($newResultRecords[$oneResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, 1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, 1);
+        $data['matchResult'] = "$homeScore-$guestScore(第二节)";
+        return $data;
     }
 
     /**
@@ -416,10 +481,15 @@ class LqRule
         $newResultRecords = array_reverse($resultRecords);
         $oneResultKey = array_search('第一节', array_column($newResultRecords, 'match_process'));
         $twoResultKey = array_search('第二节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$twoResultKey] -> home_score) - intval($newResultRecords[$oneResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$twoResultKey] -> guest_score) - intval($newResultRecords[$oneResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$twoResultKey] -> home_score) + intval($newResultRecords[$twoResultKey] -> guest_score)
-            - intval($newResultRecords[$oneResultKey] -> home_score) - intval($newResultRecords[$oneResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, -1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, -1);
+        $data['matchResult'] = "$homeScore-$guestScore(第二节)";
+        return $data;
     }
 
     /**
@@ -433,10 +503,15 @@ class LqRule
         $newResultRecords = array_reverse($resultRecords);
         $twoResultKey = array_search('第二节', array_column($newResultRecords, 'match_process'));
         $threeResultKey = array_search('第三节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$threeResultKey] -> home_score) - intval($newResultRecords[$twoResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$threeResultKey] -> guest_score) - intval($newResultRecords[$twoResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$threeResultKey] -> home_score) + intval($newResultRecords[$threeResultKey] -> guest_score)
-            - intval($newResultRecords[$twoResultKey] -> home_score) - intval($newResultRecords[$twoResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, 1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, 1);
+        $data['matchResult'] = "$homeScore-$guestScore(第三节)";
+        return $data;
     }
 
     /**
@@ -450,10 +525,15 @@ class LqRule
         $newResultRecords = array_reverse($resultRecords);
         $twoResultKey = array_search('第二节', array_column($newResultRecords, 'match_process'));
         $threeResultKey = array_search('第三节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$threeResultKey] -> home_score) - intval($newResultRecords[$twoResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$threeResultKey] -> guest_score) - intval($newResultRecords[$twoResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$threeResultKey] -> home_score) + intval($newResultRecords[$threeResultKey] -> guest_score)
-            - intval($newResultRecords[$twoResultKey] -> home_score) - intval($newResultRecords[$twoResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, -1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, -1);
+        $data['matchResult'] = "$homeScore-$guestScore(第三节)";
+        return $data;
     }
 
     /**
@@ -467,10 +547,15 @@ class LqRule
         $newResultRecords = array_reverse($resultRecords);
         $threeResultKey = array_search('第三节', array_column($newResultRecords, 'match_process'));
         $fourResultKey = array_search('第四节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$fourResultKey] -> home_score) - intval($newResultRecords[$threeResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$fourResultKey] -> guest_score) - intval($newResultRecords[$threeResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$fourResultKey] -> home_score) + intval($newResultRecords[$fourResultKey] -> guest_score)
-            - intval($newResultRecords[$threeResultKey] -> home_score) - intval($newResultRecords[$threeResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, 1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, 1);
+        $data['matchResult'] = "$homeScore-$guestScore(第四节)";
+        return $data;
     }
 
     /**
@@ -484,10 +569,15 @@ class LqRule
         $newResultRecords = array_reverse($resultRecords);
         $threeResultKey = array_search('第三节', array_column($newResultRecords, 'match_process'));
         $fourResultKey = array_search('第四节', array_column($newResultRecords, 'match_process'));
+        // 主队得分
+        $homeScore = intval($newResultRecords[$fourResultKey] -> home_score) - intval($newResultRecords[$threeResultKey] -> home_score);
+        // 客队得分
+        $guestScore = intval($newResultRecords[$fourResultKey] -> guest_score) - intval($newResultRecords[$threeResultKey] -> guest_score);
         // 总进球数
-        $allGoal = intval($newResultRecords[$fourResultKey] -> home_score) + intval($newResultRecords[$fourResultKey] -> guest_score)
-            - intval($newResultRecords[$threeResultKey] -> home_score) - intval($newResultRecords[$threeResultKey] -> guest_score);
-        return $this -> sizeCommon($model, $allGoal, -1);
+        $allGoal = $homeScore + $guestScore;
+        $data['result'] = $this -> sizeCommon($model, $allGoal, -1);
+        $data['matchResult'] = "$homeScore-$guestScore(第四节)";
+        return $data;
     }
 
     /**
@@ -501,13 +591,28 @@ class LqRule
         //获取主客队全场得分
         $home_score = $result_match->home_score;
         $guest_score = $result_match->guest_score;
+        //返回结果
+        $data = [
+            'result'=>1,
+            'matchResult'=>"$home_score-$guest_score(全场得分)"
+        ];
         //主队
         if($bet_match->odds_code == 'lq_capot_home'){
-            if($home_score > $guest_score) return 1;
+            if($home_score > $guest_score)
+            {
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
         }
         //客队
         if($bet_match->odds_code == 'lq_capot_guest'){
-            if($home_score < $guest_score) return 1;
+            if($home_score < $guest_score)
+            {
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
         }
         //上半场
         if(strstr($bet_match->odds_code,"half")){
@@ -516,13 +621,28 @@ class LqRule
             //获取主客队上半场得分
             $home_score = $last_stage_data->home_score;
             $guest_score = $last_stage_data->guest_score;
+            //返回结果
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$home_score-$guest_score(上半场得分)"
+            ];
             //主队 上半场
             if($bet_match->odds_code == 'lq_half_capot_home'){
-                if($home_score > $guest_score) return 1;
+                if($home_score > $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //客队 上半场
             if($bet_match->odds_code == 'lq_half_capot_guest'){
-                if($home_score < $guest_score) return 1;
+                if($home_score < $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
         //第一节
@@ -532,13 +652,28 @@ class LqRule
             //获取主客队第一节得分
             $home_score = $last_stage_data->home_score;
             $guest_score = $last_stage_data->guest_score;
+            //返回结果
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$home_score-$guest_score(第一节得分)"
+            ];
             //主队 第一节
             if($bet_match->odds_code == 'lq_one_capot_home'){
-                if($home_score > $guest_score) return 1;
+                if($home_score > $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //客队 第一节
             if($bet_match->odds_code == 'lq_one_capot_guest'){
-                if($home_score < $guest_score) return 1;
+                if($home_score < $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
         //第二节
@@ -548,13 +683,28 @@ class LqRule
             //获取主客队第二节得分
             $home_score = $last_stage_data->home_score;
             $guest_score = $last_stage_data->guest_score;
+            //返回结果
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$home_score-$guest_score(第二节得分)"
+            ];
             //主队 第二节
             if($bet_match->odds_code == 'lq_two_capot_home'){
-                if($home_score > $guest_score) return 1;
+                if($home_score > $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //客队 第二节
             if($bet_match->odds_code == 'lq_two_capot_guest'){
-                if($home_score < $guest_score) return 1;
+                if($home_score < $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
         //第三节
@@ -564,13 +714,28 @@ class LqRule
             //获取主客队第三节得分
             $home_score = $last_stage_data->home_score;
             $guest_score = $last_stage_data->guest_score;
+            //返回结果
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$home_score-$guest_score(第三节得分)"
+            ];
             //主队 第三节
             if($bet_match->odds_code == 'lq_three_capot_home'){
-                if($home_score > $guest_score) return 1;
+                if($home_score > $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //客队 第三节
             if($bet_match->odds_code == 'lq_three_capot_guest'){
-                if($home_score < $guest_score) return 1;
+                if($home_score < $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
         //第四节
@@ -580,17 +745,32 @@ class LqRule
             //获取主客队第四节得分
             $home_score = $last_stage_data->home_score;
             $guest_score = $last_stage_data->guest_score;
+            //返回结果
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$home_score-$guest_score(第四节得分)"
+            ];
             //主队 第四节
             if($bet_match->odds_code == 'lq_four_capot_home'){
-                if($home_score > $guest_score) return 1;
+                if($home_score > $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //客队 第四节
             if($bet_match->odds_code == 'lq_four_capot_guest'){
-                if($home_score < $guest_score) return 1;
+                if($home_score < $guest_score)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
 
-        return -1;
+        return false;
     }
 
     /**
@@ -604,6 +784,11 @@ class LqRule
         //获取主客队全场得分
         $home_score = $result_match->home_score;
         $guest_score = $result_match->guest_score;
+        //返回结果
+        $data = [
+            'result'=>1,
+            'matchResult'=>""
+        ];
         //界定 分数 条件
         $condition = $bet_match->condition;
         //赔率代码
@@ -611,19 +796,43 @@ class LqRule
 
         //全场 主队 得分大
         if($odds_code == 'lq_score_home_big'){
-            if($home_score > $condition) return 1;
+            $data['matchResult'] = "$home_score(全场主队得分)";
+            if($home_score > $condition)
+            {
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
         }
         //全场 主队 得分小
         if($odds_code == 'lq_score_home_small'){
-            if($home_score < $condition) return 1;
+            $data['matchResult'] = "$home_score(全场主队得分)";
+            if($home_score < $condition)
+            {
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
         }
         //全场 客队 得分大
         if($odds_code == 'lq_score_guest_big'){
-            if($guest_score > $condition) return 1;
+            $data['matchResult'] = "$guest_score(全场客队得分)";
+            if($guest_score > $condition)
+            {
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
         }
-        //全场 主队 得分小
+        //全场 队 得分小
         if($odds_code == 'lq_score_guest_small'){
-            if($guest_score < $condition) return 1;
+            $data['matchResult'] = "$guest_score(全场客队得分)";
+            if($guest_score < $condition)
+            {
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
         }
         //上半场
         if(strstr($odds_code,"half")){
@@ -634,19 +843,43 @@ class LqRule
             $guest_score = $last_stage_data->guest_score;
             //上半场主队得分大
             if($odds_code == 'lq_half_score_home_big'){
-                if($home_score > $condition) return 1;
+                $data['matchResult'] = "$home_score(上半场主队得分)";
+                if($home_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //上半场主队得分小
             if($odds_code == 'lq_half_score_home_small'){
-                if($home_score < $condition) return 1;
+                $data['matchResult'] = "$home_score(上半场主队得分)";
+                if($home_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //上半场客队得分大
             if($odds_code == 'lq_half_score_guest_big'){
-                if($guest_score > $condition) return 1;
+                $data['matchResult'] = "$guest_score(上半场客队得分)";
+                if($guest_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //上半场客队得分小
             if($odds_code == 'lq_half_score_guest_small'){
-                if($guest_score < $condition) return 1;
+                $data['matchResult'] = "$guest_score(上半场客队得分)";
+                if($guest_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
         //第一节
@@ -658,19 +891,43 @@ class LqRule
             $guest_score = $last_stage_data->guest_score;
             //第一节主队得分大
             if($odds_code == 'lq_one_score_home_big'){
-                if($home_score > $condition) return 1;
+                $data['matchResult'] = "$home_score(第一节主队得分)";
+                if($home_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第一节主队得分小
             if($odds_code == 'lq_one_score_home_small'){
-                if($home_score < $condition) return 1;
+                $data['matchResult'] = "$home_score(第一节主队得分)";
+                if($home_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第一节客队得分大
             if($odds_code == 'lq_one_score_guest_big'){
-                if($guest_score > $condition) return 1;
+                $data['matchResult'] = "$guest_score(第一节客队得分)";
+                if($guest_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第一节客队得分小
             if($odds_code == 'lq_one_score_guest_small'){
-                if($guest_score < $condition) return 1;
+                $data['matchResult'] = "$guest_score(第一节客队得分)";
+                if($guest_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
         //第二节
@@ -682,19 +939,43 @@ class LqRule
             $guest_score = $last_stage_data->guest_score;
             //第二节主队得分大
             if($odds_code == 'lq_two_score_home_big'){
-                if($home_score > $condition) return 1;
+                $data['matchResult'] = "$home_score(第二节主队得分)";
+                if($home_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第二节主队得分小
             if($odds_code == 'lq_two_score_home_small'){
-                if($home_score < $condition) return 1;
+                $data['matchResult'] = "$home_score(第二节主队得分)";
+                if($home_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第二节客队得分大
             if($odds_code == 'lq_two_score_guest_big'){
-                if($guest_score > $condition) return 1;
+                $data['matchResult'] = "$guest_score(第二节客队得分)";
+                if($guest_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第二节客队得分小
             if($odds_code == 'lq_two_score_guest_small'){
-                if($guest_score < $condition) return 1;
+                $data['matchResult'] = "$guest_score(第二节客队得分)";
+                if($guest_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
         //第三节
@@ -706,19 +987,43 @@ class LqRule
             $guest_score = $last_stage_data->guest_score;
             //第三节主队得分大
             if($odds_code == 'lq_three_score_home_big'){
-                if($home_score > $condition) return 1;
+                $data['matchResult'] = "$home_score(第三节主队得分)";
+                if($home_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第三节主队得分小
             if($odds_code == 'lq_three_score_home_small'){
-                if($home_score < $condition) return 1;
+                $data['matchResult'] = "$home_score(第三节主队得分)";
+                if($home_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第三节客队得分大
             if($odds_code == 'lq_three_score_guest_big'){
-                if($guest_score > $condition) return 1;
+                $data['matchResult'] = "$guest_score(第三节客队得分)";
+                if($guest_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第三节客队得分小
             if($odds_code == 'lq_three_score_guest_small'){
-                if($guest_score < $condition) return 1;
+                $data['matchResult'] = "$guest_score(第三节客队得分)";
+                if($guest_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
         //第四节
@@ -730,22 +1035,46 @@ class LqRule
             $guest_score = $last_stage_data->guest_score;
             //第四节主队得分大
             if($odds_code == 'lq_four_score_home_big'){
-                if($home_score > $condition) return 1;
+                $data['matchResult'] = "$home_score(第四节主队得分)";
+                if($home_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第四节主队得分小
             if($odds_code == 'lq_four_score_home_small'){
-                if($home_score < $condition) return 1;
+                $data['matchResult'] = "$home_score(第四节主队得分)";
+                if($home_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第四节客队得分大
             if($odds_code == 'lq_four_score_guest_big'){
-                if($guest_score > $condition) return 1;
+                $data['matchResult'] = "$guest_score(第四节客队得分)";
+                if($guest_score > $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
             //第四节客队得分小
             if($odds_code == 'lq_four_score_guest_small'){
-                if($guest_score < $condition) return 1;
+                $data['matchResult'] = "$guest_score(第四节客队得分)";
+                if($guest_score < $condition)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
         }
-        return -1;
+        return false;
     }
 
     /**
@@ -780,24 +1109,38 @@ class LqRule
     public function  lq_two_sides($model,$resultModel,$resultRecords){
         $resulttod = intval($resultModel->home_score) + intval($resultModel->guest_score) + intval($resultModel->guest_rate) + intval($resultModel->home_rate);
         if($resulttod%2==0){
-            $data = '双';
+            $text = '双';
         }else{
-            $data = '单';
+            $text = '单';
         }
-        if($data = $model->condition){
-            return 1;
+        if($text = $model->condition){
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$resulttod(全场)",
+            ];
         }else{
-            return -1;
+             $data = [
+                'result'=>-1,
+                'matchResult'=>"$resulttod(全场)",
+            ];
         }
-
+        return $data;
     }
 
     //最后进球球队 last_score 最后进球球队 model:money_buy_match  resultModel:st_lq_result
     public function lq_last_number($model,$resultModel,$resultRecords){
         if($resultModel->last_score == $model->condition){
-            return 1;
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$resultModel->last_score(全场)",
+            ];
         }else{
-            return -1;
+            $data = [
+                'result'=>-1,
+                'matchResult'=>"$resultModel->last_score(全场)",
+            ];
         }
+        return $data;
     }
+
 }

+ 47 - 9
app/Lib/Settlement/Adapter/WqRule.php

@@ -26,16 +26,32 @@ class WqRule
         $condition = $bet_match->condition;
         //赔率代码
         $odds_code = $bet_match->odds_code;
+        //返回结果
+        $allScore = $home_score+$guest_score;
+        $data = [
+            'result'=>1,
+            'matchResult'=>"$allScore(总局数全场得分)"
+        ];
         //总局数大
         if($odds_code == 'wq_total_number_big'){
-            if(($home_score+$guest_score) > $condition) return 1;
+            if(($home_score+$guest_score) > $condition)
+            {
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
         }
         //总局数小
         if($odds_code == 'wq_total_number_small'){
-            if(($home_score+$guest_score) < $condition) return 1;
+            if(($home_score+$guest_score) < $condition)
+            {
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
         }
 
-        return -1;
+        return false;
     }
 
     /**
@@ -50,16 +66,32 @@ class WqRule
         $guest_score = $result_match->guest_score;
         //赔率代码
         $odds_code = $bet_match->odds_code;
+        //返回结果
+        $allScore = $home_score+$guest_score;
+        $data = [
+            'result'=>1,
+            'matchResult'=>"$allScore(总局数全场得分)"
+        ];
         //总局数单
         if($odds_code == 'wq_two_sides_single'){
-            if(($home_score+$guest_score)%2 != 0) return 1;//不能被2整除
+            if(($home_score+$guest_score)%2 != 0)
+            { //不能被2整除
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
+
         }
         //总局数双
         if($odds_code == 'wq_two_sides_double'){
-            if(($home_score+$guest_score)%2 == 0) return 1;//能被2整除
-
+            if(($home_score+$guest_score)%2 == 0)
+            {//能被2整除
+                return $data;
+            }
+            $data['result'] = -1;
+            return $data;
         }
-        return -1;
+        return false;
     }
 
     /**
@@ -73,10 +105,16 @@ class WqRule
      * 冠军 match_winer_player:获胜队员
      */
     public function wq_kemp($bet_match,$result_match,$result_match_r){
+        //返回结果
+        $data = [
+            'result'=>1,
+            'matchResult'=>"$result_match->match_winer_player(获胜队员)"
+        ];
         if($result_match->match_winer_player == $bet_match->condition){
-            return 1;
+            return $data;
         }else{
-            return -1;
+            $data['result'] = -1;
+            return $data;
         }
     }
 

+ 176 - 74
app/Lib/Settlement/Adapter/ZqRule.php

@@ -63,7 +63,7 @@ class ZqRule
      * @param mixed $resultRecords 结果记录表数据
      * @return string 1:赢  -1:输  2:平  3:赢半平半  4:输半平半
      */
-    public function size_home($model, $resultModel, $resultRecords) {
+    public function goal_size_home($model, $resultModel, $resultRecords) {
         return $this -> sizeFull($model, $resultModel, $resultRecords, 0, 1);
     }
 
@@ -74,7 +74,7 @@ class ZqRule
      * @param mixed $resultRecords 结果记录表数据
      * @return string 1:赢  -1:输  2:平  3:赢半平半  4:输半平半
      */
-    public function size_guest($model, $resultModel, $resultRecords) {
+    public function goal_size_guest($model, $resultModel, $resultRecords) {
         return $this -> sizeFull($model, $resultModel, $resultRecords, 0, -1);
     }
 
@@ -85,7 +85,7 @@ class ZqRule
      * @param mixed $resultRecords 结果记录表数据
      * @return string 1:赢  -1:输  2:平  3:赢半平半  4:输半平半
      */
-    public function half_size_home($model, $resultModel, $resultRecords) {
+    public function half_goal_size_home($model, $resultModel, $resultRecords) {
         return $this -> sizeHalf($model, $resultModel, $resultRecords, 0, 1, 1);
     }
 
@@ -96,7 +96,7 @@ class ZqRule
      * @param mixed $resultRecords 结果记录表数据
      * @return string 1:赢  -1:输  2:平  3:赢半平半  4:输半平半
      */
-    public function half_size_guest($model, $resultModel, $resultRecords) {
+    public function half_goal_size_guest($model, $resultModel, $resultRecords) {
         return $this -> sizeHalf($model, $resultModel, $resultRecords, 0, -1, 1);
     }
 
@@ -214,26 +214,28 @@ class ZqRule
         if ($size == -1) {
             if ($count == 1) {
                 if ($resultUniqueArr[0] == 1) {
-                    return -1;
+                    $data['result'] = -1;
                 } elseif ($resultUniqueArr[0] == 2) {
-                    return 2;
+                    $data['result'] = 2;
                 } else {
-                    return 1;
+                    $data['result'] = 1;
                 }
             } elseif (in_array(1, $resultUniqueArr)) {
-                return 4;
+                $data['result'] = 4;
             } else {
-                return 3;
+                $data['result'] = 3;
             }
         } else {
             if ($count == 1) {
-                return $resultUniqueArr[0];
+                $data['result'] = $resultUniqueArr[0];
             } elseif (in_array(1, $resultUniqueArr)) {
-                return 3;
+                $data['result'] = 3;
             } else {
-                return 4;
+                $data['result'] = 4;
             }
         }
+        $data['matchResult'] = "$homeScore-$guestScore(全场)";
+        return $data;
      }
 
     /**
@@ -302,26 +304,28 @@ class ZqRule
         if ($size == -1) {
             if ($count == 1) {
                 if ($resultUniqueArr[0] == 1) {
-                    return -1;
+                    $data['result'] = -1;
                 } elseif ($resultUniqueArr[0] == 2) {
-                    return 2;
+                    $data['result'] = 2;
                 } else {
-                    return 1;
+                    $data['result'] = 1;
                 }
             } elseif (in_array(1, $resultUniqueArr)) {
-                return 4;
+                $data['result'] = 4;
             } else {
-                return 3;
+                $data['result'] = 3;
             }
         } else {
             if ($count == 1) {
-                return $resultUniqueArr[0];
+                $data['result'] = $resultUniqueArr[0];
             } elseif (in_array(1, $resultUniqueArr)) {
-                return 3;
+                $data['result'] = 3;
             } else {
-                return 4;
+                $data['result'] = 4;
             }
         }
+        $data['matchResult'] = "$homeScore-$guestScore(上半场)";
+        return $data;
      }
 
     /**
@@ -370,19 +374,21 @@ class ZqRule
         if ($count == 1) {
             // 如果猜中
             if ($resultUniqueArr[0] == $size) {
-                return 1;
+                $data['result'] = 1;
             } elseif ($resultUniqueArr[0] == 0) {
                 // 如果平
-                return 2;
+                $data['result'] = 2;
             } else {
                 // 如果猜错
-                return -1;
+                $data['result'] = -1;
             }
         } elseif (in_array($size, $resultUniqueArr)) {
-            return 3;
+            $data['result'] = 3;
         } else {
-            return 4;
+            $data['result'] = 4;
         }
+        $data['matchResult'] = "$homeGoal-$guestGoal(全场)";
+        return $data;
     }
 
     /**
@@ -449,19 +455,21 @@ class ZqRule
         if ($count == 1) {
             // 如果猜中
             if ($resultUniqueArr[0] == $size) {
-                return 1;
+                $data['result'] = 1;
             } elseif ($resultUniqueArr[0] == 0) {
                 // 如果平
-                return 2;
+                $data['result'] = 2;
             } else {
                 // 如果猜错
-                return -1;
+                $data['result'] = -1;
             }
         } elseif (in_array($size, $resultUniqueArr)) {
-            return 3;
+            $data['result'] = 3;
         } else {
-            return 4;
+            $data['result'] = 4;
         }
+        $data['matchResult'] = "$homeGoal-$guestGoal(上半场)";
+        return $data;
     }
 
     /**
@@ -479,14 +487,16 @@ class ZqRule
         $guestScore = intval($resultModel -> guest_score);
         $difference = $homeScore - $guestScore;
         if ($difference > 0 && $type == 1) {
-            return 1;
+            $data['result'] = 1;
         } elseif ($difference < 0 && $type == 2) {
-            return 1;
+            $data['result'] = 1;
         } elseif ($difference == 0 && $type == 0) {
-            return 1;
+            $data['result'] = 1;
         } else {
-            return -1;
+            $data['result'] = -1;
         }
+        $data['matchResult'] = "$homeScore-$guestScore(全场)";
+        return $data;
     }
 
     /**
@@ -521,14 +531,16 @@ class ZqRule
         }
         $difference = $homeScore - $guestScore;
         if ($difference > 0 && $type == 1) {
-            return 1;
+            $data['result'] = 1;
         } elseif ($difference < 0 && $type == 2) {
-            return 1;
+            $data['result'] = 1;
         } elseif ($difference == 0 && $type == 0) {
-            return 1;
+            $data['result'] = 1;
         } else {
-            return -1;
+            $data['result'] = -1;
         }
+        $data['matchResult'] = "$homeScore-$guestScore(上半场)";
+        return $data;
     }
 
     //  first_last_ball最先/最后进球 开始-----------------------
@@ -615,38 +627,70 @@ class ZqRule
             //获取主客队上半场得分
             $home_score = $last_half_data->home_score;
             $guest_score = $last_half_data->guest_score;
+            //返回结果
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$home_score-$guest_score(上半场)"
+            ];
             if(strstr($bet_match->condition,"其他") ){
-                if(($home_score > 3) ||  ($guest_score > 3)) return 1;
+                if(($home_score > 3) ||  ($guest_score > 3))
+                {
+                    return $data;
+                }
+            }
+            //判断结果
+            if($bet_home_score == $home_score and $bet_guest_score == $guest_score)
+            {
+                return $data;
             }
+            $data['result'] = -1;
+            return $data;
         }else{//全场
             //获取主客队全场得分
             $home_score = $result_match->home_score;
             $guest_score = $result_match->guest_score;
 
+            //返回结果
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$home_score-$guest_score(全场)"
+            ];
             if(strstr($bet_match->condition,"其他") ){
-                if(($home_score > 4) ||  ($guest_score > 4)) return 1;
+                if(($home_score > 4) ||  ($guest_score > 4))
+                {
+                    return $data;
+                }
+            }
+            //判断结果
+            if($bet_home_score == $home_score and $bet_guest_score == $guest_score)
+            {
+                return $data;
             }
+            $data['result'] = -1;
+            return $data;
         }
-
-        //判断结果
-        if($bet_home_score == $home_score and $bet_guest_score == $guest_score) return 1;
-
-        return -1;
     }
 
     //结果单/双 home_score 主队进球数 guest_score 客队进球数 home_rate 主队让球 guest_rate 客队让球
     public function  two_sides($model,$resultModel,$resultRecords){
         $resulttod = intval($resultModel->home_score) + intval($resultModel->guest_score) + intval($resultModel->guest_rate) + intval($resultModel->home_rate);
         if($resulttod%2==0){
-            $data = '双';
+            $text = '双';
         }else{
-            $data = '单';
+            $text = '单';
         }
-        if($data = $model->condition){
-            return 1;
+        if($text = $model->condition){
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$resulttod(全场)",
+            ];
         }else{
-            return -1;
+            $data = [
+                'result'=>-1,
+                'matchResult'=>"$resulttod(全场)",
+            ];
         }
+        return $data;
 
     }  
 
@@ -659,21 +703,26 @@ class ZqRule
         
         $qjnum = explode(',', $model->condition);
         if($qjnum[0]<$resulttod and $qjnum[1]>$resulttod){
-            return 1;
+            $data = [
+                'result'=>1,
+                'matchResult'=>"$resulttod(全场)",
+            ];
         }else{
-            return -1;
+           $data = [
+                'result'=>-1,
+                'matchResult'=>"$resulttod(全场)",
+            ];
         }
-
+        return $data;
     }
 
     /**
      * 半场/全场 投注规则
      */
     public function half_full($bet_match,$result_match,$result_match_r){
-//        $bet_match = DB::table('money_buy_match')->where('match_id', 3144414)->first();
-//        $result_match = DB::table('st_zq_result')->where('match_id', 3144414)->first();
-//        $result_match_r = DB::table('st_zq_result_record')->where('match_id', 3144414)->get()->toArray();
-
+//        $bet_match = DB::table('money_buy_match')->where('match_id', 3210851)->first();
+//        $result_match = DB::table('st_zq_result')->where('match_id', 3210851)->first();
+//        $result_match_r = DB::table('st_zq_result_record')->where('match_id', 3210851)->get()->toArray();
         if(empty($bet_match) || empty($result_match) || empty($result_match_r)) return false;
 
         //获取父/子级赔率代码
@@ -691,39 +740,46 @@ class ZqRule
         $full_guest_score = $result_match->guest_score;
         //半场/全场盘口
         if($p_code != 'half_full') return false;
+
+        //返回结果
+        $data = [
+            'result'=>1,
+            'matchResult'=>"$half_home_score-$half_home_score(上半场);$full_home_score-$full_guest_score(全场)"
+        ];
         switch ($odds_code ) {
             case 'half_full_home_home':// 主-主
-                if($half_home_score > $half_guest_score and $full_home_score > $full_guest_score) return 1;
+                if($half_home_score > $half_home_score and $full_home_score > $full_guest_score) return $data;
                 break;
             case 'half_full_home_dogfall':// 主-和
-                if($half_home_score > $half_guest_score and $full_home_score == $full_guest_score) return 1;
+                if($half_home_score > $half_guest_score and $full_home_score == $full_guest_score) return $data;
                 break;
             case 'half_full_home_guest':// 主-客
-                if($half_home_score > $half_guest_score and $full_home_score < $full_guest_score) return 1;
+                if($half_home_score > $half_guest_score and $full_home_score < $full_guest_score) return $data;
                 break;
             case 'half_full_dogfall_home':// 和-主
-                if($half_home_score == $half_guest_score and $full_home_score > $full_guest_score) return 1;
+                if($half_home_score == $half_guest_score and $full_home_score > $full_guest_score) return $data;
                 break;
             case 'half_full_dogfall_dogfall':// 和-和
-                if($half_home_score == $half_guest_score and $full_home_score == $full_guest_score) return 1;
+                if($half_home_score == $half_guest_score and $full_home_score == $full_guest_score) return $data;
                 break;
             case 'half_full_dogfall_guest':// 和-客
-                if($half_home_score == $half_guest_score and $full_home_score < $full_guest_score) return 1;
+                if($half_home_score == $half_guest_score and $full_home_score < $full_guest_score) return $data;
                 break;
             case 'half_full_guest_home':// 客-主
-                if($half_home_score < $half_guest_score and $full_home_score > $full_guest_score) return 1;
+                if($half_home_score < $half_guest_score and $full_home_score > $full_guest_score) return $data;
                 break;
             case 'half_full_guest_dogfall':// 客-和
-                if($half_home_score < $half_guest_score and $full_home_score == $full_guest_score) return 1;
+                if($half_home_score < $half_guest_score and $full_home_score == $full_guest_score) return $data;
                 break;
             case 'half_full_guest_guest':// 客-客
-                if($half_home_score < $half_guest_score and $full_home_score < $full_guest_score) return 1;
+                if($half_home_score < $half_guest_score and $full_home_score < $full_guest_score) return $data;
                 break;
             default:
                 return false;
         }
 
-        return -1;
+        $data['result'] = -1;
+        return $data;
     }
 
     /**
@@ -768,46 +824,92 @@ class ZqRule
 
         if(empty($bet_match) || empty($result_match) ) return false;
         if($bet_match->p_code != 'gj') return false;//冠军玩法
+
         if($bet_match->odds_code == $result_match->game_name){
             $condition = $bet_match->condition;
 
             //进球数判断
             if(strpos($bet_match->odds_code,'进球数') !== false){
+                //返回结果
+                $data = [
+                    'result'=>1,
+                    'matchResult'=>"$result_match->result(球队进球数)"
+                ];
                 //获取数值
                 $bet = $this->findNum($condition);
                 //以上/以下判断
                 if(strpos($condition,'上') !== false){
-                    if($bet < $result_match->result) return 1;
+                    if($bet < $result_match->result)
+                    {
+                        return $data;
+                    }
+                    $data['result'] = -1;
+                    return $data;
                 }
                 if(strpos($condition,'下') !== false){
-                    if($bet > $result_match->result) return 1;
+                    if($bet > $result_match->result)
+                    {
+                        return $data;
+                    }
+                    $data['result'] = -1;
+                    return $data;
                 }
                 //大/小判断
                 if(strpos($condition,'大') !== false){
-                    if($bet < $result_match->result) return 1;
+                    if($bet < $result_match->result)
+                    {
+                        return $data;
+                    }
+                    $data['result'] = -1;
+                    return $data;
                 }
                 if(strpos($condition,'小') !== false){
-                    if($bet > $result_match->result) return 1;
+                    if($bet > $result_match->result)
+                    {
+                        return $data;
+                    }
+                    $data['result'] = -1;
+                    return $data;
                 }
             }
             //积分成绩判断
             if(strpos($bet_match->odds_code,'积分') !== false){
+                //返回结果
+                $data = [
+                    'result'=>1,
+                    'matchResult'=>"$result_match->result(球队积分)"
+                ];
                 $condition = $bet_match->condition;
                 //获取数值
                 $bet = $this->findNum($condition);
-                if($bet == $result_match->result) return 1;
+                if($bet == $result_match->result)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             }
 
             //如果条件中没有数字,则获取球队/球员结果
             if((preg_match('/\d+/',$condition)) == 0){
+                //返回结果
+                $data = [
+                    'result'=>1,
+                    'matchResult'=>"$result_match->result(晋级球队)"
+                ];
                 $result = $this->teamJudge($condition,$result_match->result);
 
-                if($result) return 1;
+                if($result)
+                {
+                    return $data;
+                }
+                $data['result'] = -1;
+                return $data;
             };
 
             return false;
         }
-        return -1;
+        return false;
     }
 
     /**

+ 182 - 145
app/Lib/Settlement/SettlementWinFail.php

@@ -11,195 +11,223 @@ set_time_limit(600);
 ini_set('memory_limit', '256M');
 
 use Illuminate\Support\Facades\DB;
-use App\Models\Comendnotice  as ComendnoticeModel;
+use App\Models\Comendnotice as ComendnoticeModel;
 
 use  App\Lib\Settlement\Adapter\ZqRule;
 use  App\Lib\Settlement\Adapter\LqRule;
 use  App\Lib\Settlement\Adapter\WqRule;
-use  App\Lib\Settlement\Adapter\BqRule ;
+use  App\Lib\Settlement\Adapter\BqRule;
 
 //一场比赛结束,计算出对应 串式单式下单数据的 输赢并更新到money_buy_match对应记录
 class SettlementWinFail
 {
 
-     //比赛结束消息通知模型
-    public  $ComendNoticModel = null  ;
+    //比赛结束消息通知模型
+    public $ComendNoticModel = null;
 
 
-    public $gameType = '' ;  //类型
-    public $match_id = 0 ;  //比赛ID
+    public $gameType = '';  //类型
+    public $match_id = 0;  //比赛ID
 
-    public $resultModel = null ; //比赛最终结果对像MODEL
-    public $resultRecords = [] ; //比赛中间结果对像数组;
-    public $gjModel = null ;  //冠军比赛结果数据
+    public $resultModel = null; //比赛最终结果对像MODEL
+    public $resultRecords = []; //比赛中间结果对像数组;
+    public $gjModel = null;  //冠军比赛结果数据
 
     //类型映射
     public $gameAllMap = [
-        'zq'=>'ZqRule',
-        'lq'=>'LqRule',
-        'wq'=>'WqRule',
-        'bq'=>'BqRule',
+        'zq' => 'ZqRule',
+        'lq' => 'LqRule',
+        'wq' => 'WqRule',
+        'bq' => 'BqRule',
     ];
-    private  $AdapterObj = null ;
-    private   $RefClass = null  ;
+    private $AdapterObj = null;
+    private $RefClass = null;
 
 
     //按赛事批量结算
-    public function   doRun($id=0){
+    public function doRun($id = 0)
+    {
 
         try {
 
             $ComendNoticModel = $this->getComendNoticeModel($id);
             if (!$ComendNoticModel) {
-                return  $this->makeData(1,'没有要处理的数据,直接退出');
+                return $this->makeData(1, '没有要处理的数据,直接退出');
             }
 
 
-            DB::beginTransaction ();
+            DB::beginTransaction();
 
             $this->writeStatusBegin($ComendNoticModel);
 
-            $allmatchs = DB::table('money_buy_match')->where(['game_code'=>$ComendNoticModel->game_code,'match_id'=>$ComendNoticModel->match_id,'result'=>0])->get();
-             if (empty($allmatchs)) {
+            $allmatchs = DB::table('money_buy_match')->where(['game_code' => $ComendNoticModel->game_code, 'match_id' => $ComendNoticModel->match_id, 'result' => 0])->get();
+            if (empty($allmatchs)) {
                 $this->writeStatusEndOk($ComendNoticModel);
                 DB::commit();
-                return  $this->makeData(1,'本赛事无订单数据,退出');
+                return $this->makeData(1, '本赛事无订单数据,退出');
             }
 
 
-            $this->gameType = $ComendNoticModel->game_code ;
-            $this->match_id =  $ComendNoticModel->match_id ;
+            $this->gameType = $ComendNoticModel->game_code;
+            $this->match_id = $ComendNoticModel->match_id;
 
             $this->setAdapterObj($ComendNoticModel->game_code);
-            $this->RefClass = new  \ReflectionClass(  $this->AdapterObj ) ;
-            $this->getCompResult($ComendNoticModel->game_code,$ComendNoticModel->match_id);
+            $this->RefClass = new  \ReflectionClass($this->AdapterObj);
+            $this->getCompResult($ComendNoticModel->game_code, $ComendNoticModel->match_id);
 
-            $this->Settlement_simplex($this->gameType,$this->match_id);
-            $this->Settlement_str($this->gameType,$this->match_id);
+            $this->Settlement_simplex($this->gameType, $this->match_id);
+            $this->Settlement_str($this->gameType, $this->match_id);
 
 
             $this->writeStatusEndOk($ComendNoticModel);
             DB::commit();
-            return  $this->makeData(1,'success-all');
+            return $this->makeData(1, 'success-all');
 
-        }catch (\Exception $e){
+        } catch (\Exception $e) {
             DB::rollBack();
-            return $this->makeData(0,'false',['msg'=>$e->getMessage(),'code'=>$e->getCode()]) ;
+            return $this->makeData(0, 'false', ['msg' => $e->getMessage(), 'code' => $e->getCode()]);
 
         }
     }
 
     //单式订单结算处理
-    private  function   Settlement_simplex($game_type,$match_id){
-        $buyModels = DB::table('money_buy_simplex')->where(['match_id'=>$match_id,'game_status'=>0])->get();
-        if (empty($buyModels)){ return true; }
-        $buymatchModles = DB::table('money_buy_match')->where(['match_id'=>$match_id,'bet_type'=>1,'result'=>0,'game_code'=>$game_type])->orderby('batch_id','asc')->get();
-        if (empty($buymatchModles)) { return true ; }
-
-        $buyKeyModel =  $buymatchKeyModles = [] ;
-        foreach ($buyModels as $val){
+    private function Settlement_simplex($game_type, $match_id)
+    {
+        $buyModels = DB::table('money_buy_simplex')->where(['match_id' => $match_id, 'game_status' => 0])->get();
+        if (empty($buyModels)) {
+            return true;
+        }
+        $buymatchModles = DB::table('money_buy_match')->where(['match_id' => $match_id, 'bet_type' => 1, 'result' => 0, 'game_code' => $game_type])->orderby('batch_id', 'asc')->get();
+        if (empty($buymatchModles)) {
+            return true;
+        }
+
+        $buyKeyModel = $buymatchKeyModles = [];
+        foreach ($buyModels as $val) {
             $batch_id = $val->batch_id;
             $buyKeyModel[$batch_id] = $val;
         }
-        foreach ($buymatchModles as $val){
+        foreach ($buymatchModles as $val) {
             $batch_id = $val->batch_id;
             $buymatchKeyModles[$batch_id][] = $val;
         }
 
-        foreach ($buyKeyModel as $batch_id=>$val){
-            foreach ($buymatchKeyModles as $sub_batch_id=>$fsval){
-                    foreach ($fsval as $sval) {
-                        $winorfalse = $this->winOrfalseInfo($sval);
-                        $this->makesql_up_buymatch_winorfalse($sval->id, $winorfalse, date("Y-m-d H:i:s"));
-                    }
+        foreach ($buyKeyModel as $batch_id => $val) {
+            foreach ($buymatchKeyModles as $sub_batch_id => $fsval) {
+                foreach ($fsval as $sval) {
+                    $winorfalse = $this->winOrfalseInfo($sval);
+                    $wininfo = $winorfalse['result'];
+                    $matchinfo = $winorfalse['matchResut'];
+                    $this->makesql_up_buymatch_winorfalse($sval->id, $wininfo, date("Y-m-d H:i:s"), $matchinfo);
+                }
             }
         }
         return true;
     }
 
     //串式订单结算处理
-    private function   Settlement_str($game_type,$match_id){
-           $matchModels = DB::table('money_buy_match')->where(['match_id'=>$match_id,'bet_type'=>2,'game_code'=>$game_type])->get();
-           if (empty($matchModels)) {  return true; }
-
-           $batch_ids_array = [] ;
-           $matchKeyModels = [] ;
-           foreach ($matchModels as $val){
-                $matchKeyModels[$val->batch_id][] = $val ;
-                if (!in_array($val->batch_id,$batch_ids_array)){
-                    $batch_ids_array[] = $val->batch_id;
+    private function Settlement_str($game_type, $match_id)
+    {
+        $matchModels = DB::table('money_buy_match')->where(['match_id' => $match_id, 'bet_type' => 2, 'game_code' => $game_type])->get();
+        if (empty($matchModels)) {
+            return true;
+        }
+
+        $batch_ids_array = [];
+        $matchKeyModels = [];
+        foreach ($matchModels as $val) {
+            $matchKeyModels[$val->batch_id][] = $val;
+            if (!in_array($val->batch_id, $batch_ids_array)) {
+                $batch_ids_array[] = $val->batch_id;
+            }
+        }
+
+        $buyModels = DB::table('money_buy_str')->whereIn('batch_id', $batch_ids_array)->get();
+        $buyKeyModels = [];
+        if (empty($buyModels)) {
+            return true;
+        }
+        foreach ($buyModels as $val) {
+            $buyKeyModels[$val->batch_id][] = $val;
+        }
+
+        foreach ($matchKeyModels as $key => $sval_2) {
+            foreach ($sval_2 as $sval) {
+                if ($sval->match_id != $this->match_id) {
+                    continue;
                 }
-           }
-
-           $buyModels =  DB::table('money_buy_str')->whereIn( 'batch_id',$batch_ids_array)->get();
-           $buyKeyModels = [] ;
-           if (empty($buyModels)) { return true ; }
-           foreach ($buyModels  as $val){
-               $buyKeyModels[$val->batch_id][] = $val ;
-           }
-
-           foreach ($matchKeyModels as $key=>$sval_2){
-               foreach ($sval_2 as $sval){
-                       if ( $sval->match_id != $this->match_id ){ continue ; }
-                       $winorfalse = $this->winOrfalseInfo($sval);
-                       $this->makesql_up_buymatch_winorfalse($sval->id,$winorfalse,date("Y-m-d H:i:s"));
-                       $sql = "update money_buy_str  set  wait_match_num=wait_match_num-1 where  batch_id='$sval->batch_id' ";
-                       DB::update($sql);
-               }
-           }
+                $winorfalse = $this->winOrfalseInfo($sval);
+                $wininfo = $winorfalse['result'];
+                $matchinfo = $winorfalse['matchResut'];
+                $this->makesql_up_buymatch_winorfalse($sval->id, $wininfo, date("Y-m-d H:i:s"), $matchinfo);
+                $sql = "update money_buy_str  set  wait_match_num=wait_match_num-1 where  batch_id='$sval->batch_id' ";
+                DB::update($sql);
+            }
+        }
     }
 
     //输赢结果判断 $sval 为 money_buy_match  Model; 结果为  -1输  1赢  2平  3赢半平半  4输半平半
-    private  function  winOrfalseInfo($sval){
-        $fun = $sval->odds_code ;
-        $fun2 = $sval->p_code ;
+    private function winOrfalseInfo($sval)
+    {
+        $fun = $sval->odds_code;
+        $fun2 = $sval->p_code;
 
-        if ($sval->p_code != 'gj'){
-            if (empty($this->resultModel) ||  empty($this->resultRecords)){
+        if ($sval->p_code != 'gj') {
+            if (empty($this->resultModel) || empty($this->resultRecords)) {
                 throw  new \Exception('非冠军比赛结果数据不能为空');
             }
 
-            if ( $this->RefClass->hasMethod($fun) ){
-                $winorfalse = $this->AdapterObj->$fun($sval,$this->resultModel,$this->resultRecords);
-            }elseif ( $this->RefClass->hasMethod($fun2) ){
-                $winorfalse = $this->AdapterObj->$fun2($sval,$this->resultModel,$this->resultRecords);
-            }else{
-                throw new \Exception('没有找到玩法输赢判断规则',40010);
+            if ($this->RefClass->hasMethod($fun)) {
+                $winorfalse = $this->AdapterObj->$fun($sval, $this->resultModel, $this->resultRecords);
+            } elseif ($this->RefClass->hasMethod($fun2)) {
+                $winorfalse = $this->AdapterObj->$fun2($sval, $this->resultModel, $this->resultRecords);
+            } else {
+                throw new \Exception('没有找到玩法输赢判断规则', 40010);
             }
-        }else{
+        } else {
             $this->getGjDatas($sval);
-            if (empty($this->gjModel)){
+            if (empty($this->gjModel)) {
                 throw  new \Exception('冠军比赛结果数据不能为空');
             }
 
-            if ( $this->RefClass->hasMethod($fun) ){
-                $winorfalse = $this->AdapterObj->$fun($sval,$this->gjModel,[]);
-            }elseif ( $this->RefClass->hasMethod($fun2) ){
-                $winorfalse = $this->AdapterObj->$fun2($sval,$this->gjModel,[]);
-            }else{
-                throw new \Exception('没有找到玩法输赢判断规则',40010);
+            if ($this->RefClass->hasMethod($fun)) {
+                $winorfalse = $this->AdapterObj->$fun($sval, $this->gjModel, []);
+            } elseif ($this->RefClass->hasMethod($fun2)) {
+                $winorfalse = $this->AdapterObj->$fun2($sval, $this->gjModel, []);
+            } else {
+                throw new \Exception('没有找到玩法输赢判断规则', 40010);
             }
         }
-        if (!in_array($winorfalse,[-1,1,2,3,4])) {
+
+        if (isset($winorfalse['result']) || isset($winorfalse['matchResut'])) {
+            throw new \Exception('输赢结果数据结构异常!', 40011);
+        }
+
+        if (!in_array($winorfalse['result'], [-1, 1, 2, 3, 4])) {
             throw new \Exception('输赢结果异常!');
         }
-        return $winorfalse ;
+        return $winorfalse;
     }
 
 
-    private function  makesql_up_buymatch_winorfalse($id,$result,$utime){
-        $sql = " update  money_buy_match  set  result=$result,utime='$utime'  where id=$id  ";
-        DB::update($sql) ;
+    private function makesql_up_buymatch_winorfalse($id, $result, $utime, $matchResult = '')
+    {
+        $sql = " update  money_buy_match  set  result=$result,utime='$utime',matchResult='$matchResult'  where id=$id  ";
+        DB::update($sql);
 
         return true;
     }
 
-     //设置 输赢 解析规则适配器
-    private  function  setAdapterObj($game_type){
+    //设置 输赢 解析规则适配器
+    private function setAdapterObj($game_type)
+    {
         $game_type = strtolower($game_type);
-        if ( !isset($this->gameAllMap)){  throw  new \Exception('赛事类型错误-'.$game_type,4002);   return false;  }
+        if (!isset($this->gameAllMap)) {
+            throw  new \Exception('赛事类型错误-' . $game_type, 4002);
+            return false;
+        }
 
-        switch ($game_type){
+        switch ($game_type) {
             case 'bq':
                 $this->AdapterObj = new BqRule();
                 break;
@@ -210,89 +238,93 @@ class SettlementWinFail
                 $this->AdapterObj = new WqRule();
                 break;
             case  'zq':
-               $this->AdapterObj = new ZqRule();
+                $this->AdapterObj = new ZqRule();
                 break;
         }
-        return  true ;
+        return true;
     }
 
 
     //返回数据
-    private function  makeData($status=1,$message='success',$data=''){
+    private function makeData($status = 1, $message = 'success', $data = '')
+    {
         return [
-            'status' => $status ,
-            'message' =>$message,
-            'data' => $data ,
-        ] ;
+            'status' => $status,
+            'message' => $message,
+            'data' => $data,
+        ];
     }
 
     //写处理状态
-    public function  writeStatusBegin($comendnticeModel){
+    public function writeStatusBegin($comendnticeModel)
+    {
 
-        $comendnticeModel->status = 1 ;
+        $comendnticeModel->status = 1;
         $comendnticeModel->done_time = date("Y-m-d H:i:s");
-        $comendnticeModel->pcount ++ ;
+        $comendnticeModel->pcount++;
         $comendnticeModel->logs = 'begin|';
         $ret = $comendnticeModel->save();
 
-        return  $ret;
+        return $ret;
     }
 
     //写处理状态结束
-    public function  writeStatusEndOk($comendnticeModel){
+    public function writeStatusEndOk($comendnticeModel)
+    {
 
-        $comendnticeModel->status = 4 ;
+        $comendnticeModel->status = 4;
         $comendnticeModel->done_time = date("Y-m-d H:i:s");
-        $comendnticeModel->logs = $comendnticeModel->logs.'end ok';
+        $comendnticeModel->logs = $comendnticeModel->logs . 'end ok';
         $ret = $comendnticeModel->save();
 
-        return  $ret;
+        return $ret;
     }
 
 
-
     //是否有需要进行结果算处理的赛事记录
-    public  function   getComendNoticeModel($id=0){
-            if ($id){
-                $ret = (new ComendnoticeModel())->where(['id'=>$id,'status'=>0])->orderby('id','asc')->first();
-            }else{
-                $ret = (new ComendnoticeModel())->where('status',0)->orderby('id','asc')->first();
-            }
+    public function getComendNoticeModel($id = 0)
+    {
+        if ($id) {
+            $ret = (new ComendnoticeModel())->where(['id' => $id, 'status' => 0])->orderby('id', 'asc')->first();
+        } else {
+            $ret = (new ComendnoticeModel())->where('status', 0)->orderby('id', 'asc')->first();
+        }
 
 
-            $this->ComendNoticModel = $ret;
-            return $ret;
+        $this->ComendNoticModel = $ret;
+        return $ret;
     }
 
 
     //得到比赛最终结果记录 和 中间结果记录
-    public function  getCompResult($type,$match_id){
-        $model = null ;
-        switch ($type){
+    public function getCompResult($type, $match_id)
+    {
+        $model = null;
+        switch ($type) {
             case 'bq':
-                $model = DB::table('st_bq_result')->where('match_id',$match_id)->first();
-                $models = DB::table('st_bq_result_record')->where('match_id',$match_id)->orderBy('id','asc')->get()->toArray();
+                $model = DB::table('st_bq_result')->where('match_id', $match_id)->first();
+                $models = DB::table('st_bq_result_record')->where('match_id', $match_id)->orderBy('id', 'asc')->get()->toArray();
                 break;
             case  'lq':
-                $model = DB::table('st_lq_result')->where('match_id',$match_id)->first();
-                $models = DB::table('st_lq_result_record')->where('match_id',$match_id)->orderBy('id','asc')->get()->toArray();
+                $model = DB::table('st_lq_result')->where('match_id', $match_id)->first();
+                $models = DB::table('st_lq_result_record')->where('match_id', $match_id)->orderBy('id', 'asc')->get()->toArray();
                 break;
             case  'wq':
-                $model = DB::table('st_wq_result')->where('match_id',$match_id)->first();
-                $models = DB::table('st_wq_result_record')->where('match_id',$match_id)->orderBy('id','asc')->get()->toArray();
+                $model = DB::table('st_wq_result')->where('match_id', $match_id)->first();
+                $models = DB::table('st_wq_result_record')->where('match_id', $match_id)->orderBy('id', 'asc')->get()->toArray();
                 break;
             case  'zq':
-                $model = DB::table('st_zq_result')->where('match_id',$match_id)->first();
-                $models = DB::table('st_zq_result_record')->where('match_id',$match_id)->orderBy('id','asc')->get()->toArray();
+                $model = DB::table('st_zq_result')->where('match_id', $match_id)->first();
+                $models = DB::table('st_zq_result_record')->where('match_id', $match_id)->orderBy('id', 'asc')->get()->toArray();
                 break;
         }
 
         $this->resultModel = $model;
-        $this->resultRecords = $models ;
+        $this->resultRecords = $models;
 
         $ret = [
             'result' => $model,
-            'records' => $models ,
+            'records' => $models,
         ];
         return $ret;
 
@@ -300,14 +332,19 @@ class SettlementWinFail
 
 
     //冠军比赛结果
-    public function  getGjDatas($matchModel){
-        if ( !empty($this->gjModel) ) {  return $this->gjModel ; }
-        $table = 'st_'.$matchModel->game_code.'_league_result';
-        $where = ['lg_id'=>$matchModel->lg_id,'game_name'=>$matchModel->odds_code];
+    public function getGjDatas($matchModel)
+    {
+        if (!empty($this->gjModel)) {
+            return $this->gjModel;
+        }
+        $table = 'st_' . $matchModel->game_code . '_league_result';
+        $where = ['lg_id' => $matchModel->lg_id, 'game_name' => $matchModel->odds_code];
         $model = DB::table($table)->where($where)->first();
-        if (empty($model)){        throw new  \Exception('冠军数据没找到!');      }
-        $this->gjModel = $model ;
-        return $model ;
+        if (empty($model)) {
+            throw new  \Exception('冠军数据没找到!');
+        }
+        $this->gjModel = $model;
+        return $model;
     }
 
 }

+ 38 - 16
app/Models/MoneyBuyStr.php

@@ -31,6 +31,12 @@ class MoneyBuyStr extends BaseModel {
             return -2021052003; //
         }
 
+        //反水
+        $water_return_money = \App\Models\Money_details::where('trade_type','7')->get();
+
+        //订单投注的玩法
+        $content = \App\Models\MoneyBuyMatch::where('bet_type','2')->get();
+
         for($i=0;$i<count($data);$i++){
             if($data[$i]->status==1){
                 $data[$i]->status = '投注';
@@ -57,20 +63,23 @@ class MoneyBuyStr extends BaseModel {
             $data[$i]->detail_content = $data[$i]->settle_status.':'.$mun[0].' [<a class="detail" lay-event="detail" pid="id" uri="/admin/SoccerStringNoteList/detail/?id=" href="/admin/SoccerStringNoteList/detail/?id='.$data[$i]->id.'"> 详情 </a>]';
 
             //反水
-            $data[$i]->water_return = '0';
-            $water_return_money = \App\Models\Money_details::where('trade_id',$data[$i]->order_id)->where('trade_type','7')->first();
-            if(!empty($water_return_money)){
-                $data[$i]->water_return = $water_return_money->money;
-                //用户投注后账户金额
-                $data[$i]->frozen_cash = $water_return_money->money_cash;
-            }else{
+            $data[$i]->water_return = -1;
+            for($a=0;$a<count($water_return_money);$a++){
+                if($data[$i]->order_id == $water_return_money[$a]->trade_id){
+                    $data[$i]->water_return = $water_return_money[$a]->money;
+                    //用户投注后账户金额
+                    $data[$i]->frozen_cash = $water_return_money[$a]->money_cash;
+                }
+            }
+            if($data[$i]->water_return == -1){
+                $data[$i]->water_return == 0;
                 //用户投注后账户金额
                 $data[$i]->frozen_cash = $data[$i]->money_cash;
             }
+            //此时的结果金额
             $data[$i]->result = $data[$i]->water_return+$data[$i]->gain_money;
-
-            $data[$i]->money_match_time = '投注:'.$data[$i]->money_time;
-            
+            //下注时间
+            $data[$i]->money_time = '下注:'.$data[$i]->money_time;
             //用户投注前账户金额
             $data[$i]->available_cash = $data[$i]->money_cash+$data[$i]->money;
 
@@ -78,9 +87,10 @@ class MoneyBuyStr extends BaseModel {
 
             if($data[$i]->settle_status == '未结算'){
                 $result = array();
-                $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;
+                for($j=0;$j<count($content);$j++){
+                    if($data[$i]->batch_id == $content[$j]->batch_id){
+                        $result[] = $content[$j]->result;
+                    }
                 }
                 if(in_array(0,$result)){
                     $data[$i]->settle_status = $data[$i]->settle_status.'<br><a class="layui-btn layui-btn-sm resettlement settlement" lay-event="detail" pid="id" lay-filter = "resettlement" uri="" href="javascript:void(0)" style="background-color: grey;"> 结算 </a>';
@@ -89,7 +99,6 @@ class MoneyBuyStr extends BaseModel {
                 }
 
             }else if($data[$i]->settle_status == '已结算'){
-//                $data[$i]->settle_status = $data[$i]->settle_status.'<br><a class="layui-btn layui-btn-sm resettlement" lay-event="detail" pid="id" lay-filter = "resettlement" uri="/admin/SoccerStringNoteList/resettlement/?id=" href="javascript:resettlement(\'/admin/SoccerStringNoteList/resettlement/?id='.$data[$i]->id.'\');"> 重新结算 </a>';
                 $data[$i]->settle_status = $data[$i]->settle_status.'<br><a class="layui-btn layui-btn-sm resettlement settlement" lay-event="detail" pid="id" lay-filter = "resettlement" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已结算 </a>';
             }
 
@@ -119,19 +128,32 @@ class MoneyBuyStr extends BaseModel {
         $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();
+            $league = DB::table('st_'.$data[$i]->game_code.'_league')->join('st_'.$data[$i]->game_code.'_competition','st_'.$data[$i]->game_code.'_competition.lg_id','=','st_'.$data[$i]->game_code.'_league.lg_id')->where('st_'.$data[$i]->game_code.'_league.lg_id',$data[$i]->lg_id)->first();
             if(!empty($league)){
                 $data[$i]->league = $league->name_chinese;
+                $data[$i]->time = $league->match_date.' '.$league->match_time;
+
             }else{
                 $data[$i]->league = $data[$i]->lg_id;
             }
 
-            $odds_code = \App\Models\Matchcode::where('odds_code',$data[$i]->odds_code)->first();
+            if(!empty(strstr($data[$i]->odds_code,'home',true))){
+                $data[$i]->team = $data[$i]->home_team;
+            }
+            if(!empty(strstr($data[$i]->odds_code,'guest',true))){
+                $data[$i]->team = $data[$i]->guest_team;
+            }
+            $p_code = \App\Models\Matchcode::where('odds_code',$data[$i]->p_code)->where('game_code',$data[$i]->game_code)->first();
+            $odds_code = \App\Models\Matchcode::where('odds_code',$data[$i]->odds_code)->where('game_code',$data[$i]->game_code)->first();
             if(!empty($odds_code)){
                 $data[$i]->odds_code = $odds_code->odds_name;
             }
+            if(!empty($p_code)){
+                $data[$i]->p_code = $p_code->odds_name;
+            }
 
             $data[$i]->home_guest = $data[$i]->home_team.' VS '.$data[$i]->guest_team;
+            $data[$i]->content = $data[$i]->p_code.'<br>'.$data[$i]->odds_code.$data[$i]->condition.'<br>'.$data[$i]->team.' @'.$data[$i]->odds;
 
             for($j=0;$j<count($game_type);$j++){
                 if($data[$i]->game_code == $game_type[$j]->game_code){

+ 83 - 57
app/Models/SportsNoteList.php

@@ -17,7 +17,7 @@ class SportsNoteList extends BaseModel {
             ->join('money_details','money_details.info_identity','=','money_buy_simplex.info_identity')
             ->join('st_'.$type.'_competition','st_'.$type.'_competition.match_id','=','money_buy_simplex.match_id')
             ->join('st_'.$type.'_league','st_'.$type.'_competition.lg_id','=','st_'.$type.'_league.lg_id')
-            ->select('money_buy_simplex.id','money_buy_simplex.account_name','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','money_details.money_cash','money_buy_simplex.batch_id','st_'.$type.'_league.name_chinese')
+            ->select('money_buy_simplex.id','money_buy_simplex.account_name','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','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);
@@ -31,6 +31,10 @@ class SportsNoteList extends BaseModel {
         //订单投注的玩法
         $content = \App\Models\MoneyBuyMatch::where('bet_type','1')->get();
 
+        //玩法
+        $result = \App\Models\Matchcode::where('game_code','zq')->get();
+        //$result = \App\Models\Matchcode::get();
+
 
         for($i=0;$i<count($data);$i++){
             if($data[$i]->settle_status==1){
@@ -51,8 +55,8 @@ 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]->match_time = '开赛:'.$data[$i]->match_date.' '.$data[$i]->match_time;
-            $data[$i]->money_match_time = '投注:'.$data[$i]->money_time.'<br>'.$data[$i]->match_time;
+            $data[$i]->time = '开赛:'.$data[$i]->match_date.' '.$data[$i]->match_time;
+            $data[$i]->money_match_time = '下注:'.$data[$i]->money_time.'<br>'.$data[$i]->time;
 
             //反水
             $data[$i]->water_return = -1;
@@ -68,72 +72,94 @@ class SportsNoteList extends BaseModel {
                 //用户投注后账户金额
                 $data[$i]->frozen_cash = $data[$i]->money_cash;
             }
-
-//            $water_return_money = \App\Models\Money_details::where('trade_id',$data[$i]->order_id)->where('trade_type','7')->first();
-//            if(!empty($water_return_money)){
-//                $data[$i]->water_return = $water_return_money->money;
-//                //用户投注后账户金额
-//                $data[$i]->frozen_cash = $water_return_money->money_cash;
-//            }else{
-//                //用户投注后账户金额
-//                $data[$i]->frozen_cash = $data[$i]->money_cash;
-//            }
-
+            //此时结果金额
             $data[$i]->result = $data[$i]->water_return+$data[$i]->gain_money;
-
             //用户投注前账户金额
             $data[$i]->available_cash = $data[$i]->money_cash;
 
             $data[$i]->account = $data[$i]->available_cash.'<br><span>'.$data[$i]->account_name.'</span><br>'.$data[$i]->frozen_cash;
 
-//            $data[$i]->str = 0;
-//            for($b=0;$b<count($content);$b++){
-//                if($data[$i]->match_id == $content[$b]->match_id && $data[$i]->batch_id == $content[$b]->batch_id){
-//                    if($content[$b]->result == '0'){
-//                        $data[$i]->str = 1;
-//                    }else{
-//                        if($data[$i]->game_status == '未处理'){
-//                            $data[$i]->str = 2;
-//                        }else{
-//                            $data[$i]->str = 3;
-//                        }
-//                    }
-//                }
-//            }
-//            if($data[$i]->str == 1){
-//                $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm audit" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 结算 </a>';
-//            }
-//            if($data[$i]->str == 2){
-//                $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm settlement" lay-event="detail" pid="id" uri="/admin/SoccerNoteList/settlement/?id=" href="javascript:settlement(\'/admin/SoccerNoteList/settlement/?id='.$data[$i]->id.'\');"> 结算 </a>';
-//            }
-//            if($data[$i]->str == 3){
-//                $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm resettlement" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已结算 </a>';
-//            }
 
+            $data[$i]->str = 0;
+            $data[$i]->str1 = 0;
+            for($b=0;$b<count($content);$b++){
+                if(!empty($content[$b]->odds_code)){
+                    if(!empty(strstr($content[$b]->odds_code,'home',true))){
+                        $data[$i]->team = $data[$i]->home_team;
+                    }
+                    if(!empty(strstr($content[$b]->odds_code,'guest',true))){
+                        $data[$i]->team = $data[$i]->guest_team;
+                    }
+                }
 
-            $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{
-                if($data[$i]->game_status == '未处理'){
-                    $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm settlement" lay-event="detail" pid="id" uri="/admin/SoccerNoteList/settlement/?id=" href="javascript:settlement(\'/admin/SoccerNoteList/settlement/?id='.$data[$i]->id.'\');"> 结算 </a>';
-                }else{
-                    //$data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm resettlement" lay-event="detail" pid="id" uri="/admin/SoccerNoteList/resettlement/?id=" href="javascript:resettlement(\'/admin/SoccerNoteList/resettlement/?id='.$data[$i]->id.'\');"> 重新结算 </a>';
-                    $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm resettlement" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已结算 </a>';
+                if($data[$i]->match_id == $content[$b]->match_id && $data[$i]->batch_id == $content[$b]->batch_id){
+                    if($content[$b]->result == '0'){
+                        $data[$i]->str = 1;
+                    }else{
+                        if($data[$i]->game_status == '未处理'){
+                            $data[$i]->str = 2;
+                        }else{
+                            $data[$i]->str = 3;
+                        }
+                    }
+
+                    //投注详情
+                    if(!empty($data[$i]->match_time)){
+                        $data[$i]->content1 = '['.$data[$i]->match_time.']';
+                        //$data[$i]->match_time = $data[$i]->match_time;
+                    }else{
+                        if(!empty($data[$i]->last_time)){
+                            $datetime = explode(' ',$data[$i]->last_time);
+                            //$data[$i]->match_time = $datetime[1];
+                            $data[$i]->content1 = '['.$datetime[1].']';
+                        }
+                    }
+                    for($c=0;$c<count($result);$c++){
+                        if($content[$b]->odds_code == $result[$c]->odds_code){
+                            $data[$i]->str1 = 1;
+                            $data[$i]->content = $data[$i]->content.$result[$c]->odds_name.' '.$content[$b]->condition.'<br>'.$data[$i]->team.'@'.$content[$b]->odds.' ¥'.$content[$b]->bet_money.'<br>';
+                        }
+                    }
+                    if($data[$i]->str1 == 0){
+                        $data[$i]->content = $data[$i]->content.$content[$b]->odds_code.' '.$content[$b]->condition.'<br>'.$data[$i]->team.'@'.$content[$b]->odds.' ¥'.$content[$b]->bet_money.'<br>';
+                    }
                 }
             }
+            if($data[$i]->str == 1){
+                $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm audit" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: grey;"> 结算 </a>';
+            }
+            if($data[$i]->str == 2){
+                $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm settlement" lay-event="detail" pid="id" uri="/admin/SoccerNoteList/settlement/?id=" href="javascript:settlement(\'/admin/SoccerNoteList/settlement/?id='.$data[$i]->id.'\');"> 结算 </a>';
+            }
+            if($data[$i]->str == 3){
+                $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm resettlement" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已结算 </a>';
+            }
+            $data[$i]->content = $data[$i]->content1.$data[$i]->content;
 
-            for($j=0;$j<count($content);$j++){
-                $odds_code = $content[$j]->odds_code;
-                $result = \App\Models\Matchcode::where('odds_code',$odds_code)->first();
-                if(!empty($result)){
-                    $odds_name = $result->odds_name;
-                }else{
-                    $odds_name = $odds_code;
-                }
-                $data[$i]->content = $data[$i]->content.$odds_name.$content[$j]->condition.' ¥'.$content[$j]->bet_money.'@'.$content[$j]->odds.'<br>';
 
-            }
+//            $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{
+//                if($data[$i]->game_status == '未处理'){
+//                    $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm settlement" lay-event="detail" pid="id" uri="/admin/SoccerNoteList/settlement/?id=" href="javascript:settlement(\'/admin/SoccerNoteList/settlement/?id='.$data[$i]->id.'\');"> 结算 </a>';
+//                }else{
+//                    //$data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm resettlement" lay-event="detail" pid="id" uri="/admin/SoccerNoteList/resettlement/?id=" href="javascript:resettlement(\'/admin/SoccerNoteList/resettlement/?id='.$data[$i]->id.'\');"> 重新结算 </a>';
+//                    $data[$i]->game_status = $data[$i]->game_status.'<br><a class="layui-btn layui-btn-sm resettlement" lay-event="detail" pid="id" uri="" href="javascript:void(0)" style="background-color: #FFAF60;"> 已结算 </a>';
+//                }
+//            }
+//
+//            for($j=0;$j<count($content);$j++){
+//                $odds_code = $content[$j]->odds_code;
+//                $result = \App\Models\Matchcode::where('odds_code',$odds_code)->first();
+//                if(!empty($result)){
+//                    $odds_name = $result->odds_name;
+//                }else{
+//                    $odds_name = $odds_code;
+//                }
+//                $data[$i]->content = $data[$i]->content.$odds_name.' #'.$content[$j]->condition.' ¥'.$content[$j]->bet_money.'@'.$content[$j]->odds.'<br>';
+//
+//            }
 
         }
         return $data->toArray();

+ 1 - 0
public/function.php

@@ -306,3 +306,4 @@ function  floatPointDigit($data,$long=2){
     $for2 = "%.".($long+1)."f" ;
     return  sprintf($for1,substr(sprintf($for2, $data), 0, -1));
 }
+

+ 1 - 1
resources/lang/zh-cn/sportsfoot.php

@@ -32,7 +32,7 @@ return array(
 	'end_time' => '时间止',
 	'lgselect' => '联赛查询',
 	'qxlgselect' => '请选择联赛',
-	'newtime' => '日期/联赛',
+	'newtime' => '联赛',
 	'totime' => '时间',
 	'dsnum' => '单式注单数',
 	'csnum' => '串式注单数',

+ 2 - 1
resources/lang/zh-cn/sportsnotelist.php

@@ -9,7 +9,8 @@ return array(
     'match_id_order' => '赛事id/订单号',
     'game' => '游戏名称',
     'league' => '联赛名',
-    'money_match_time' => '投注/开赛时间',
+    'money_match_time' => '下注/开赛时间',
+    'time' => '开赛时间',
     'home_guest' => '主队 VS 客队',
     'game_no' => '游戏期号',
     'prize_note' => '中奖注数',