支付意愿限制,及意愿插入bug修改

master
zhengyongxing 5 years ago
parent b5fab80b3b
commit e2c0f9d46e

@ -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 {

@ -122,6 +122,8 @@
</div>
</div>
<input style="display: none" id="user_token" value="{$_REQUEST['user_token']}">
<input style="display: none" id="user_id" value="{$_REQUEST['user_id']}">
<input style="display: none" id="game_id" value="{$_REQUEST['game_id']}">
<!-- 横屏 -->
<div class="payment_heng">
<!-- <div class="heard">
@ -276,10 +278,14 @@
function payChannelIntentionInit(user_token) {
var game_id = $('#game_id').val();
var user_id = $('#user_id').val();
$.ajax({
type:'post',
dataType:'json',
data:{user_token:user_token,payway:payway},
data:{user_token:user_token,payway:payway,game_id:game_id,user_id:user_id},
url:'/sdk.php/Spend/addPayChannelIntention',
success:function(result) {
if(result.code==0) {

@ -116,6 +116,8 @@
</div>
</div>
<input style="display: none" id="user_token" value="{$_REQUEST['user_token']}">
<input style="display: none" id="user_id" value="{$_REQUEST['user_id']}">
<input style="display: none" id="game_id" value="{$_REQUEST['game_id']}">
<!-- 横屏 -->
<div class="payment_heng">
<!-- <div class="heard">
@ -241,10 +243,13 @@
function payChannelIntentionInit(user_token) {
var game_id = $('#game_id').val();
var user_id = $('#user_id').val();
$.ajax({
type:'post',
dataType:'json',
data:{user_token:user_token,payway:payway},
data:{user_token:user_token,payway:payway,game_id:game_id,user_id:user_id},
url:'/sdk.php/Spend/addPayChannelIntention',
success:function(result) {
if(result.code==0) {

Loading…
Cancel
Save