|
@@ -17,6 +17,10 @@ class Recharge extends Frontend
|
|
|
|
|
|
public function index()
|
|
|
{
|
|
|
+ $isWechat = strpos($this->request->server('HTTP_USER_AGENT'), 'MicroMessenger') !== false;
|
|
|
+ if($isWechat)
|
|
|
+ {exit('不能在微信浏览器打开');}
|
|
|
+
|
|
|
$conf_list = Db::name('paygold_webcon')->order('id asc')->select();
|
|
|
$this->assign('conf_list',$conf_list);
|
|
|
return $this->view->fetch();
|
|
@@ -25,6 +29,12 @@ class Recharge extends Frontend
|
|
|
//创建订单
|
|
|
public function recharge_pc(){
|
|
|
|
|
|
+ //微信不能打开
|
|
|
+ $isWechat = strpos($this->request->server('HTTP_USER_AGENT'), 'MicroMessenger') !== false;
|
|
|
+ if($isWechat)
|
|
|
+ {$this->error('不能在微信浏览器打开');}
|
|
|
+
|
|
|
+ //
|
|
|
$rc_id = input('rc_id',0);
|
|
|
$pay_type = input('pay_type','alipay');
|
|
|
$mobile = input('mobile',0);
|
|
@@ -65,6 +75,13 @@ class Recharge extends Frontend
|
|
|
$gold = bcmul($money,$money_to_gold,0);
|
|
|
}
|
|
|
|
|
|
+ //method
|
|
|
+
|
|
|
+ $payment_method = $pay_type == 'alipay' ? 'web' : 'scan';
|
|
|
+ if($this->request->isMobile()){
|
|
|
+ $payment_method = 'wap';
|
|
|
+ }
|
|
|
+
|
|
|
//创建订单
|
|
|
$data = [];
|
|
|
$data['status'] = 0;
|
|
@@ -76,7 +93,7 @@ class Recharge extends Frontend
|
|
|
$data['ext_info'] = json_encode(['subject'=>'充值金币支付']);
|
|
|
$data['memo'] = '充值金币支付';
|
|
|
$data['createtime'] = time();
|
|
|
- $data['payment'] = $pay_type == 'alipay' ? 'web' : 'scan';
|
|
|
+ $data['payment'] = $payment_method;
|
|
|
$orderid = Db::name('pay_order')->insertGetId($data);
|
|
|
|
|
|
//创建回调
|
|
@@ -96,7 +113,7 @@ class Recharge extends Frontend
|
|
|
'title' => $data['memo'],
|
|
|
'amount' => $data['money'],
|
|
|
// 'amount' => 0.01,
|
|
|
- 'method' => $pay_type == 'alipay' ? 'web' : 'scan',
|
|
|
+ 'method' => $payment_method,
|
|
|
'notifyurl' => $this->request->root(true) . '/notify.php/paytype/'.$pay_type,
|
|
|
'returnurl' => $this->request->root(true) . '/index/recharge',
|
|
|
];
|