Browse Source

追加推送 pc版接口 5/17

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

+ 9 - 9
Application/InApi/Controller/Index.php

@@ -79,7 +79,7 @@ class Index extends Controller {
         $this->parasString = $params = $_REQUEST['params'];
         $this->userKey = $_REQUEST['Key'];
 
-        $arr = explode('$',base64_decode($params));
+        $arr = explode('&',base64_decode($params));
 
         if  (is_array($arr)){
             foreach ($arr as $substring){
@@ -91,14 +91,14 @@ class Index extends Controller {
                 }
             }
         }else{
-            Render('',10009,lang('Errors','Sports')->get('error-10009'));
+            Render('',10010,lang('Errors','Sports')->get('error-10009'));
         }
 
         $allmap = $this->ActionMap();
         $method = isset($this->paras['method']) ? $this->paras['method'] : '';
 
         if (!isset( $allmap[$method] )){
-            Render('',10009,lang('Errors','Sports')->get('error-10009'));
+            Render('',10011,lang('Errors','Sports')->get('error-10009'));
         }
 
         $format = isset($this->paras['format']  ) ?   strtolower(trim($this->paras['format'])) : '';
@@ -120,7 +120,7 @@ class Index extends Controller {
         $ret = $model->CheckKey($model,$this->parasString,$this->userKey) ;
         if ( $ret!=1 ){
             if ($ret == -1){
-                Render('10',0,'Token overTime,please Refresh!');
+                Render('10',2,'Token overTime,please Refresh!');
             }
             Render('10',0,'key check error!');
         }
@@ -150,7 +150,7 @@ class Index extends Controller {
             //if ($key=='agent'){   $val = 'test1agent' ;   }
             array_push($strArr,$key.'='.$val);
         }
-        $string = implode ('$',$strArr);
+        $string = implode ('&',$strArr);
 	    $key = md5(base64_encode($string).'58f306c11e6a9d4cc74723bb76b17500');
 
 	    if (isset($_REQUEST['debug'])){
@@ -167,13 +167,13 @@ class Index extends Controller {
     //客户获取token用于 Key 的生成使用
     public function  getToken(){
 
-            $agengname = $_REQUEST['name'] ;
-            $key = $_REQUEST['key'] ;
-            $secret = $_REQUEST['secret'] ;
+            $agengname = $_POST['wagent_name'] ;
+            $key = $_POST['wagent_key'] ;
+            $secret = $_POST['wagent_secret'] ;
 
             $model  = (new Wagent)->TokenGetAndUpdate($agengname,$key,$secret);
             if (!$model){
-                    Render('',0,'get Token false!');
+                    Render('',3,'get Token false!');
             }
 
             Render(['token'=>$model->auth_token],1,'success');

+ 22 - 10
Application/Sports/Controller/MatchList.php

@@ -181,6 +181,8 @@ class  MatchList extends Controller {
                     ->select($st_league.'.name_chinese',$st_league.'.lg_id')
                     ->where($where)
                     ->where($where_search)
+                    ->where($st_competition.'.home_team','<>',null)
+                    ->where($st_competition.'.guest_team','<>',null)
                     ->where($st_competition.'.source',$this->source['source'])
                     ->distinct($st_competition.'.match_id')
                     ->get()
@@ -358,8 +360,6 @@ class  MatchList extends Controller {
                     ->where($where)
                     ->where($Orwhere)
                     ->where($where_search)
-                    ->where($st_competition.'.home_team','<>',null)
-                    ->where($st_competition.'.guest_team','<>',null)
                     ->distinct($st_competition.'.match_id')
                     ->count($st_competition.'.match_id');
 
@@ -375,8 +375,6 @@ class  MatchList extends Controller {
                     ->where($Orwhere)
                     ->where($where_search)
                     ->where($st_competition.'.lg_id',$v['lg_id'])
-                    ->where($st_competition.'.home_team','<>',null)
-                    ->where($st_competition.'.guest_team','<>',null)
                     ->get()
                     ->toarray();
                 if(!$data[$k]['match_info']){
@@ -436,6 +434,8 @@ class  MatchList extends Controller {
             ->where($st_league.'.name_chinese','like','%'.$search.'%')
             ->where($st_league.'.source',$this->source)
             ->where([])
+            ->where($st_competition.'.home_team','<>',null)
+            ->where($st_competition.'.guest_team','<>',null)
             ->get()
             ->toArray();
         //洲下所有联赛
@@ -448,6 +448,8 @@ class  MatchList extends Controller {
             ->where($st_league.'.source',$this->source)
             ->where()
             ->where([])
+            ->where($st_competition.'.home_team','<>',null)
+            ->where($st_competition.'.guest_team','<>',null)
             ->get()
             ->toArray();
         //统计国家联赛下的赛事.
@@ -464,7 +466,9 @@ class  MatchList extends Controller {
                     $country[$k]['league_count'][$kk]['count'] = lm($st_competition, 'Sports')
                         ->where($this->source)
                         ->where('lg_id',$vv['lg_id'])
-                        ->count();
+                        ->where($st_competition.'.home_team','<>',null)
+                        ->where($st_competition.'.guest_team','<>',null)
+                        ->count('*');
                     if($country[$k]['league_count'][$kk]['count'] == 0){
                         unset($country[$k]['league_count'][$kk]);
                     }
@@ -485,7 +489,9 @@ class  MatchList extends Controller {
                     $area[$k]['league_count'][$kk]['count'] = lm($st_competition, 'Sports')
                         ->where($this->source)
                         ->where('lg_id',$vv['lg_id'])
-                        ->count();
+                        ->where($st_competition.'.home_team','<>',null)
+                        ->where($st_competition.'.guest_team','<>',null)
+                        ->count('*');
                     if($area[$k]['league_count'][$kk]['count'] == 0){
                         unset($area[$k]['league_count'][$kk]);
                     }
@@ -558,7 +564,8 @@ class  MatchList extends Controller {
                     ->where($st_league.'.source',$this->source)
                     ->where($st_league.'.name_chinese','like','%'.$search.'%')
                     ->where('country_id', $v['region_id'])
-                    ->get()->toarray();
+                    ->get()
+                    ->toarray();
             }
             foreach ($country as $k => $v) {
                 foreach($v['league_count'] as $kk => $vv ){
@@ -568,7 +575,9 @@ class  MatchList extends Controller {
                         ->where('lg_id',$vv['lg_id'])
                         ->where('status', '<', '2')
                         ->where('us_time','>',qgmdate('Y-m-d H:i:s', '', -4))
-                        ->count();
+                        ->where($st_competition.'.home_team','<>',null)
+                        ->where($st_competition.'.guest_team','<>',null)
+                        ->count('*');
                     if($country[$k]['league_count'][$kk]['count'] == 0){
                         unset($country[$k]['league_count'][$kk]);
                     }
@@ -584,17 +593,20 @@ class  MatchList extends Controller {
                     ->where($this->source)
                     ->where($st_league.'.name_chinese','like','%'.$search.'%')
                     ->where('area_id', $v['region_id'])
-                    ->get()->toarray();
+                    ->get()
+                    ->toarray();
             }
             foreach ($area as $k => $v) {
                 foreach($v['league_count'] as $kk => $vv ){
                     $area[$k]['league_count'][$kk]['count'] = lm($st_competition, 'Sports')
                         ->where($this->source)
                         ->where($where)
+                        ->where($st_competition.'.home_team','<>',null)
+                        ->where($st_competition.'.guest_team','<>',null)
                         ->where('status', '<', '2')
                         ->where('us_time','>',qgmdate('Y-m-d H:i:s', '', -4))
                         ->where('lg_id',$vv['lg_id'])
-                        ->count();
+                        ->count('*');
                     if($area[$k]['league_count'][$kk]['count'] == 0){
                         unset($area[$k]['league_count'][$kk]);
                     }

+ 12 - 4
Application/Sports/Controller/MatchListWeb.php

@@ -27,9 +27,9 @@ class MatchListWeb extends Controller{
     //各球类玩法列表及数量
     public function gameList(){
 
-        $type = $_REQUEST['type'];
-        $game_code= $_REQUEST['game_code'];
-        $p_code= $_REQUEST['p_code'];
+        $type = $_REQUEST['type'];//状态代码
+        $game_code= $_REQUEST['game_code'];//球类代码
+        $p_code= $_REQUEST['p_code'];//父级玩法代码
 
         try {
             if(empty($type) ){
@@ -61,7 +61,14 @@ class MatchListWeb extends Controller{
     }
 
     //获取滚球
-    public function getRollBall($type){
+    public function getRollBall($type,$game_code,$p_code){
+        //根据球类代码及玩法代码 获取相关赛事赔率数据
+        if(!empty($game_code) and !empty($p_code)){
+            $matchData = $this->getMatchData($type,$game_code,$p_code);
+
+            Render($matchData, '1', lang('Tips','Sports')->get('success'));
+        }
+
         $game = lm('GameType', 'Sports')->select('game_code')->where('status',1)->get()->toArray();
         $gameData = [];
         foreach ($game as $k=>$v){
@@ -111,6 +118,7 @@ class MatchListWeb extends Controller{
 
     //获取赛事数据
     public function getMatchData($type,$game_code,$p_code=''){
+        //$p_code 获取具体玩法下的赛事数据
         $where = $this->commonFunction->getState($type);
         $models = $this->commonFunction->getModels($game_code,1);
         $select = [$models['model_match'].'.match_id'];

+ 10 - 0
Application/Sports/Controller/Sports.php

@@ -34,6 +34,8 @@ class Sports extends Controller{
                 ->join($st_league,$st_league.'.lg_id',$st_competition.'.lg_id')
                 ->where(getState('StToday'))
                 ->where($st_competition.'.source',$this->source['source'])
+                ->where($st_competition.'.home_team','<>',null)
+                ->where($st_competition.'.guest_team','<>',null)
                 ->distinct($st_competition.'.match_id')
                 ->count('*');
             } else {
@@ -43,6 +45,8 @@ class Sports extends Controller{
                 $data['all']['count'] = lm($st_competition,'Sports')
                     ->where([[$st_competition.'.status', '<', '2'],
                         [$st_competition.'.source',$this->source['source']]])
+                    ->where($st_competition.'.home_team','<>',null)
+                    ->where($st_competition.'.guest_team','<>',null)
                     ->where($st_competition.'.us_time','>',qgmdate('Y-m-d H:i:s', '', -4))
                     ->count('*');
             }
@@ -53,6 +57,8 @@ class Sports extends Controller{
             ->where([[$st_competition.'.status','<',2],[$st_competition.'.source',$this->source]])
             ->where($st_competition.'.us_time','>',qgmdate('Y-m-d H:i:s', '', -4))
             ->where($where)
+            ->where($st_competition.'.home_team','<>',null)
+            ->where($st_competition.'.guest_team','<>',null)
             ->limit($limit_mt)
             ->get();
         if(!empty($data['match'])){
@@ -65,6 +71,8 @@ class Sports extends Controller{
             ->where([[$st_competition.'.status','<',2],[$st_competition.'.source',$this->source]])
             ->where($st_competition.'.us_time','>',qgmdate('Y-m-d H:i:s', '', -4))
             ->where($where)
+            ->where($st_competition.'.home_team','<>',null)
+            ->where($st_competition.'.guest_team','<>',null)
             ->limit($limit_lg)
             ->distinct($st_league.'lg_id')
             ->get();
@@ -78,6 +86,8 @@ class Sports extends Controller{
                     ->where([[$st_competition.'.status','<',2],[$st_competition.'.source',$this->source]])
                     ->where('lg_id',$v['lg_id'])
                     ->where($where)
+                    ->where($st_competition.'.home_team','<>',null)
+                    ->where($st_competition.'.guest_team','<>',null)
                     ->count('*');
             }
         }