|
|
@@ -39,6 +39,7 @@ class Betorder extends BaseController{
|
|
|
unset($res[count($res)-1]);
|
|
|
foreach ($last as $k =>$v){
|
|
|
foreach ($v as $kk =>$vv){
|
|
|
+ /*
|
|
|
$num = $kk+1;
|
|
|
//验证球类代码是否有效
|
|
|
$this->verify_gameType($vv['ballId'],$num);
|
|
|
@@ -50,6 +51,7 @@ class Betorder extends BaseController{
|
|
|
//验证赛事下赔率玩法是否有效
|
|
|
$this->verify_odds($vv['ballId'],$vv['odds_only'],$vv['odds'],$vv['condition'],$vv['odds_code'],$num);
|
|
|
}
|
|
|
+ */
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -228,8 +230,11 @@ class Betorder extends BaseController{
|
|
|
$prize_money = 0; //可赢额
|
|
|
|
|
|
foreach($v as $kk => $vv){
|
|
|
- //是否是冠军投注
|
|
|
- $is_champion = $vv['is_champion'];
|
|
|
+ //是否是冠军投注,如果==0 则为冠军投注
|
|
|
+ $is_champion = 0;
|
|
|
+ if($vv['match_id'] == 0){
|
|
|
+ $is_champion = 1;
|
|
|
+ }
|
|
|
$bet_money += $vv['bet_amount'];
|
|
|
//计算每个投注玩法下的可赢金额
|
|
|
// $prize_money += $this->commonFunction->getEarnMoney($game_code,$vv['p_code'],$vv['odds'],$vv['bet_amount'],1);
|
|
|
@@ -288,225 +293,6 @@ class Betorder extends BaseController{
|
|
|
Render('', $insertMoney,lang('Errors','Api')->get('error'.$insertMoney));
|
|
|
}
|
|
|
$this->M->fanshui($userInfo['account_identity'],$userInfo['account'],$bet_money,$OrderID);//反水
|
|
|
-
|
|
|
- /*
|
|
|
- //获取投注单中冠军联赛数据
|
|
|
- $championData = [];
|
|
|
- //获取投注单中普通赛事数据
|
|
|
- $matchData = [];
|
|
|
- foreach($v as $kk=>$vv){
|
|
|
-
|
|
|
- if($vv['is_champion'] == 1){
|
|
|
- $championData[]=$vv;
|
|
|
- }
|
|
|
- else if($vv['is_champion'] ==0){
|
|
|
- $matchData[]=$vv;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //处理普通赛事数据
|
|
|
- if(!empty($matchData)){
|
|
|
- foreach($matchData as $k_match=>$v_match){
|
|
|
- $bet_money += $v_match['bet_amount'];
|
|
|
- //计算每个投注玩法下的可赢金额
|
|
|
- // $prize_money += $this->commonFunction->getEarnMoney($game_code,$vv['p_code'],$vv['odds'],$vv['bet_amount'],1);
|
|
|
- $prize_money += $v_match['odds']* $v_match['bet_amount'];
|
|
|
- //是否是滚球投注
|
|
|
- $is_rolling = 0;
|
|
|
- if($vv['oddsType']=='StRollBall'){
|
|
|
- $is_rolling = 1;
|
|
|
- }
|
|
|
- $matchData_set[] =[
|
|
|
- 'odds_id' =>$v_match['id'],
|
|
|
- 'home_team' => $v_match['home_team'],
|
|
|
- 'guest_team' => $v_match['guest_team'],
|
|
|
- 'condition' => $v_match['condition'],
|
|
|
- 'odds' => $v_match['odds'],
|
|
|
- 'odds_code' => $v_match['odds_code'],
|
|
|
- 'p_code' => $v_match['p_code'],
|
|
|
- 'odds_only' => $v_match['odds_only'],
|
|
|
- 'match_id' => $v_match['match_id'],
|
|
|
- 'game_code' => $game_code,
|
|
|
- 'lg_id' => $v_match['lg_id'],
|
|
|
- 'batch_id' => $batch_id,
|
|
|
- 'bet_type' => 1,
|
|
|
- 'bet_money' => $v_match['bet_amount'],
|
|
|
- 'ctime' => $this->time,
|
|
|
- 'utime' => $this->time,
|
|
|
- 'is_rolling' =>$is_rolling,
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- //插入数据源 赛事
|
|
|
- $moneyBuyMatch = lm('MoneyBuyMatch','Api')->insert($matchData_set);
|
|
|
- if(!$moneyBuyMatch){
|
|
|
- Render('','3205',lang('errors','Api')->get('error-3205'));
|
|
|
- }
|
|
|
-
|
|
|
- $OrderID = IDOrderID('S');
|
|
|
-
|
|
|
- //组装注单数据
|
|
|
- $order =[
|
|
|
- 'info_identity' => $UUID,
|
|
|
- 'account_name' => $userInfo['account'],
|
|
|
- 'account_identity' => $userInfo['account_identity'],
|
|
|
- 'order_id' => $OrderID,
|
|
|
- 'game_code' => $game_code,
|
|
|
- 'batch_id' => $batch_id,
|
|
|
- 'match_id' => $k,
|
|
|
- 'game_no' => "",
|
|
|
- 'prize_money'=> $prize_money,
|
|
|
- 'money' => $bet_money, //投注金额
|
|
|
- 'money_time' => $this->time,
|
|
|
- 'is_champion' => 1,//1 冠军投注 0普通赛事投注
|
|
|
- ];
|
|
|
- $insert = lm("MoneyBuySimplex",'Api')->insert($order);
|
|
|
- if(!$insert){
|
|
|
- Render('','3205',lang('errors','Api')->get('error-3205'));
|
|
|
- }
|
|
|
- //资金变动
|
|
|
- $insertMoney = $this->M->insertMoney($userInfo['account_identity'],$bet_money,$OrderID,1,"",$UUID,$userInfo);
|
|
|
-
|
|
|
- if($insertMoney!=1){
|
|
|
- Render('', $insertMoney,lang('Errors','Api')->get('error'.$insertMoney));
|
|
|
- }
|
|
|
- //反水变动
|
|
|
- $this->M->fanshui($userInfo['account_identity'],$userInfo['account'],$bet_money,$OrderID);//反水
|
|
|
- }
|
|
|
-
|
|
|
- //处理冠军投注数据
|
|
|
- if(!empty($championData)){
|
|
|
- foreach($championData as $k_champion=>$v_champion){
|
|
|
- $bet_money += $v_champion['bet_amount'];
|
|
|
- //计算每个投注玩法下的可赢金额
|
|
|
- // $prize_money += $this->commonFunction->getEarnMoney($game_code,$vv['p_code'],$vv['odds'],$vv['bet_amount'],1);
|
|
|
- $prize_money += $v_champion['odds']* $v_champion['bet_amount'];
|
|
|
- //是否是滚球投注
|
|
|
- $is_rolling = 0;
|
|
|
- if($vv['oddsType']=='StRollBall'){
|
|
|
- $is_rolling = 1;
|
|
|
- }
|
|
|
- $matchData_set[] =[
|
|
|
- 'odds_id' =>$v_champion['id'],
|
|
|
- 'home_team' => $v_champion['home_team'],
|
|
|
- 'guest_team' => $v_champion['guest_team'],
|
|
|
- 'condition' => $v_champion['condition'],
|
|
|
- 'odds' => $v_champion['odds'],
|
|
|
- 'odds_code' => $v_champion['odds_code'],
|
|
|
- 'p_code' => $v_champion['p_code'],
|
|
|
- 'odds_only' => $v_champion['odds_only'],
|
|
|
- 'match_id' => $v_champion['match_id'],
|
|
|
- 'game_code' => $game_code,
|
|
|
- 'lg_id' => $v_champion['lg_id'],
|
|
|
- 'batch_id' => $batch_id,
|
|
|
- 'bet_type' => 1,
|
|
|
- 'bet_money' => $v_champion['bet_amount'],
|
|
|
- 'ctime' => $this->time,
|
|
|
- 'utime' => $this->time,
|
|
|
- 'is_rolling' =>$is_rolling,
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- //插入数据源 赛事
|
|
|
- $moneyBuyMatch = lm('MoneyBuyMatch','Api')->insert($matchData_set);
|
|
|
- if(!$moneyBuyMatch){
|
|
|
- Render('','3205',lang('errors','Api')->get('error-3205'));
|
|
|
- }
|
|
|
-
|
|
|
- $OrderID = IDOrderID('S');
|
|
|
-
|
|
|
- //组装注单数据
|
|
|
- $order =[
|
|
|
- 'info_identity' => $UUID,
|
|
|
- 'account_name' => $userInfo['account'],
|
|
|
- 'account_identity' => $userInfo['account_identity'],
|
|
|
- 'order_id' => $OrderID,
|
|
|
- 'game_code' => $game_code,
|
|
|
- 'batch_id' => $batch_id,
|
|
|
- 'match_id' => $k,
|
|
|
- 'game_no' => "",
|
|
|
- 'prize_money'=> $prize_money,
|
|
|
- 'money' => $bet_money, //投注金额
|
|
|
- 'money_time' => $this->time,
|
|
|
- 'is_champion' => 1,//1 冠军投注 0普通赛事投注
|
|
|
- ];
|
|
|
- $insert = lm("MoneyBuySimplex",'Api')->insert($order);
|
|
|
- if(!$insert){
|
|
|
- Render('','3205',lang('errors','Api')->get('error-3205'));
|
|
|
- }
|
|
|
- //资金变动
|
|
|
- $insertMoney = $this->M->insertMoney($userInfo['account_identity'],$bet_money,$OrderID,1,"",$UUID,$userInfo);
|
|
|
-
|
|
|
- if($insertMoney!=1){
|
|
|
- Render('', $insertMoney,lang('Errors','Api')->get('error'.$insertMoney));
|
|
|
- }
|
|
|
- //反水变动
|
|
|
- $this->M->fanshui($userInfo['account_identity'],$userInfo['account'],$bet_money,$OrderID);//反水
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- dd(111);
|
|
|
- /*
|
|
|
- foreach($v as $kk => $vv){
|
|
|
- $bet_money += $vv['bet_amount'];
|
|
|
- //计算每个投注玩法下的可赢金额
|
|
|
- // $prize_money += $this->commonFunction->getEarnMoney($game_code,$vv['p_code'],$vv['odds'],$vv['bet_amount'],1);
|
|
|
- $prize_money += $vv['odds']* $vv['bet_amount'];
|
|
|
- //是否是滚球投注
|
|
|
- $is_rolling = 0;
|
|
|
- if($vv['oddsType']=='StRollBall'){
|
|
|
- $is_rolling = 1;
|
|
|
- }
|
|
|
- $matchData =[
|
|
|
- 'odds_id' =>$vv['id'],
|
|
|
- 'home_team' => $vv['home_team'],
|
|
|
- 'guest_team' => $vv['guest_team'],
|
|
|
- 'condition' => $vv['condition'],
|
|
|
- 'odds' => $vv['odds'],
|
|
|
- 'odds_code' => $vv['odds_code'],
|
|
|
- 'p_code' => $vv['p_code'],
|
|
|
- 'odds_only' => $vv['odds_only'],
|
|
|
- 'match_id' => $vv['match_id'],
|
|
|
- 'game_code' => $game_code,
|
|
|
- 'lg_id' => $vv['lg_id'],
|
|
|
- 'batch_id' => $batch_id,
|
|
|
- 'bet_type' => 1,
|
|
|
- 'bet_money' => $vv['bet_amount'],
|
|
|
- 'ctime' => $this->time,
|
|
|
- 'utime' => $this->time,
|
|
|
- 'is_rolling' =>$is_rolling,
|
|
|
- ];
|
|
|
- //插入数据源
|
|
|
- $moneyBuyMatch = lm('MoneyBuyMatch','Api')->insert($matchData);
|
|
|
- if(!$moneyBuyMatch){
|
|
|
- Render('','3205',lang('errors','Api')->get('error-3205'));
|
|
|
- }
|
|
|
- }
|
|
|
- $order =[
|
|
|
- 'info_identity' => $UUID,
|
|
|
- 'account_name' => $userInfo['account'],
|
|
|
- 'account_identity' => $userInfo['account_identity'],
|
|
|
- 'order_id' => OrderID('S'),//$OrderID,
|
|
|
- 'game_code' => $game_code,
|
|
|
- 'batch_id' => $batch_id,
|
|
|
- 'match_id' => $k,
|
|
|
- 'game_no' => "",
|
|
|
- 'prize_money'=> $prize_money,
|
|
|
- 'money' => $bet_money, //投注金额
|
|
|
- 'money_time' => $this->time
|
|
|
- ];
|
|
|
- $insert = lm("MoneyBuySimplex",'Api')->insert($order);
|
|
|
- if(!$insert){
|
|
|
- Render('','3205',lang('errors','Api')->get('error-3205'));
|
|
|
- }
|
|
|
- $insertMoney = $this->M->insertMoney($userInfo['account_identity'],$bet_money,$OrderID,1,"",$UUID,$userInfo);
|
|
|
-
|
|
|
- if($insertMoney!=1){
|
|
|
- Render('', $insertMoney,lang('Errors','Api')->get('error'.$insertMoney));
|
|
|
- }
|
|
|
- $this->M->fanshui($userInfo['account_identity'],$userInfo['account'],$bet_money,$OrderID);//反水
|
|
|
- */
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -544,7 +330,7 @@ class Betorder extends BaseController{
|
|
|
'lg_id'=>29,
|
|
|
'repeat'=>'false',
|
|
|
'match_type'=>'StRollBall',//滚球投注
|
|
|
- 'is_champion'=>1,//是否是冠军联赛
|
|
|
+ // 'is_champion'=>1,//是否是冠军联赛
|
|
|
],
|
|
|
[
|
|
|
'id'=>2260632,
|
|
|
@@ -569,13 +355,15 @@ class Betorder extends BaseController{
|
|
|
]
|
|
|
],
|
|
|
|
|
|
- 'token'=>'zoUGmH15681966585d78c832ac4a4',
|
|
|
+ 'token'=>'ppWGRW15682541865d79a8eacb0b1',
|
|
|
'bet_money'=>900,
|
|
|
'bet_money_arr'=>[100,200,300],
|
|
|
|
|
|
];
|
|
|
+
|
|
|
*/
|
|
|
- /* 模拟串式数据
|
|
|
+ /*
|
|
|
+ // 模拟串式数据
|
|
|
$get_data = [
|
|
|
'data'=>[
|
|
|
[
|
|
|
@@ -594,7 +382,7 @@ class Betorder extends BaseController{
|
|
|
'guest_team'=>'圣奥尔本斯U20',
|
|
|
'name'=>'圣奥尔本斯U20',
|
|
|
'odds'=>1.01,
|
|
|
- 'match_id'=>1273,
|
|
|
+ 'match_id'=>0,
|
|
|
'condition'=>'4/4.5',
|
|
|
'ballId'=>'zq',
|
|
|
'odds_code'=>'goal_size_big',
|
|
|
@@ -648,7 +436,7 @@ class Betorder extends BaseController{
|
|
|
]
|
|
|
],
|
|
|
|
|
|
- 'token'=>'Zowv7715649767885d47a6945b98f',
|
|
|
+ 'token'=>'ppWGRW15682541865d79a8eacb0b1',
|
|
|
'bet_money'=>2
|
|
|
|
|
|
];
|
|
|
@@ -687,7 +475,7 @@ class Betorder extends BaseController{
|
|
|
}
|
|
|
|
|
|
//追加验证用户投注金额限额
|
|
|
- // $this->bet_money_limit($data,$userInfo);
|
|
|
+ $this->bet_money_limit($data,$userInfo);
|
|
|
|
|
|
//获取订单批次号
|
|
|
$batch_id = OrderID();///strtotime(date('Y-m-d H:i:s',time())).mt_rand('1','99');//批量ID
|
|
|
@@ -1044,7 +832,7 @@ class Betorder extends BaseController{
|
|
|
public function verify_stringType($data=[]){
|
|
|
if($data){
|
|
|
foreach($data as $k=>$v){
|
|
|
- if($v['match_id']==$v['match_id']){
|
|
|
+ if($v['match_id']==$v['match_id'] ){
|
|
|
$r[$v['match_id']][] = $v;
|
|
|
}
|
|
|
}
|
|
|
@@ -1054,6 +842,9 @@ class Betorder extends BaseController{
|
|
|
if(count($v) > 1){
|
|
|
$msg = lang('Errors','Api')->get('error-50038');
|
|
|
Render([], '50038',$msg);
|
|
|
+ }else if( $k == 0){
|
|
|
+ $msg = lang('Errors','Api')->get('error-50043');
|
|
|
+ Render([], '50043',$msg);
|
|
|
}
|
|
|
}
|
|
|
}
|