diff --git a/Application/Sdk/Controller/SpendController.class.php b/Application/Sdk/Controller/SpendController.class.php index 29714688..eaa07174 100644 --- a/Application/Sdk/Controller/SpendController.class.php +++ b/Application/Sdk/Controller/SpendController.class.php @@ -537,25 +537,33 @@ ADD COLUMN `pay_url` varchar(255) NOT NULL DEFAULT '' AFTER `check_sign`; } public function addPayChannelIntention() { - $user_token = I('user_token'); - $pay_way = I('payway'); + $user_token = I('request.user_token'); + $pay_way = I('request.payway'); + $game_id = I('request.game_id'); + $user_id = I('request.user_id'); if (!$user_token) { echo "access deny!"; die(); } - $user_info = M('user_token','tab_')->field('user_id,game_id')->where(['user_token'=>$user_token])->find(); - if (!$user_info) { - echo json_encode(['code'=>0,'msg'=>'用户信息不存在']); +// var_dump($game_id);die(); + if (!$game_id) { + echo json_encode(['code'=>0,'msg'=>'参数错误']); + exit; + } + + if(!$user_id) { + echo json_encode(['code'=>0,'msg'=>'参数错误']); exit; } $pay_info = M('pay_info', 'tab_')->where([ - 'user_id' => $user_info['user_id'], - 'game_id' => $user_info['game_id'] + 'user_id' => $user_id, + 'game_id' => $game_id ])->order("id desc")->find(); +// var_dump($pay_info);die(); if (!$pay_info['order_id']) { echo json_encode(['code'=>0,'msg'=>'error']); @@ -582,9 +590,23 @@ ADD COLUMN `pay_url` varchar(255) NOT NULL DEFAULT '' AFTER `check_sign`; echo json_encode(['code'=>200,'msg'=>'']); exit; } + + $intentionLog = $payChannelIntention->where(array( + 'pay_order_number' => $pay_info['order_id'] + ))->count(); + + + $pay_intention_num = M('pay_intention_num','tab_')->field('num')->where(['pay_order_number' => $pay_info['order_id']])->find(); + + if ($pay_intention_num&&$pay_intention_num['num']>9) { + // 超过十条不做记录 + echo json_encode(['code'=>200,'msg'=>'']); + exit; + } + // $user_info = M('user','tab_')->field('account')->where(['id'=>$user_id])->find(); - $insert['user_id'] = $user_info['user_id']; + $insert['user_id'] = $user_id; $insert['user_account'] = $pay_info['user_account']; $insert['pay_way'] = $pay_way; $insert['pay_amount'] = $pay_info['price']; @@ -594,6 +616,13 @@ ADD COLUMN `pay_url` varchar(255) NOT NULL DEFAULT '' AFTER `check_sign`; $is_success = M('pay_channel_intention','tab_')->add($insert); if ($is_success) { + + if (!$pay_intention_num) { + M('pay_intention_num','tab_')->add(['num'=>1,'pay_order_number'=>$pay_info['order_id']]); + } else { + M('pay_intention_num','tab_')->where(['pay_order_number' => $pay_info['order_id']])->setInc('num'); + } + echo json_encode(['code'=>200,'msg'=>"success"]); die(); } else { diff --git a/Application/Sdk/View/default/Spend/pay_way.html b/Application/Sdk/View/default/Spend/pay_way.html index 40d5748e..33dd32ca 100644 --- a/Application/Sdk/View/default/Spend/pay_way.html +++ b/Application/Sdk/View/default/Spend/pay_way.html @@ -122,6 +122,8 @@ + +