彭俊 6 éve
szülő
commit
35d919b7e4

+ 0 - 1
Application/Api/Controller/Betorder.php

@@ -681,7 +681,6 @@ class Betorder extends BaseController{
             }
             _commit();//提交
             Render('', '1',lang('Errors','Api')->get('error-1'));
-
         } catch (Exception $e) {
             _rollBack();//回滚
             print $e->getMessage();

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

@@ -807,13 +807,6 @@ where a.match_id = b.match_id and a.id = b.id ";
         Render($data, '1', lang('Tips','Sports')->get('success'));
     }
 
-    /**
-     * 验证 赛事赔率/比分 是否发生变更
-     */
-    public function getOdds(){
-
-    }
-
     /**
      * 获取赛事所有数据
      * @param  [array] $where 条件

+ 1 - 0
Application/Sports/Controller/MatchListWeb.php

@@ -657,6 +657,7 @@ where a.match_id = b.match_id and a.id = b.id ";
         $oddsCodeNum['kemp']['code_num'] = count($oddsData_gj_num);
 
         sort($oddsCodeNum);
+        dd($oddsCodeNum);
         return $oddsCodeNum;
     }
 

+ 163 - 0
Application/Sports/Controller/MatchVer.php

@@ -0,0 +1,163 @@
+<?php
+
+namespace App\Sports\Controller;
+
+use BaseController\Controller;
+
+use Biz\Account\AccountManager;
+
+/**
+ * 赛事数据验证
+ * Tank.peng
+ * 2019/11/6
+ */
+class MatchVer extends Controller
+{
+    public function init() {
+        $this->time = date('Y-m-d H:i:s',time());
+        $this->accountManager = new AccountManager();
+        $this->commonFunction =  C()->get('commonFunction');
+    }
+
+    /**
+     * 验证 赛事赔率/比分 是否发生变更
+     */
+    public function VerOddsScore(){
+        /*
+        //拼装请求数据
+        $data = [
+            [
+                'game_code'=>'zq',//球类代码
+                'match_id'=>123,//赛事id
+                'home_score'=>1,//主队得分/进球 如果是滚球让球
+                'guest_score'=>2,//客队得分/进球 如果是滚球让球
+                'odds_only'=>'34f8e550779c6446c05d2dd2bb969631'//赔率uuid
+            ],
+            [
+                'game_code'=>'lq',
+                'match_id'=>123,
+                'home_score'=>1,
+                'guest_score'=>2,
+                'odds_only'=>'5c890c276384c40648760233194067b9'
+            ]
+
+        ];
+        */
+
+        //获取 查询数据
+        $data_json = $_REQUEST['data'];
+        $token = $_REQUEST['token'];
+
+        if(empty($data_json)||empty($token)){
+            Render('', '51029',lang('Errors','Api')->get('error-51029'));
+        }
+
+        //验证用户token
+        $this->getAgent($token);
+
+        //数据转arr
+        $data_arr = json_decode($data_json,true);
+        if(empty($data_arr)) Render('', '1', lang('Tips','Sports')->get('success'));
+        //循环处理 根据球类分组
+        //足球 赛事数据
+        $zq_data = [];
+        //篮球 赛事数据
+        $lq_data = [];
+        //网球 赛事数据
+        $wq_data = [];
+        //棒球 赛事数据
+        $bq_data = [];
+        foreach($data_arr as $k=>$v){
+            //序号 赋值
+            $v['sort'] = $k;
+            //足球
+            if($v['game_code'] == 'zq'){
+                $zq_data[] = $v;
+            }
+            //篮球
+            if($v['game_code'] == 'lq'){
+                $lq_data[] = $v;
+            }
+            //网球
+            if($v['game_code'] == 'wq'){
+                $wq_data[] = $v;
+            }
+            //棒球
+            if($v['game_code'] == 'bq'){
+                $bq_data[] = $v;
+            }
+        }
+        //处理 足球
+        if(!empty($zq_data)){
+            //获取model
+            $getModels = $this->commonFunction->getModels('zq');
+            //获取赛事id
+            $zq_match_ids = array_column($zq_data,'match_id');
+            //根据赛事id 获取赛事状态
+            $zq_match_status = $this->getMatchStatus($zq_match_ids,$getModels);
+            //根据赛事id 获取赛事比分
+            $zq_match_score = $this->getMatchScore($zq_match_ids,$getModels);
+            //根据赔率uuid 验证是否存在
+            
+
+            dd($zq_match_score);exit;
+        }
+        dd($zq_data);
+
+        //验证比分是否发生变化
+        //
+        dd(123);
+
+        Render('', '1', lang('Tips','Sports')->get('success'));
+
+
+    }
+
+    /**
+     * 获取各球类 指定赛事 状态
+     */
+    public function getMatchStatus($match_ids,$getModels){
+        
+        $match_model = $getModels['model_match'];
+
+        $match_status = lm($match_model, 'Sports')
+            ->select('id as match_id','status')
+            ->whereIn('id',$match_ids)
+            ->get()
+            ->toArray();
+
+        return $match_status;
+    }
+
+    /**
+     * 获取各球类 指定赛事 比分
+     */
+    public function getMatchScore($match_ids,$getModels){
+        $model_result = $getModels['model_result'];
+
+        $match_result = lm($model_result, 'Sports')
+            ->select('home_score','guest_score')
+            ->whereIn('id',$match_ids)
+            ->get()
+            ->toArray();
+
+        return $match_result;
+    }
+
+    /**
+     * token获取用户详情
+     */
+    public function getAgent($token = '') {
+        $checkToken = $this->accountManager->checkEffectiveTime($token);
+        if ($checkToken['status'] != 1) {
+            Render($checkToken['data'], $checkToken['status'], lang('commons')->get('user does login'));
+        };
+        // $result = $this->accountManager->refreshToken($token);
+        // return $result['data'];
+    }
+
+}
+
+
+
+

+ 2 - 0
Application/Sports/Model/St_zq_competition.php

@@ -143,6 +143,7 @@ class St_zq_competition extends Model
                                 $matchData[$k]['home_score'] = $vv->home_score?:0;
                                 $matchData[$k]['guest_score'] = $vv->guest_score?:0;
                             }
+                            $matchData[$k]['result_mark'] = $vv->result_mark;
                             $matchData[$k]['a_time'] = $vv->a_time;//?:C()->get('commonFunction')->getMatchTime($v['match_date'],$v['match_time']);
                             $matchData[$k]['match_process'] = $vv->match_process;//?:C()->get('commonFunction')->getMatchProcess( $matchData[$k]['a_time'],$ret['game_code']);
                         }
@@ -157,6 +158,7 @@ class St_zq_competition extends Model
                         $matchData[$k]['home_score'] = 0;
                         $matchData[$k]['guest_score'] = 0;
                     }
+                    $matchData[$k]['result_mark'] = '';
                     $matchData[$k]['a_time'] = 0;//C()->get('commonFunction')->getMatchTime($v['match_date'],$v['match_time']);
                     $matchData[$k]['match_process'] = '';//C()->get('commonFunction')->getMatchProcess( $matchData[$k]['a_time'],$ret['game_code']);
                 }

+ 2 - 2
Biz/Account/AccountManager.php

@@ -513,8 +513,8 @@ class AccountManager
 
         $userInfo = lm('account_detailed', 'Commons')->join('account', 'account_detailed.account_identity', '=', 'account.identity')->where('account_detailed.token', $token)->first();
         if (empty($userInfo)) {
-            Render([], '2001', lang('Common','Api') -> get('user does login'));
-            // return false;
+            // Render([], '2001', lang('Common','Api') -> get('user does login'));
+            return false;
         }
 //        $userInfo->identity = $userInfo->account_identity;
         return $userInfo;