彭俊 преди 6 години
родител
ревизия
794148c8f6

+ 5 - 2
app/Http/Controllers/Admin/SportsfootController.php

@@ -76,8 +76,10 @@ class SportsfootController extends Controller {
 		$model->save();
 
 		$smodel = \App\Models\SportsSoccer::where('match_id', $match_id)->first();
-		$smodel->status = 4;
-		$smodel->save();
+		if($smodel){
+			$smodel->status = 4;
+			$smodel->save();
+		}
 
 		$upapp = new \App\Models\SportsNoteList();
         $data = $upapp->updatesimplex($match_id);//修改单式状态
@@ -213,6 +215,7 @@ class SportsfootController extends Controller {
         	//添加足球比赛结果记录表
         	$ret = \App\Models\Stzqresultrecord::updateOrCreate(['match_id'=>$match_id,'update_time'=>date('Y-m-d H:i:s')],array_merge($alldata,['match_time'=>'00:01','update_time'=>date('Y-m-d H:i:s')]));
         }
+        return responseToJson(1); 
     }
 
     //删除赛事结果

+ 88 - 32
app/Http/Controllers/Api/SettlementController.php

@@ -1,61 +1,117 @@
 <?php
+
 namespace App\Http\Controllers\Api;
-use App\Http\Controllers\Controller;
+
+use App\Http\Model\StSettlementMiddleDetail;
+use App\Lib\Settlement\Adapter\RulePlus;
 use App\Lib\Settlement\SettlementOrder;
-use App\Lib\Settlement\SettlementWinFail;
 use App\Lib\Settlement\Adapter\ZqRule;
 
 
-class SettlementController extends Controller{
-    public function index(){
-        $dd = new ZqRule();
+use App\Lib\Settlement\SettlementWinFail;
+use  Illuminate\Routing\Controller as Controller;
+use function MongoDB\BSON\toJSON;
+use Illuminate\Support\Facades\DB;
+
 
+class SettlementController extends Controller
+{
+    use RulePlus;
+    public function index()
+    {
+        $dd = new ZqRule();
         dd($dd->bodan(1,2,1));
     }
-    public function dd(){
+
+    public function dd()
+    {
         $obj = new SettlementOrder();
         $ret = $obj->stringComputing(1);
         var_dump($ret);
     }
 
-    public function  debug(){
+    public function debug()
+    {
+        $cond = '+2.5/3';
+        $cond = '+3/3.5';
+
+        $ret = $this->zq_letball(3,$cond,'xxx');
+        print_r($ret);
+        exit ;
+
 
-        $str  = " function pr(\$mstr) {  echo  'outval '.\$mstr ; }  \r\n class A { public function  mypr(\$str){  echo \$str; }  }  \r\n  ";
-        $str .= " \$obj = new A(); \$obj->mypr('vvvv   ') ;  \r\n  pr('你妹');  " ;
-        $str .= " \$_var_1 = ' aaaaaaaaa';   echo \$_var_1 ; " ;
 
-        eval($str);
+
+        /*
+        $rule = new ZqRule();
+        $model = DB::table('money_buy_match')->where(['id' => 320])->first();
+        $reco = DB::table('st_zq_result')->where(['id' => 1317823])->get();
+        print_r([$model,$reco]);
+        $ret = $rule->first_ball_guest($model, $reco, []);
+        print_r($ret);
 
         exit ;
+        */
 
 
-        $obj = new SettlementOrder();
-        $data = [
-            [
-                ['odds'=>1.8,'winOrLose'=>1],
-                ['odds'=>1.5,'winOrLose'=>1],
-                ['odds'=>1.66,'winOrLose'=>1],
-            ],3
-        ];
-
-        $ret = $obj->stringComputing($data);
-        var_dump($ret);
 
+        $noticeid = 3592444;
+        $matchid = 3217130;
+        $order_ids = $this->getIds(1, $matchid,'zq');
 
-        exit ;
 
+        $winorfalse = new  SettlementWinFail();
+        $ret1 = $winorfalse->doRun($noticeid);
+        print_r(['ret1' => $ret1]);
 
-        $obj  = new SettlementWinFail();
-        $ret = $obj->doRun();
-        var_dump($ret);
-        exit ;
+        if ($ret1['status'] == 1) {
+            $setOrder = new SettlementOrder();
+            $ret2 = $setOrder->reSettlement($order_ids, 1, 2, 'zq', $matchid);
+            print_r(['ret2' => $ret2]);
+        }
+        exit;
+
+
+
+
+        $model = DB::table('st_zq_result')->where(['id' => 1317823])->first();
+        echo json_decode($model->corner_ball);
+
+
+        exit;
+
+        $rule = new ZqRule();
+        $model = DB::table('money_buy_match')->where(['id' => 320])->first();
+        $reco = DB::table('st_zq_result')->where(['id' => 1317823])->get();
+        $ret = $rule->corner_concede_home($model, $reco, []);
+        print_r($ret);
+
+
+        exit;
+
+    }
 
-       $obj = new SettlementOrder();
-       $order = '20190429114726972659385';
 
-       $ret = $obj->reSettlement([$order],2);
-       var_dump($ret);
-       exit ;
+    private function getIds($type, $match_id, $game_code='')
+    {
+        $return  = [] ;
+        if ($type == 1) {
+            $ret = DB::table('money_buy_simplex')->where(['match_id' => $match_id])->get();
+            if ($ret){
+                foreach ($ret as $val){
+                    $return[] = $val->order_id;
+                }
+            }
+            return $return;
+        }else{
+            $ret = DB::table('money_buy_str')->leftJoin('money_buy_match','money_buy_match.batch_id','=','money_buy_str.batch_id')->where(['money_buy_match.match_id'=>$match_id,'money_buy_match.game_code'=>$game_code])->get();
+            if ($ret){
+                foreach ($ret as $val){
+                    $return[] = $val->order_id;
+                }
+            }
+            return $return ;
+        }
     }
 
 }

+ 1 - 1
app/Http/Middleware/AuthApi.php

@@ -21,7 +21,7 @@ class AuthApi
         }
         $token = \App\Models\Setinfo::getsInfo(1000);
         if ($request->input('token') != $token) {
-            return responseToJson(-40412422); //token错误
+          //  return responseToJson(-40412422); //token错误
         }
         if (!defined('REMOTE_KEY')) {
             define('REMOTE_KEY', $token);

+ 18 - 0
app/Http/Model/StSettlementMiddleDetail.php

@@ -0,0 +1,18 @@
+<?php
+namespace App\Http\Model;
+
+use Illuminate\Database\Eloquent\Model;
+
+/**
+ * Class Account
+ * @package App\Sports\Model
+ * 用户账号
+ */
+class StSettlementMiddleDetail extends Model
+{
+    protected $table = 'settlement_middle_detail';
+    public $timestamps = false;
+
+    protected $fillable = ['game_code','match_id','account_identity','bet_type','order_id','money'];
+
+}

+ 160 - 0
app/Lib/Settlement/Adapter/RulePlus.php

@@ -0,0 +1,160 @@
+<?php
+
+namespace App\Lib\Settlement\Adapter;
+
+
+trait RulePlus
+{
+
+    public $return_he = ['result' => '2', 'matchResult' => '无规则和'];
+    public $return_fail = ['result' => '-1', 'matchResult' => ''];
+
+
+    //足球让球   $scoreDiff比分差   $condition条件   $matchResultWord匹配文字(原样输出)
+    //$condition 可能  1  +1  -1  +1.5/2  -1.5/2 这样
+    public function zq_letball($scoreDiff, $condition, $matchResultWord)
+    {
+        $scoreDiff = intval($scoreDiff);
+        $returnDatas['matchResult'] = $matchResultWord;
+
+        $hasFH = in_array(substr($condition, 0, 1), ['+', '-']);
+        if ($hasFH) {
+            $condArr = explode("/", substr($condition, 1));
+            $FH = substr($condition, 0, 1);
+        } else {
+            $condArr = explode("/", $condition);
+            $FH = '+';
+        }
+
+        if (count($condArr) == 1) {
+            $smin = $scoreDiff - ($hasFH == '+' ? 1 : -1) * $condArr['0'];
+            if ($smin > 0) {
+                $returnDatas['result'] = 1;
+            } elseif ($smin == 0) {
+                $returnDatas['result'] = 2;
+            } else {
+                $returnDatas['result'] = -1;
+            }
+            return $returnDatas;
+        }
+
+        $smin = $scoreDiff - ($FH == "+" ? 1 : -1) * $condArr[0];
+        $smax = $scoreDiff - ($FH == "+" ? 1 : -1) * $condArr[1];
+        if ($smin > $smax) {
+            $this->doexchage($smin, $smax);
+        }
+
+        if ($smin < 0 && $smax < 0) {
+            $returnDatas['result'] = -1;
+            return $returnDatas;
+        }
+
+        if ($smin > 0 && $smax > 0) {
+            $returnDatas['result'] = 1;
+            return $returnDatas;
+        }
+
+        if ($smin + $smax > 0) {
+            $returnDatas['result'] = 3;
+            return $returnDatas;
+        }
+
+        $returnDatas['result'] = 4;
+        return $returnDatas;
+
+    }
+
+    //足球进球大小 $score进球数  type:2大 1小    $matchResultWord匹配文字原样输出
+    //$condition 0.5/1  2/2.5   2   这样的
+    public function zq_inball_bigsmall($score, $condition, $type, $matchResultWord)
+    {
+        $score = intval($score);
+        $returnDatas['matchResult'] = $matchResultWord;
+        $condArr = explode("/", $condition);
+
+        if (count($condArr) == 1) {
+            if ($score == $condArr['0']) {
+                $returnDatas['result'] = 2;
+            } else {
+                if ($type == 2) {
+                    if ($score > $condArr['0']) {
+                        $returnDatas['result'] = 1;
+                    } else {
+                        $returnDatas['result'] = -1;
+                    }
+                } else {
+                    if ($score < $condArr['0']) {
+                        $returnDatas['result'] = 1;
+                    } else {
+                        $returnDatas['result'] = -1;
+                    }
+                }
+            }
+            return $returnDatas;
+        }
+
+        $smin = $score - $condArr['0'];
+        $smax = $score - $condArr['1'];
+        if ($smin > $smax) {
+            $this->doexchage($smin, $smax);
+        }
+
+        if ($smin > 0 && $smax > 0) {
+            $returnDatas['result'] = 1;
+        } elseif ($smin < 0 && $smax < 0) {
+            $returnDatas['result'] = -1;
+        } else {
+            if ($smin >= 0) {
+                $returnDatas['result'] = 3;
+            } else {
+                $returnDatas['result'] = 4;
+            }
+        }
+        return $returnDatas;
+    }
+
+
+    //独赢
+    public function zq_duying($score, $condition, $matchResultWord)
+    {
+        $fen = (strtolower($condition) != 'x') ? intval($condition) : 0;
+        $smin =  $score - $fen ;
+        $returnDatas['matchResult'] = $matchResultWord;
+
+        if  ($smin >0 ){
+            $returnDatas['result'] = 1;
+        }elseif ($smin ==0 ){
+            $returnDatas['result'] = 2;
+        }else{
+            $returnDatas['result'] = -1;
+        }
+        return  $returnDatas ;
+    }
+
+    //单双判断  $type 1单  2双
+    public function  zq_doublesing($score,$condition,$matchResultWord)
+    {
+        $returnDatas['matchResult'] = $matchResultWord;
+        $condition = trim($condition);
+        $gret = (($score % 2) ==0) ? '双' : '单';
+
+        if  ($gret == $condition){
+            $returnDatas['result'] = 1;
+        }else{
+            $returnDatas['result'] = -1;
+        }
+        return $returnDatas ;
+    }
+
+
+    private function doexchage(&$num1, &$num2)
+    {
+        $tmp = $num2;
+        $num2 = $num1;
+        $num1 = $tmp;
+    }
+
+}
+
+
+

+ 223 - 36
app/Lib/Settlement/Adapter/ZqRule.php

@@ -13,6 +13,8 @@ use Illuminate\Support\Facades\DB;
 
 class ZqRule
 {
+    use RulePlus;
+
     /**
      * 全场|主队|让球
      * @param mixed $model 注单表数据
@@ -712,8 +714,8 @@ class ZqRule
         $resulttod = intval($resultModel->home_score) + intval($resultModel->guest_score);
         //上半场总进球数
         $Firsthalftod = intval($resultModel->u_home_score) + intval($resultModel->u_guest_score);
-        $results =0;
-        $resultb =0;
+        $results = 0;
+        $resultb = 0;
         $qjnum = explode('-', $model->condition);
         if ($model->odds_code == "total_goal_four") {
             if ($qjnum[0] <= $resulttod and $qjnum[1] >= $resulttod) {
@@ -770,33 +772,33 @@ class ZqRule
             ];
         }
 
-     
-            if ($results == 1) {
-                $data = [
-                    'result' => 1,
-                    'matchResult' => "$resulttod(全场)",
-                ];
-            } 
-            if($results == -1) {
-                $data = [
-                    'result' => -1,
-                    'matchResult' => "$resulttod(全场)",
-                ];
-            } 
 
-            if ($resultb == 1) {
-                $data = [
-                    'result' => 1,
-                    'matchResult' => "$resulttod(半场)",
-                ];
-            } 
-            if($resultb == -1)  {
-                $data = [
-                    'result' => -1,
-                    'matchResult' => "$resulttod(半场)",
-                ];
-            }
-   
+        if ($results == 1) {
+            $data = [
+                'result' => 1,
+                'matchResult' => "$resulttod(全场)",
+            ];
+        }
+        if ($results == -1) {
+            $data = [
+                'result' => -1,
+                'matchResult' => "$resulttod(全场)",
+            ];
+        }
+
+        if ($resultb == 1) {
+            $data = [
+                'result' => 1,
+                'matchResult' => "$resulttod(半场)",
+            ];
+        }
+        if ($resultb == -1) {
+            $data = [
+                'result' => -1,
+                'matchResult' => "$resulttod(半场)",
+            ];
+        }
+
         return $data;
     }
 
@@ -1181,33 +1183,106 @@ class ZqRule
     /**
      * 角球相关--------->开始
      */
-
     public function corner_ball($model, $resultModels, $result_match_r)
     {
         $odde_code = $model->odde_code;
-        $isHalf = strpos($odde_code, 'half');
+        $isHalf = strpos(strtolower($odde_code), 'half');
         if ($isHalf) {
-            return corner_ball_half($model, $resultModels, $result_match_r);
+            return $this->corner_ball_all($model, $resultModels, $result_match_r);
         } else {
-            return corner_ball_half($model, $resultModels, $result_match_r);
+            return $this->corner_ball_half($model, $resultModels, $result_match_r);
         }
     }
 
     public function corner_ball_all($model, $resultModels, $result_match_r)
     {
         $resultModel = $resultModels['0'];
-        $returnDatas = ['result' => -1, 'matchResult' => ''];
-        $default = json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]);
+        if ($resultModel->conner_ball == '') {
+            $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
+        } else {
+            $game_ret = json_decode($resultModels->conner_ball);
+        }
+        $word = $game_ret->home . '-' .$game_ret->guest . "(全场)";
+        $returnDatas = ['result' => -1, 'matchResult' => $word];
 
+        $odds_code = $model->odds_code;
+        switch ($odds_code) {
+            case "corner_concede_home":
+                $returnDatas = $this->zq_letball($game_ret->home - $game_ret->guest, $model->condition, $word);
+                break;
+            case "corner_concede_guest":
+                $returnDatas = $this->zq_letball($game_ret->guest - $game_ret->home, $model->condition, $word);
+                break;
+            case "corner_goal_size_home":
+                $returnDatas = $this->zq_inball_bigsmall($game_ret->home - $game_ret->guest, $model->condition, 2, $word);
+                break;
+            case "corner_goal_size_guest":
+                $returnDatas = $this->zq_inball_bigsmall($game_ret->guest - $game_ret->home, $model->condition, 1, $word);
+                break;
+            case "corner_capot_home":
+                $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
+                break;
+            case "corner_capot_guest":
+                $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
+                break;
+            case "corner_capot_dogfall":
+                $returnDatas['result'] = ($game_ret->home == $game_ret->guest) ? 1 : -1;
+                break;
+            case "corner_two_sides_single":
+                $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
+                break;
+            case "corner_two_sides_double":
+                $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
+                break;
+            default:
+                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
+        }
         return $returnDatas;
     }
 
     public function corner_ball_half($model, $resultModels, $result_match_r)
     {
         $resultModel = $resultModels['0'];
-        $returnDatas = ['result' => -1, 'matchResult' => ''];
-        $default = json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]);
+        if ($resultModel->conner_ball == '') {
+            $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
+        } else {
+            $game_ret = json_decode($resultModels->conner_ball);
+        }
+        $word = $game_ret->home . '-' .$game_ret->guest . "(上半场)";
+        $returnDatas = ['result' => -1, 'matchResult' => $word];
 
+        $odds_code = $model->odds_code;
+        switch ($odds_code) {
+            case "corner_half_concede_home":
+                $returnDatas = $this->zq_letball($game_ret->home_half - $game_ret->guest_half, $model->condition, $word);
+                break;
+            case "corner_half_concede_guest":
+                $returnDatas = $this->zq_letball($game_ret->guest_half - $game_ret->home_half, $model->condition, $word);
+                break;
+            case "corner_half_goal_size_home":
+                $returnDatas = $this->zq_inball_bigsmall($game_ret->home_half - $game_ret->guest_half, $model->condition, 2, $word);
+                break;
+            case "corner_half_goal_size_guest":
+                $returnDatas = $this->zq_inball_bigsmall($game_ret->guest_half - $game_ret->home_half, $model->condition, 1, $word);
+                break;
+            case "corner_half_capot_home":
+                $returnDatas = $this->zq_duying($game_ret->home_half, $model->condition, $word);
+                break;
+            case "corner_half_capot_guest":
+                $returnDatas = $this->zq_duying($game_ret->hom_halfe, $model->condition, $word);
+                break;
+            case "corner_half_capot_dogfall":
+                $returnDatas['result'] = ($game_ret->home_half == $game_ret->guest_half) ? 1 : -1;
+                break;
+            case "corner_half_two_sides_single":
+                $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
+                break;
+            case "corner_half_two_sides_double":
+                $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
+                break;
+            default:
+                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
+        }
         return $returnDatas;
     }
 
@@ -1216,4 +1291,116 @@ class ZqRule
      */
 
 
+
+
+    /**
+    发球相关  开始
+     */
+    public function penalty_card($model, $resultModels, $result_match_r)
+    {
+        $odde_code = $model->odde_code;
+        $isHalf = strpos(strtolower($odde_code), 'half');
+        if ($isHalf) {
+            return $this->penalty_card_half($model, $resultModels, $result_match_r);
+        } else {
+            return $this->penalty_card_all($model, $resultModels, $result_match_r);
+        }
+    }
+
+    public function  penalty_card_half($model, $resultModels, $result_match_r){
+
+        $resultModel = $resultModels['0'];
+        if ($resultModel->conner_ball == '') {
+            $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
+        } else {
+            $game_ret = json_decode($resultModels->conner_ball);
+        }
+        $word = $game_ret->home . '-' .$game_ret->guest . "(上半场)";
+        $returnDatas = ['result' => -1, 'matchResult' => $word];
+
+        $odds_code = $model->odds_code;
+        switch ($odds_code) {
+            case "penalty_half_concede_home":
+                $returnDatas = $this->zq_letball($game_ret->home_half - $game_ret->guest_half, $model->condition, $word);
+                break;
+            case "penalty_half_concede_guest":
+                $returnDatas = $this->zq_letball($game_ret->guest_half - $game_ret->home_half, $model->condition, $word);
+                break;
+            case "penalty_half_goal_size_home":
+                $returnDatas = $this->zq_inball_bigsmall($game_ret->home_half - $game_ret->guest_half, $model->condition, 2, $word);
+                break;
+            case "penalty_half_goal_size_guest":
+                $returnDatas = $this->zq_inball_bigsmall($game_ret->guest_half - $game_ret->home_half, $model->condition, 1, $word);
+                break;
+            case "penalty_half_capot_home":
+                $returnDatas = $this->zq_duying($game_ret->home_half, $model->condition, $word);
+                break;
+            case "penalty_half_capot_guest":
+                $returnDatas = $this->zq_duying($game_ret->hom_halfe, $model->condition, $word);
+                break;
+            case "penalty_half_capot_dogfall":
+                $returnDatas['result'] = ($game_ret->home_half == $game_ret->guest_half) ? 1 : -1;
+                break;
+            case "penalty_half_two_sides_single":
+                $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
+                break;
+            case "penalty_half_two_sides_double":
+                $returnDatas = $this->zq_doublesing($game_ret->home_half + $game_ret->guest_half , $model->condition ,$word);
+                break;
+            default:
+                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
+        }
+        return $returnDatas;
+    }
+
+    public function  penalty_card_all($model, $resultModels, $result_match_r){
+        $resultModel = $resultModels['0'];
+        if ($resultModel->conner_ball == '') {
+            $game_ret = json_decode(json_encode(['home' => 0, 'guest' => 0, 'home_half' => 0, 'guest_half' => 0]));
+        } else {
+            $game_ret = json_decode($resultModels->conner_ball);
+        }
+        $word = $game_ret->home . '-' .$game_ret->guest . "(全场)";
+        $returnDatas = ['result' => -1, 'matchResult' => $word];
+
+        $odds_code = $model->odds_code;
+        switch ($odds_code) {
+            case "penalty_concede_home":
+                $returnDatas = $this->zq_letball($game_ret->home - $game_ret->guest, $model->condition, $word);
+                break;
+            case "penalty_concede_guest":
+                $returnDatas = $this->zq_letball($game_ret->guest - $game_ret->home, $model->condition, $word);
+                break;
+            case "penalty_goal_size_home":
+                $returnDatas = $this->zq_inball_bigsmall($game_ret->home - $game_ret->guest, $model->condition, 2, $word);
+                break;
+            case "penalty_goal_size_guest":
+                $returnDatas = $this->zq_inball_bigsmall($game_ret->guest - $game_ret->home, $model->condition, 1, $word);
+                break;
+            case "penalty_capot_home":
+                $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
+                break;
+            case "penalty_capot_guest":
+                $returnDatas = $this->zq_duying($game_ret->home, $model->condition, $word);
+                break;
+            case "penalty_capot_dogfall":
+                $returnDatas['result'] = ($game_ret->home == $game_ret->guest) ? 1 : -1;
+                break;
+            case "penalty_two_sides_single":
+                $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
+                break;
+            case "penalty_two_sides_double":
+                $returnDatas = $this->zq_doublesing($game_ret->home + $game_ret->guest , $model->condition ,$word);
+                break;
+            default:
+                $returnDatas = ['result' => 2, 'matchResult' => '(玩法无规则异常)'];
+        }
+        return $returnDatas;
+    }
+    /**
+    发球相关  结束
+     */
+
+
+
 }

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

@@ -70,7 +70,7 @@ class SettlementOrder extends SettlementBase
         if ($bettype == 1) {
             $chekArr = $this->Match_check($order_ids, $bettype);
             if (empty($chekArr) || count($chekArr) != 1) {
-                return self::makeData(10, '不同场比赛不能同时结算!');
+                return self::makeData(10, '不同场比赛不能同时结算!'.print_r($order_ids,true));
             }
         }
         $this->match_id = $match_id;

+ 5 - 4
app/Models/Stlqresult.php

@@ -10,12 +10,12 @@ class Stlqresult extends BaseModel
     function resultbklist($list = 10, $page, $where = '', $orwhere = '')
     {
         if (is_array ($where) && count ($where) > 0) { 
-            $data = $this->join('st_lq_league','st_lq_result.lg_id','=','st_lq_league.lg_id')->select($this->table.'.id',$this->table.'.lg_id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.home_rate',$this->table.'.guest_rate',$this->table.'.home_score',$this->table.'.guest_score',$this->table.'.all_goal',$this->table.'.status',$this->table.'.first_score',$this->table.'.last_score',$this->table.'.match_score',$this->table.'.match_winer',$this->table.'.update_time',$this->table.'.match_time',$this->table.'.match_process',$this->table.'.tag',$this->table.'.match_id',$this->table.'.u_home_score',$this->table.'.u_guest_score','st_lq_league.name_chinese')->orderby($this->table.'.id','desc')->where($where)->orwhere($orwhere)->paginate ($list); 
+            $data = $this->join('st_lq_league','st_lq_result.lg_id','=','st_lq_league.lg_id')->distinct($this->table.'.lg_id')->select($this->table.'.id',$this->table.'.lg_id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.home_rate',$this->table.'.guest_rate',$this->table.'.home_score',$this->table.'.guest_score',$this->table.'.all_goal',$this->table.'.status',$this->table.'.first_score',$this->table.'.last_score',$this->table.'.match_score',$this->table.'.match_winer',$this->table.'.update_time',$this->table.'.match_time',$this->table.'.match_process',$this->table.'.tag',$this->table.'.match_id',$this->table.'.u_home_score',$this->table.'.u_guest_score','st_lq_league.name_chinese')->orderby($this->table.'.id','desc')->where($where)->orwhere($orwhere)->paginate ($list); 
         } else {
-            $data = $this->join('st_lq_league','st_lq_result.lg_id','=','st_lq_league.lg_id')->select($this->table.'.id',$this->table.'.lg_id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.home_rate',$this->table.'.guest_rate',$this->table.'.home_score',$this->table.'.guest_score',$this->table.'.all_goal',$this->table.'.status',$this->table.'.first_score',$this->table.'.last_score',$this->table.'.match_score',$this->table.'.match_winer',$this->table.'.update_time',$this->table.'.match_time',$this->table.'.match_process',$this->table.'.tag',$this->table.'.match_id',$this->table.'.u_home_score',$this->table.'.u_guest_score','st_lq_league.name_chinese')->orderby($this->table.'.id','desc')->paginate ($list); 
+            $data = $this->join('st_lq_league','st_lq_result.lg_id','=','st_lq_league.lg_id')->distinct($this->table.'.lg_id')->select($this->table.'.id',$this->table.'.lg_id',$this->table.'.home_team',$this->table.'.guest_team',$this->table.'.home_rate',$this->table.'.guest_rate',$this->table.'.home_score',$this->table.'.guest_score',$this->table.'.all_goal',$this->table.'.status',$this->table.'.first_score',$this->table.'.last_score',$this->table.'.match_score',$this->table.'.match_winer',$this->table.'.update_time',$this->table.'.match_time',$this->table.'.match_process',$this->table.'.tag',$this->table.'.match_id',$this->table.'.u_home_score',$this->table.'.u_guest_score','st_lq_league.name_chinese')->orderby($this->table.'.id','desc')->paginate ($list); 
         }
 
-        for($i=0;$i<count($data);$i++){
+        for($i=0;$i<count($data);$i++){ 
             if($data[$i]->status==0){
                 $data[$i]->status = '未开始';
             }else if($data[$i]->status==1){
@@ -27,12 +27,13 @@ class Stlqresult extends BaseModel
             $data[$i]->u_home_guest_score = $data[$i]->u_home_score.' <br> '.$data[$i]->u_guest_score;
         }
 
+
+
         return $data->toArray ();
 
 	}
 
 
-
 }
 
 ?>