Browse Source

异常处理

彭俊 6 năm trước cách đây
mục cha
commit
c92f659c06

+ 2 - 1
app/Http/Controllers/Admin/SoccerStringNoteListController.php

@@ -69,6 +69,7 @@ class SoccerStringNoteListController extends Controller
         $status = Request::has('status') ? Request::get('status') : '';
         $order_status = Request::has('order_status') ? Request::get('order_status') : '';
         $sureblur = Request::has('sureblurs') ? Request::get('sureblurs') : 'off';
+        $game_code = Request::has('game_code') ? Request::get('game_code') : '';
 
         $where = array();
         if (!empty($account)) {
@@ -98,7 +99,7 @@ class SoccerStringNoteListController extends Controller
         $ids = array();
         if(!empty($match_id)){
             $allcs = new \App\Models\MoneyBuyMatch();
-            $csorder = $allcs->allstrorder($match_id);
+            $csorder = $allcs->allstrorder($match_id,$game_code);
             if(!empty($csorder)){
                 for($i=0;$i<count($csorder);$i++){
                     $ids[] = $csorder[$i]['order_id'];

+ 5 - 2
app/Models/MoneyBuyMatch.php

@@ -18,7 +18,7 @@ class MoneyBuyMatch extends Model
 
     public function getByAttrs($where, $orderArray = [])
     {
-        if (empty($order)) {
+        if (empty($orderArray)) {
             $datas = $this->where($where)->get();
         } else {
             $datas = $this->where($where)->orderby($orderArray['orderby'], $orderArray['order'])->get();
@@ -39,12 +39,15 @@ class MoneyBuyMatch extends Model
     }
 
     //赛事下所有下注串式下单
-    function allstrorder($ssid)
+    function allstrorder($ssid,$game_code = '')
     {
         //串式下单
         $where = array();
         $where[] = array('money_buy_match.match_id', '=', $ssid);
         $where[] = array('money_buy_match.bet_type', '=', 2);
+        if(!empty($game_code)){
+            $where[] = array('money_buy_match.game_code', '=', $game_code);
+        }
         $data = $this->join('money_buy_str', 'money_buy_match.batch_id', '=', 'money_buy_str.batch_id')->select('money_buy_str.order_id')->where($where)->distinct('money_buy_match.batch_id')->get()->toArray();
         return $data;
     }

+ 14 - 3
app/Models/MoneyBuyStr.php

@@ -215,8 +215,8 @@ class MoneyBuyStr extends BaseModel
     //投注金额汇总统计
     function MoneyCount($where = '',$match_id='',$game_code='')
     {
+        $data = array();
         if(empty($match_id)){
-            $data = array();
             $data['all_money'] = $this->where('status', '1')->sum('money');
             $data['all_prize_money'] = $this->where('status', '1')->sum('prize_money');
             $data['alraedy_prize_money'] = $this->where('settle_status', '2')->where('status', '1')->sum('gain_money');
@@ -226,16 +226,27 @@ class MoneyBuyStr extends BaseModel
                 $data['alraedy_prize_money'] = $this->where($where)->where('settle_status', '2')->where('status', '1')->sum('gain_money');
             }
         }
+
         //追加 如果有赛事id+球类代码 则查询该赛事下所有串式投注
         if(!empty($game_code) and !empty($match_id)){
-            $where = ['game_code'=>$game_code,'match_id'=>$match_id,'bet_type'=>2];
+            $where_match = ['game_code'=>$game_code,'match_id'=>$match_id,'bet_type'=>2];
             $moneyBuyMatch = new MoneyBuyMatchModel();
-            $str_order_ids = $moneyBuyMatch->getByAttrs($where)->toArray();
+            $str_order_ids = $moneyBuyMatch->getByAttrs($where_match)->toArray();
            
+
             if(empty($str_order_ids)){
                 $data['all_money'] = 0;
                 $data['all_prize_money'] = 0;
                 $data['alraedy_prize_money'] = 0;
+            }else{
+                $data['all_money'] = $this->where('status', '1')->sum('money');
+                $data['all_prize_money'] = $this->where('status', '1')->sum('prize_money');
+                $data['alraedy_prize_money'] = $this->where('settle_status', '2')->where('status', '1')->sum('gain_money');
+                if (!empty($where) && is_array($where)) {
+                    $data['all_money'] = $this->where($where)->where('status', '1')->sum('money');
+                    $data['all_prize_money'] = $this->where($where)->where('status', '1')->sum('prize_money');
+                    $data['alraedy_prize_money'] = $this->where($where)->where('settle_status', '2')->where('status', '1')->sum('gain_money');
+                }
             }
         }