Kaynağa Gözat

追加推送 4/30

彭俊 6 yıl önce
ebeveyn
işleme
8624868f93

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

@@ -348,6 +348,10 @@ return array(
     "error-51027" => "下级达到标要求的推荐人数不足",
     "error-51028" => "游戏统计数据不存在",
     "error-51029" => "提交数据为空",
+    "error-51030" => "获取反水信息失败",
+    "error-51031" => "获取批次投注总额失败",
+    "error-51032" => "反水失败",
+
 
     'error-51050' => '缺少彩金类型',
     'error-51051' => '缺少彩金时间',

+ 0 - 9
Application/Api/Lang/Money.php

@@ -1,9 +0,0 @@
-<?php 
-header("content-Type: text/html; charset=Utf-8");
-return [
-	'promotion'=>'%s从等级%s升级到%s等级,申请晋级彩金,经自动计算赠送%s',
-    'first' => '%s通过%s活动发起彩金申请,首充金额为%s,赠送比例为%s,赠送额度为%s,选择等级为%s,流水倍数为%s,订单号为%s',
-];
-
-
-?>

+ 61 - 25
Application/Sports/Controller/MatchList.php

@@ -144,6 +144,7 @@ class  MatchList extends Controller {
         $game_code = $_REQUEST['game_code'];//游戏代码
         $code = $_REQUEST['code'];//参赛代码
         $search = $_REQUEST['search'];//参赛代码
+        $lg_id = $_REQUEST['lg_id'];//参赛代码
         //===查询该球类是否存在或启用===
         $getModels = $this->commonFunction->getModels($game_code);
         $st_league = $getModels['model_league'];
@@ -283,6 +284,23 @@ class  MatchList extends Controller {
                     ->distinct($st_competition.'.match_id')
                     ->get()
                     ->toarray();
+  break;
+            case $code == 'qt':
+                $where = [
+                    [$st_competition.'.status','<', '2'],
+                    [$st_competition.'.source',$this->source['source']],
+                    [$st_competition.'.us_time','>',qgmdate('Y-m-d H:i:s', '', -4)],
+                    [$st_league.'.lg_id',$lg_id]
+                ];
+                //指定联赛下的赛事
+                $data = lm($st_competition,'Sports')
+                    ->join($st_league,$st_league.'.lg_id',$st_competition.'.lg_id')
+                    ->select($st_league.'.name_chinese',$st_league.'.lg_id')
+                    ->where($where)
+                    ->where($where_search)
+                    ->distinct($st_competition.'.match_id')
+                    ->get()
+                    ->toarray();
   break;
         }
         //根据联赛ID赛事信息
@@ -559,7 +577,7 @@ class  MatchList extends Controller {
 
         $data = $_REQUEST;
         try {
-            if(empty($data['game_code']) || empty($data['leagueID'])){
+            if(empty($data['game_code']) || empty($data['leagueID']) || empty($data['oddsType'])){
                 throw new \Exception(Render([], '10001', lang('Tips','Sports')->get('PARAM_ERROR')));
             }
 
@@ -574,8 +592,15 @@ class  MatchList extends Controller {
                 }
             }
 
+            $models = $this->commonFunction->getModels($data['game_code'],0);
+            $model_match = $models['model_match'];
+            $model_odds = $models['model_odds'];
+            $model_league = $models['model_league'];
+            $model_result = $models['model_result'];
+
+            $oddsTypeWhere = $this->getOddsTypeWhere($model_odds,$data['oddsType']);
             $source = $this->source;//数据源
-            $data = $this->getOddsData->getOddsData($data,$whereDate,$source);
+            $data = $this->getOddsData->getOddsData($data,$whereDate,$source,$oddsTypeWhere);
             Render($data, '1', lang('Tips','Sports')->get('success'));
 
         } catch (\Exception $e) {
@@ -653,6 +678,37 @@ class  MatchList extends Controller {
         }
     }
 
+    /**
+     * 根据赛事状态获取赔率查询条件
+     */
+    public function getOddsTypeWhere($model_odds,$oddsType){
+
+        //获取赛事不同状态下的赔率
+        if(!empty($oddsType)){
+            switch ($oddsType)
+            {
+                case 'StRollBall'://滚球
+                    $oddsTypeWhere = [[$model_odds.'.is_rollball','=',1],];
+                    break;
+                case 'StSoon'://即将
+                    $oddsTypeWhere = [[$model_odds.'.is_morningplate','=',1],];
+                    break;
+                case 'StToday'://今日
+                    $oddsTypeWhere = [[$model_odds.'.is_today','=',1],];
+                    break;
+                case 'StMorningPlate'://早盘
+                    $oddsTypeWhere = [[$model_odds.'.is_morningplate','=',1],];
+                    break;
+                case 'StStringScene'://串场
+                    $oddsTypeWhere = [[$model_odds.'.is_stringscene','=',1],];
+                    break;
+                default:
+                    $oddsTypeWhere = [];
+            }
+        }
+
+        return $oddsTypeWhere;
+    }
     /**
      * 获取赛事所有玩法赔率数据
      */
@@ -674,30 +730,8 @@ class  MatchList extends Controller {
             $model_league = $models['model_league'];
             $model_result = $models['model_result'];
 
-            //获取赛事不同状态下的赔率
-            if(!empty($oddsType)){
-                switch ($oddsType)
-                {
-                    case 'StRollBall'://滚球
-                        $oddsTypeWhere = [[$model_odds.'.is_rollball','=',1],];
-                        break;
-                    case 'StSoon'://即将
-                        $oddsTypeWhere = [[$model_odds.'.is_morningplate','=',1],];
-                        break;
-                    case 'StToday'://今日
-                        $oddsTypeWhere = [[$model_odds.'.is_today','=',1],];
-                        break;
-                    case 'StMorningPlate'://早盘
-                        $oddsTypeWhere = [[$model_odds.'.is_morningplate','=',1],];
-                        break;
-                    case 'StStringScene'://串场
-                        $oddsTypeWhere = [[$model_odds.'.is_stringscene','=',1],];
-                        break;
-                    default:
-                        $oddsTypeWhere = [];
-                }
-            }
 
+            $oddsTypeWhere = $this->getOddsTypeWhere($model_odds,$oddsType);
             $oddsData = lm($model_odds, 'Sports')
                 ->select('id','odds_only','p_code','odds_code',$model_odds.'.status','odds','condition','sort','source','utime')
                 ->where($this->source)
@@ -715,6 +749,8 @@ class  MatchList extends Controller {
                 ->first();
 //                ->toarray();
 
+            if(empty($matchData)) Render([], '1', lang('Tips','Sports')->get('success'));
+
             $matchData->ptime = '';//赛事进行时间
             $matchData->match_score = '';//赛事比分
             //如果该赛事正在进行,则获取进行时间

+ 12 - 12
Application/Sports/Controller/RollingBall.php

@@ -46,22 +46,22 @@ class RollingBall extends Controller{
 
         $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;
-        }
+//        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'=>$da
+            'matchData'=>$result
         ];
         Render($data, '1', lang('Tips','Sports')->get('success'));
 

+ 9 - 5
Application/Sports/Controller/Sports.php

@@ -20,15 +20,17 @@ class Sports extends Controller{
     private function Sports_info($game_code,$where,$limit_mt = 3,$limit_lg = 3){
         $data=[];
         $data['name'] = lm('GameType','Sports')->where('game_code',$game_code)->value('game_name');
+        $data['game_code'] = $game_code;
         //===查询该球类Models===
         $getModels = getModels($game_code);
         $st_league = $getModels['model_league'];
         $st_competition = $getModels['model_match'];
         //查询足球早盘其他球的所有赛事
         if ($game_code == 'zq'){
-            $data['today']['name'] ='今日赛事';
-            $data['today']['code'] = $game_code;
-            $data['today']['count'] = lm($st_competition,'Sports')
+            $data['all']['name'] ='今日赛事';
+            $data['all']['game_code'] = $game_code;
+            $data['all']['code'] = 'today';
+            $data['all']['count'] = lm($st_competition,'Sports')
                 ->join($st_league,$st_league.'.lg_id',$st_competition.'.lg_id')
                 ->where(getState('StToday'))
                 ->where($st_competition.'.source',$this->source['source'])
@@ -36,7 +38,8 @@ class Sports extends Controller{
                 ->count('*');
             } else {
                 $data['all']['name'] = '所有赛事';
-                $data['all']['code'] = $game_code;
+                $data['all']['game_code'] = $game_code;
+                $data['all']['code'] = 'all';
                 $data['all']['count'] = lm($st_competition,'Sports')
                     ->where([[$st_competition.'.status', '<', '2'],
                         [$st_competition.'.source',$this->source['source']]])
@@ -69,7 +72,8 @@ class Sports extends Controller{
             $data['league'] = $data['league']->toarray();
             foreach($data['league'] as $k => $v){
                 //统计当前联赛下的联赛
-                $data['league'][$k]['code'] = $game_code;
+                $data['league'][$k]['game_code'] = $game_code;
+                $data['league'][$k]['code'] = "qt";
                 $data['league'][$k]['count'] = lm($st_competition,'Sports')
                     ->where([[$st_competition.'.status','<',2],[$st_competition.'.source',$this->source]])
                     ->where('lg_id',$v['lg_id'])

+ 5 - 5
Biz/Match/GetOddsData.php

@@ -14,7 +14,7 @@ class GetOddsData {
     /**
      * 根据不同球类获取相关赔率数据
      */
-    public function getOddsData($data,$whereDate,$source){
+    public function getOddsData($data,$whereDate,$source,$oddsTypeWhere=''){
         if($data['search']){
             $search = $data['search'];
         }
@@ -55,16 +55,16 @@ class GetOddsData {
 
         switch ($data['game_code']){
             case 'zq'://获取足球默认赔率数据
-                $list = $this->getOddsZQ($matchData,$model_odds,$source);
+                $list = $this->getOddsZQ($matchData,$model_odds,$source,$oddsTypeWhere);
                 break;
             case 'lq'://获取篮球默认赔率数据
-                $list = $this->getOddsLQ($matchData,$model_odds,$source);
+                $list = $this->getOddsLQ($matchData,$model_odds,$source,$oddsTypeWhere);
                 break;
             case 'wq'://获取网球默认赔率数据
-                $list = $this->getOddsWQ($matchData,$model_odds,$source);
+                $list = $this->getOddsWQ($matchData,$model_odds,$source,$oddsTypeWhere);
                 break;
             case 'bq'://获取棒球默认赔率数据
-                $list = $this->getOddsBQ($matchData,$model_odds,$source);
+                $list = $this->getOddsBQ($matchData,$model_odds,$source,$oddsTypeWhere);
                 break;
             default:
                 throw new \Exception(Render([], '10002', lang('Tips','Sports')->get('PARAM_ERROR')));

+ 45 - 0
Biz/Money/Money.php

@@ -231,6 +231,51 @@ class Money {
 			return false;
 		}
 	}
+	/**
+	 * 反水
+	 * @param  string $account_identity 用户唯一ID
+	 * @param  string  $account 用户名
+	 * @param  string  $batch_id 批量号
+	 */
+	public function fanshui($account_identity,$account,$batch_id){
+		//查询是否可以反水
+		$account_info = lm('Account','Api')->where([['identity',$account_identity],['account',$account]])->first();
+		if(!$account_info){
+			Render('', '51030',lang('Errors','Api')->get('error-51030'));
+		}
+		$account_info->toArray();
+		if($account_info['fanshui'] == 1){
+			//查询计算当前批次号投注总金额
+			$simplex = lm("MoneyBuySimplex",'Api')->select('money')->where('batch_id',$batch_id)->get();//单式
+			$str = lm("MoneyBuyStr",'Api')->select('money')->where('batch_id',$batch_id)->get();//串式
+			$simplex_money = 0;
+			if(!empty($simplex)){
+				$simplex->toArray();
+				foreach($simplex as $k => $v){
+					$simplex_money += $v['money'];
+				}
+			}
+			$str_money = 0;
+			if(!empty($str)){
+				$str->toArray();
+				foreach($str as $k => $v){
+					$str_money += $v['money'];
+				}
+			}
+			$bet_money  = $str_money + $simplex_money;
+			if($bet_money != 0 ){
+				//执行插入金额详情与用户余额加反水
+				$order_id = OrderID(); //订单ID
+				$UUID = UUID(); //信息ID
+				$type = 7; //反水
+				$res = $this->insertMoney($account_identity, $bet_money, $order_id, $type, $game_no = '',$UUID,$account_info);
+				if($res != 1){
+					Render('', $res,lang('Errors','Api')->get('error'.$res));
+				}
+			}
+		}
+	}
+
 
 	/**
 	 * 获取描述信息