优先扣除绑币、平台币

超级签
兼容应用内应用外跳转
master
tpingzhang 5 years ago
parent 0f41a508be
commit c3a8f6b508

@ -4,6 +4,7 @@ namespace Callback\Controller;
use Think\Controller;
use Common\Api\GameApi;
use Org\UcenterSDK\Ucservice;
use Think\Log;
/**
* 支付回调控制器
* @author 小纯洁
@ -54,6 +55,7 @@ class BaseController extends Controller {
$spend = M('Spend',"tab_");
$map['pay_order_number'] = $data['out_trade_no'];
$d = $spend->where($map)->find();
if(empty($d)){$this->record_logs("数据异常");return false;}
// 支付金额判断 by zgc
if ($d['pay_amount'] != $data['money']) {
@ -61,6 +63,63 @@ class BaseController extends Controller {
}
if($d['pay_status'] == 0){
// 处理绑币平台币优先处理
if ($d['deduction_amount'] > 0) {
$out_trade_no = "PF_" . date('Ymd') . date('His') . sp_random_string(4);
$bind_balance = M('user_play', 'tab_')->where(array(
'user_id' => $d['user_id'],
'game_id' => $d['game_id']
))->getField('bind_balance');
$request = $d;
$request['pay_order_number'] = $out_trade_no;
$request['price'] = $bind_balance;
$request['deduction_amount'] = 0;
$request['pay_way'] = -1;
$request['pay_status'] = 1;
if ($d['deduction_amount'] > $bind_balance)
$bb = 0;
else
$bb = $bind_balance - $d['deduction_amount'];
if ($bind_balance > 0) {
M('user_play', 'tab_')->where(array(
'user_id' => $d['user_id'],
'game_id' => $d['game_id']
))->save(array(
'bind_balance' => $bb
));
$result = $this->add_spend($request);
$this->set_ratio($request['pay_order_number'], 2); // 游戏返利
}
if ($bb == 0) {
$mbalance = $d['deduction_amount'] - $bind_balance;
if ($mbalance > 0) {
$request['pay_way'] = 0;
$request['pay_order_number'] = $request['pay_order_number']."_1";
$request['price'] = $mbalance;
$balance = M('user', 'tab_')->where(array(
'id' => $d['user_id'],
))->getField('balance');
if ($balance < $mbalance) { // 异常
$this->record_logs($mbalance."平台币余额不足".$balance);return false;
}
M('user', 'tab_')->where(array(
'id' => $d['user_id']
))->save(array(
'balance' => $balance - $mbalance,
));
$result = $this->add_spend($request);
$this->set_ratio($request['pay_order_number'], 2); // 游戏返利
}
}
}
$data_save['pay_status'] = 1;
$data_save['order_number'] = $data['trade_no'];
$map_s['pay_order_number'] = $data['out_trade_no'];
@ -464,4 +523,155 @@ class BaseController extends Controller {
fwrite($myfile, $txt);
fclose($myfile);
}
/**
*消费表添加数据
*/
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;
}
/**
*消费记录表 参数
*/
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_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;
}
/**
* 获取用户折扣
* @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;
}
} */
}

@ -15,15 +15,12 @@ use Sdk\Controller\Ipa365Controller;
*/
class NotifyController extends BaseController
{
/**
*通知方法
*/
public function notify()
{
C(api('Config/lists'));
$apitype = I('get.apitype');#获取支付api类型
@ -61,14 +58,13 @@ class NotifyController extends BaseController
if ($apitype == "swiftpass") {
$apitype = "weixin";
}
$pay = new \Think\Pay($pay_way, C($apitype));
if ($pay->verifyNotify($notify)) {
//获取回调订单信息
$order_info = $pay->getInfo();
Log::write(serialize($order_info), Log::DEBUG);
if ($order_info['status']) {
$pay_where = substr($order_info['out_trade_no'], 0, 2);

@ -110,4 +110,5 @@ return array(
'SQ_UNION' => 10,
'SQ_SHORTCUT' => 15
),
'WX_PAY_LIMIT' => 3000, // 微信支付限额
);

@ -92,7 +92,14 @@ class AppleController extends BaseController{
$request = json_decode(think_decrypt($file),true);
C(api('Config/lists'));
/*$request['user_id'] = 1;
$request['game_id'] = 1;
$request['price'] = 1.01;
$request['extend'] = 21111183;
$request['pay_order_number'] = 21111183;
$request['sdk_version'] = 2;
$request['code'] =1;
*/
if (empty($request)) {
echo json_encode(['code'=>0,'msg'=>'登录数据不能为空']);exit;
}
@ -115,6 +122,8 @@ class AppleController extends BaseController{
echo json_encode(['code'=>0,'msg'=>'订单号重复,请关闭支付页面重新支付']);exit;
}
$this->other_price($request);
if(get_zfb_type()==0){ // 支付宝官方
if(C('alipay.way')==1 || ($request['is_create_ordernumer']==1 && C('alipay.way')==0)){/* wap */
@ -126,8 +135,8 @@ class AppleController extends BaseController{
$request['payway'] = 1;
$request['title']=$request['price'];
$request['body']=$request['price'];
$request['callback'] = 'http://'.$_SERVER['HTTP_HOST']. "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
$request['notifyurl'] = 'http://'.$_SERVER['HTTP_HOST']. "/callback.php/Notify/notify/apitype/alipay/method/notify";
//$request['callback'] = 'http://'.$_SERVER['HTTP_HOST']. "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
//$request['notifyurl'] = 'http://'.$_SERVER['HTTP_HOST']. "/callback.php/Notify/notify/apitype/alipay/method/notify";
$pay_url=$this->pay($request);
//echo $pay_url['url'];die;
//redirect($pay_url['url']);
@ -333,7 +342,7 @@ class AppleController extends BaseController{
if($param['is_uc']==1){
return $pay->buildRequestForm($vo,1);
}else{
$pay_['url']= $pay->buildRequestForm($vo);
$pay_['url']= $pay->buildRequestForm($vo, 0, $param);
$pay_['out_trade_no']= $out_trade_no;
return $pay_;
}
@ -347,10 +356,10 @@ class AppleController extends BaseController{
$request = json_decode(think_decrypt($file),true);
/*$request['user_id'] = 1;
$request['game_id'] = 1;
$request['price'] = 0.01;
$request['extend'] = 21111177;
$request['pay_order_number'] = 21111177;
$request['price'] = 157.01;
$request['extend'] = 21111178;
$request['pay_order_number'] = 21111178;
$request['sdk_version'] = 2;
$request['code'] =1;
*/
if (empty($request)) {
@ -358,7 +367,7 @@ class AppleController extends BaseController{
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'登录数据不能为空')));exit;
}
// 支付验证 是否让支付
$payCheck = pay_check($request['user_id']);
$payCheck = pay_check($user_id);
if (!$payCheck['code']) {
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=> $payCheck['msg'])));exit;
}
@ -367,10 +376,9 @@ class AppleController extends BaseController{
if($game['pay_status'] == 0){
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'该游戏暂时无法充值,请联系客服!')));exit;
}
if($request['price']*1<=0){
if($request['price']*1<=0 || $request['price'] > C('WX_PAY_LIMIT')) {
// $this->set_message(0,"fail","充值金额有误");
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'充值金额有误')));exit;
}
$extend_data = M('spend','tab_')->where(array('extend'=>$request['extend'],'game_id'=>$request['game_id'],'game_status'=>1))->find();
if($extend_data){
@ -388,6 +396,9 @@ class AppleController extends BaseController{
$discount = $discount['discount'];
$pay_amount = $discount * $request['price'] / 10;
file_put_contents(dirname(__FILE__).'/1222222.txt',get_wx_pay_type());
// 绑币平台币优先处理
$this->other_price($request, $discountAmount);
//0 官方 1威富通 2俊付通
if (get_wx_pay_type() == 0) {
$weixn = new Weixin();
@ -749,6 +760,102 @@ class AppleController extends BaseController{
}
/*
* 平台币抵扣
* 优先抵扣绑币 平台币 调这个接口说明 不走第三方支付通道
*/
public function platform_coin_deduction($user_id, $game_id) {
$file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
$request = json_decode(think_decrypt($file),true);
if (empty($request)) {
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'参数错误')));exit;
}
// 支付验证 是否让支付
$payCheck = pay_check($request['user_id']);
if (!$payCheck['code']) {
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=> $payCheck['msg'])));exit;
}
if ($request['price'] *1<=0) {
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'充值金额有误')));exit;
}
$request['price'] = abs($request['price']);
$extend_data = M('spend','tab_')->where(array('extend'=>$request['extend'],'pay_status'=>1,'game_id'=>$request['game_id']))->find();
if($extend_data){
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'订单号重复,请关闭支付页面重新支付')));exit;
}
$user_info = get_user_entity($request['user_id']);
if($user_info['lock_status'] == 0 || $user_info['check_status'] == 0){
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'账号被禁用,无法充值,请联..系客服!')));exit;
}
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
if($game['pay_status'] == 0){
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'该游戏暂时无法充值,请联系客服!')));exit;
}
$out_trade_no = "PF_" . date('Ymd') . date('His') . sp_random_string(4);
$request['order_number'] = $out_trade_no;
$request['pay_order_number'] = $out_trade_no;
$request['out_trade_no'] = $out_trade_no;
$request['title'] = $request['title'];
$request['pay_status'] = 1;
$request['pay_way'] = 0;
$request['spend_ip'] = get_client_ip();
$user_entity = get_user_entity($request['user_id']);
$discount_arr = $this->get_discount($request['game_id'], $user_entity['promote_id'], $request['user_id']);
$discount = $discount_arr['discount'];
$user = M("user", "tab_");
//添加黑名单
$check_deposit_money = $this->check_deposit_money($user_entity);
$check_bind_money = $this->check_bind_money($user_entity);
if($check_deposit_money === false || $check_bind_money === false || (C('BRUSH_MONEY') && (abs($check_deposit_money)>=C('BRUSH_MONEY') || abs($check_bind_money)>=C('BRUSH_MONEY'))) || (!C('BRUSH_MONEY') && (abs($check_deposit_money) != 0 || abs($check_bind_money) != 0))){
if(C('BRUSH_SMS_STATUS') && C('BRUSH_PHONE')&& C('BRUSH_SMS_ID')){
$result = $this-> send_block(C('BRUSH_PHONE'),$user_entity['account']);
}
$block_data['check_status'] = 0;
$block_data['block_time'] = time();
$user->where(['id'=>$user_entity['id']])->save($block_data);
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'您的账号暂时无法充值,请联系客服处理.')));exit;
}
$result = false;
// 先扣绑币
$request['pay_way'] = -1;
$user_play = M("UserPlay", "tab_");
$user_play_map['user_id'] = $request['user_id'];
$user_play_map['game_id'] = $request['game_id'];
$user_play_data = $user_play->where($user_play_map)->find();
if ($user_play_data['bind_balance'] < $request['price']) {
$price = $request['price'];
if ($user_play_data['bind_balance'] > 0) {
$user_play->where($user_play_map)->save(array('bind_balance' => 0)); // 扣绑定币
$request['price'] = $user_play_data['bind_balance'];
$result = $this->add_spend($request);
$this->set_ratio($request['pay_order_number'], 2); // 游戏返利
}
$request['pay_way'] = 0; // 扣平台币
$real_price = $price - $user_play_data['bind_balance'];
$user->where(array('id' => $request["user_id"]))->setDec("balance", $real_price);
//$this->set_message(0,"fail", $request['pay_order_number']);
$request['pay_order_number'] = $request['pay_order_number']."_1";
$request['price'] = $real_price;
$result = $this->add_spend($request);
$this->set_ratio($request['pay_order_number'], 1); // 游戏返利
} else { // 绑定币足够扣
$user_play->where($user_play_map)->setDec('bind_balance', $request['price']); // 扣绑定币
$result = $this->add_spend($request);
$this->set_ratio($request['pay_order_number'], 2); // 游戏返利
}
$game = new GameApi();
$game->game_pay_notify($request, $request['code']);
$url = 'http://' . $_SERVER ['HTTP_HOST'] . "/sdk.php/Spend/pay_success3/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
redirect($url);
}
/**
*苹果支付验证
*/

@ -68,7 +68,24 @@ class Ipa365Controller extends BaseController{
));
}
public function pay_order_check() {
$orderId = I('order_id');
$order = M('game_supersign', 'tab_')->where(array(
'order_id' => $orderId
))->find();
if (!$order) {
echo "订单不存在!";
}
if ($order['pay_status'] == 1) {
redirect(U("Ipa365/install_show", [
'game_id' => $order['game_id'],
'order_id' => $order['order_id']
]));
}
echo "订单正在处理中.请稍后再试!";
exit();
}
/*
* 发起支付
*/
@ -132,9 +149,6 @@ class Ipa365Controller extends BaseController{
$param['notifyurl'] = "https://api.wmtxkj.com/callback.php/Notify/notify/apitype/alipay";
$ret = $this->alipay($param);
$_SESSION['paytip_price']=self::signprice;
$_SESSION['paytip_order_id']=$orderId;
$_SESSION['paytip_url']=$ret['url'];
$this->assign("price", self::signprice);
$this->assign("url", $ret['url']);
@ -145,10 +159,46 @@ class Ipa365Controller extends BaseController{
$this->display();
}
public function paytip(){
$this->assign("price", $_SESSION['paytip_price']);
$this->assign("url", $_SESSION['paytip_url']);
$this->assign("order_id", $_SESSION['paytip_order_id']);
$orderId = I('order_id');
$payLog = M('game_supersign', 'tab_')->where(array(
'order_id' => $orderId,
))->find();
$this->assign('url', U('Ipa365/install', array(
'order_id' => $payLog['order_id'],
'user_id' => $payLog['user_id'],
'game_id' => $payLog['game_id'],
)));
$price = $payLog['pay_price'];
$userId = $payLog['user_id'];
$gameId = $payLog['game_id'];
$param['price'] = $price;
$param['sdk_version'] = '2';
$param['user_id'] = $userId;
$param['game_id'] = $gameId;
$param['order_id'] = $orderId;
$param['apitype'] = "alipay";
$param['config'] = "alipay";
$param['signtype']= "MD5";
$param['server'] = "alipay.wap.create.direct.pay.by.user";
$param['payway'] = 1;
$param['title'] = $price;
$param['body'] = $price;
$param['callback'] = "https://api.wmtxkj.com/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}";
$param['notifyurl'] = "https://api.wmtxkj.com/callback.php/Notify/notify/apitype/alipay";
$ret = $this->alipay($param);
$this->assign("url", $ret['url']);
$this->assign("price", $price);
$this->assign("order_id", $payLog['order_id']);
$this->assign("game_id", $payLog['game_id']);
//$this->assign("jump_url",$jump_url);
$this->display();
}

@ -328,6 +328,98 @@ class PayController extends BaseController
echo base64_encode(json_encode($data));
}
/*
* 平台币抵扣
* 优先抵扣绑币 平台币 调这个接口说明 不走第三方支付通道
*/
public function platform_coin_deduction() {
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
$request = json_decode(base64_decode(file_get_contents("php://input")), true);
#记录信息
if ($request['price'] *1<=0) {
$this->set_message(1011, "fail", "充值金额有误");
}
$request['price'] = abs($request['price']);
$extend_data = M('spend','tab_')->where(array('extend'=>$request['extend'],'pay_status'=>1,'game_id'=>$request['game_id']))->find();
if($extend_data){
$this->set_message(1089,"fail","订单号重复,请关闭支付页面重新支付");
}
$user_info = get_user_entity($request['user_id']);
if($user_info['lock_status'] == 0 || $user_info['check_status'] == 0){
$this->set_message(0,"fail","账号被禁用,无法充值,请联..系客服!");
}
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
if($game['pay_status'] == 0){
$this->set_message(0,"fail","该游戏暂时无法充值,请联系客服!");
}
$out_trade_no = "PF_" . date('Ymd') . date('His') . sp_random_string(4);
$request['order_number'] = $out_trade_no;
$request['pay_order_number'] = $out_trade_no;
$request['out_trade_no'] = $out_trade_no;
$request['title'] = $request['title'];
$request['pay_status'] = 1;
$request['pay_way'] = 0;
$request['spend_ip'] = get_client_ip();
$user_entity = get_user_entity($request['user_id']);
$discount_arr = $this->get_discount($request['game_id'], $user_entity['promote_id'], $request['user_id']);
$discount = $discount_arr['discount'];
$user = M("user", "tab_");
//添加黑名单
$check_deposit_money = $this->check_deposit_money($user_entity);
$check_bind_money = $this->check_bind_money($user_entity);
if($check_deposit_money === false || $check_bind_money === false || (C('BRUSH_MONEY') && (abs($check_deposit_money)>=C('BRUSH_MONEY') || abs($check_bind_money)>=C('BRUSH_MONEY'))) || (!C('BRUSH_MONEY') && (abs($check_deposit_money) != 0 || abs($check_bind_money) != 0))){
if(C('BRUSH_SMS_STATUS') && C('BRUSH_PHONE')&& C('BRUSH_SMS_ID')){
$result = $this-> send_block(C('BRUSH_PHONE'),$user_entity['account']);
}
$block_data['check_status'] = 0;
$block_data['block_time'] = time();
$user->where(['id'=>$user_entity['id']])->save($block_data);
echo base64_encode(json_encode(array("status" => 1076,"return_code" => "fail", "return_msg" => C('BRUSH_MONEY')."您的账号暂时无法充值,请联系客服处理.".$check_deposit_money)));
exit();
}
$result = false;
// 先扣绑币
$request['pay_way'] = -1;
$user_play = M("UserPlay", "tab_");
$user_play_map['user_id'] = $request['user_id'];
$user_play_map['game_id'] = $request['game_id'];
$user_play_data = $user_play->where($user_play_map)->find();
if ($user_play_data['bind_balance'] < $request['price']) {
$price = $request['price'];
if ($user_play_data['bind_balance'] > 0) {
$user_play->where($user_play_map)->save(array('bind_balance' => 0)); // 扣绑定币
$request['price'] = $user_play_data['bind_balance'];
$result = $this->add_spend($request);
$this->set_ratio($request['pay_order_number'], 2); // 游戏返利
}
$request['pay_way'] = 0; // 扣平台币
$real_price = $price - $user_play_data['bind_balance'];
$user->where(array('id' => $request["user_id"]))->setDec("balance", $real_price);
//$this->set_message(0,"fail", $request['pay_order_number']);
$request['pay_order_number'] = $request['pay_order_number']."_1";
$request['price'] = $real_price;
$result = $this->add_spend($request);
$this->set_ratio($request['pay_order_number'], 1); // 游戏返利
} else { // 绑定币足够扣
$user_play->where($user_play_map)->setDec('bind_balance', $request['price']); // 扣绑定币
$result = $this->add_spend($request);
$this->set_ratio($request['pay_order_number'], 2); // 游戏返利
}
$game = new GameApi();
$game->game_pay_notify($request, $request['code']);
if ($result) {
echo base64_encode(json_encode(array("status" => 200, "return_code" => "success", "return_msg" => "支付成功", "out_trade_no" => $out_trade_no)));
} else {
echo base64_encode(json_encode(array("status" => 1078, "return_code" => "fail", "return_msg" => "支付失败")));
}
}
/**
*平台币支付
@ -347,7 +439,7 @@ class PayController extends BaseController
}
$user_info = get_user_entity($request['user_id']);
if($user_info['lock_status'] == 0 || $user_info['check_status'] == 0){
$this->set_message(0,"fail","账号被禁用,无法充值,请联系客服!");
$this->set_message(0,"fail","账号被禁用,无法充值,请联系客服...");
}
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
if($game['pay_status'] == 0){

@ -43,9 +43,8 @@ class SpendController extends Controller {
* @return [type] [description]
*/
public function pay_way() {
$user_id = I ( 'user_id' );
$game_id = I ( 'game_id' );
$user_id = I ('user_id');
$game_id = I ('game_id');
$file = file_get_contents ( "./Application/Sdk/OrderNo/" . $user_id . "-" . $game_id . ".txt" );
$request = json_decode ( think_decrypt ( $file ), true );
@ -63,17 +62,16 @@ class SpendController extends Controller {
'user_id' => $user_id,
'game_id' => $game_id
) )->getField ( 'bind_balance' );
/* $sqpay = new Sqpay();
$prefix = $request['code'] == 1 ? "SP_" : "PF_"; // SP 0 充值 1消费
$order_no = $prefix.date('Ymd').date('His').sp_random_string(4);
$ret = $sqpay->sq_pay($order_no,$request ['price'],$merno="168885",$ip=0,$returnurl="");
$ret = json_decode($ret, true); */
$data['price'] = 1;
$this->assign ( 'balance', $balance );
$this->assign ( 'bind_balance', $bind_balance );
$this->assign ( 'data', $data );
$this->assign ( 'btncolor', $request ['btncolor'] );
if ($balance + $bind_balance > $data['price'])
$this->assign ('pay_price', 0); // 是否第三方支付
else
$this->assign ('pay_price', $data['price'] - $balance - $bind_balance);
/* $this->assign ( 'alipayurl', $ret[0]['payURL']);
header("Access-Control-Allow-Origin: *"); */
@ -87,6 +85,7 @@ class SpendController extends Controller {
$orderno = $_GET ['jinzhue'];
}
$pay_where = substr ( $orderno, 0, 2 );
$Scheme = file_get_contents ( "./Application/Sdk/Scheme/" . $_GET ['game_id'] . ".txt" );
$map ['pay_order_number'] = $orderno;
switch ($pay_where) {
case 'SP' :
@ -104,6 +103,7 @@ class SpendController extends Controller {
$result = M ( 'bind_recharge', 'tab_' )->field ( 'pay_status' )->where ( $map )->find ();
break;
}
$this->assign ( 'Scheme', $Scheme );
$this->assign ( 'paystatus', $result ['pay_status'] );
$this->display ();
}

@ -57,35 +57,6 @@ class WapPayController extends BaseController{
return $pay->buildRequestForm($vo, 0, $param);
}
/**
* 优先扣除绑币 和平台 处理
* $request $discountAmount 折扣价格
*/
public function other_price(&$request, $discountAmount=0) {
// 优先扣除绑定币平台币
$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']) {
$this->set_message(1089,"fail",$deductionAmount."平台币足够,请关闭支付页面重新支付".$pay_amount);
}
// 实际支付金额 = 支付总金额 - 折扣抵扣价格 - 绑币和平台币抵扣金额
$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);
}
/**
*支付宝移动支付
@ -120,7 +91,7 @@ class WapPayController extends BaseController{
$out_trade_no = $prefix.date('Ymd').date('His').sp_random_string(4);
$request = $this->other_price($request);
Log::write(serialize($request), Log::DEBUG);
//Log::write(serialize($request), Log::DEBUG);
if(get_zfb_type()==0){
$game_set_data = get_game_set_info($request['game_id']);
@ -133,6 +104,7 @@ Log::write(serialize($request), Log::DEBUG);
$request['title']=$request['price'];
$request['body']=$request['price'];
$request['out_trade_no'] = $out_trade_no;
//$this->set_message(1011,"fail", $request['code']);
$pay_url=$this->pay($request);
@ -594,7 +566,7 @@ Log::write(serialize($request), Log::DEBUG);
$this->set_message(1088, "fail", $payCheck['msg']);
}
C(api('Config/lists'));
if($request['price']*1<=0){
if($request['price']*1<=0 || $request['price'] > C('WX_PAY_LIMIT')){
$this->set_message(1011,"fail","充值金额有误");
}
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();

@ -69,7 +69,7 @@
<span>{$price}元</span>
</div>
<a class="order-payinfo-item"
href="#;" onclick="jump('{$url}')"
href="#;" onclick="jump('{$order_id}')"
title="支付宝">
<div class="order-payinfo-icon">
<img src="__IMG__/ssg/alipay/zfb-pic.jpg" alt="支付宝">
@ -86,11 +86,11 @@
</div>
</body>
<script>
function jump($pay_url) {
function jump(pay_url) {
if(isWeiXin()){
window.location.href = "/sdk.php/Ipa365/paytip";
window.location.href = "/sdk.php/Ipa365/paytip/order_id/"+pay_url;
}else{
window.location.href=$pay_url;
window.location.href=pay_url;
}
}
//判断是否是微信浏览器的函数

@ -16,7 +16,7 @@
<script>
$(document).ready(function(){
if(isWeiXin()==false){
//window.location.href='{$url}';
window.location.href='{$url}';
}
});
//判断是否是微信浏览器的函数
@ -54,7 +54,7 @@
<label>商品名称:</label><span>超级签购买</span>
</div>
<div class="m-order-item">
<label>商品描述:</label><span>{$url}</span>
<label>商品描述:</label><span></span>
</div>
<div class="m-order-item">
<label>交易金额:</label><span>{$price}元</span>
@ -62,10 +62,10 @@
</div>
<div class="m-order-qrcode">
<div class="m-weixin-alipay-hintinfo">由于微信不支持支付宝直接支付请点击微信右上角菜单在Safari中打开</div>
<!--<div class="m-weixin-alipay-qrcode-foot">
<a class="fail-pay" href="http://apipay.37376.com/pay/payreturn?TradeNo=201909231287512597767135279&amp;SignatureStamp=1569242244&amp;SignatureMD5=256B903183112B9BA4A826E579E89142">支付遇到问题</a>
<a class="success-pay" href="http://apipay.37376.com/pay/payreturn?TradeNo=201909231287512597767135279&amp;SignatureStamp=1569242244&amp;SignatureMD5=256B903183112B9BA4A826E579E89142">支付完成</a>
</div>-->
<div class="m-weixin-alipay-qrcode-foot">
<a class="fail-pay" href="{:U('Ipa365/pay_order_check', array('order_id' => $order_id, 'game_id' => $game_id))}">支付遇到问题</a>
<a class="success-pay" href="{:U('Ipa365/pay_order_check', array('order_id' => $order_id, 'game_id' => $game_id))}">支付完成</a>
</div>
</div>
</div>

@ -42,11 +42,27 @@ border: 1px solid #999;
</style>
<div class="news_area" style="padding:0px;">
<input type="hidden" name="pay_order_number" class="orderno" value="{:I('pay_order_number')}">
<input type="hidden" name="Scheme" class="Scheme" value="{$Scheme}">
<br/><br/><br/><br/><br/>
<style>
.notice {
margin: 0 auto;
padding: 0;
font-size: 1.2rem;
background: rgba(25,177,234);
color: #fff;
line-height: 3.2rem;
width: 80%;
border-radius: 0.7rem;
}
</style>
<!--未绑定-->
<div class="pay_suc">
<if condition="$paystatus eq 1">
<img src="__IMG__/my_suc.png">
<h3>支付成功</h3>
<button class="notice" id="back_success">点击返回</button>
<script src="__JS__/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
var orderno=$('.orderno').val();
@ -60,12 +76,11 @@ border: 1px solid #999;
}
}catch(err){
setTimeout(function () {
/* setTimeout(function () {
window.location.href= "/mobile.php?s=/User/index.html";
},1000)
},1000) */
}
</script>
@ -76,7 +91,7 @@ border: 1px solid #999;
<img src="__IMG__/my_fail.png">
<h3>支付失败{$paystatus}</h3>
<button class="notice" id="back_error">点击返回</button>
<script src="__JS__/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
var orderno=$('.orderno').val();
@ -89,9 +104,9 @@ try{
window.webkit.messageHandlers.exchangeResult.postMessage(0);
}
}catch(err){
setTimeout(function () {
/* setTimeout(function () {
window.location.href= "/mobile.php?s=/User/index.html";
},1000)
},1000) */
}
</script>
@ -106,6 +121,75 @@ try{
</div>
<script>
$("#back_success").click(function() {
/* var orderno=$('.orderno').val();
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
try{
if(isAndroid){
window.mengchuang.getPayResult('succeed');
}else{
window.webkit.messageHandlers.exchangeResult.postMessage(1);
}
}catch(err){
} */
var Scheme=$('.Scheme').val();
var orderno=$('.orderno').val();
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
if(isAndroid){
window.mengchuang.getPayResult('succeed');
}else{
<if condition="get_wx_type() neq 1">
window.location.href = Scheme+"://1&back";
<else/>
window.location.href = "mengchuang://showWapPayResult_btnType_?1&back";
</if>
}
});
$("#back_error").click(function() {
/* var orderno=$('.orderno').val();
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
try{
if(isAndroid){
window.mengchuang.getPayResult('fail');
}else{
window.webkit.messageHandlers.exchangeResult.postMessage(0);
}
}catch(err){
} */
var Scheme=$('.Scheme').val();
var orderno=$('.orderno').val();
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
if(isAndroid){
window.mengchuang.getPayResult('fail');
}else{
<if condition="get_wx_type() neq 1">
if (!Scheme)
;
else
window.location.href = Scheme+"://0&back";
<else/>
window. location.href = "mengchuang://showWapPayResult_btnType_?0&back";
</if>
}
});
</script>
</body>
</html>

@ -43,13 +43,26 @@ border: 1px solid #999;
<div class="news_area" style="padding:0px;">
<input type="hidden" name="pay_order_number" class="orderno" value="{:I('pay_order_number')}">
<input type="hidden" name="Scheme" class="Scheme" value="{$Scheme}">
<br/><br/><br/><br/><br/>
<style>
.notice {
margin: 0 auto;
padding: 0;
font-size: 1.2rem;
background: rgba(25,177,234);
color: #fff;
line-height: 3.2rem;
width: 80%;
border-radius: 0.7rem;
}
</style>
<!--未绑定-->
<div class="pay_suc">
<if condition="$paystatus eq 1">
<!-- <img src="__IMG__/my_suc.png">
<h3>支付成功</h3> -->
<img src="__IMG__/my_suc.png">
<h3>支付成功</h3>
<button class="notice" id="back_success">点击返回</button>
<script src="__JS__/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
var Scheme=$('.Scheme').val();
@ -75,8 +88,9 @@ border: 1px solid #999;
<else/>
<img src="__IMG__/my_fail.png">
<h3>支付失败{$paystatus}</h3>
<button class="notice" id="back_error">点击返回1</button>
<script src="__JS__/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
var Scheme=$('.Scheme').val();
@ -106,6 +120,43 @@ if(isAndroid){
</div>
<script>
$("#back_success").click(function() {
var orderno=$('.orderno').val();
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
try{
if(isAndroid){
window.mengchuang.getPayResult('succeed');
}else{
window.webkit.messageHandlers.exchangeResult.postMessage(1);
}
}catch(err){
}
});
$("#back_error").click(function() {
var orderno=$('.orderno').val();
var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
try{
if(isAndroid){
window.mengchuang.getPayResult('fail');
}else{
window.webkit.messageHandlers.exchangeResult.postMessage(0);
}
}catch(err){
}
});
</script>
</body>
</html>

@ -1,201 +1,230 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<link href="__CSS__/index.css" rel="stylesheet" />
<style>input{outline:none;-webkit-appearance:none;}
html{font-size:12px;}
body {background:#F3F2F7;font-size:inherit;}
i{font-style:normal;font-weight:normal;}
.recharge_table {display:table;width:100%;}
.recharge_table .recharge_cell {display:table-cell;vertical-align:middle;text-align:center;}
.recharge_content {margin:0 auto;}
.recharge_content span {display:block;}
.recharge_money {height:5.818rem;background:#FFF;}
.recharge_content_number {color:#01B1EC;font-size:1.3rem;}
.recharge_content_coin,.recharge_game_name {color:#999;}
.recharge_content_number i {font-size:1.636rem;}
.recharge_game {background:#FFF;font-size:1.2rem;height:3.727rem;line-height:3.737rem;border-top:2px solid #DEE2E5;}
.recharge_game .recharge_value {padding:0 1.13rem;}
.recharge_way {height:10.8rem;}
.recharge_way_title {height:2.7rem;line-height:2.7rem;text-align:center;font-size:1.07rem;}
.recharge_way_content,.recharge_way_wrap {height:8rem;}
.recharge_way_btn {height:7.2rem;display:inline-block;}
.recharge_way_btn img{width:6.84rem;height:6.84rem;display:inline-block;margin-top:.18rem;}
.recharge_way_btn_alipay img{width:6.84rem;height:6.84rem;margin-top:0;}
.platform_pop {position:absolute;top:0;left:0;width:100%;height:100%;display:none;}
.platform_pop_table {width:100%;height:100%;}
.platform_box {color:#999;position:relative;top:0;left:auto;right:auto;width:24rem;display:block;margin:0 auto;background:#FFF;border-radius:.3rem;}
.platform_pop_close {position:absolute;top:0.8rem;right:0.8rem;color:#999;}
.platform_pop_close img {width:1.7rem;height:1.7rem;}
.platform_title {line-height:3.4rem;font-size:1.8rem;}
.platform_content {padding:0 0.8rem;text-align:left;font-size:1.5rem;}
.platform_notice {color:#333;line-height:1.4;}
.platform_notice span {color:red;}
.platform_radio {padding-top:.2rem;padding-bottom:0.2rem;}
.platform_radio .platform_radio_item {display:block;line-height:1.8;position:relative;}
.platform_radio_item input {position:absolute;top:0;left:0;z-index:-1;width:1.8rem;height:1.8rem;}
.platform_radio_item input~i{width:1.6rem;height:1.6rem;background:url(__IMG__/btn_check_n.png) center center no-repeat;background-size:100% 100%;display:inline-block;vertical-align:middle;margin-top:-.3rem;margin-right:0.2rem;}
.platform_radio_item input:checked~i{background-image:url(__IMG__/btn_check_s.png);}
.platform_btn {padding:0.2rem .8rem 1rem;}
.platform_btn input {background:#F9AB42;color:#FFF;line-height:1.8;font-size:1.8rem;border:none;width:100%;border-radius:.3rem;}
@media screen and (max-width:400px) {
.recharge_game {border-top-width:1px;}
}
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1,IE=edge">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="__CSS__/weui.min.css">
<script src="__JS__/flex.min.js"></script>
<script src="__JS__/jquery-1.11.1.min.js"></script>
<script src="__STATIC__/layer_mobile/layer.js"></script>
<title>支付中心</title>
</head>
<style>
html,
body {
background-color: #F5F5F5;
min-height: 100vh;
</head>
}
<body>
<div class="containers">
.weui-cells {
border-radius: .2rem;
box-shadow: 0px 0px .05rem rgba(0, 0, 0, .2);
margin-top: 0px;
}
<div class="recharge_money recharge_table">
<div class="recharge_cell">
<div class="recharge_content">
<span class="recharge_content_number"><i>{$data.price}</i></span>
<span class="recharge_content_coin">{$data.coin}</span>
</div>
</div>
</div>
<eq name="data.code" value="1">
<div class="recharge_game">
<div class="recharge_value">
<span class="recharge_game_name">游戏名称:</span>
<span>{$data.game_name}</span>
</div>
</div>
</eq>
.weui-cell {
height: 0.85rem;
font-size: .28rem;
color: #292929;
padding: 0px .3rem;
}
<div class="recharge_way">
<div class="recharge_way_title">请选择支付方式</div>
<div class="recharge_way_content">
<div class="recharge_way_wrap recharge_table">
<if condition="C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.wx') eq 1) or (C('heepay.status') eq 1 and C('heepay.wxp') eq 1)">
<div class="recharge_cell">
<a href="{:U('Apple/apple_weixin_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}" class="recharge_way_btn recharge_way_btn_wechat"><img src="__IMG__/btn_pay_wechat@3x.png"></a>
</div>
</if>
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1)">
<div class="recharge_cell">
<!-- <a href="{:U('Apple/apple_alipay_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}" class="recharge_way_btn recharge_way_btn_alipay"><img src="__IMG__/btn_pay_alipay@3x.png"></a>
-->
<a href="javascript:;" data-url="/sdk.php?s=/Apple/apple_alipay_pay&user_id={:I('user_id')}&game_id={:I('game_id')}" id="alipaybtn" class="recharge_way_btn recharge_way_btn_alipay"><img src="__IMG__/btn_pay_alipay@3x.png"></a>
<!--
<a href="{$alipayurl}" data-url="" id="alipaybtn" class="recharge_way_btn recharge_way_btn_alipay"><img src="__IMG__/btn_pay_alipay@3x.png"></a>
-->
</div>
</if>
<if condition="C('sqpay.status') eq 1 and C('sqpay.union') eq 1">
<div class="recharge_cell">
<a href="{:U('Apple/apple_union_pay', array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}" class="recharge_way_btn recharge_way_btn_alipay">
<img src="__IMG__/unionpay.png"></a>
</div>
</if>
img {
width: .72rem;
height: .72rem;
margin-right: .2rem;
/* margin: .3rem; */
}
.paylist .weui-cell {
padding: .2rem .3rem;
height: 1rem;
}
<if condition="pay_set_status('ptb_pay') eq 1 and $data['code'] eq 1">
<div class="recharge_cell">
<a href="javascript:;" id="platform_id" class="recharge_way_btn recharge_way_btn_platform"><img src="__IMG__/btn_pay_platform@3x.png"></a>
</div>
</if>
.paylist .weui-cell__hd {
display: flex;
}
<if condition="pay_set_status('bind_pay') eq 1 and $data['code'] eq 1">
<div class="recharge_cell">
<a href="javascript:;" id="platform_id1" class="recharge_way_btn recharge_way_btn_platform"><img src="__IMG__/icon_bangbi@3x.png"></a>
</div>
</if>
.weui-cells:after {
border: 0px;
}
<if condition="C('sqpay.status') eq 1 and C('sqpay.shortcut') eq 1">
<div class="recharge_cell">
<a href="{:U('WapPay/wap_shortcut_pay', array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}" class="recharge_way_btn recharge_way_btn_alipay">
<img src="__IMG__/unionpay.png"></a>
</div>
</if>
.weui-cells:before {
border: 0px;
}
</div>
@media screen and (orientation: portrait) {
.box{
padding:.3rem;
}
.bottombutton{
height:1rem;background-color: #21B1EB;color: #ffffff;font-size: .32rem;text-align: center;line-height:1rem;bottom: 0px;
position: fixed;left: 0;right: 0;
}
}
@media screen and (orientation: landscape) {
/*横屏 css*/
.box{
padding:.3rem .5rem;
}
.bottombutton{
height:1rem;background-color: #21B1EB;color: #ffffff;font-size: .32rem;text-align: center;line-height:1rem;
width: 7.5rem;border-radius: .2rem;position: absolute;left: 50%;margin: .5rem 0 .5rem -3.75rem;
}
body{
padding-bottom: .50rem;
}
.paylist-box{
display: flex;
height: auto;
flex-wrap:wrap;
}
.paylist-box .weui-cell{
min-width: 30%;
box-sizing: content-box;
margin-left: 3%;
padding: .2rem .0rem;
/* padding: .4rem .3rem; */
}
.paylist-box .weui-cell:before{
content: none;
}
}
.border-half-line{
width: 97%;
margin-left: 3%;
float:left;
height:1px;
background-color: #e5e5e5;
-webkit-transform:scale(1,0.5);
transform:scale(1,0.5);
-webkit-transform-origin:top center;
transform-origin: top center
}
@media screen and (orientation: portrait) {
.box{
padding:.3rem;
}
}
@media screen and (orientation: landscape) {
/*横屏 css*/
.box{
padding:.3rem .5rem;
}
.bottombutton{
height:1rem;background-color: #21B1EB;color: #ffffff;font-size: .32rem;text-align: center;line-height:1rem;
width: 7.5rem;border-radius: .2rem;position: absolute;left: 50%;margin: .5rem 0 .5rem -3.75rem;
}
body{
padding-bottom: .50rem;
}
}
</style>
<body>
<div class="box">
<div class="weui-cells">
<div class="weui-cell">
<div class="weui-cell__bd">
<p>订单金额:</p>
</div>
<div class="weui-cell__ft" style="color: red">¥{$data['price']}元</div>
</div>
<div class="platform_pop" id="platform_pop">
<div class="platform_pop_table recharge_table">
<div class="recharge_cell">
<form class="platform_box" action="{:U('Apple/apple_platform_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}" enctype="multipart/form-data" method="post">
<a href="javascript:;" id="platform_pop_close" class="platform_pop_close"><img src="__IMG__/icon_close@3x.png" ></a>
<div class="platform_title">平台币</div>
<div class="platform_content">
<div class="platform_notice">应付款平台币数量:<span>{$data.price}</span></div>
<div class="platform_radio">
<label class="platform_radio_item"><input type="radio" name="way" value="1" checked><i></i>平台币余额:<span>{$balance}</span></label>
<div class="weui-cell">
<div class="weui-cell__bd">
<p>您的账户余额:</p>
</div>
<div class="weui-cell__ft" style="color: #A9A9A9;">{$balance+$bind_balance}平台币</div>
</div>
<div class="platform_btn">
<input type="submit" value="立即支付" style="background-color:<notempty name='btncolor'>#{$btncolor}<else />#F9AB42</notempty>">
</div>
</form>
<div class="weui-cells" style="margin-top: .3rem;">
<div class="weui-cell">
<div class="weui-cell__bd">
<p>适用平台余额:</p>
</div>
<div class="weui-cell__ft" style="color: #292929">-¥{$balance+$bind_balance}</div>
</div>
<div class="weui-cell">
<div class="weui-cell__bd">
<p>还需支付:</p>
</div>
<div class="platform_pop" id="platform_pop1">
<div class="platform_pop_table recharge_table">
<div class="recharge_cell">
<form class="platform_box" action="{:U('Apple/apple_platform_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}" enctype="multipart/form-data" method="post">
<a href="javascript:;" id="platform_pop_close1" class="platform_pop_close"><img src="__IMG__/icon_close@3x.png" ></a>
<div class="platform_title">绑币平台币</div>
<div class="platform_content">
<div class="platform_notice">应付款绑币数量:<span>{$data.price}</span></div>
<div class="platform_radio">
<label class="platform_radio_item"><input type="radio" name="way" value="2" checked><i></i>绑定平台币余额:<span>{$bind_balance}</span></label>
<div data-pay_price="{$pay_price}" id="pay_price" class="weui-cell__ft" style="color: red">¥{$pay_price}</div>
</div>
</div>
<div class="platform_btn">
<input type="submit" value="立即支付" style="background-color:<notempty name='btncolor'>#{$btncolor}<else />#F9AB42</notempty>">
<div class="weui-cells paylist" style="margin-top: .3rem;">
<div class="weui-cells__title" style="line-height: .85rem;color: #a9a9a9;font-size:.28rem;margin: 0px;">
请选择支付方式</div>
<div class="border-half-line" style="position: absolute;"></div>
<div class="paylist-box">
<if condition="C('alipay.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.zfb') eq 1) or (C('sqpay.status') eq 1 and C('sqpay.zfb') eq 1)">
<a id="alipaybtn" class="weui-cell" href="javascript:;" data-url="/sdk.php?s=/Apple/apple_alipay_pay&user_id={:I('user_id')}&game_id={:I('game_id')}" id="alipaybtn" class="recharge_way_btn recharge_way_btn_alipay">
<div class="weui-cell__hd"><img src="__IMG__/alipay.png"></div>
<div class="weui-cell__bd">
<p style="color: #292929;font-size:.28rem;">支付宝支付</p>
<p style="color: #a9a9a9;font-size:.2rem;">推荐支付宝用户使用</p>
</div>
</a>
</if>
<if condition="$pay_price elt C('WX_PAY_LIMIT')">
<if condition="C('wei_xin.status') eq 1 or C('weixin_gf.status') eq 1 or (C('goldpig.status') eq 1 and C('goldpig.wx') eq 1) or (C('heepay.status') eq 1 and C('heepay.wxp') eq 1)">
<a class="weui-cell" href="{:U('Apple/apple_weixin_pay',array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}" class="recharge_way_btn recharge_way_btn_wechat">
<div class="weui-cell__hd"><img src="__IMG__/wxpay.png"></div>
<div class="weui-cell__bd">
<p style="color: #292929;font-size:.28rem;">微信支付</p>
<p style="color: #a9a9a9;font-size:.2rem;">推荐微信用户使用</p>
</div>
</form>
</a>
</if>
</if>
<if condition="C('sqpay.status') eq 1 and C('sqpay.union') eq 1">
<a class="weui-cell" href="{:U('Apple/apple_union_pay', array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}" class="recharge_way_btn recharge_way_btn_alipay">
<div class="weui-cell__hd"><img src="__IMG__/cardpay.png"></div>
<div class="weui-cell__bd">
<p style="color: #292929;font-size:.28rem;">银行卡支付</p>
<p style="color: #a9a9a9;font-size:.2rem;">使用银行卡支付</p>
</div>
</a>
</if>
<if condition="C('sqpay.status') eq 1 and C('sqpay.shortcut') eq 1">
<a class="weui-cell" href="{:U('WapPay/wap_shortcut_pay', array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}" class="recharge_way_btn recharge_way_btn_alipay">
<div class="weui-cell__hd"><img src="__IMG__/onlinepay.png"></div>
<div class="weui-cell__bd">
<p style="color: #292929;font-size:.28rem;">快捷支付</p>
<p style="color: #a9a9a9;font-size:.2rem;">可在线快捷支付</p>
</div>
</a>
</if>
</div>
</div>
</body>
<script>
var html=document.getElementsByTagName('html')[0];
function fontsizechange() {
var rate = html.clientWidth/640;
var basesize = 22;
html.style.fontSize = (rate>1?basesize:basesize*rate)+'px';
}
fontsizechange();
window.onresize = function() {
fontsizechange();
</div>
<botton id="platform_pay" class="bottombutton">
确认支付
</botton>
</body>
<script>
$(function() {
if ($("#pay_price").data("pay_price") == 0) {
$("#platform_pay").show();
$(".paylist").hide();
} else {
$("#platform_pay").hide();
$(".paylist").show();
}
$(function() {
$('#platform_id').on('click',function() {
$('#platform_pop').fadeIn().find('#platform_pop_close').on('click',function() {
$(this).closest('#platform_pop').fadeOut();
return false;
});
return false;
});
$('#platform_id1').on('click',function() {
$('#platform_pop1').fadeIn().find('#platform_pop_close1').on('click',function() {
$(this).closest('#platform_pop1').fadeOut();
return false;
});
return false;
$("#platform_pay").click(function() {
var url = "{:U('Apple/platform_coin_deduction',array('user_id'=>I('user_id'),'game_id'=>I('game_id')))}";
window.location.href = url;
});
$('#alipaybtn').on('click',function() {
@ -218,11 +247,8 @@
window.webkit.messageHandlers.noticeAppResult.postMessage(data.url);
}
else {
window.webkit.messageHandlers.noticeAppResult.postMessage(data.url);
}
} else {
layer.open({
content: result.msg
@ -239,7 +265,6 @@
return false;
});
});
</script>
});
</script>
</html>

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

@ -0,0 +1 @@
!function(e){var t=e.document,n=t.documentElement,i="orientationchange"in e?"orientationchange":"resize",a=function e(){var t=n.getBoundingClientRect().width;return n.style.fontSize=5*Math.max(Math.min(t/750*20,11.2),8.55)+"px",e}();n.setAttribute("data-dpr",e.navigator.appVersion.match(/iphone/gi)?e.devicePixelRatio:1),/iP(hone|od|ad)/.test(e.navigator.userAgent)&&(t.documentElement.classList.add("ios"),parseInt(e.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/)[1],10)>=8&&t.documentElement.classList.add("hairline")),t.addEventListener&&(e.addEventListener(i,a,!1),t.addEventListener("DOMContentLoaded",a,!1))}(window);

@ -50,14 +50,14 @@ class Pay
$this->setDriver($class, $config);
}
public function buildRequestForm(Pay\PayVo $vo, $uc = 0)
public function buildRequestForm(Pay\PayVo $vo, $uc = 0, $param=array())
{
$this->payer->check();
$result = false;
if ($uc == 0) {
switch ($vo->getTable()) {
case 'spend':
$result = $this->add_spend($vo);
$result = $this->add_spend($vo, $param);
break;
case 'deposit':
$result = $this->add_deposit($vo);
@ -302,7 +302,7 @@ class Pay
/**
*消费表添加数据
*/
private function add_spend(Pay\PayVo $vo)
private function add_spend(Pay\PayVo $vo, $param=array())
{
$spend = M("spend", "tab_");
$spend_data['user_id'] = $vo->getUserId();
@ -337,6 +337,10 @@ class Pay
$spend_data['small_id'] = $vo->getSmallId();
$spend_data['small_account'] = $vo->getSmallAccount();
}
if ($param) {
$spend_data['deduction_amount'] = $param['deduction_amount'];
$spend_data['discount_amount'] = $param['discount_amount'];
}
$result = $spend->add($spend_data);
return $result;
}

Loading…
Cancel
Save