优先扣除绑币 平台币 微信支付限额3000

master
tpingzhang 5 years ago
parent 098860c384
commit dbbfc165c0

@ -18,8 +18,11 @@ class BaseController extends RestController{
&&!preg_match("/wap_shortcut_pay/",GetCurUrl())
&&!preg_match("/shortcut_pay/",GetCurUrl())
&&!preg_match("/android_shortcut_pay/",GetCurUrl())
&&!preg_match("/alipay_pay/",GetCurUrl())
&&!preg_match("/wap_shortcut_pay/",GetCurUrl())
&&!preg_match("/apple_weixin_pay/",GetCurUrl())
&&!preg_match("/Ipa365/",GetCurUrl())
&&!preg_match("/user_login/",GetCurUrl())
&&!preg_match("/platform_coin_deduction/",GetCurUrl())
){
$data = json_decode(base64_decode(file_get_contents("php://input")),true);
@ -614,6 +617,7 @@ class BaseController extends RestController{
*/
public function set_ratio($data,$type = 1){
$map['pay_order_number']=$data;
$map['pay_way'] = ($type==2) ? -1 : 0; // 判断支付类型
$spend=M("Spend","tab_")->where($map)->find();
$reb_map['game_id']=$spend['game_id'];
$time = time();
@ -676,4 +680,39 @@ class BaseController extends RestController{
$add['create_time']=time();
return $add;
}
/**
* 优先扣除绑币 和平台 处理
* $request $discountAmount 折扣价格
*/
public function other_price(&$request, $discountAmount=0) {
// 优先扣除绑定币平台币
if ($request['code'] == '0') return $request; // 平台币充值 不做判断
$deductionAmount = 0;
$user_id = $request['user_id'];
$game_id = $request['game_id'];
$balance = M ('user', 'tab_')->where (array(
'id' => $user_id
))->getField('balance');
$bind_balance = M('user_play', 'tab_')->where(array(
'user_id' => $user_id,
'game_id' => $game_id
))->getField('bind_balance');
// 够抵扣的情况 不走这个接口
$deductionAmount = $bind_balance + $balance;
if ($deductionAmount > $request['price']) {
if ($request['sdk_version'] == 1)
$this->set_message(1089,"fail",$deductionAmount."平台币足够,请关闭支付页面重新支付".$pay_amount);
else {
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>"平台币足够,请关闭支付页面重新支付")));exit;
}
}
// 实际支付金额 = 支付总金额 - 折扣抵扣价格 - 绑币和平台币抵扣金额
$request['actual_amount'] = round($request['price'] - $discountAmount - $deductionAmount, 2).'';
$request['discount_amount'] = round($discountAmount, 2).'';
$request['deduction_amount'] = round($deductionAmount, 2).'';
$request['price'] = round($request['actual_amount'], 2).'';
return $request;
//$this->set_message(1089,"fail",$request['price']."新支付".$pay_amount);
}
}

@ -1717,6 +1717,7 @@ class UserController extends BaseController
} else if (pay_set_status('wei_xin_app') == 0 && pay_set_status('weixin') == 0 && pay_set_status('jft_wap') == 0) {
$wx_game = 0;
}
if ($request['price'] > C('WX_PAY_LIMIT')) $wx_game = 0;
if (pay_set_status('alipay') == 1 || (pay_set_status('goldpig') == 1 && C('goldpig.zfb'))
|| (pay_set_status('sqpay') == 1 && C('sqpay.zfb'))
) {

Loading…
Cancel
Save