Parcourir la source

修复首页赛事统计数量

彭俊 il y a 6 ans
Parent
commit
11e5d76236
1 fichiers modifiés avec 8 ajouts et 3 suppressions
  1. 8 3
      Application/Sports/Controller/Sports.php

+ 8 - 3
Application/Sports/Controller/Sports.php

@@ -113,7 +113,8 @@ class Sports extends Controller{
                 //统计当前联赛下的联赛
                 $data['league'][$k]['game_code'] = $game_code;
                 $data['league'][$k]['code'] = "qt";
-                $data['league'][$k]['count'] = lm($st_competition,'Sports')
+                $matchData = lm($st_competition,'Sports')
+                    ->select($st_competition.'.id as match_id')
                     ->where([[$st_competition.'.status','<',2]])
                     ->where('lg_id',$v['lg_id'])
                     ->where($where)
@@ -123,7 +124,11 @@ class Sports extends Controller{
                         [$st_competition.'.status','<',2],
                         [$st_competition.'.us_time','>',$this->commonFunction->qgmdate('Y-m-d H:i:s', '', -4)]
                     ])
-                    ->count('*');
+                    ->get()
+                    ->toArray();
+                    //===获取当前赛事是否有赔率,如果没有则去除===
+                $matchNum = $this->commonFunction->Handle_Odds_Null($matchData,$getModels);
+                $data['league'][$k]['count'] = count($matchNum);
             }
         }
         return $data;
@@ -134,10 +139,10 @@ class Sports extends Controller{
      */
     public  function  data(){
         $where = [];//球类额外条件
+        $zq[] = $this->Sports_info('zq',$where);
         $lq[] = $this->Sports_info('lq',$where);
         $wq[] = $this->Sports_info('wq',$where);
         $bq[] = $this->Sports_info('bq',$where);
-        $zq[] = $this->Sports_info('zq',$where);
         $data = array_merge_recursive($zq,$lq,$bq,$wq);
         Render($data,'1', lang('Tips','Sports')->get('success'));
     }