|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|