You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

730 lines
28 KiB
PHP

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace Sdk\Controller;
use Think\Controller\RestController;
use Org\XiguSDK\Xigu;
class BaseController extends RestController{
protected function _initialize(){
C(api('Config/lists'));
if(
!preg_match("/apple_alipay_pay/",GetCurUrl())
&&!preg_match("/apple_weixin_pay/",GetCurUrl())
&&!preg_match("/get_alipay_zmxy_return/",GetCurUrl())
&&!preg_match("/apple_platform_pay/",GetCurUrl())
&&!preg_match("/notice/",GetCurUrl())
&&!preg_match("/apple_union_pay/",GetCurUrl())
&&!preg_match("/test/",GetCurUrl())
&&!preg_match("/wap_shortcut_pay/",GetCurUrl())
&&!preg_match("/shortcut_pay/",GetCurUrl())
&&!preg_match("/android_shortcut_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);
// #判断数据是否为空
if(empty($data) || empty($data['game_id'])){
echo base64_encode(json_encode(array("status"=>10,"return_msg"=>"操作数据或游戏ID不能为空")));exit();
}
$md5Sign = $data['md5_sign'];
unset($data['md5_sign']);
#获取游戏key
$game_data = M("game","tab_")->alias("g")->field("s.*")
->where(['g.apply_status'=>1,'g.id'=>$data['game_id']])
->join("left join tab_game_set s on s.game_id = g.id")
->find();
if(empty($game_data)){
$this->set_message(0,"fail","游戏不存在或未通过审核");
}
if (isset($data['openid'])) // 小程序支付增加参数
unset($data['openid']);
$md5_sign = $this->encrypt_md5($data,$game_data["access_key"]);//mengchuang DZQkkiz!@#9527
if($md5Sign !== $md5_sign){
$this->set_message(0,"fail","验签失败");
}
}
}
/**
*设置接口提示信息
*@param int $status 提示状态
*@param string $return_code 提示代码
*@param string $return_msg 提示信息
*@return string base64加密后的json格式字符串
*@author 小纯洁
*/
public function set_message($status=0,$return_code="fail",$return_msg="操作失败"){
$msg = array(
"status" => $status,
"return_code" => $return_code,
"return_msg" => $return_msg
);
echo base64_encode(json_encode($msg));
exit();
}
/**
* 返回输出
* @param int $status 状态
* @param string $return_msg 错误信息
* @param array $data 返回数据
* author: xmy 280564871@qq.com
*/
public function new_set_message($status, $return_msg = 0, $data = [],$type=0)
{
if ($status == 1){
$status = 200;
}
$msg = array(
"code" => $status,
"msg" => $return_msg,
"data" => $data
);
if ($type == 1){
echo base64_encode(json_encode($msg,JSON_FORCE_OBJECT));
}elseif($type == 2){
echo base64_encode(json_encode($msg,true));
}else{
echo base64_encode(json_encode($msg));
}
exit;
}
/**
*设置登录提示信息
*@param int $status 提示状态
*@param string $return_code 提示代码
*@param string $return_msg 提示信息
*@return string base64加密后的json格式字符串
*@author 小纯洁
*/
public function set_login_msg($uid,$token,$is_uc=0){
if($is_uc){
$res_msg = array(
"status" => 200,
"return_code" => "success",
"return_msg" => "登录成功",
"user_id" => $uid,
"token" => $token,
'is_uc'=>1,
);
}else{
$res_msg = array(
"status" => 200,
"return_code" => "success",
"return_msg" => "登录成功",
"user_id" => $uid,
"token" => $token,
);
}
//wite_text(json_encode($res_msg).'\n',dirname(__FILE__)."/res.txt");
echo base64_encode(json_encode($res_msg));
}
/**
*设置登录提示信息
*@param int $status 提示状态
*@param string $return_code 提示代码
*@param string $return_msg 提示信息
*@return string base64加密后的json格式字符串
*@author 小纯洁
*/
public function set_tr_login_msg($uid,$account,$token){
$res_msg = array(
"status" => 200,
"return_code" => "success",
"return_msg" => "登录成功",
"user_id" => $uid,
"account" =>$account,
"token" => $token,
);
echo base64_encode(json_encode($res_msg));
}
/**
*验证签名
*/
public function validation_sign($encrypt="",$md5_sign=""){
$signString = $this->arrSort($encrypt);
$md5Str = $this->encrypt_md5($signString,$key="");
if($md5Str === $md5_sign){
return true;
}
else{
return false;
}
}
/**
*对数据进行排序
*/
private function arrSort($para){
ksort($para);
reset($para);
return $para;
}
/**
*MD5验签加密
*/
public function encrypt_md5($param="",$key=""){
#对数组进行排序拼接
if(is_array($param)){
$md5Str = implode($this->arrSort($param));
}
else{
$md5Str = $param;
}
$md5 = md5($md5Str . $key);
return '' === $param ? 'false' : $md5;
}
public function sms_send($phone) {
$result = R('Common/Sms/send_sms_code',array($phone,10,false));
if($result['code']==200) {
$this->new_set_message(200,"验证码发送成功");
} else {
$this->new_set_message($result['code'], $result['msg']);
}
}
/**
* @函数或方法说明
* @发送拉黑短信提示
* @param $phone
* @param $user_account
*
* @author: 郭家屯
* @since: 2019/5/6 11:53
*/
public function send_block($phone,$user_account){
$result = R('Common/Sms/send_sms_block',array($phone,$user_account));
}
/**
*短信验证
*/
public function sms_verify($phone="" ,$code="",$type=2){
$result = R('Common/Sms/verify_sms_code',array($phone,$code,false));
if($result['code']==200) {
if($type==1){
$this->set_message(200,"success","正确");
}else{
return true;
}
} else {
switch ($result['code']) {
case 1021:{
$this->set_message(1010,"fail","验证码已失效,请重新获取");
};break;
case 1022:{
$this->set_message(1022,"fail","验证码不正确,请重新输入");
};break;
default:
$this->set_message($result['code'],"fail",$result['msg']);
}
}
}
/** *短信验证 */
public function sms_verify2($phone="" ,$code="",$type=2){
$result = R('Common/Sms/verify_sms_code',array($phone,$code,false));
if($result['code']==200) {
if($type==1) {
$this->new_set_message(200,"正确");
} else {
return true;
}
} else {
switch ($result['code']) {
case 1021:{
$this->set_message(1010,"fail","验证码已失效,请重新获取");
};break;
case 1022:{
$this->set_message(1022,"fail","验证码不正确,请重新输入");
};break;
default:
$this->set_message($result['code'],"fail",$result['msg']);
}
}
}
/**
* @函数或方法说明
* @检查平台币金额
* @param $user_id
*
* @author: 郭家屯
* @since: 2019/5/6 11:21
*/
public function check_deposit_money($user_entity=[]){
//充值平台币金额
$brush_map['user_id'] = $user_entity['id'];
$brush_map['pay_status'] = 1;
$brush_map['create_time'] = ['egt',$user_entity['check_time']];
$deposit_order = M('deposit','tab_')->where($brush_map)->field('id,order_number,user_id,pay_amount,check_sign,create_time')->select();
$deposit_amount = 0;
foreach ($deposit_order as $key=>$v){
$sign = get_check_sign($v['user_id'],$v['order_number'],$v['pay_amount'],$v['create_time']);
if($sign != $v['check_sign']){
return false;
}
$deposit_amount += $v['pay_amount'];
}
//发放平台币金额
$batch_map['user_id'] = $user_entity['id'];
$batch_map['status'] = 1;
$batch_map['create_time'] = ['egt',$user_entity['check_time']];
$batch_amount = M('provide_user','tab_')->where($batch_map)->sum('amount');
//积分兑换平台币
$point_map['user_id'] = $user_entity['id'];
$point_map['good_type'] = 3;
$point_map['create_time'] = ['egt',$user_entity['check_time']];
$point_ptb = M('point_shop_record','tab_')->where($point_map)->sum('number');
$point_ptb = $point_ptb ? $point_ptb : 0;
//分享获取平台币
$share_map['invite_id'] = $user_entity['id'];
$share_map['create_time'] = ['egt',$user_entity['check_time']];
$share_amount = M('share_record','tab_')->where($share_map)->sum('award_coin');
//消费平台币金额
$spend_map['user_id'] = $user_entity['id'];
$spend_map['pay_status'] = 1;
$spend_map['pay_way'] = 0;
$spend_map['pay_time'] = ['egt',$user_entity['check_time']];
$spend_amount = M('spend','tab_')->where($spend_map)->sum('pay_amount');
$check_money = floatval($user_entity['balance'])-floatval($share_amount)-floatval($point_ptb)-floatval($deposit_amount)-floatval($batch_amount)+floatval($spend_amount)-floatval($user_entity['check_money']);
return round((float)$check_money,2);
}
/**
* @函数或方法说明
* @检查绑币余额
* @param array $user_entity
*
* @author: 郭家屯
* @since: 2019/5/6 11:52
*/
public function check_bind_money($user_entity=[]){
//充值绑币金额
$brush_map['user_id'] = $user_entity['id'];
$brush_map['pay_status'] = 1;
$brush_map['create_time'] = ['egt',$user_entity['check_time']];
$bind_recharge_order = M('bind_recharge','tab_')->where($brush_map)->field('id,amount,order_number,user_id,real_amount,check_sign,create_time')->select();
$bind_recharge_amount = 0;
foreach ($bind_recharge_order as $key=>$v){
$sign = get_check_sign($v['user_id'],$v['order_number'],$v['amount'],$v['create_time']);
if($sign != $v['check_sign']){
return false;
}
$bind_recharge_amount += $v['real_amount'];
}
//发放绑币金额
$batch_map['user_id'] = $user_entity['id'];
$batch_map['status'] = 1;
$batch_map['create_time'] = ['egt',$user_entity['check_time']];
$batch_amount = M('provide','tab_')->where($batch_map)->sum('amount');
//消费返利
$rebate_map['user_id'] = $user_entity['id'];
$rebate_map['create_time'] = ['egt',$user_entity['check_time']];
$rebate_money = M("rebate_list","tab_")->where($rebate_map)->sum('ratio_amount');
//会长代充
$agent_map['user_id'] = $user_entity['id'];
$agent_map['pay_status'] = 1;
$agent_map['create_time'] = ['egt',$user_entity['check_time']];
$agent_amount = M('agent','tab_')->where($agent_map)->sum('amount');
//消费平台币金额
$spend_map['user_id'] = $user_entity['id'];
$spend_map['pay_status'] = 1;
$spend_map['pay_way'] = -1;
$spend_map['pay_time'] = ['egt',$user_entity['check_time']];
$spend_amount = M('spend','tab_')->where($spend_map)->sum('pay_amount');
//检查绑币金额
$check_map['user_id'] = $user_entity['id'];
$check_money = M('user_play','tab_')->where($check_map)->sum('check_money');
$sum_money = M('user_play','tab_')->where($check_map)->sum('bind_balance');
$check_money = floatval($sum_money)+floatval($spend_amount)-floatval($rebate_money)-floatval($bind_recharge_amount)-floatval($batch_amount)-floatval($agent_amount)-floatval($check_money);
return round((float)$check_money,2);
}
/**
*消费记录表 参数
*/
private function spend_param($param=array()){
$user_entity = get_user_entity($param['user_id']);
$data_spned['user_id'] = $param["user_id"];
$data_spned['user_account'] = $user_entity["account"];
$data_spned['user_nickname'] = $user_entity["nickname"];
$data_spned['game_id'] = $param["game_id"];
$data_spned['game_appid'] = $param["game_appid"];
$data_spned['game_name'] = get_game_name($param["game_id"]);
$data_spned['selle_ratio'] = get_game_selle_ratio($param["game_id"]);
$data_spned['server_id'] = $param["server_id"];
$data_spned['server_name'] = $param["server_name"];
$data_spned['game_player_id'] = $param["game_player_id"];
$data_spned['game_player_name'] = $param["game_player_name"];
$data_spned['promote_id'] = $user_entity["promote_id"];
$data_spned['promote_account'] = $user_entity["promote_account"];
$data_spned['order_number'] = $param["order_number"];
$data_spned['pay_order_number'] = $param["pay_order_number"];
$data_spned['props_name'] = $param["title"];
$data_spned['cost'] = $param["price"];//原价
$data_spned['deduction_amount'] = $param["deduction_amount"];// 抵扣价格
$data_spned['discount_amount'] = $param["discount_amount"];// 折扣价格
$data_spned['pay_time'] = NOW_TIME;
$data_spned['pay_status'] = $param["pay_status"];
$data_spned['pay_game_status'] = 0;
$data_spned['extend'] = $param['extend'];
$data_spned['pay_way'] = $param["pay_way"];
if($data_spned['pay_way'] != 7){
$discount = $this->get_discount($param['game_id'],$user_entity['promote_id'],$param['user_id']);
$data_spned['pay_amount'] = $param["price"] * $discount['discount']/10;//实付金额
$data_spned['discount_type'] = $discount['discount_type'];
}else{//苹果支付不计入折扣
$data_spned['pay_amount'] = $param["price"];
$data_spned['discount_type'] = 0;
}
if (isset($param['actual_amount']) && $param['actual_amount'])
$data_spned['pay_amount'] = $param['actual_amount']; // 实际支付价格
$data_spned['spend_ip'] = $param["spend_ip"];
$data_spned['sdk_version'] = $param["sdk_version"];
if($param['small_user_id'] != $param['user_id']) {
$data_spned['small_id'] = $param["small_user_id"];
$data_spned['small_account'] = get_user_account_by_id($param['small_user_id']);
}
return $data_spned;
}
/**
*平台币充值记录表 参数
*/
private function deposit_param($param=array()){
$user_entity = get_user_entity($param['user_id']);
$data_deposit['order_number'] = $param["order_number"];
$data_deposit['pay_order_number'] = $param["pay_order_number"];
$data_deposit['user_id'] = $param["user_id"];
$data_deposit['user_account'] = $user_entity["account"];
$data_deposit['user_nickname'] = $user_entity["nickname"];
$data_deposit['promote_id'] = $user_entity["promote_id"];
$data_deposit['promote_account'] = $user_entity["promote_account"];
$data_deposit['pay_amount'] = $param["price"];
$data_deposit['cost'] = $param["price"];
$data_deposit['reality_amount'] = $param["price"];
$data_deposit['pay_status'] = $param["pay_status"];
$data_deposit['pay_source'] = 2;
$data_deposit['pay_way'] = $param["pay_way"];
$data_deposit['pay_ip'] = $param["spend_ip"];
$data_deposit['sdk_version'] = $param["sdk_version"];
$data_deposit['create_time'] = NOW_TIME;
return $data_deposit;
}
/**
*绑定平台币消费
*/
private function bind_spend_param($param = array()){
$user_entity = get_user_entity($param['user_id']);
$data_bind_spned['user_id'] = $param["user_id"];
$data_bind_spned['user_account'] = $user_entity["account"];
$data_bind_spned['user_nickname'] = $user_entity["nickname"];
$data_bind_spned['game_id'] = $param["game_id"];
$data_bind_spned['game_appid'] = $param["game_appid"];
$data_bind_spned['game_name'] = get_game_name($param["game_id"]);
$data_bind_spned['server_id'] = 0;
$data_bind_spned['server_name'] = $param["server_name"];
$data_bind_spned['game_player_name'] = $param["game_player_name"];
$data_bind_spned['promote_id'] = $user_entity["promote_id"];
$data_bind_spned['promote_account'] = $user_entity["promote_account"];
$data_bind_spned['order_number'] = $param["order_number"];
$data_bind_spned['pay_order_number'] = $param["pay_order_number"];
$data_bind_spned['props_name'] = $param["title"];
$data_bind_spned['cost'] = $param["price"];//原价
$data_bind_spned['pay_amount'] = $param["price"];
$data_bind_spned['pay_time'] = NOW_TIME;
$data_bind_spned['pay_status'] = $param["pay_status"];
$data_bind_spned['pay_game_status'] = 0;
$data_bind_spned['pay_way'] = 1;
$data_bind_spned['extend'] = $param['extend'];
$data_bind_spned['spend_ip'] = $param["spend_ip"];
$data_bind_spned['sdk_version'] = $param["sdk_version"];
return $data_bind_spned;
}
//用户登录记录
public function user_login_record($data,$type,$game_id,$game_name,$sdk_version){
$data=array(
'user_id'=>$data['id'],
'user_account'=>$data['account'],
'user_nickname'=>$data['nickname'],
'game_id'=>$game_id,
'game_name'=>$game_name,
'server_id'=>null,
'type'=>$type,
'server_name'=>null,
'login_time'=>NOW_TIME,
'login_ip'=>get_client_ip(),
'sdk_version'=>$sdk_version,
);
$uid =M('user_login_record','tab_')->add($data);
return $uid ? $uid : 0; //0-未知错误大于0登录记录成功
}
//判断game_id是否有值
public function updateLogin_($uid,$account,$user_fgame_id,$game_id,$game_name){
$model = M('User','tab_');
$data["id"] = $uid;
$data["login_time"] = NOW_TIME;
$data["login_ip"] = get_client_ip();
if($user_fgame_id){
$model->save($data);
}else{
$data['fgame_id']=$game_id;
$data['fgame_name']=$game_name;
$model->save($data);
}
}
/**
*消费表添加数据
*/
public function add_spend($data,$type=0){
$spend = M("spend","tab_");
$spend_data = $this->spend_param($data);
$ordercheck = $spend->where(array('pay_order_number'=>$spend_data["pay_order_number"]))->find();
if($ordercheck)
{
if($type==1){
redirect(U('Spend/notice',array('user_id'=>$ordercheck['user_id'],'game_id'=>$ordercheck['game_id'],'msg'=>'订单已经存在,请刷新充值页面重新下单!')));exit;
}else{
$this->set_message(0,'fail',"订单已经存在,请刷新充值页面重新下单!");
}
}
// if(!is_check_apply_promote($spend_data['game_id'],$spend_data['promote_id'])){
// $spend_data['promote_id']=0;
// $spend_data['promote_account']="自然注册";
// }
$result = $spend->add($spend_data);
return $result;
}
/*
*平台币充值记录
*/
public function add_deposit($data, $type=0){
$deposit = M("deposit","tab_");
$deposit_data = $this->deposit_param($data);
$ordercheck = $deposit->where(array('pay_order_number'=>$deposit_data["pay_order_number"]))->find();
if($ordercheck) {
if ($type) {
redirect(U('Spend/notice',array('user_id'=>$ordercheck['user_id'],'game_id'=>$ordercheck['game_id'],'msg'=>'订单已经存在,请刷新充值页面重新下单!')));
exit;
} else {
$this->set_message(0,'fail',"订单已经存在,请刷新充值页面重新下单!");
}
}
// if(!is_check_apply_promote($deposit_data['game_id'],$deposit_data['promote_id'])){
// $deposit_data['promote_id']=0;
// $deposit_data['promote_account']="自然注册";
// }
$result = $deposit->add($deposit_data);
return $result;
}
/*
*绑定平台币消费记录
*/
public function add_bind_spned($data){
$bind_spned = M("BindSpend","tab_");
$data_bind_spned = $this->bind_spend_param($data);
$ordercheck = $bind_spned->where(array('pay_order_number'=>$data_bind_spned["pay_order_number"]))->find();
if($ordercheck)$this->set_message(0,'fail',"订单已经存在,请刷新充值页面重新下单!");
// if(!is_check_apply_promote($data_bind_spned['game_id'],$data_bind_spned['promote_id'])){
// $data_bind_spned['promote_id']=0;
// $data_bind_spned['promote_account']="自然注册";
// }
$result = $bind_spned->add($data_bind_spned);
return $result;
}
/**
*设置数据里游戏的图片
*/
public function set_game_icon($game_id=0){
$game = M("Game","tab_")->field('icon')->find($game_id);
$icon_url ="http://".$_SERVER['HTTP_HOST'].get_cover($game['icon'],"path");
return $icon_url;
}
/**
* 获取用户折扣
* @param $game_id 游戏ID
* @param $promote_id 渠道ID
* @param $user_id 用户ID
* @return mixed
*/
protected function get_discount($game_id,$promote_id,$user_id){
//获取折扣
$map['game_id'] = $game_id;
$map['promote_id'] =-1;
$map['status'] = 2;
$discount = M('Promote_welfare','tab_')->where($map)->find();
if(null==$discount){
$map['game_id'] = $game_id;
$map['promote_id'] = $promote_id == 0 ? 0 : -2;
$map['status'] = 2;
$discount = M('Promote_welfare','tab_')->where($map)->find();
}
$discount = discount_data($discount);
if(empty($discount)){
$res['discount'] = 10;
$res['discount_type'] = 0;//无折扣
return $res;
}
//判断用户是否为首冲
$where['game_id'] = $game_id;
$where['user_id'] = $user_id;
$where['pay_status'] = 1;
$data = M('bind_spend','tab_')->where($where)->find();
if(!empty($data) || !empty(M('spend','tab_')->where($where)->find())){
$res['discount'] = $discount['continue_discount'];//续冲
$res['discount_type'] = 2;
}else{
$res['discount'] = $discount['first_discount'];//首冲
$res['discount_type'] = 1;
}
return $res;
}
/**
*游戏返利
*$type 类型 1 非绑定平台币 2绑定平台币
*/
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();
$reb_map['starttime'] = ['lt',$time];
$reb_map_str = "endtime > {$time} or endtime = 0";
switch ($spend['promote_id']) {
case 0:
$reb_map['promote_id'] = array('in','0,-1');
break;
default:
$reb_map['promote_id'] = array('in','1,-1');
break;
}
//如果是绑币则判断是否开启绑币返利
if($type == 2){$reb_map['bind_status'] = 1;}
$rebate=M("Rebate","tab_")->where($reb_map)->where($reb_map_str)->find();//
if (!empty($rebate)) {
if($rebate['money']>0 && $rebate['status']==1){
if($spend['pay_amount']>=$rebate['money']){
$this->compute($spend,$rebate);
}else{
return false;
}
}else{
$this->compute($spend,$rebate);
}
}else{
return false;
}
}
//计算返利
public function compute($spend,$rebate){
$user_map['user_id']=$spend['user_id'];
$user_map['game_id']=$spend['game_id'];
$bind_balance=$spend['pay_amount']*($rebate['ratio']/100);
$spend['ratio']=$rebate['ratio'];
$spend['ratio_amount']=$bind_balance;
M("rebate_list","tab_")->add($this->add_rebate_list($spend));
$re=M("UserPlay","tab_")->where($user_map)->setInc("bind_balance",$bind_balance);
return $re;
}
/**
*返利记录
*/
protected function add_rebate_list($data){
$add['pay_order_number']=$data['pay_order_number'];
$add['game_id']=$data['game_id'];
$add['game_name']=$data['game_name'];
$add['user_id']=$data['user_id'];
$add['user_name']=$data['user_account'];
$add['pay_amount']=$data['pay_amount'];
$add['ratio']=$data['ratio'];
$add['ratio_amount']=$data['ratio_amount'];
$add['promote_id']=$data['promote_id'];
$add['promote_name']=$data['promote_account'];
$add['create_time']=time();
return $add;
}
/**
* 优先扣除绑币 和平台 处理
* $request $discountAmount 折扣价格
*/
public function other_price(&$request, $discountAmount=0) {
return $request;
// 优先扣除绑定币平台币
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);
}
}