Browse Source

追加提交各球类冠军管理列表处理

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

+ 1 - 1
app/Http/Controllers/Admin/BqChampionsLeagueController.php

@@ -82,7 +82,7 @@ class BqChampionsLeagueController extends Controller
         }
 
         $newapp = new \App\Models\BaseLeague();
-        $data = $newapp->getinfo($list, $page, $where);
+        $data = $newapp->get_league_gj_info($list, $page, $where);
         return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
     }
 

+ 1 - 1
app/Http/Controllers/Admin/LqChampionsLeagueController.php

@@ -82,7 +82,7 @@ class LqChampionsLeagueController extends Controller
         }
 
         $newapp = new \App\Models\BasketLeague();
-        $data = $newapp->getinfo($list, $page, $where);
+        $data = $newapp->get_league_gj_info($list, $page, $where);
         return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
     }
 

+ 1 - 1
app/Http/Controllers/Admin/WqChampionsLeagueController.php

@@ -83,7 +83,7 @@ class WqChampionsLeagueController extends Controller
         }
 
         $newapp = new \App\Models\TennisLeague();
-        $data = $newapp->getinfo($list, $page, $where);
+        $data = $newapp->get_league_gj_info($list, $page, $where);
         return \App\Lib\DataTable\DataTable::init()->toJson($data['data'], $data['total']);
     }
 

+ 68 - 0
app/Models/BaseLeague.php

@@ -95,5 +95,73 @@ class BaseLeague extends BaseModel {
         return $data->toArray();
     }
 
+    //测试冠军联赛数据
+    function get_league_gj_info($list = 10, $page, $where = '')
+    {
+        if (is_array ($where) && count ($where) > 0){
+            $data = $this
+                ->join('st_bq_odds','st_bq_odds.lg_id','=','st_bq_league.id')
+                ->select('st_bq_league.id','st_bq_league.name_chinese','st_bq_league.area_id','st_bq_league.country_id','st_zq_league.status','st_zq_league.utime')
+                ->orderby('st_bq_league.utime','desc')
+                ->where($where)
+                ->distinct('st_bq_league.name_chinese')
+                ->paginate ($list);
+        }else{
+            $data = $this
+                ->join('st_bq_odds','st_bq_odds.lg_id','=','st_bq_league.id')
+                ->select('st_bq_league.id','st_bq_league.name_chinese','st_bq_league.area_id','st_bq_league.country_id','st_bq_league.status','st_bq_league.utime')
+                ->where('st_bq_odds.type',1)
+                ->distinct('st_bq_league.name_chinese')
+                ->orderby('st_bq_league.utime','desc')
+                ->paginate ($list);
+        }
+        if (!$data) {
+            return -5040000102; //无相关信息
+        }
+        //地区
+        $area = \App\Models\StAreaCountry::where('pid','0')->get();
+
+        //国家
+        $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
+
+        for($i=0;$i<count($data);$i++){
+            //$data[$i]->id = $data[$i]->lg_id;
+
+            if($data[$i]->status == '-1'){
+                $data[$i]->league_status = '未启用';
+            }
+            if($data[$i]->status == '1'){
+                $data[$i]->league_status = '启用';
+            }
+
+            $str = 0;
+            $str1 = 0;
+            if($data[$i]->area_id == '0'){
+                $data[$i]->area = '无';
+            }else{
+                for($b=0;$b<count($area);$b++){
+                    if($area[$b]->id == $data[$i]->area_id){
+                        $str = 1;
+                        $data[$i]->area = $area[$b]->name;
+                    }
+                }
+                if($str == 0){$data[$i]->area = '无';}
+            }
+            if($data[$i]->country_id == 0){
+                $data[$i]->country = '无';
+            }else{
+                for($c=0;$c<count($country);$c++){
+                    if($country[$c]->id == $data[$i]->country_id){
+                        $str1 = 1;
+                        $data[$i]->country = $country[$c]->name;
+                    }
+                }
+                if($str1 == 0){$data[$i]->country = '无';}
+            }
+
+        }
+
+        return $data->toArray();
+    }
 
 }

+ 68 - 0
app/Models/BasketLeague.php

@@ -98,4 +98,72 @@ class BasketLeague extends BaseModel {
     }
 
 
+    //测试冠军联赛数据
+    function get_league_gj_info($list = 10, $page, $where = '')
+    {
+        if (is_array ($where) && count ($where) > 0){
+            $data = $this
+                ->join('st_lq_odds','st_lq_odds.lg_id','=','st_lq_league.id')
+                ->select('st_lq_league.id','st_lq_league.name_chinese','st_lq_league.area_id','st_lq_league.country_id','st_lq_league.status','st_lq_league.utime')
+                ->orderby('st_lq_league.utime','desc')
+                ->where($where)
+                ->distinct('st_lq_league.name_chinese')
+                ->paginate ($list);
+        }else{
+            $data = $this
+                ->join('st_lq_odds','st_lq_odds.lg_id','=','st_lq_league.id')
+                ->select('st_lq_league.id','st_lq_league.name_chinese','st_lq_league.area_id','st_lq_league.country_id','st_lq_league.status','st_lq_league.utime')
+                ->where('st_lq_odds.type',1)
+                ->distinct('st_lq_league.name_chinese')
+                ->orderby('st_lq_league.utime','desc')
+                ->paginate ($list);
+        }
+        if (!$data) {
+            return -5040000102; //无相关信息
+        }
+        //地区
+        $area = \App\Models\StAreaCountry::where('pid','0')->get();
+
+        //国家
+        $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
+
+        for($i=0;$i<count($data);$i++){
+            //$data[$i]->id = $data[$i]->lg_id;
+
+            if($data[$i]->status == '-1'){
+                $data[$i]->league_status = '未启用';
+            }
+            if($data[$i]->status == '1'){
+                $data[$i]->league_status = '启用';
+            }
+
+            $str = 0;
+            $str1 = 0;
+            if($data[$i]->area_id == '0'){
+                $data[$i]->area = '无';
+            }else{
+                for($b=0;$b<count($area);$b++){
+                    if($area[$b]->id == $data[$i]->area_id){
+                        $str = 1;
+                        $data[$i]->area = $area[$b]->name;
+                    }
+                }
+                if($str == 0){$data[$i]->area = '无';}
+            }
+            if($data[$i]->country_id == 0){
+                $data[$i]->country = '无';
+            }else{
+                for($c=0;$c<count($country);$c++){
+                    if($country[$c]->id == $data[$i]->country_id){
+                        $str1 = 1;
+                        $data[$i]->country = $country[$c]->name;
+                    }
+                }
+                if($str1 == 0){$data[$i]->country = '无';}
+            }
+
+        }
+
+        return $data->toArray();
+    }
 }

+ 68 - 0
app/Models/TennisLeague.php

@@ -99,5 +99,73 @@ class TennisLeague extends BaseModel {
         return $data->toArray();
     }
 
+    //测试冠军联赛数据
+    function get_league_gj_info($list = 10, $page, $where = '')
+    {
+        if (is_array ($where) && count ($where) > 0){
+            $data = $this
+                ->join('st_wq_odds','st_wq_odds.lg_id','=','st_wq_league.id')
+                ->select('st_wq_league.id','st_wq_league.name_chinese','st_wq_league.area_id','st_wq_league.country_id','st_wq_league.status','st_wq_league.utime')
+                ->orderby('st_wq_league.utime','desc')
+                ->where($where)
+                ->distinct('st_wq_league.name_chinese')
+                ->paginate ($list);
+        }else{
+            $data = $this
+                ->join('st_wq_odds','st_wq_odds.lg_id','=','st_wq_league.id')
+                ->select('st_wq_league.id','st_wq_league.name_chinese','st_wq_league.area_id','st_wq_league.country_id','st_wq_league.status','st_wq_league.utime')
+                ->where('st_wq_odds.type',1)
+                ->distinct('st_wq_league.name_chinese')
+                ->orderby('st_wq_league.utime','desc')
+                ->paginate ($list);
+        }
+        if (!$data) {
+            return -5040000102; //无相关信息
+        }
+        //地区
+        $area = \App\Models\StAreaCountry::where('pid','0')->get();
+
+        //国家
+        $country = \App\Models\StAreaCountry::where('pid','<>','0')->get();
+
+        for($i=0;$i<count($data);$i++){
+            //$data[$i]->id = $data[$i]->lg_id;
+
+            if($data[$i]->status == '-1'){
+                $data[$i]->league_status = '未启用';
+            }
+            if($data[$i]->status == '1'){
+                $data[$i]->league_status = '启用';
+            }
+
+            $str = 0;
+            $str1 = 0;
+            if($data[$i]->area_id == '0'){
+                $data[$i]->area = '无';
+            }else{
+                for($b=0;$b<count($area);$b++){
+                    if($area[$b]->id == $data[$i]->area_id){
+                        $str = 1;
+                        $data[$i]->area = $area[$b]->name;
+                    }
+                }
+                if($str == 0){$data[$i]->area = '无';}
+            }
+            if($data[$i]->country_id == 0){
+                $data[$i]->country = '无';
+            }else{
+                for($c=0;$c<count($country);$c++){
+                    if($country[$c]->id == $data[$i]->country_id){
+                        $str1 = 1;
+                        $data[$i]->country = $country[$c]->name;
+                    }
+                }
+                if($str1 == 0){$data[$i]->country = '无';}
+            }
+
+        }
+
+        return $data->toArray();
+    }
 
 }