Pārlūkot izejas kodu

追加推送 5/7

彭俊 6 gadi atpakaļ
vecāks
revīzija
13079224f4

+ 3 - 7
Application/Api/Controller/Account.php

@@ -750,14 +750,10 @@ class Account extends BaseController {
             $accountDetailClass = new AccountDetail();
             // 修改用户基本信息
             $result = $accountDetailClass -> updateHeader();
-            if ($result) {
-                $code = 1;
-                $msg = lang('Index','Api') -> get('success');
+            $code = 1;
+            $msg = lang('Index', 'Api')->get('success');
 
-                Render($result, $code, $msg);
-            } else {
-                Render([], $code, $msg);
-            }
+            Render($result, $code, $msg);
         } catch (Exception $e) {
             Render([], $code, $msg);
         }

+ 10 - 5
Application/Api/Controller/BetOrder.php

@@ -184,6 +184,7 @@ class Betorder extends BaseController{
             if($insertMoney!=1){
                 Render('', $insertMoney,lang('Errors','Api')->get('error'.$insertMoney));
             }
+            $this->M->fanshui($userInfo['account_identity'],$userInfo['account'],$bet_money,$OrderID);//反水
         }
     }
 
@@ -286,7 +287,11 @@ class Betorder extends BaseController{
      *
      */
     public function verify_odds($game_code,$odds_only,$odds,$condition,$num = 1){
-        if(empty($odds_only)                   ||empty($odds)){
+        if (empty($odds_only)){
+            $msg = '第'.$num.'条数据'.lang('Errors','Api')->get('error-5111');
+            Render([], '5111', $msg);
+        }
+        if(empty($odds)){
             $msg = '第'.$num.'条数据'.lang('Errors','Api')->get('error-7029');
             Render([], '7029', $msg);
         }
@@ -462,7 +467,7 @@ class Betorder extends BaseController{
             if($insertMoney!=1){
                 Render('', $insertMoney,lang('Errors','Api')->get('error'.$insertMoney));
             }
-
+            $this->M->fanshui($userInfo['account_identity'],$userInfo['account'],$moneyData,$orderID);//反水
         }
 
         //写注单 表
@@ -538,7 +543,7 @@ class Betorder extends BaseController{
         $allNum = count($data_all);//所有数量
         $odds_all = [];//所有投注项数据
         foreach ($data_all as $k=>$v){
-            $odds_all[] = $v['odds'];
+            $odds_all[] = $v['odds']+1;
         }
         //投注总额
         $data['moneyData'] = (double)$bet_amount*(double)$multiple;
@@ -546,7 +551,7 @@ class Betorder extends BaseController{
             //获取所有赛事赔率乘积
             $odds = array_product($odds_all);
             //获取可赢金额
-            $data['prize_money'] =  floor($bet_amount*$odds*100)/100;//保留两位小数
+            $data['prize_money'] =  sprintf("%.2f",substr(sprintf("%.3f", $bet_amount*$odds), 0, -1));//floor($bet_amount*$odds*100)/100;//保留两位小数
         }
 
         if($sonNum < $allNum and (int)$after ==1){//例:N场赛事 <N串一
@@ -558,7 +563,7 @@ class Betorder extends BaseController{
             $odds = (array_sum($odds))-(count($odds));
 
             //获取可赢金额
-            $data['prize_money'] =  floor($bet_amount*$odds*100)/100;
+            $data['prize_money'] =  sprintf("%.2f",substr(sprintf("%.3f", $bet_amount*$odds), 0, -1));//floor($bet_amount*$odds*100)/100;
         }
 
         return $data;

+ 3 - 0
Application/Api/Lang/Common.php

@@ -2,6 +2,9 @@
 return array(
     'error' => '未知错误',
 	'cash fail' => '提现失败',
+    'Picture files are not supported' => "只支持上传‘jpg’,‘png’,‘gif’ 的格式",
+    'Picture too large' => "只支持上传小于100 KB 的图片",
+    'Upload failure' => "上传失败",
 	'no withdraw data' => '没有提现数据',
 	'notice no identity' => '通知内容没有传入ID',
 	'Content fail data' => '没有获取内容',

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

@@ -246,6 +246,7 @@ return array(
     'error-5108' => '该赛事已结束',
     'error-5109' => '赛事ID为空',
     'error-5110' => '赔率条件为空',
+    'error-5111' => '赔率唯一ID为空',
 
 
 
@@ -319,6 +320,9 @@ return array(
     'error-50037' => '未匹配到对应等级',
     'error-50038' => '同赛事下有多个记录,不能进行串式投注',
     'error-50039' => '写入串式投注数据失败',
+    'error-50040' => '只支持上传‘jpg’,‘png’,‘gif’ 的格式',
+    'error-50041' => '只支持上传小于100 KB 的图片',
+    'error-50042' => '上传失败',
 
 
 

+ 28 - 19
Application/Api/Model/AccountDetail.php

@@ -40,6 +40,9 @@ class AccountDetail extends Model {
         if (!empty($_POST['img_id'])) {
             $updateData['img_id'] = $_POST['img_id'];
             $updateData['img_url'] = '';
+            $oldImg = lm('Account_detailed', 'commons') -> accountDetailed(['img_url'], $updateWhere);
+            // 删除以前的文件
+            unlink(ROOT_PATH . $oldImg -> img_url);
         }
         if (!empty($_POST['name'])) {
             $updateData['name'] = $_POST['name'];
@@ -64,27 +67,33 @@ class AccountDetail extends Model {
         if (empty($userInfo['identity'])) {
             Render([], '2001', lang('Common','Api') -> get('user does login'));
         }
-        $updateWhere['account_identity'] = $userInfo['identity'];
-        $avatar = $request->file('avatar')->store('/public/' . date('Y-m-d') . '/avatars');
-        echo json_encode($input);die;
-        $updateData = [];
-        // 提取修改数据
-        if (!empty($_POST['email'])) {
-            $updateData['email'] = $_POST['email'];
+        // 规定上传格式
+        $allowedType = ["png", "jpg", "gif"];
+        $allowedExtensions = ["image/jpg","image/jpeg","image/png","image/pjpeg","image/gif","image/bmp","image/x-png"];
+        // 最大为 100 Kb
+        $maxSize = 102400;
+        // 获取上传文件
+        $img = $_FILES['img'];
+        // 获取上传文件格式并转换为小写
+        $imgType = strtolower(substr($img['name'],strrpos($img['name'],".") + 1));
+        // 判断格式是否符合要求
+        if (!in_array($imgType, $allowedType) || !in_array(strtolower($img['type']), $allowedExtensions)) {
+            Render([], '50040', lang('Common','Api') -> get('Picture files are not supported'));
         }
-        if (!empty($_POST['phone'])) {
-            $updateData['phone'] = $_POST['phone'];
+        if ($img['size'] > $maxSize) {
+            Render([], '50041', lang('Common','Api') -> get('Picture too large'));
         }
-        if (!empty($_POST['img_id'])) {
-            $updateData['img_id'] = $_POST['img_id'];
-            $updateData['img_url'] = '';
-        }
-        if (!empty($_POST['name'])) {
-            $updateData['name'] = $_POST['name'];
+        // 修改文件名
+        $imgName = strtotime('now') + rand(10000, 99999);
+        $filePath = ROOT_PATH . '/Public/img/header/';
+        $imgPath = '/Public/img/header/' . $imgName . ".png";
+        if (move_uploaded_file($img['tmp_name'], $filePath . $imgName . ".png")) {
+            $updateWhere['account_identity'] = $userInfo['identity'];
+            $oldImg = lm('Account_detailed', 'commons') -> accountDetailed(['img_url'], $updateWhere);
+            unlink(ROOT_PATH . $oldImg -> img_url);
+            lm('Account_detailed', 'commons') -> updateDetailed($updateWhere, ['img_url' => $imgPath]);
+        } else {
+            Render([], '50042', lang('Common','Api') -> get('Upload failure'));
         }
-        if (empty($updateData)) {
-            Render([], '4027', lang('Common','Api') -> get('please enter the modification'));
-        }
-        return lm('Account_detailed', 'commons') -> updateDetailed($updateWhere, $updateData);
     }
 }

+ 18 - 5
Application/Sports/Controller/Head.php

@@ -88,9 +88,12 @@ class Head extends Controller{
                         //根据球类代码 获取相关model
                         $models = $this->commonFunction->getModels($item1['game_code'],1);
                         $model_match = $models['model_match'];
+                        $model_league = $models['model_league'];
+
                         $where = $this->commonFunction->getState($item['type_code'],$model_match);
                         if($item1['game_code'] != 'gj'){
-                            $matchNum[$key1][] = lm($model_match, 'Sports')
+                            $matchNum[$key1][] = lm($model_league,"Sports")
+                                ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
                                 ->where($model_match.'.source',$this->source['source'])
                                 ->where($where)
                                 ->count("*");
@@ -102,9 +105,15 @@ class Head extends Controller{
                         //根据球类代码 获取相关model
                         $models = $this->commonFunction->getModels($item1['game_code'],1);
                         $model_match = $models['model_match'];
+                        $model_league = $models['model_league'];
                         $where = $this->commonFunction->getState($item['type_code'],$model_match);
                         if($item1['game_code'] != 'gj'){
-                            $matchNum[$key1][] = lm($model_match, 'Sports')
+//                            $matchNum[$key1][] = lm($model_match, 'Sports')
+//                                ->where($model_match.'.source',$this->source['source'])
+//                                ->where($where)
+//                                ->count("*");
+                            $matchNum[$key1][] = lm($model_league,"Sports")
+                                ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
                                 ->where($model_match.'.source',$this->source['source'])
                                 ->where($where)
                                 ->count("*");
@@ -116,9 +125,11 @@ class Head extends Controller{
                         //根据球类代码 获取相关model
                         $models = $this->commonFunction->getModels($item1['game_code'],1);
                         $model_match = $models['model_match'];
+                        $model_league = $models['model_league'];
                         $where = $this->commonFunction->getState($item['type_code'],$model_match);
                         if($item1['game_code'] != 'gj'){
-                            $matchNum[$key1][] = lm($model_match, 'Sports')
+                            $matchNum[$key1][] = lm($model_league,"Sports")
+                                ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
                                 ->where($model_match.'.source',$this->source['source'])
                                 ->where($where)
                                 ->count("*");
@@ -130,10 +141,12 @@ class Head extends Controller{
                         //根据球类代码 获取相关model
                         $models = $this->commonFunction->getModels($item1['game_code'], 1);
                         $model_match = $models['model_match'];
+                        $model_league = $models['model_league'];
                         $where = $this->commonFunction->getState($item['type_code'], $model_match);
                         if ($item1['game_code'] != 'gj') {
-                            $matchNum[$key1][] = lm($model_match, 'Sports')
-                                ->where($model_match . '.source', $this->source['source'])
+                            $matchNum[$key1][] = lm($model_league,"Sports")
+                                ->join($model_match,$model_match.'.lg_id',$model_league.'.lg_id')
+                                ->where($model_match.'.source',$this->source['source'])
                                 ->where($where)
                                 ->count("*");
                         }

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

@@ -627,10 +627,15 @@ class  MatchList extends Controller {
 
                 if($type_code != 'StChampion'){
                     $matchModel = $this->commonFunction->getModels($type['game_code']);
-                    $matchNum = lm($matchModel['model_match'], 'Sports')
-                        ->where($this->source)
+                    $matchNum = lm($matchModel['model_league'],"Sports")
+                        ->join($matchModel['model_match'],$matchModel['model_match'].'.lg_id',$matchModel['model_league'].'.lg_id')
+                        ->where($matchModel['model_match'].'.source',$this->source['source'])
                         ->where($where)
-                        ->count('*');
+                        ->count("*");
+//                        lm($matchModel['model_match'], 'Sports')
+//                        ->where($this->source)
+//                        ->where($where)
+//                        ->count('*');
                     //获取满足状态的球类/去除冠军类
                     if($matchNum != 0 and $type['game_code']!='gj'){
                         $gameData[] = $type;
@@ -739,7 +744,7 @@ class  MatchList extends Controller {
             $oddsData = lm($model_odds, 'Sports')
                 ->select('sort','p_code','id','odds_only','odds_code',$model_odds.'.status','odds','condition','sort','source','utime')
                 ->where($this->source)
-                ->where($oddsTypeWhere)
+//                ->where($oddsTypeWhere)
 //                ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
                 ->where([$model_odds.'.match_id'=>$matchID,$model_odds.'.type'=>0])//,$model_odds.'.expire_time'=>$utime
                 ->orderBy('sort', 'desc')
@@ -777,8 +782,12 @@ class  MatchList extends Controller {
                     ->select('match_id','home_team','guest_team')
                     ->where($this->source)
                     ->where('lg_id',$matchData->lg_id)
-                    ->get()->toarray();
+                    ->where('home_team','<>',null)
+                    ->where('guest_team','<>',null)
+                    ->get()
+                    ->toarray();
             }
+//            dump(lm($model_match,'Sports')->getsql());die;
             $list = array();
             foreach ($oddsData as $key=>$item){
                 $item['team'] = '';
@@ -828,7 +837,7 @@ class  MatchList extends Controller {
                 'p_code_array'=> $p_code_array,
                 'oddsData'=>$oddsData, //$sd,
                 'league' => $league,
-                'lang' => lang('OddsTemp','Sports')->getAll(),
+//                'lang' => lang('OddsTemp','Sports')->getAll(),
             ];
             Render($data, '1', lang('Tips','Sports')->get('success'));
 
@@ -937,11 +946,22 @@ class  MatchList extends Controller {
                 ->join($model_odds,$model_odds.'.match_id',$model_match.'.match_id')
                 ->select($model_match.'.match_id',$model_match.'.match_date',$model_match.'.home_team',$model_match.'.guest_team',$model_odds.'.id as odds_id',$model_odds.'.p_code',$model_odds.'.odds_code',$model_odds.'.condition',$model_odds.'.odds',$model_odds.'.odds_only',$model_odds.'.status',$model_odds.'.sort')
                 ->where($model_match.'.source',$this->source)
+                ->where($model_odds.'.type',0)
                 ->where($where)
 //                ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
                 ->get()->toArray();
 
-        Render($oddsData, '1', lang('Tips','Sports')->get('success'));
+        $p_code_array = [];
+        foreach ($oddsData as $key =>$val){
+            $p_code_array[$val['p_code']] = lang('OddsTemp','Sports')->get($val['p_code']);
+        }
+
+        $data = [
+            'oddsData'=>$oddsData,
+            'p_code_array'=>$p_code_array
+        ];
+
+        Render($data, '1', lang('Tips','Sports')->get('success'));
     }
 
 }

+ 32 - 47
Application/Sports/Controller/RollingBall.php

@@ -25,45 +25,25 @@ class RollingBall extends Controller{
         $model_result = $models['model_result'];
         $model_match = $models['model_match'];
 
-
-//        $result = lm($model_result,'Sports')
-//            ->leftjoin($model_match,$model_match.'.match_id',$model_result.'.match_id')
-//            ->select($model_result.'.match_id',$model_result.'.home_team',$model_result.'.guest_team',$model_result.'.status',$model_result.'.home_score',$model_result.'.guest_score',$model_match.'.match_date as start_date',$model_match.'.match_time as start_time',$model_result.'.match_time',$model_result.'.match_process')
-//            ->where('status',1)
-//            ->orderby('match_time','desc')
-//            ->get()->toArray();
-
         //获取 滚球查询条件
         $where = $this->commonFunction->getState('StRollBall',$model_match);
 
         $result =lm($model_match,"Sports")
-            ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
+            ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
             ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
             ->where($model_match.'.source',$this->source['source'])
             ->where($where)
             ->get()
             ->toarray();
 
-        $da = [];
-
-//        foreach ($result as $key =>$item){
-//            if($item['match_process'] ==""){
-//                $mark = substr($item['match_time'],0,strrpos($item['match_time'],":"));
-//                if((int)$mark < 45){
-//                    $item['match_process'] = '上半场';
-//                }else{
-//                    $item['match_process'] = '下半场';
-//                }
-//            }
-//            $da[$key]= $item;
-//        }
-
         $data = [
             'game_code'=>'zq',
             'gameName'=>'足球',
             'matchData'=>$result
         ];
-        Render($data, '1', lang('Tips','Sports')->get('success'));
+
+        return $data;
+//        Render($data, '1', lang('Tips','Sports')->get('success'));
 
     }
 
@@ -80,26 +60,20 @@ class RollingBall extends Controller{
         //获取 滚球查询条件
         $where = $this->commonFunction->getState('StRollBall',$model_match);
         $result =lm($model_match,"Sports")
-            ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
+            ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
             ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
             ->where($model_match.'.source',$this->source['source'])
             ->where($where)
             ->get()
             ->toarray();
 
-
-//        $lq = lm($model_result,'Sports')
-//            ->select('id','home_team','guest_team','home_score','guest_score','status','match_score','update_time','match_time','match_process')
-//            ->where('status','1')
-//            ->orderby('update_time','desc')
-//            ->get()->toArray();
-
         $data = [
             'game_code'=>'lq',
             'gameName'=>'篮球',
             'matchData'=>$result
         ];
-        Render($data, '1', lang('Tips','Sports')->get('success'));
+        return $data;
+//        Render($data, '1', lang('Tips','Sports')->get('success'));
     }
 
     public function wqrollingball(){
@@ -111,24 +85,20 @@ class RollingBall extends Controller{
         //获取 滚球查询条件
         $where = $this->commonFunction->getState('StRollBall',$model_match);
         $result =lm($model_match,"Sports")
-            ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
+            ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
             ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time','home_player_name','guest_player_name','first_inning_score','second_inning_score','third_inning_score',$model_result.'.match_time','match_process')
             ->where($model_match.'.source',$this->source['source'])
             ->where($where)
             ->get()
             ->toarray();
 
-//        $wq = lm($model_result,'Sports')
-//            ->select('id','host_player_name','guest_player_name','status','first_inning_score','second_inning_score','third_inning_score','update_time','match_time','match_process')
-//            ->where('status','1')
-//            ->orderby('update_time','desc')
-//            ->get()->toArray();
         $data = [
             'game_code'=>'wq',
             'gameName'=>'网球',
             'matchData'=>$result
         ];
-        Render($data, '1', lang('Tips','Sports')->get('success'));
+        return $data;
+//        Render($data, '1', lang('Tips','Sports')->get('success'));
     }
 
     public function bqrollingball(){
@@ -140,24 +110,39 @@ class RollingBall extends Controller{
         //获取 滚球查询条件
         $where = $this->commonFunction->getState('StRollBall',$model_match);
         $result =lm($model_match,"Sports")
-            ->leftjoin($model_result,$model_result.'.match_id',$model_match.'.match_id')
+            ->join($model_result,$model_result.'.match_id',$model_match.'.match_id')
             ->select($model_match.'.match_id',$model_match.'.tag','match_date as start_date',$model_match.'.match_time as start_time',$model_match.'.home_team',$model_match.'.guest_team','home_score','guest_score',$model_result.'.match_time','match_process')
             ->where($model_match.'.source',$this->source['source'])
             ->where($where)
             ->get()
             ->toarray();
-//        $bq = lm($model_result,'Sports')
-//            ->select('id','home_team','guest_team','home_score','guest_score','status','match_score','update_time','match_time','match_process')
-//            ->where('status','1')
-//            ->orderby('update_time','desc')
-//            ->get()->toArray();
 
         $data = [
             'game_code'=>'bq',
             'gameName'=>'棒球',
             'matchData'=>$result
         ];
-        Render($data, '1', lang('Tips','Sports')->get('success'));
+        return $data;
+//        Render($data, '1', lang('Tips','Sports')->get('success'));
+
+    }
+
+    /**
+     * 获取所有球类滚球
+     */
+    public function getRollingBall(){
+        $zqRollingBall = $this->zqrollingball();
+        $lqRollingBall = $this->lqrollingball();
+        $wqRollingBall = $this->wqrollingball();
+        $bqRollingBall = $this->bqrollingball();
 
+        $data = [
+            'zqData' =>$zqRollingBall,
+            'lqData' =>$lqRollingBall,
+            'wqData' =>$wqRollingBall,
+            'bqData' =>$bqRollingBall,
+        ];
+
+        Render($data, '1', lang('Tips','Sports')->get('success'));
     }
 }

+ 31 - 0
Biz/Common/CommonFunction.php

@@ -909,6 +909,37 @@ class CommonFunction {
         return array_values($data);
     }
 
+    /**
+     * 处理冠军以外 数组结构
+     */
+    function array_other_tt($data,$matchData){
+        foreach ($data as $k=>&$v){
+            foreach ($v['league_count'] as $kk=>&$vv){
+                foreach ($matchData as $kkk=>$vvv){
+                    if($vv['lg_id'] == $vvv['lg_id']){
+                        $vv['matchData'][]=$vvv;
+                    }
+                }
+
+                if($vv['matchData']){
+                    $vv['matchData'] = $this->array_unset_tt($vv['matchData'],'match_id');
+                    $vv['count'] = count($vv['matchData']);
+                    unset($vv['matchData']);
+                }
+
+                if(count($vv) == 5){
+                    unset($v['league_count'][$kk]);
+                }
+            }
+            $v['league_count'] =  array_values($v['league_count']);
+            if(empty($v['league_count'])){
+                unset($data[$k]);
+            }
+        }
+
+        return array_values($data);
+    }
+
     /**
      * 时间格式化
      * @param string $dateformat 时间格式

+ 4 - 4
Biz/Match/GetOddsData.php

@@ -96,7 +96,7 @@ class GetOddsData {
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->where($source)
-                ->where($oddsTypeWhere)
+//                ->where($oddsTypeWhere)
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
                 ->where(
@@ -141,7 +141,7 @@ class GetOddsData {
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->where($source)
-                ->where($oddsTypeWhere)
+//                ->where($oddsTypeWhere)
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
                 ->where(
@@ -186,7 +186,7 @@ class GetOddsData {
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->where($source)
-                ->where($oddsTypeWhere)
+//                ->where($oddsTypeWhere)
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
                 ->where(
@@ -231,7 +231,7 @@ class GetOddsData {
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','p_code','odds_code','status','odds','condition','sort','odds_only')
                 ->where($source)
-                ->where($oddsTypeWhere)
+//                ->where($oddsTypeWhere)
                 ->where(['match_id'=>$item['match_id'],'type'=>0])
 //                    ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))//追加查询有效时间
                 ->where(

+ 72 - 3
Biz/Match/GetmatchData.php

@@ -151,7 +151,7 @@ class GetmatchData {
                     ->leftjoin($model_odds,$model_odds.'.match_id',$model_match.'.match_id')
                     ->select($model_odds.'.id','p_code','odds_code',$model_odds.'.status','odds','condition','sort')
                     ->where($model_match.'.source',$source['source'])
-                    ->where([$model_odds.'.match_id' => $vv['match_id'],$model_odds.'.is_rollball'=>1,$model_odds.'.type'=>0])//查询滚球赔率
+                    ->where([$model_odds.'.match_id' => $vv['match_id'],$model_odds.'.type'=>0])//查询滚球赔率
                     //->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
                     ->where(function($query)use ($model_odds){
                         $query->where($model_odds.'.odds_code','concede_home')
@@ -249,7 +249,7 @@ class GetmatchData {
                     ->select($model_odds.'.id','odds_only','p_code','odds_code',$model_odds.'.status','odds','condition','sort')
                     ->where($model_match.'.source',$source['source'])
                     ->where([$model_odds.'.match_id' => $vv['match_id'],$model_odds.'.type'=>0])
-                    ->where($oddsTypeWhere)
+//                    ->where($oddsTypeWhere)
 //                        ->where($model_odds.'.expire_time','>',date("Y-m-d H:i:s"))
                     ->where(function($query)use ($model_odds){
                         $query->where($model_odds.'.odds_code','concede_home')
@@ -441,6 +441,75 @@ class GetmatchData {
      * 非冠军盘口
      */
     public function getMatchNum($source,$country,$area,$model_league,$model_match='',$model_odds='',$where,$search,$time='',$type=0){
+        $leagueData = lm($model_league,'Sports')
+            ->select('id','lg_id','name_chinese as league','country_id','area_id')
+            ->where($source)
+            ->where($model_league.'.name_chinese','like','%'.$search.'%')
+            ->get()
+            ->toArray();
+
+        $matchData = lm($model_match,'Sports')
+            ->select('id','lg_id','match_id')
+            ->where($where)
+            ->where($source)
+            ->get()
+            ->toArray();
+
+        //按国家
+        $countryData = [];
+        if(!empty($country) and !empty($leagueData) and !empty($matchData)){
+            foreach ($country as $k=>$v){
+                if($v['country_id']){
+                    $countryData[$k] = $v;
+                    foreach ($leagueData as $kk=>$vv){
+                        if($v['country_id'] == $vv['country_id']){
+                            $countryData[$k]['league_count'][] = $vv;
+                        }
+                    }
+                }
+            }
+        }
+
+        //去除无联赛 国家
+        foreach ($countryData as $k=>$v){
+            if(count($v) == 2){
+                unset($countryData[$k]);
+            }
+        }
+
+        //按地区
+        $areaData = [];
+        if(!empty($area) and !empty($leagueData) and($matchData)){
+            foreach ($area as $k=>$v){
+                if($v['area_id']){
+                    $areaData[$k] = $v;
+                    foreach ($leagueData as $kk=>$vv){
+                        if($v['area_id'] == $vv['area_id']){
+                            $areaData[$k]['league_count'][] = $vv;
+                        }
+                    }
+                }
+            }
+        }
+
+        //去除无联赛 地区
+        foreach ($areaData as $k=>$v){
+            if(count($v) == 2){
+                unset($areaData[$k]);
+            }
+        }
+
+        $countryData = $this->commonFunction->array_other_tt($countryData,$matchData);
+        $areaData = $this->commonFunction->array_other_tt($areaData,$matchData);
+        $data = array_merge($countryData,$areaData);
+        return $data;
+    }
+
+    /**
+     * 弃用 获取联赛下赛事 数量
+     * 非冠军盘口
+     */
+    public function __getMatchNum($source,$country,$area,$model_league,$model_match='',$model_odds='',$where,$search,$time='',$type=0){
         //统计国家下联赛-赛事/盘口数量
         if(!empty($country)){
 
@@ -569,7 +638,7 @@ class GetmatchData {
 
         //按国家
         $countryData = [];
-        if(!empty($country) and !empty($leagueData) and($oddsData)){
+        if(!empty($country) and !empty($leagueData) and !empty($oddsData)){
             foreach ($country as $k=>$v){
                 if($v['country_id']){
                     $countryData[$k] = $v;

+ 2 - 5
Biz/Money/Money.php

@@ -78,7 +78,6 @@ class Money {
 			if($insertDetail !=1){
 				return $insertDetail;
 			}
-			$this->fanshui($account_identity,$account['account'],$money,$order_id);//反水
 		}
 		return '1';
 	}
@@ -239,9 +238,7 @@ class Money {
 	 * @param  string  $bet_money 投注总金额
 	 */
 	public function fanshui($account_identity,$account,$bet_money,$order_id){
-		if(empty($bet_money)){
-			Render('', '5105222222',lang('Errors','Api')->get('error-5105'));
-		}
+
 		//查询是否可以反水
 		$account_info = lm('Account','Api')->where([['identity',$account_identity],['account',$account]])->first();
 		if(!$account_info){
@@ -249,7 +246,7 @@ class Money {
 		}
 		//查询反水比例
 		$Setinfo = lm('SetInfo','Api')->where([['infoname','fanshui'],['status',1]])->first();
-		if(!$Setinfo){
+		if(empty($Setinfo)){
 			Render('', '51034',lang('Errors','Api')->get('error-51034'));
 		}
 		$account_info->toArray();

BIN
Public/img/header/1557246674.png