彭俊 6 жил өмнө
parent
commit
c872818131

+ 8 - 13
Application/Api/Controller/Betorder.php

@@ -305,15 +305,6 @@ class Betorder extends BaseController{
         $models = $this->commonFunction->getModels($game_code);
         $model_odds = $models['model_odds'];
         $model_odds_record = $models['model_odds_record'];
-        //查询赔率记录是否存在该赔率
-        $is_odds = lm($model_odds_record,'Sports')
-            ->select('odds')
-            ->where($model_odds_record.'.odds_only',$odds_only)
-            ->first();
-        if(empty($is_odds)){
-            $msg = '第'.$num.'条数据'.lang('Errors','Api')->get('error-7026');
-            Render([], '7026', $msg);
-        }
         //匹配赔率是否过期
         $odds_info = lm($model_odds,'Sports')
             ->join($model_odds_record,$model_odds_record.'.odds_only',$model_odds.'.odds_only')
@@ -321,13 +312,17 @@ class Betorder extends BaseController{
             ->where($model_odds.'.odds_only',$odds_only)
             ->first();
         if(empty($odds_info)){
-            $msg = '第'.$num.'条数据'.lang('Errors','Api')->get('error-7027');
-            Render([], '7027', $msg);
+            $msg = '第'.$num.'条数据'.lang('Errors','Api')->get('error-7051');
+            Render([], '7051', $msg);
         }
         $odds_info = $odds_info->toarray();
         if($condition != $odds_info['condition']){
-            $msg = '第'.$num.'条数据'.lang('Errors','Api')->get('error-7025');
-            Render([], '7025', $msg);
+            $msg = '第'.$num.'条数据'.lang('Errors','Api')->get('error-7047');
+            Render([], '7047', $msg);
+        }
+        if($odds != $odds_info['odds']){
+            $msg = '第'.$num.'条数据'.lang('Errors','Api')->get('error-7049');
+            Render([], '7049', $msg);
         }
         return $odds_info;
     }

+ 6 - 4
Application/Api/Lang/Errors.php

@@ -423,9 +423,7 @@ return array(
     'error-500146' => '扣减用户账户资金失败',
     'error-500147' => '未获取到流水信息',
 
-    'error-7025' => '赔率条件不匹配',
-    'error-7026' => '赔率数据不匹配',
-    'error-7027' => '赔率数据过期',
+
     'error-7028' => '请传入集合',
     'error-7029' => '未获取到赔率数据',
     'error-7030' => '未提交用户名',
@@ -446,7 +444,11 @@ return array(
     'error-7044' => '数据错误',
     'error-7045' => '生成红包数据错误',
     'error-7046' => 'MG电子统一错误码',
-
+    'error-7047' => '赔率条件不匹配',
+    'error-7048' => '赔率数据不匹配',
+    'error-7049' => '赔率数据过期',
+    'error-7050' => '赔率代码不匹配',
+    'error-7051' => '未获取到赔率记录',
     /*
      * 在线支付相关配置
      */

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

@@ -196,11 +196,13 @@ class  MatchList extends Controller {
                 $data  = $this->getMatchInfo($where,$Orwhere,$where_search,$game_code);
         break;
         }
+
         //根据赛事ID获取赔率数据
         foreach($data as $k => $v){
             $data[$k]['match_info'] = $this->getOdds($v['match_info'],$st_odds);
+            $data[$k]['match_info'] = array_values($data[$k]['match_info']);
         }
-
+        $data = array_values($data);
         Render($data, '1', lang('Tips','Sports')->get('success'));
     }
 
@@ -234,10 +236,10 @@ class  MatchList extends Controller {
             ->value('game_name');
         //国家联赛数据
         $select=['st_country.country_id as region_id','st_country.name_chinese as region',$st_league.'.lg_id',$st_league.'.name_chinese as league'];
-        $country = $this->getRegionInfo($where,$search,$select,'st_country','country_id',$gameType);
+        $country = $this->getRegionInfo($where,$search,$select,'st_country','country_id','country_id',$gameType);
         //洲下所有联赛
         $select=['st_area.id as region_id','st_area.title as region',$st_league.'.lg_id',$st_league.'.name_chinese as league'];
-        $area = $this->getRegionInfo($where,$search,$select,'st_area','id',$gameType);
+        $area = $this->getRegionInfo($where,$search,$select,'st_area','id','area_id',$gameType);
         $data['info'] = array_merge($country,$area);
         Render($data, '1', lang('Tips','Sports')->get('success'));
     }
@@ -250,7 +252,7 @@ class  MatchList extends Controller {
      * @param  [type] $game_code 球类代码
      * @return [array] $data
      */
-    public function getRegionInfo($where=[],$search,$select,$regionModel,$regionID,$game_code ='zq'){
+    public function getRegionInfo($where=[],$search,$select,$regionModel,$regionID,$a_c_id,$game_code ='zq'){
         $getModels = $this->commonFunction->getModels($game_code);
         $st_league = $getModels['model_league'];
         $st_competition = $getModels['model_match'];
@@ -258,7 +260,7 @@ class  MatchList extends Controller {
             //地区联赛赛事数据
             $regionInfo = lm($st_league,"Sports")
                 ->join($st_competition,$st_competition.'.lg_id',$st_league.'.lg_id')
-                ->join($regionModel,$regionModel.'.'.$regionID,$st_league.'.country_id')
+                ->join($regionModel,$regionModel.'.'.$regionID,$st_league.'.'.$a_c_id)
                 ->select($select)
                 ->where($st_league.'.name_chinese','like','%'.$search.'%')
                 ->where($where)
@@ -630,10 +632,11 @@ class  MatchList extends Controller {
      */
     public function getOddsCode(){
         $type = $_REQUEST['type'];
+        $game_code = $_REQUEST['game_code'];
         if($type == 'p_code'){
             $p_code = lm('st_odds_code','Sports')
-                ->select('odds_code','odds_name')
-                ->where('p_id',0)
+                ->select('game_code','odds_code','odds_name')
+                ->where(['p_id'=>0])
                 ->get();
         }else{
             $p_code = lm('st_odds_code','Sports')

+ 59 - 5
Application/Sports/Controller/MatchListWeb.php

@@ -206,11 +206,68 @@ class MatchListWeb extends Controller{
         $select = ['match_id','p_code'];
         $whereOr = [];
         if($p_code){
-            $whereOr = [['p_code','=',$p_code],['sort','=',0]];
             $select = ['match_id','id','p_code','odds_code','condition','odds','odds_only','sort','status'];
+            if($p_code == 'concede' and $game_code == 'zq'){
+                $whereOr = [['sort','=',0]];
+                $oddsData = lm($model_odds,"Sports")
+                    ->select($select)
+                    ->whereIn('match_id', $match_id)
+                    ->where('source',$this->source['source'])
+                    ->where($whereOr)
+                    ->whereIn('p_code',['concede','goal_size'])
+                    ->get()
+                    ->toArray();
+                return $oddsData;
+            }
+            if($p_code == 'concede'  and $game_code == 'lq'){
+                $whereOr = [['sort','=',0]];
+                $oddsData = lm($model_odds,"Sports")
+                    ->select($select)
+                    ->whereIn('match_id', $match_id)
+                    ->where('source',$this->source['source'])
+                    ->where($whereOr)
+                    ->whereIn('p_code',['concede','total_size','team_score'])
+                    ->get()
+                    ->toArray();
+                return $oddsData;
+            }
+            if($p_code == 'concede'  and $game_code == 'wq'){
+                $whereOr = [['sort','=',0]];
+                $oddsData = lm($model_odds,"Sports")
+                    ->select($select)
+                    ->whereIn('match_id', $match_id)
+                    ->where('source',$this->source['source'])
+                    ->where($whereOr)
+                    ->whereIn('p_code',['dishes','bureau','total_number'])
+                    ->get()
+                    ->toArray();
+                return $oddsData;
+            }
+            if($p_code == 'concede'  and $game_code == 'bq'){
+                $whereOr = [['sort','=',0]];
+                $oddsData = lm($model_odds,"Sports")
+                    ->select($select)
+                    ->whereIn('match_id', $match_id)
+                    ->where('source',$this->source['source'])
+                    ->where($whereOr)
+                    ->whereIn('p_code',['concede','total_size','two_sides'])
+                    ->get()
+                    ->toArray();
+                return $oddsData;
+            }
+            else{
+                $whereOr = [['p_code','=',$p_code],['sort','=',0]];
+                $oddsData = lm($model_odds,"Sports")
+                    ->select($select)
+                    ->whereIn('match_id', $match_id)
+                    ->where('source',$this->source['source'])
+                    ->where($whereOr)
+                    ->get()
+                    ->toArray();
+                return $oddsData;
+            }
         }
         $oddsData = lm($model_odds,"Sports")
-//           ->select('match_id','p_code')(
             ->select($select)
             ->whereIn('match_id', $match_id)
             ->where('source',$this->source['source'])
@@ -218,9 +275,6 @@ class MatchListWeb extends Controller{
             ->get()
             ->toArray();
 
-        if($p_code){
-            return $oddsData;
-        }
         //按父级玩法分组
         $oddsCode = [];
         foreach ($oddsData as $kk=>$vv){

+ 137 - 97
Application/Sports/Controller/WriteSports.php

@@ -21,21 +21,23 @@ class WriteSports extends Controller{
      * 体育数据入库接口
      */
     public function setSports(){
-        $obt = $_REQUEST['data'];
-
+        $obt = $_POST['data'];
+        //写文件
+//        file_put_contents("C:/Users/Jun.peng/Desktop/abc/as.txt",$obt);
         $data = $this->getAddData($obt);
-
         //验证二维数组内是否有空值
 //        foreach ($data['data'] as $v){
 //            if(in_array('', $v)) Render([], '10001', lang('Tips','Sports')->get('PARAM_ERROR'));
 //        }
         switch ($data['title']){
-//            case 'area'://地区
+            case 'area'://地区
+                Render([], '10025', lang('Tips','Sports')->get('auth_error'));
 //                $ret = $this->area($data['data']);
-//                break;
-//            case 'country'://国家
+                break;
+            case 'country'://国家
+                Render([], '10025', lang('Tips','Sports')->get('auth_error'));
 //                $ret = $this->country($data['data']);
-//                break;
+                break;
             case 'league'://联赛
                 $ret = $this->league($data);
                 break;
@@ -46,10 +48,12 @@ class WriteSports extends Controller{
                 $ret = $this->odds($data);
                 break;
             case 'league_result'://联赛结果
-                $ret = $this->league_result($data);
+                Render([], '10025', lang('Tips','Sports')->get('auth_error'));
+//                $ret = $this->league_result($data);
                 break;
             case 'match_result'://赛事结果
-                $ret = $this->com_result($data);
+                Render([], '10025', lang('Tips','Sports')->get('auth_error'));
+//                $ret = $this->com_result($data);
                 break;
             case 'match_result_record'://赛事结果记录
                 $ret = $this->com_result_record($data);
@@ -57,6 +61,10 @@ class WriteSports extends Controller{
             case 'odds_record'://赔率记录
                 $ret = $this->odds_record($data);
                 break;
+            case ''://将所有进行中的赛事写入结果
+                if(empty($data['game_code'])) Render([], '10007', lang('Tips','Sports')->get('abnormal'));
+//                if($data['game_code'] != 'zq' || $data['game_code'] != 'lq' || $data['game_code'] != 'wq' || $data['game_code'] != 'bq') Render([], '10007', lang('Tips','Sports')->get('abnormal'));
+                $ret = $this->match_result($data);
             default:
                 Render([], '10007', lang('Tips','Sports')->get('abnormal'));
         }
@@ -67,14 +75,96 @@ class WriteSports extends Controller{
         Render([], '10010', lang('Tips','Sports')->get('HANDLE_ERRORS'));
     }
 
+
+    //计算滚球 赛事进行时间
+    private function secTime($sec=0){
+        $min = floor($sec/60);
+        $res = $min.':'.($sec-$min*60);
+        return $res;
+    }
+
+    //将进行中赛事写入 赛事结果
+    public function match_result($opt = []){
+        $game_code = $opt['game_code'];
+        $data = $opt['data'];
+        $model = $this->commonFunction->getModels($game_code,1);
+
+        if(empty($data)){
+            //获取赛事表所有滚球
+            $matchData = lm($model['model_match'],'Sports')
+                ->select('id','home_team','guest_team','lg_id','status','tag','match_time')
+                ->where(['status'=> 1])
+                ->get()
+                ->toarray();
+//            dd($matchData);
+            //没有滚球数据,无需操作
+            if(empty($matchData)) Render([], '1', lang('Tips','Sports')->get('success'));
+            //获取赛事结果表 所有滚球
+            $matchData_r = lm($model['model_result'],'Sports')
+                ->select()
+                ->where(['status'=> 1])
+                ->get()
+                ->toarray();
+            //没有滚球结果,直接插入结果表
+            if(empty($matchData_r)){
+                foreach ($matchData as $k=>$v){
+                    $time = time()-strtotime($v['match_time']);
+                    $match_time = $this->secTime($time);
+                    $set_match_r[] = [
+                        "match_id"=> $v['id'],
+                        "home_team"=>$v['home_team'],
+                        "guest_team"=>$v['guest_team'],
+                        "lg_id"=>$v['lg_id'],
+                        "status"=>$v['status'],
+                        "tag"=> $v['tag'],
+                        'match_time'=>$match_time,
+                        "update_time"=>$this->newTime
+                        ];
+                }
+                $ret = lm($model['model_result'],'Sports')->insert($set_match_r);
+                if($ret != true) Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
+            }
+
+            //如果结果表有数据,则获取结果表没有的赛事
+            foreach ($matchData as $k=>$v){
+                foreach ($matchData_r as $kk=>$vv){
+                    if($v['id'] == $vv['match_id']){
+                        unset($matchData[$k]);
+                    }
+                }
+            }
+            //如果还有未写入赛事
+            if(!empty($matchData)){
+                //写入结果表不存在赛事
+                foreach ($matchData as $k=>$v){
+                    $time = time()-strtotime($v['match_time']);
+                    $match_time = $this->secTime($time);
+                    $set_match_r[] = [
+                        "match_id"=> $v['id'],
+                        "home_team"=>$v['home_team'],
+                        "guest_team"=>$v['guest_team'],
+                        "lg_id"=>$v['lg_id'],
+                        "status"=>$v['status'],
+                        "tag"=> $v['tag'],
+                        'match_time'=>$match_time,
+                        "update_time"=>$this->newTime
+                    ];
+                }
+                $ret = lm($model['model_result'],'Sports')->insert($set_match_r);
+                if($ret != true) Render([], '10022', lang('Tips','Sports')->get('add_match_r_error'));
+
+            }
+        }
+        Render([], '1', lang('Tips','Sports')->get('success'));
+    }
     //写入地区数据 弃用
-    public function __area($opt = []){
+    public function area($opt = []){
         $ret = lm('st_area','Sports')->insert($opt);
         return $ret;
     }
 
     //写入国家数据 弃用
-    public function __country($opt = []){
+    public function country($opt = []){
         $ret = lm('st_country','Sports')->insert($opt);
         return $ret;
     }
@@ -127,44 +217,6 @@ class WriteSports extends Controller{
 
         Render([], '1', lang('Tips','Sports')->get('success'));
     }
-    //弃用
-    public function __league($opt = []){
-        $game_code = $opt['game_code'];
-        //根据球类代码获取相关model
-        $model = $this->commonFunction->getModels($game_code,1);
-        $data = $opt['data'];
-//        foreach ($opt['data'] as $k => $v){
-            //验证联赛所属国家
-            if(!empty($data['country_id'])){
-                $country = lm('st_country','Sports')
-                    ->where(['country_id'=>$data['country_id']])
-                    ->count();
-                if($country < 1) Render([], '10013', lang('Tips','Sports')->get('country_error'));
-            }
-            //验证联赛所属地区
-            if(!empty($data['area_id'])){
-                $area = lm('st_area','Sports')
-                    ->where(['id'=>$data['area_id']])
-                    ->count();
-                if($area < 1) Render([], '10014', lang('Tips','Sports')->get('area_error'));
-            }
-            $post = lm($model['model_league'],'Sports')
-                ->where(['lg_id'=>$data['lg_id']])
-                ->count();
-            //更新操作
-            if($post > 0){
-                $ret = lm($model['model_league'],'Sports')
-                    -> where(['lg_id'=>$data['lg_id']])
-                    -> update($data);
-                if($ret < 1) Render([], '10011', lang('Tips','Sports')->get('update_error'));
-            }else{
-                //写入操作
-                $ret = lm($model['model_league'],'Sports')->insert($data);
-                if($ret != true) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
-            }
-//        }
-        Render([], '1', lang('Tips','Sports')->get('success'));
-    }
 
     //写入赛事数据
     public function competition($opt = []){
@@ -184,36 +236,56 @@ class WriteSports extends Controller{
 
         //查询关联记录是否存在
         $match_id = lm($model['model_local_match'],'Sports')
-            ->select('match_id')
             ->where(['others_match_id'=>$data['match_id'],'source'=>$data['source']])
-            ->first()->match_id;
+            ->value('match_id');
         if(empty($match_id)){
             //查询赛事是否存在
             $id = lm($model['model_match'],'Sports')
-                ->select('id')
                 ->where(['home_team'=>$data['home_team'],'guest_team'=>$data['guest_team'],'match_date'=>$data['match_date'],'match_time'=>$data['match_time']])
-                ->first()->id;
-
+                ->value('id');
+
+            //如果有上半场赛事id 获取上半场赛事是否存在
+            if(!empty($data['half_match_id'])){
+                $half_match_id = $match_id = lm($model['model_local_match'],'Sports')
+                    ->where(['others_match_id'=>$data['half_match_id'],'source'=>$data['source']])
+                    ->value('match_id');
+                if(empty($half_match_id)) Render([], '10024', lang('Tips','Sports')->get('half_match_error'));
+            }
             //写入赛事
             if(empty($id)){
+                //如果赛事没有开始日期,则为冠军盘口赛事
+                if(empty($data['match_date'])){
+                    //冠军盘口赛事获取所属联赛结束时间
+                    $last_time = lm($model['model_league'],'Sports')
+                        ->where(['id'=>$lg_id])
+                        ->value('last_time');
+
+                    if(empty($last_time)) Render([], '10023', lang('Tips','Sports')->get('lg_lastTime_error'));
+                    //给冠军盘口赛事 赋值时间
+                    $time = strtotime($last_time);
+                    $data['match_date'] = date('Y-m-d',$time);
+                    $data['match_time'] = date('H:m:i',$time);
+                }
+
                 $set_match = [
                     'ctime'=>$this->newTime,
                     'utime'=>$this->newTime,
                     'expire_time'=>date('Y-m-d H:m:i',time()+60),
-                    'home_team'=>$data['home_team'],
-                    'guest_team'=>$data['guest_team'],
+                    'home_team'=>$data['home_team']?:'',
+                    'guest_team'=>$data['guest_team']?:'no_team',
                     'lg_id'=>$lg_id,
                     'status'=>$data['status'],
-                    'match_date'=>$data['match_date'],
-                    'match_time'=>$data['match_time'],
-                    'tag'=>$data['tag'],
-                    'is_rollball'=>$data['is_rollball'],
-                    'is_today'=>$data['is_today'],
-                    'is_morningplate'=>$data['is_morningplate'],
-                    'is_stringscene'=>$data['is_stringscene'],
-                    'us_time'=>$data['us_time'],
+                    'match_date'=>$data['match_date']?:'',
+                    'match_time'=>$data['match_time']?:'',
+                    'tag'=>$data['tag']?:0,
+                    'is_rollball'=>$data['is_rollball']?:0,
+                    'is_today'=>$data['is_today']?:0,
+                    'is_morningplate'=>$data['is_morningplate']?:0,
+                    'is_stringscene'=>$data['is_stringscene']?:0,
+                    'us_time'=>$data['us_time']?:'',
+                    'half_match_id'=>$half_match_id?:0,
                 ];
-
+                //写入赛事 返回id
                 $id = lm($model['model_match'],'Sports')->insertGetId($set_match);
                 if($id < 1) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
             }
@@ -228,38 +300,6 @@ class WriteSports extends Controller{
         Render([], '1', lang('Tips','Sports')->get('success'));
     }
 
-    //写入赛事数据  弃用
-    public function __competition($opt = []){
-        $game_code = $opt['game_code'];
-        //根据球类代码获取相关model
-        $model = $this->commonFunction->getModels($game_code,1);
-        $data = $opt['data'];
-//        foreach ($opt['data'] as $k => $v){
-            //验证赛事所属联赛
-            if(!empty($data['lg_id'])){
-                $lg = lm($model['model_league'],'Sports')
-                    ->where(['lg_id'=>$data['lg_id']])
-                    ->count();
-                if($lg < 1) Render([], '10015', lang('Tips','Sports')->get('league_error'));
-            }
-            $post = lm($model['model_match'],'Sports')
-                ->where(['match_id'=>$data['match_id']])
-                ->count();
-            //更新操作
-            if($post > 0){
-                $ret = lm($model['model_match'],'Sports')
-                    -> where(['match_id'=>$data['match_id']])
-                    -> update($data);
-                if($ret < 1) Render([], '10011', lang('Tips','Sports')->get('update_error'));
-            }else{
-                //写入操作
-                $ret = lm($model['model_match'],'Sports')->insert($data);
-                if($ret != true) Render([], '10012', lang('Tips','Sports')->get('insert_error'));
-            }
-//        }
-        Render([], '1', lang('Tips','Sports')->get('success'));
-    }
-
     //写入赔率数据
     public function odds($opt){
         $game_code = $opt['game_code'];

+ 4 - 0
Application/Sports/Lang/Errors.php

@@ -50,6 +50,10 @@ return array(
     'error-10020' => '赛事赔率记录写入失败',
     'error-10021' => '联赛结果写入失败',
     'error-10022' => '赛事结果记录写入失败',
+    'error-10023' => '联赛赛季结束时间不存在',
+    'error-10024' => '所属上半场赛事不存在',
+    'error-10025' => '无权操作',
+
 
 
 

+ 3 - 0
Application/Sports/Lang/Tips.php

@@ -20,6 +20,9 @@ return array(
     'add_lg_r_error' =>'联赛结果写入失败',
     'add_match_r_error' =>'赛事结果写入失败',
     'add_match_r_r_error' =>'赛事结果记录写入失败',
+    'lg_lastTime_error' =>'联赛赛季结束时间不存在',
+    'half_match_error' =>'所属上半场赛事不存在',
+    'auth_error' => '无权操作',
 
     // ====end===
 

+ 18 - 8
Application/Sports/Model/St_bq_odds.php

@@ -31,14 +31,24 @@ class St_bq_odds extends Model
         $oddsData = self::select('match_id','id','p_code','odds_code','status','odds','condition','sort','odds_only')
             ->where($source)
             ->whereIn('match_id',$match_ids)
-            ->where(
-                function($query){
-                    $query->where('odds_code','capot_home')
-                        ->orWhere(function($query){
-                            $query->where('odds_code','capot_guest');
-                        });
-                }
-            )
+            ->where(function($query){
+                $query->where('odds_code','concede_home')
+                    ->orWhere(function($query){
+                        $query->where('odds_code','concede_guest');
+                    })
+                    ->orWhere(function($query){
+                        $query->where('odds_code','total_size_small');
+                    })
+                    ->orWhere(function($query){
+                        $query->where('odds_code','total_size_big');
+                    })
+                    ->orWhere(function($query){
+                        $query->where('odds_code','capot_home');
+                    })
+                    ->orWhere(function($query){
+                        $query->where('odds_code','capot_guest');
+                    });
+            })
             ->get()
             ->toArray();
 

+ 6 - 1
Application/Sports/Model/St_zq_competition.php

@@ -31,9 +31,14 @@ class St_zq_competition extends Model
         $model_match = $models['model_match'];
         $model_result = $models['model_result'];
 
+        $select = [$model_match.'.lg_id',$model_match.'.match_id',$model_match.'.tag','match_date',$model_match.'.match_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time as a_time','match_process'];
+        if($model_result == 'st_wq_result'){
+            $select = [$model_match.'.lg_id',$model_match.'.match_id',$model_match.'.tag','match_date',$model_match.'.match_time',$model_match.'.home_team',$model_match.'.guest_team','home_player_score','guest_player_score',$model_result.'.match_time as a_time','match_process'];
+        }
         $data = lm($model_match,"Sports")
             ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
-            ->select($model_match.'.lg_id',$model_match.'.match_id',$model_match.'.tag','match_date',$model_match.'.match_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time as a_time','match_process')
+//            ->select($model_match.'.lg_id',$model_match.'.match_id',$model_match.'.tag','match_date',$model_match.'.match_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time as a_time','match_process')
+            ->select($select)
             ->where($model_match.'.source',$source['source'])
             ->whereIn($model_match.'.lg_id',$lg_ids)
             ->where($where)

+ 2 - 2
Application/Sports/Model/St_zq_odds.php

@@ -40,10 +40,10 @@ class St_zq_odds extends Model
                         $query->where($model_odds.'.odds_code','concede_guest');
                     })
                     ->orWhere(function($query)use ($model_odds){
-                        $query->where($model_odds.'.odds_code','size_home');
+                        $query->where($model_odds.'.odds_code','total_size_small');
                     })
                     ->orWhere(function($query)use ($model_odds){
-                        $query->where($model_odds.'.odds_code','size_guest');
+                        $query->where($model_odds.'.odds_code','total_size_big');
                     })
                     ->orWhere(function($query)use ($model_odds){
                         $query->where($model_odds.'.odds_code','capot_home');

+ 4 - 4
Biz/Match/GetOddsData.php

@@ -138,10 +138,10 @@ class GetOddsData {
                             $query->where($model_odds.'.odds_code','concede_guest');
                         })
                         ->orWhere(function($query)use ($model_odds){
-                            $query->where($model_odds.'.odds_code','size_home');
+                            $query->where($model_odds.'.odds_code','goal_size_home');
                         })
                         ->orWhere(function($query)use ($model_odds){
-                            $query->where($model_odds.'.odds_code','size_guest');
+                            $query->where($model_odds.'.odds_code','goal_size_guest');
                         });
                 }
             )
@@ -216,10 +216,10 @@ class GetOddsData {
                             $query->where($model_odds.'.odds_code','concede_guest');
                         })
                         ->orWhere(function($query)use ($model_odds){
-                            $query->where($model_odds.'.odds_code','total_sizes_big');
+                            $query->where($model_odds.'.odds_code','total_size_big');
                         })
                         ->orWhere(function($query)use ($model_odds){
-                            $query->where($model_odds.'.odds_code','total_sizes_small');
+                            $query->where($model_odds.'.odds_code','total_size_small');
                         });
                 }
             )

+ 84 - 18
Biz/Match/GetmatchData.php

@@ -214,6 +214,7 @@ class GetmatchData {
         }
         //统计联赛下的赛事及查询赛事
         $matchData = matchModel::getRollMatchDataAll($source,$models,$where,$lg_ids);
+
         //获取赛事id
         $match_ids = [];
         foreach ($matchData as $k => $v){
@@ -231,24 +232,41 @@ class GetmatchData {
             }
             $data[$k]['matchNum'] = count($data[$k]['matchData']);
         }
-        foreach ($data as $k=>$v){
-            foreach ($v['matchData'] as $kk=>$vv){
-                //获取赛事下赔率并且分组
-                $capot = [];
-                $concede_size = [];
-                foreach ($oddsData as $kkk=>$vvv) {
-                    if ($vv['match_id'] == $vvv['match_id'] and $vvv['sort']==0) {
-                        if($vvv['p_code'] == 'concede_size'){
-                            $concede_size[] = $vvv;
+        if($ret['game_code'] == 'wq') {
+            $oddsData = WQoddsModel::getMatchOdds($source,$match_ids);
+            foreach ($data as $k=>$v){
+                foreach ($v['matchData'] as $kk=>$vv){
+                    //获取赛事下赔率并且分组
+                    $odds = [];
+                    foreach ($oddsData as $kkk=>$vvv) {
+                        if ($vv['match_id'] == $vvv['match_id'] and $vvv['sort']==0) {
+                            $odds[] = $vvv;
                         }
-                        if($vvv['p_code'] == 'capot'){
-                            $capot[] = $vvv;
+                    }
+                    $data[$k]['matchData'][$kk]['oddsData'] = $odds;
+                }
+            }
+        }else{
+            foreach ($data as $k=>$v){
+                foreach ($v['matchData'] as $kk=>$vv){
+                    //获取赛事下赔率并且分组
+                    $capot = [];
+                    $concede_size = [];
+                    foreach ($oddsData as $kkk=>$vvv) {
+                        if ($vv['match_id'] == $vvv['match_id'] and $vvv['sort']==0) {
+                            if($vvv['odds_code'] == 'concede_guest' || $vvv['odds_code'] == 'concede_home' || $vvv['odds_code'] == 'goal_size_home' || $vvv['odds_code'] == 'goal_size_guest'){
+                                $concede_size[] = $vvv;
+                            }
+                            if($vvv['p_code'] == 'capot'){
+                                $capot[] = $vvv;
+                            }
                         }
                     }
+                    $data[$k]['matchData'][$kk]['oddsData'] = [$concede_size,$capot];
                 }
-                $data[$k]['matchData'][$kk]['oddsData'] = [$concede_size,$capot];
             }
         }
+
         return $data;
     }
 
@@ -467,14 +485,37 @@ class GetmatchData {
                     $concede_size = [];
                     foreach ($oddsData as $kkk=>$vvv) {
                         if ($vv['match_id'] == $vvv['match_id'] and $vvv['sort']==0) {
-                            if($vvv['p_code'] == 'concede_size'){
-                                $concede_size[] = $vvv;
+                            if($vvv['odds_code'] == 'concede_guest'){
+                                $concede_g = $vvv;
                             }
-                            if($vvv['p_code'] == 'capot'){
-                                $capot[] = $vvv;
+                            if($vvv['odds_code'] == 'concede_home'){
+                                $concede_h = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'total_size_small'){
+                                $size_s = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'total_size_big'){
+                                $size_b = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'capot_home'){
+                                $capot_h = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'capot_dogfall'){
+                                $capot_d = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'capot_guest'){
+                                $capot_g = $vvv;
                             }
                         }
                     }
+                    $concede_size = [$concede_g,$concede_h,$size_s,$size_b];
+                    $capot = [$capot_h,$capot_d,$capot_g];
+                    foreach ($concede_size as $key => $vaule){
+                        if($vaule == null) unset($concede_size[$key]);
+                    }
+                    foreach ($capot as $key1 => $vaule1){
+                        if($vaule1 == null) unset($capot[$key1]);
+                    }
                     $data[$k]['matchData'][$kk]['oddsData'] = [$concede_size,$capot];
                 }
             }
@@ -529,10 +570,35 @@ class GetmatchData {
                     $odds = [];
                     foreach ($oddsData as $kkk=>$vvv) {
                         if ($vv['match_id'] == $vvv['match_id'] and $vvv['sort']==0) {
-                            $odds[] = $vvv;
+                            if($vvv['odds_code'] == 'concede_guest'){
+                                $concede_g = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'concede_home'){
+                                $concede_h = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'total_size_small'){
+                                $size_s = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'total_size_big'){
+                                $size_b = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'capot_home'){
+                                $capot_h = $vvv;
+                            }
+                            if($vvv['odds_code'] == 'capot_guest'){
+                                $capot_g = $vvv;
+                            }
                         }
                     }
-                    $data[$k]['matchData'][$kk]['oddsData'] = $odds;
+                    $concede_size = [$concede_g,$concede_h,$size_s,$size_b];
+                    $capot = [$capot_h,$capot_g];
+                    foreach ($concede_size as $key => $vaule){
+                        if($vaule == null) unset($concede_size[$key]);
+                    }
+                    foreach ($capot as $key1 => $vaule1){
+                        if($vaule1 == null) unset($capot[$key1]);
+                    }
+                    $data[$k]['matchData'][$kk]['oddsData'] = [$concede_size,$capot];
                 }
             }
         }