Files
addons
app_download_files
extend
hyhproject
admin
app
common
home
home2
behavior
common
conf
controller
Ads.php
Alipays.php
Areas.php
Base.php
Brands.php
Carts.php
Cashconfigs.php
Cashdraws.php
Error.php
Favorites.php
Goods.php
Goodsappraises.php
Goodscats.php
Goodsconsult.php
Goodsvirtuals.php
Helpcenter.php
Imports.php
Index.php
Informs.php
Invoices.php
Logmoneys.php
Messages.php
News.php
Ordercomplains.php
Orderrefunds.php
Orders.php
Reports.php
Settlements.php
Shopcats.php
Shopconfigs.php
Shopfreights.php
Shoproles.php
Shops.php
Shopusers.php
Switchs.php
Tmp.php
Unionpays.php
Useraddress.php
Users.php
Userscores.php
Wallets.php
Weixinpays.php
model
validate
view
mobile2
wechat2
.htaccess
command.php
mobile
oss
static
thinkphp
upload
vendor
wxtmp
.gitignore
.htaccess
.user.ini
404.html
H5436787D.wgt
admin.php
app-release.apk
app_download.html
cash.lock
demo.php
get_version.php
get_version_new.php
index.html
index.php
reg.lock
robots.txt
qlg.tsgz.moe/hyhproject/home2/controller/Wallets.php
2019-09-06 23:53:10 +08:00

69 lines
1.9 KiB
PHP
Executable File

<?php
namespace wstmart\home\controller;
use wstmart\common\model\Orders as OM;
use wstmart\common\model\Users as UM;
/**
* ============================================================================
* 余额控制器
*/
class Wallets extends Base{
/**
* 生成支付代码
*/
function getWalletsUrl(){
$orderNo = input('orderNo');
$isBatch = (int)input('isBatch');
$base64 = new \org\Base64();
$key = WSTBase64url($base64->encrypt($orderNo."_".$isBatch, "WSTMart"),true);
$data = [];
$data['status'] = 1;
$data['url'] = url('home/wallets/payment','key='.$key,'html',true);
return $data;
}
/**
* 跳去支付页面
*/
public function payment(){
if((int)session('WST_USER.userId')==0){
$this->assign('message',"对不起,您尚未登录,请先登录!");
return $this->fetch('error_msg');
}
$userId = (int)session('WST_USER.userId');
$m = new UM();
$user = $m->getFieldsById($userId,["payPwd"]);
$this->assign('hasPayPwd',($user['payPwd']!="")?1:0);
$key = input('key');
$this->assign('paykey',$key);
$key = WSTBase64url($key,false);
$base64 = new \org\Base64();
$key = $base64->decrypt($key,"WSTMart");
$key = explode('_',$key);
$data = [];
$data['orderNo'] = $key[0];
$data['isBatch'] = (int)$key[1];
$data['userId'] = $userId;
$m = new OM();
$rs = $m->getOrderPayInfo($data);
if(empty($rs)){
$this->assign('message',"您的订单已支付,请勿重复支付~");
return $this->fetch('error_msg');
}else{
$this->assign('needPay',$rs['needPay']);
//获取用户钱包
$user = model('users')->getFieldsById($data['userId'],'userMoney');
$this->assign('userMoney',$user['userMoney']);
return $this->fetch('order_pay_wallets');
}
}
/**
* 钱包支付
*/
public function payByWallet(){
$m = new OM();
return $m->payByWallet();
}
}