You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
247
hyhproject/mobile2/controller/Alipays.php
Executable file
247
hyhproject/mobile2/controller/Alipays.php
Executable file
@ -0,0 +1,247 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use think\Loader;
|
||||
use wstmart\common\model\Payments as M;
|
||||
use wstmart\mobile\model\Orders as OM;
|
||||
use wstmart\common\model\LogPayParams as PM;
|
||||
use wstmart\common\model\ChargeItems as CM;
|
||||
use wstmart\common\model\LogMoneys as LM;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 阿里支付控制器
|
||||
*/
|
||||
class Alipays extends Base{
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
private $alipayConfig;
|
||||
public function _initialize() {
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
Loader::import ( 'alipay.Corefunction' );
|
||||
Loader::import ( 'alipay.Md5function' );
|
||||
Loader::import ( 'alipay.AlipayNotify' );
|
||||
Loader::import ( 'alipay.AlipaySubmit' );
|
||||
$m = new M();
|
||||
$payment = $m->getPayment("alipays");
|
||||
$this->alipayConfig = array(
|
||||
'partner' =>$payment['parterID'], //这里是你在成功申请支付宝接口后获取到的PID;
|
||||
'key'=>$payment['parterKey'],//这里是你在成功申请支付宝接口后获取到的Key
|
||||
'seller_email'=>$payment['payAccount'],
|
||||
'sign_type'=>strtoupper('MD5'),
|
||||
'input_charset'=> strtolower('utf-8'),
|
||||
'cacert'=>'',
|
||||
'transport'=> 'http'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付宝支付跳转方法
|
||||
*/
|
||||
public function toAliPay(){
|
||||
|
||||
$payObj = input("payObj/s");
|
||||
|
||||
$call_back_url = "";
|
||||
$notify_url = "";
|
||||
$subject = "";
|
||||
$total_fee = 0;
|
||||
$transId = 0;
|
||||
$userId = 0;
|
||||
$payParams = array();
|
||||
if($payObj=="recharge"){//充值
|
||||
$itemId = (int)input("itemId/d");
|
||||
$orderAmount = 0;
|
||||
if($itemId>0){
|
||||
$cm = new CM();
|
||||
$item = $cm->getItemMoney($itemId);
|
||||
$total_fee = isSet($item["chargeMoney"])?$item["chargeMoney"]:0;
|
||||
}else{
|
||||
$total_fee = (int)input("needPay/d");
|
||||
}
|
||||
|
||||
$shopId = (int)session('WST_USER.shopId');
|
||||
$targetType = ($shopId>0)?1:0;
|
||||
$targetId = (int)session('WST_USER.userId');
|
||||
if($targetType==1){//商家
|
||||
$targetId = $shopId;
|
||||
}
|
||||
$userId = $targetId;
|
||||
$out_trade_no = WSTOrderNo();
|
||||
$transId = $out_trade_no;
|
||||
$payParams["targetId"] = $targetId;
|
||||
$payParams["targetType"] = $targetType;
|
||||
$payParams["itemId"] = $itemId;
|
||||
$payParams["payObj"] = $payObj;
|
||||
|
||||
$call_back_url = url("mobile/users/index","",true,true);
|
||||
$notify_url = url("mobile/alipays/aliNotify","",true,true);
|
||||
$subject = '钱包充值';
|
||||
}else{
|
||||
$orderNo = input('orderNo');
|
||||
$isBatch = (int)input('isBatch');
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$m = new OM();
|
||||
$obj = array();
|
||||
$obj["userId"] = $userId;
|
||||
$obj["orderNo"] = input("orderNo/s");
|
||||
$obj["isBatch"] = (int)input("isBatch/d");
|
||||
$rs = $m->getOrderPayInfo($obj);
|
||||
if(empty($rs)){
|
||||
$this->assign('type','');
|
||||
return $this->fetch("users/orders/orders_list");
|
||||
}else{
|
||||
$m = new M();
|
||||
$om = new OM();
|
||||
$data = $om->checkOrderPay($obj);
|
||||
if($data["status"]==-1){
|
||||
echo "<span style='font-size:40px;'>您的订单已支付,不要重复支付!</span>";
|
||||
return;
|
||||
}else if($data["status"]==-2){
|
||||
echo "<span style='font-size:40px;'>您的订单因商品库存不足,不能支付!</span>";
|
||||
return;
|
||||
}
|
||||
}
|
||||
$order = $om->getPayOrders($obj);
|
||||
$total_fee = $order["needPay"];
|
||||
$payRand = $order["payRand"];
|
||||
$out_trade_no = $obj["orderNo"]."a".$payRand;
|
||||
$transId = $obj["orderNo"];
|
||||
|
||||
$payParams["userId"] = $userId;
|
||||
$payParams["isBatch"] = $isBatch;
|
||||
$payParams["orderNo"] = $orderNo;
|
||||
|
||||
$call_back_url = url("mobile/orders/index","",true,true);
|
||||
$notify_url = url("mobile/alipays/aliNotify","",true,true);
|
||||
$subject = '支付购买商品费用';
|
||||
}
|
||||
|
||||
$format = "xml";
|
||||
$v = "2.0";
|
||||
$req_id = date('Ymdhis');
|
||||
$merchant_url = "";
|
||||
$seller_email = $this->alipayConfig['seller_email'];
|
||||
|
||||
$req_data = '<direct_trade_create_req><notify_url>' . $notify_url . '</notify_url><call_back_url>' . $call_back_url . '</call_back_url><seller_account_name>' . $seller_email . '</seller_account_name><out_trade_no>' . $out_trade_no . '</out_trade_no><subject>' . $subject . '</subject><total_fee>' . $total_fee . '</total_fee><merchant_url>' . $merchant_url . '</merchant_url></direct_trade_create_req>';
|
||||
|
||||
//构造要请求的参数数组,无需改动
|
||||
$para_token = array(
|
||||
"service" => "alipay.wap.trade.create.direct",
|
||||
"partner" => trim($this->alipayConfig['partner']),
|
||||
"sec_id" => trim($this->alipayConfig['sign_type']),
|
||||
"format" => $format,
|
||||
"v" => $v,
|
||||
"req_id" => $req_id,
|
||||
"req_data" => $req_data,
|
||||
"_input_charset" => trim(strtolower($this->alipayConfig['input_charset']))
|
||||
);
|
||||
//建立请求
|
||||
$alipaySubmit = new \AlipaySubmit($this->alipayConfig);
|
||||
$html_text = $alipaySubmit->buildRequestHttp($para_token);
|
||||
//URLDECODE返回的信息
|
||||
$html_text = urldecode($html_text);
|
||||
//解析远程模拟提交后返回的信息
|
||||
$para_html_text = $alipaySubmit->parseResponse($html_text);
|
||||
//获取request_token
|
||||
$request_token = $para_html_text['request_token'];
|
||||
//**************************根据授权码token调用交易接口alipay.wap.auth.authAndExecute**************************
|
||||
//业务详细
|
||||
$req_data = '<auth_and_execute_req><request_token>' . $request_token . '</request_token></auth_and_execute_req>';
|
||||
//必填
|
||||
|
||||
//构造要请求的参数数组,无需改动
|
||||
$parameter = array(
|
||||
"service" => "alipay.wap.auth.authAndExecute",
|
||||
"partner" => trim($this->alipayConfig['partner']),
|
||||
"sec_id" => trim($this->alipayConfig['sign_type']),
|
||||
"format" => $format,
|
||||
"v" => $v,
|
||||
"req_id" => $req_id,
|
||||
"req_data" => $req_data,
|
||||
"_input_charset" => trim(strtolower($this->alipayConfig['input_charset']))
|
||||
);
|
||||
|
||||
$data = array();
|
||||
$data["userId"] = $userId;
|
||||
$data["transId"] = $transId;
|
||||
$data["paramsVa"] = json_encode($payParams);
|
||||
$data["payFrom"] = 'alipays';
|
||||
$m = new PM();
|
||||
$m->addPayLog($data);
|
||||
|
||||
//建立请求
|
||||
$alipaySubmit = new \AlipaySubmit($this->alipayConfig);
|
||||
$html_text = $alipaySubmit->buildRequestForm($parameter, 'get', '');
|
||||
echo $html_text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务器异步通知页面方法
|
||||
*
|
||||
*/
|
||||
function aliNotify() {
|
||||
$om = new OM();
|
||||
// 计算得出通知验证结果
|
||||
$alipayNotify = new \AlipayNotify ( $this->alipayConfig );
|
||||
$verify_result = $alipayNotify->verifyNotify ();
|
||||
|
||||
if ($verify_result) {
|
||||
$notify_data = $_POST['notify_data'];
|
||||
// 获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表
|
||||
// 解析notify_data
|
||||
// 注意:该功能PHP5环境及以上支持,需开通curl、SSL等PHP配置环境。建议本地调试时使用PHP开发软件
|
||||
$doc = new \DOMDocument ();
|
||||
$doc->loadXML ( $notify_data );
|
||||
if (! empty ( $doc->getElementsByTagName ( "notify" )->item ( 0 )->nodeValue )) {
|
||||
// 交易号
|
||||
$trade_no = $doc->getElementsByTagName ( "trade_no" )->item ( 0 )->nodeValue;
|
||||
// 商户订单号
|
||||
$out_trade_no = $doc->getElementsByTagName ( "out_trade_no" )->item ( 0 )->nodeValue;
|
||||
|
||||
$total_fee = $doc->getElementsByTagName( "total_fee" )->item(0)->nodeValue;
|
||||
// 支付宝交易号
|
||||
$trade_no = $doc->getElementsByTagName ( "trade_no" )->item ( 0 )->nodeValue;
|
||||
// 交易状态
|
||||
$trade_status = $doc->getElementsByTagName ( "trade_status" )->item ( 0 )->nodeValue;
|
||||
if ($trade_status == 'TRADE_FINISHED' OR $trade_status == 'TRADE_SUCCESS') {
|
||||
$obj["trade_no"] = $trade_no;
|
||||
$tradeNo = explode("a",$out_trade_no);
|
||||
|
||||
$obj["out_trade_no"] = $tradeNo[0];
|
||||
$obj["payFrom"] = 'alipays';
|
||||
$obj["total_fee"] = $total_fee;
|
||||
|
||||
$m = new PM();
|
||||
$payParams = $m->getPayLog(["transId"=>$obj["out_trade_no"]]);
|
||||
if(isSet($payParams["payObj"]) && $payParams["payObj"]=='recharge'){
|
||||
|
||||
$obj["targetId"] = $payParams["targetId"];
|
||||
$obj["targetType"] = $payParams["targetType"];
|
||||
$obj["itemId"] = $payParams["itemId"];;
|
||||
// 支付成功业务逻辑
|
||||
$m = new LM();
|
||||
$rs = $m->complateRecharge ( $obj );
|
||||
}else{
|
||||
//$payFrom = $om->getOrderPayFrom($tradeNo[0]);
|
||||
$obj["userId"] = $payParams["userId"];
|
||||
$obj["isBatch"] = $payParams["isBatch"];
|
||||
//支付成功业务逻辑
|
||||
$rs = $om->complatePay($obj);
|
||||
}
|
||||
|
||||
if($rs["status"]==1){
|
||||
echo 'success';
|
||||
}else{
|
||||
echo 'fail';
|
||||
}
|
||||
}
|
||||
//echo "success"; // 请不要修改或删除
|
||||
}
|
||||
} else {
|
||||
// 验证失败
|
||||
echo "fail";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
17
hyhproject/mobile2/controller/Areas.php
Executable file
17
hyhproject/mobile2/controller/Areas.php
Executable file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\Areas as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 地区控制器
|
||||
*/
|
||||
class Areas extends Base{
|
||||
/**
|
||||
* 列表查询
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->listQuery();
|
||||
return WSTReturn('', 1,$rs);
|
||||
}
|
||||
}
|
71
hyhproject/mobile2/controller/Base.php
Executable file
71
hyhproject/mobile2/controller/Base.php
Executable file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use think\Controller;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 基础控制器
|
||||
*/
|
||||
class Base extends Controller {
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
WSTConf('CONF',WSTConfig());
|
||||
$this->assign("v",WSTConf('CONF.wstVersion')."_".WSTConf('CONF.wstPcStyleId'));
|
||||
|
||||
if(WSTConf('CONF.seoMallSwitch')==0){
|
||||
$this->redirect('mobile/switchs/index');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
// 权限验证方法
|
||||
protected function checkAuth(){
|
||||
$USER = session('WST_USER');
|
||||
if(empty($USER)){
|
||||
if(request()->isAjax()){
|
||||
die('{"status":-999,"msg":"您还未登录"}');
|
||||
}else{
|
||||
$this->redirect('mobile/users/login');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 店铺权限验证方法
|
||||
protected function checkShopAuth($opt){
|
||||
$shopMenus = WSTShopOrderMenus();
|
||||
if($opt=="list"){
|
||||
if(count($shopMenus)==0){
|
||||
session('moshoporder','对不起,您无权进行该操作');
|
||||
$this->redirect('mobile/error/message',['code'=>'moshoporder']);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
if(!array_key_exists($opt,$shopMenus)){
|
||||
if(request()->isAjax()){
|
||||
die('{"status":-1,"msg":"您无权进行该操作"}');
|
||||
}else{
|
||||
session('moshoporder','对不起,您无权进行该操作');
|
||||
$this->redirect('mobile/error/message',['code'=>'moshoporder']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected function fetch($template = '', $vars = [], $replace = [], $config = []){
|
||||
$style = WSTConf('CONF.wstmobileStyle')?WSTConf('CONF.wstmobileStyle'):'default';
|
||||
$replace['__MOBILE__'] = str_replace('/index.php','',\think\Request::instance()->root()).'/hyhproject/mobile/view/'.$style;
|
||||
return $this->view->fetch($style."/".$template, $vars, $replace, $config);
|
||||
|
||||
}
|
||||
/**
|
||||
* 上传图片
|
||||
*/
|
||||
public function uploadPic(){
|
||||
return WSTUploadPic(0);
|
||||
}
|
||||
/**
|
||||
* 获取验证码
|
||||
*/
|
||||
public function getVerify(){
|
||||
WSTVerify();
|
||||
}
|
||||
}
|
26
hyhproject/mobile2/controller/Brands.php
Executable file
26
hyhproject/mobile2/controller/Brands.php
Executable file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\Brands as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 品牌控制器
|
||||
*/
|
||||
class Brands extends Base{
|
||||
/**
|
||||
* 主页
|
||||
*/
|
||||
public function index(){
|
||||
return $this->fetch('brands');
|
||||
}
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery(input('pagesize/d'));
|
||||
foreach ($rs['Rows'] as $key =>$v){
|
||||
$rs['Rows'][$key]['brandImg'] = WSTImg($v['brandImg'],2);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
}
|
152
hyhproject/mobile2/controller/Carts.php
Executable file
152
hyhproject/mobile2/controller/Carts.php
Executable file
@ -0,0 +1,152 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\Carts as M;
|
||||
use wstmart\common\model\UserAddress;
|
||||
use wstmart\common\model\Payments;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 购物车控制器
|
||||
*/
|
||||
class Carts extends Base{
|
||||
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth'
|
||||
];
|
||||
/**
|
||||
* 批量修改购物车状态
|
||||
*/
|
||||
public function batchChangeCartGoods(){
|
||||
$m = new M();
|
||||
return $m->batchChangeCartGoods();
|
||||
}
|
||||
/**
|
||||
* 查看购物车列表
|
||||
*/
|
||||
public function index(){
|
||||
$m = new M();
|
||||
$carts = $m->getCarts(false);
|
||||
$this->assign('carts',$carts);
|
||||
return $this->fetch('carts');
|
||||
}
|
||||
/**
|
||||
* 加入购物车
|
||||
*/
|
||||
public function addCart(){
|
||||
$m = new M();
|
||||
$rs = $m->addCart();
|
||||
$rs['cartNum'] = WSTCartNum();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 修改购物车商品状态
|
||||
*/
|
||||
public function changeCartGoods(){
|
||||
$m = new M();
|
||||
$rs = $m->changeCartGoods();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 删除购物车里的商品
|
||||
*/
|
||||
public function delCart(){
|
||||
$m = new M();
|
||||
$rs= $m->delCart();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 计算运费、惠宝和总商品价格
|
||||
*/
|
||||
public function getCartMoney(){
|
||||
$m = new M();
|
||||
$data = $m->getCartMoney();
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* 计算运费、惠宝和总商品价格/虚拟商品
|
||||
*/
|
||||
public function getQuickCartMoney(){
|
||||
$m = new M();
|
||||
$data = $m->getQuickCartMoney();
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* 跳去购物车结算页面
|
||||
*/
|
||||
public function settlement(){
|
||||
$m = new M();
|
||||
//获取一个用户地址
|
||||
$addressId = (int)input('addressId');
|
||||
$ua = new UserAddress();
|
||||
if($addressId>0){
|
||||
$userAddress = $ua->getById($addressId);
|
||||
}else{
|
||||
$userAddress = $ua->getDefaultAddress();
|
||||
}
|
||||
$this->assign('userAddress',$userAddress);
|
||||
//获取支付方式
|
||||
$pa = new Payments();
|
||||
$payments = $pa->getByGroup('2');
|
||||
$areaId2 = isset($userAddress['areaId2']) ? $userAddress['areaId2'] : 0;
|
||||
//dump($payments);
|
||||
//获取已选的购物车商品
|
||||
$carts = $m->getCarts(true, 0, $areaId2);
|
||||
|
||||
//hook("mobileControllerCartsSettlement",["carts"=>$carts,"payments"=>&$payments]);
|
||||
//ect整合相关优惠还有判断不能和在线支付商品一块
|
||||
// hook("ectIntegration",["carts"=>&$carts,'isSettlement'=>false,'uId'=>(int)session('WST_USER.userId')]);
|
||||
$this->assign('payments',$payments);
|
||||
//获取用户惠宝
|
||||
$user = model('users')->getFieldsById((int)session('WST_USER.userId'),'userScore');
|
||||
//计算可用惠宝和金额
|
||||
$goodsTotalMoney = (int)(($carts['goodsTotalMoney'] - $carts['promotionMoney'] - $carts['allShippingMoney']) * HuiScale());//$carts['goodsTotalMoney']; 惠宝最多可抵用20% mark 20170907
|
||||
$goodsTotalScore = WSTScoreToMoney($goodsTotalMoney,true);
|
||||
|
||||
$useOrderScore =0;
|
||||
$useOrderMoney = 0;
|
||||
if($user['userScore']>$goodsTotalScore){
|
||||
$useOrderScore = $goodsTotalScore;
|
||||
$useOrderMoney = $goodsTotalMoney;
|
||||
}else{
|
||||
$useOrderScore = $user['userScore'];
|
||||
$useOrderMoney = WSTScoreToMoney($useOrderScore);
|
||||
}
|
||||
$this->assign('userOrderScore',$useOrderScore);
|
||||
$this->assign('userOrderMoney',$useOrderMoney);
|
||||
|
||||
$this->assign('carts',$carts);
|
||||
return $this->fetch('settlement');
|
||||
}
|
||||
/**
|
||||
* 跳去虚拟商品购物车结算页面
|
||||
*/
|
||||
public function quickSettlement(){
|
||||
$m = new M();
|
||||
//获取支付方式
|
||||
$pa = new Payments();
|
||||
$payments = $pa->getByGroup('2');
|
||||
$this->assign('payments',$payments);
|
||||
//获取用户惠宝
|
||||
$user = model('users')->getFieldsById((int)session('WST_USER.userId'),'userScore');
|
||||
//获取已选的购物车商品
|
||||
$carts = $m->getQuickCarts();
|
||||
//计算可用惠宝和金额
|
||||
$goodsTotalMoney = (int)($carts['goodsTotalMoney'] * HuiScale());//$carts['goodsTotalMoney']; 惠宝最多可抵用20% mark 20170907
|
||||
$goodsTotalScore = WSTScoreToMoney($goodsTotalMoney,true);
|
||||
|
||||
$useOrderScore =0;
|
||||
$useOrderMoney = 0;
|
||||
if($user['userScore']>$goodsTotalScore){
|
||||
$useOrderScore = $goodsTotalScore;
|
||||
$useOrderMoney = $goodsTotalMoney;
|
||||
}else{
|
||||
$useOrderScore = $user['userScore'];
|
||||
$useOrderMoney = WSTScoreToMoney($useOrderScore);
|
||||
}
|
||||
$this->assign('userOrderScore',$useOrderScore);
|
||||
$this->assign('userOrderMoney',$useOrderMoney);
|
||||
|
||||
$this->assign('carts',$carts);
|
||||
return $this->fetch('settlement_quick');
|
||||
}
|
||||
}
|
54
hyhproject/mobile2/controller/Cashconfigs.php
Executable file
54
hyhproject/mobile2/controller/Cashconfigs.php
Executable file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 提现账号控制器
|
||||
*/
|
||||
class Cashconfigs extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth',
|
||||
];
|
||||
/**
|
||||
* 查看提现账号
|
||||
*/
|
||||
public function index(){
|
||||
$this->assign('area',model('areas')->listQuery(0));
|
||||
$this->assign('banks',model('banks')->listQuery(0));
|
||||
return $this->fetch('users/cashconfigs/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户数据
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$data = model('CashConfigs')->pageQuery(0,$userId);
|
||||
return WSTReturn("", 1,$data);
|
||||
}
|
||||
/**
|
||||
* 获取记录
|
||||
*/
|
||||
public function getById(){
|
||||
$id = (int)input('id');
|
||||
return model('CashConfigs')->getById($id);
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
return model('CashConfigs')->add();
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
public function edit(){
|
||||
return model('CashConfigs')->edit();
|
||||
}
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public function del(){
|
||||
return model('CashConfigs')->del();
|
||||
}
|
||||
}
|
34
hyhproject/mobile2/controller/Cashdraws.php
Executable file
34
hyhproject/mobile2/controller/Cashdraws.php
Executable file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 提现记录控制器
|
||||
*/
|
||||
class Cashdraws extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth',
|
||||
];
|
||||
/**
|
||||
* 查看用户提现记录
|
||||
*/
|
||||
public function index(){
|
||||
return $this->fetch('users/cashdraws/list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户数据
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$data = model('CashDraws')->pageQuery(0,$userId);
|
||||
return WSTReturn("", 1,$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现
|
||||
*/
|
||||
public function drawMoney(){
|
||||
return model('CashDraws')->drawMoney();
|
||||
}
|
||||
}
|
75
hyhproject/mobile2/controller/Demo.php
Executable file
75
hyhproject/mobile2/controller/Demo.php
Executable file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
//use wstmart\common\model\Demo as M;
|
||||
//use think\Loader;
|
||||
//use think\Db;
|
||||
//require_once(ROOT_PATH.'../php/lib/XS.php');
|
||||
/**
|
||||
* ============================================================================
|
||||
* 地区控制器
|
||||
*/
|
||||
class Demo extends Base{
|
||||
/**
|
||||
* 列表查询
|
||||
*/
|
||||
public function index(){
|
||||
//Loader::import ( 'php.lib.XS' );
|
||||
$xs = new \XS('goods');
|
||||
//$doc = new \XSDocument; // 自动使用 $prefix/sdk/php/app/demo.ini 作项目配置文件
|
||||
$data = array(
|
||||
'goodsId' => 6666667, // 此字段为主键,是进行文档替换的唯一标识
|
||||
'goodsName' => '测鞋子的标题'
|
||||
);
|
||||
//$doc->setFields($data);
|
||||
// $index = $xs->index; // 获取 索引对象
|
||||
// //$index->del(array('6666666', '6666667')); // 同时删除主键值为 123, 789, 456 的记录
|
||||
// //添加到索引数据库中
|
||||
// $index->add($doc);
|
||||
|
||||
|
||||
// // 创建文档对象
|
||||
// $xs = new \XS('goods');
|
||||
|
||||
// $info = $xs->search->search('苹果');
|
||||
// //echo $info->goodsName;
|
||||
// //dump($info);
|
||||
// foreach ($info as $key => $v) {
|
||||
// $data[$key]['goodsId'] = $v['goodsId'];
|
||||
// $data[$key]['goodsName'] = $v['goodsName'];
|
||||
// }
|
||||
//dump($data);
|
||||
}
|
||||
public function search(){
|
||||
|
||||
//'select * form hyh_ads a where a.adPositionId in (select positionId from hyh_ad_positions where positionCode='mo-ads-index' ) '
|
||||
//$ads_list = Db::name('ads')->where(['adPositionId'=>291,'dataFlag'=>1])->order('adSort asc')->select();
|
||||
//dump($ads_list);
|
||||
|
||||
//$m = new Demo();
|
||||
//$brand_list = $m->getBrandList();
|
||||
//dump($brand_list);
|
||||
|
||||
|
||||
$keyword = input('keyword');
|
||||
$shopId = (int)input('shopId');
|
||||
//$xs = new \XS('goods');
|
||||
$search = 'goodsName:'.$keyword;
|
||||
if($shopId){
|
||||
$search.=' goodsId:'.$shopId;
|
||||
}
|
||||
$info = $xs->search->getField('goodsId')->search($search);
|
||||
//$info = $xs->search->search($keyword);
|
||||
foreach ($info as $key => $v) {//把返回的数据转换为数组
|
||||
$data[$key]['goodsId'] = $v['goodsId'];
|
||||
$data[$key]['goodsName'] = $v['goodsName'];
|
||||
}
|
||||
if($data){
|
||||
exit(jsonReturn('调用成功',1,$data));
|
||||
}
|
||||
exit(jsonReturn('调用失败',-1));
|
||||
}
|
||||
// public function getBrandList(){
|
||||
// return Db::name('brands')->where('dataFlag=1')->select();
|
||||
|
||||
// }
|
||||
}
|
21
hyhproject/mobile2/controller/Error.php
Executable file
21
hyhproject/mobile2/controller/Error.php
Executable file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 错误处理控制器
|
||||
*/
|
||||
class Error extends Base{
|
||||
public function index(){
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
return $this->fetch('error_sys');
|
||||
}
|
||||
public function message(){
|
||||
$code = input('code');
|
||||
if($code !== null && session($code)!=''){
|
||||
$this->assign('message',session($code));
|
||||
}else{
|
||||
$this->assign('message','操作错误,请联系商城管理员');
|
||||
}
|
||||
return $this->fetch('error_lost');
|
||||
}
|
||||
}
|
68
hyhproject/mobile2/controller/Favorites.php
Executable file
68
hyhproject/mobile2/controller/Favorites.php
Executable file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\Favorites as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 收藏控制器
|
||||
*/
|
||||
class Favorites extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth',
|
||||
];
|
||||
/**
|
||||
* 关注的商品
|
||||
*/
|
||||
public function goods(){
|
||||
return $this->fetch('users/favorites/list_goods');
|
||||
}
|
||||
/**
|
||||
* 关注的店铺
|
||||
*/
|
||||
public function shops(){
|
||||
return $this->fetch('users/favorites/list_shops');
|
||||
}
|
||||
/**
|
||||
* 关注的商品列表
|
||||
*/
|
||||
public function listGoodsQuery(){
|
||||
$m = new M();
|
||||
$data = $m->listGoodsQuery();
|
||||
foreach($data['Rows'] as $k=>$v){
|
||||
$data['Rows'][$k]['goodsImg'] = WSTImg($v['goodsImg'],3);
|
||||
}
|
||||
return WSTReturn("", 1,$data);
|
||||
}
|
||||
/**
|
||||
* 关注的店铺列表
|
||||
*/
|
||||
public function listShopQuery(){
|
||||
$m = new M();
|
||||
$data = $m->listShopQuery();
|
||||
foreach($data['Rows'] as $k=>$v){
|
||||
$data['Rows'][$k]['shopImg'] = WSTImg($v['shopImg'],3);
|
||||
if(!empty($v['goods'])){
|
||||
foreach($v['goods'] as $k1=>$v1){
|
||||
$v[$k1]['goodsImg'] = WSTImg($v1['goodsImg'],3);
|
||||
}
|
||||
}
|
||||
}
|
||||
return WSTReturn("", 1,$data);
|
||||
}
|
||||
/**
|
||||
* 取消关注
|
||||
*/
|
||||
public function cancel(){
|
||||
$m = new M();
|
||||
$rs = $m->del();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 增加关注
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
$rs = $m->add();
|
||||
return $rs;
|
||||
}
|
||||
}
|
108
hyhproject/mobile2/controller/Goods.php
Executable file
108
hyhproject/mobile2/controller/Goods.php
Executable file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\GoodsCats;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商品控制器
|
||||
*/
|
||||
class Goods extends Base{
|
||||
/**
|
||||
* 商品主页
|
||||
*/
|
||||
public function detail(){
|
||||
$m = model('goods');
|
||||
$goods = $m->getBySale(input('goodsId/d'));
|
||||
$key=input('key');
|
||||
hook('mobileControllerGoodsIndex',['getParams'=>input()]);
|
||||
|
||||
|
||||
// 找不到商品记录
|
||||
if(empty($goods))return $this->fetch('error_lost');
|
||||
//判断是否药品
|
||||
$goods_cat=strpos($goods['goodsCatIdPath'],'389');
|
||||
if($goods_cat!==false && $key==''){
|
||||
return $this->fetch("error_lost");
|
||||
}
|
||||
//记录用户浏览商品
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
if($userId){
|
||||
$data['userId']=$userId;
|
||||
$data['goodsId']=$goods['goodsId'];
|
||||
$data['path']='2';
|
||||
$data['create_time']=time();
|
||||
$result=db('page_view')->insert($data);
|
||||
}
|
||||
$goods['goodsDesc']=htmlspecialchars_decode($goods['goodsDesc']);
|
||||
$rule = '/<img src=".*?\/(upload.*?)"/';
|
||||
preg_match_all($rule, $goods['goodsDesc'], $images);
|
||||
foreach($images[0] as $k=>$v){
|
||||
|
||||
$goods['goodsDesc'] = str_replace('/'.$images[1][$k], '__IMGURL__/'.WSTConf("CONF.goodsLogo") . "\" data-echo=\"__IMGURL__/".WSTImg($images[1][$k],2), $goods['goodsDesc']);
|
||||
}
|
||||
if(!empty($goods)){
|
||||
$history = cookie("wx_history_goods");
|
||||
$history = is_array($history)?$history:[];
|
||||
array_unshift($history, (string)$goods['goodsId']);
|
||||
$history = array_values(array_unique($history));
|
||||
if(!empty($history)){
|
||||
cookie("wx_history_goods",$history,25920000);
|
||||
}
|
||||
}
|
||||
$goods['consult'] = model('GoodsConsult')->firstQuery($goods['goodsId']);
|
||||
$goods['appraises'] = model('GoodsAppraises')->getGoodsEachApprNum($goods['goodsId']);
|
||||
hook('afterGetGoods',['params'=>&$goods]);
|
||||
$goods['is_seckilling']=isset($goods['is_seckilling'])?$goods['is_seckilling']:0;
|
||||
//hook('afterGetGoods',['params'=>&$goods]);
|
||||
$this->assign("info", $goods);
|
||||
return $this->fetch('goods_detail');
|
||||
}
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
public function lists(){
|
||||
$this->assign("keyword", input('keyword'));
|
||||
$this->assign("catId", input('catId/d'));
|
||||
$this->assign("brandId", input('brandId/d'));
|
||||
return $this->fetch('goods_list');
|
||||
}
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = model('goods');
|
||||
$gc = new GoodsCats();
|
||||
$catId = (int)input('catId');
|
||||
if($catId>0){
|
||||
$goodsCatIds = $gc->getParentIs($catId);
|
||||
}else{
|
||||
$goodsCatIds = [];
|
||||
}
|
||||
$rs = $m->pageQuery($goodsCatIds);
|
||||
foreach ($rs['Rows'] as $key =>$v){
|
||||
$rs['Rows'][$key]['goodsImg'] = WSTImg($v['goodsImg'],2);
|
||||
$rs['Rows'][$key]['praiseRate'] = ($v['totalScore']>0)?(sprintf("%.2f",$v['totalScore']/($v['totalUsers']*15))*100).'%':'100%';
|
||||
}
|
||||
// `券`标签
|
||||
hook('afterQueryGoods',['page'=>&$rs]);
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 浏览历史页面
|
||||
*/
|
||||
public function history(){
|
||||
return $this->fetch('users/history/list');
|
||||
}
|
||||
/**
|
||||
* 获取浏览历史
|
||||
*/
|
||||
public function historyQuery(){
|
||||
$rs = model('goods')->historyQuery();
|
||||
if(!empty($rs)){
|
||||
foreach($rs['Rows'] as $k=>$v){
|
||||
$rs['Rows'][$k]['goodsImg'] = WSTImg($v['goodsImg'],3);
|
||||
}
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
}
|
44
hyhproject/mobile2/controller/Goodsappraises.php
Executable file
44
hyhproject/mobile2/controller/Goodsappraises.php
Executable file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\GoodsAppraises as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 评价控制器
|
||||
*/
|
||||
class GoodsAppraises extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth' => ['except'=>'getbyid'],// 只要访问only下的方法才才需要执行前置操作
|
||||
];
|
||||
/**
|
||||
* 根据商品id获取评论
|
||||
*/
|
||||
public function getById(){
|
||||
$m = new M();
|
||||
$rs = $m->getById();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 根据订单id,用户id,商品id获取评价
|
||||
*/
|
||||
public function getAppr(){
|
||||
$m = model('GoodsAppraises');
|
||||
$rs = $m->getAppr();
|
||||
if(!empty($rs['data']['images'])){
|
||||
$imgs = explode(',',$rs['data']['images']);
|
||||
foreach($imgs as $k=>$v){
|
||||
$imgs[$k] = WSTImg($v,1);
|
||||
}
|
||||
$rs['data']['images'] = $imgs;
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 添加评价
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
$rs = $m->add();
|
||||
return $rs;
|
||||
}
|
||||
}
|
18
hyhproject/mobile2/controller/Goodscats.php
Executable file
18
hyhproject/mobile2/controller/Goodscats.php
Executable file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\mobile\model\GoodsCats as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商品分类控制器
|
||||
*/
|
||||
class GoodsCats extends Base{
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public function index(){
|
||||
$m = new M();
|
||||
$goodsCatList = $m->getGoodsCats();
|
||||
$this->assign('list',$goodsCatList);
|
||||
return $this->fetch('goods_category');
|
||||
}
|
||||
}
|
35
hyhproject/mobile2/controller/Goodsconsult.php
Executable file
35
hyhproject/mobile2/controller/Goodsconsult.php
Executable file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\GoodsConsult as CG;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商品咨询控制器
|
||||
*/
|
||||
class GoodsConsult extends Base{
|
||||
/**
|
||||
* 商品咨询页
|
||||
*/
|
||||
public function index(){
|
||||
$this->assign('goodsId',(int)input('goodsId'));
|
||||
return $this->fetch('goodsconsult/list');
|
||||
}
|
||||
/**
|
||||
* 根据商品id获取商品咨询
|
||||
*/
|
||||
public function listQuery(){
|
||||
$m = new CG();
|
||||
return $m->listQuery();
|
||||
}
|
||||
/**
|
||||
* 发布商品咨询页
|
||||
*/
|
||||
public function consult(){
|
||||
$this->assign('goodsId',(int)input('goodsId'));
|
||||
return $this->fetch('goodsconsult/consult');
|
||||
}
|
||||
public function add(){
|
||||
$m = new CG();
|
||||
return $m->add();
|
||||
}
|
||||
|
||||
}
|
83
hyhproject/mobile2/controller/Index.php
Executable file
83
hyhproject/mobile2/controller/Index.php
Executable file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\mobile\model\Index as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 默认控制器
|
||||
*/
|
||||
class Index extends Base{
|
||||
/**
|
||||
* 首页
|
||||
*/
|
||||
public function index(){
|
||||
$m = new M();
|
||||
hook('mobileControllerIndexIndex',['getParams'=>input()]);
|
||||
|
||||
//秒杀商品
|
||||
// $now_time = time(); //当前时间
|
||||
// if(is_int($now_time/7200)){ //双整点时间,如:10:00, 12:00
|
||||
// $start_time = $now_time;
|
||||
// }else{
|
||||
// $start_time = floor($now_time/7200)*7200; //取得前一个双整点时间
|
||||
// }
|
||||
// $end_time = $start_time+7200; //结束时间
|
||||
|
||||
$year = date("Y");
|
||||
$month = date("m");
|
||||
$day = date("d");
|
||||
$start_time = mktime(8,0,0,$month,$day,$year);//当天开始时间戳
|
||||
$end_time= mktime(20,0,0,$month,$day,$year);//当天结束时间戳
|
||||
$this->assign('start_time',$start_time);
|
||||
$this->assign('end_time',$end_time);
|
||||
|
||||
$news = $m->getSysMsg('msg');
|
||||
$this->assign('news',$news);
|
||||
$ads['count'] = count(model("common/Tags")->listAds("mo-ads-index",99,86400));
|
||||
$ads['width'] = 'width:'.$ads['count'].'00%';
|
||||
$this->assign("ads", $ads);
|
||||
return $this->fetch('index');
|
||||
}
|
||||
/**
|
||||
* 楼层
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery();
|
||||
if(isset($rs['goods'])){
|
||||
foreach ($rs['goods'] as $key =>$v){
|
||||
$rs['goods'][$key]['goodsImg'] = WSTImg($v['goodsImg'],2);
|
||||
}
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 猜你喜欢
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function guess_like(){
|
||||
$m = new M();
|
||||
$rs = $m->guess_like();
|
||||
if(isset($rs['goods'])){
|
||||
foreach ($rs['goods'] as $key =>$v){
|
||||
$rs['goods'][$key]['goodsImg'] = WSTImg($v['goodsImg'],2);
|
||||
}
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 转换url
|
||||
*/
|
||||
public function transfor(){
|
||||
$data = input('param.');
|
||||
$url = $data['url'];
|
||||
unset($data['url']);
|
||||
echo Url($url,$data);
|
||||
}
|
||||
/**
|
||||
* 跳去登录之前的地址
|
||||
*/
|
||||
public function sessionAddress(){
|
||||
session('WST_MO_WlADDRESS',input('url'));
|
||||
return WSTReturn("", 1);
|
||||
}
|
||||
}
|
31
hyhproject/mobile2/controller/Invoices.php
Executable file
31
hyhproject/mobile2/controller/Invoices.php
Executable file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\Invoices as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 发票信息控制器
|
||||
*/
|
||||
class Invoices extends Base{
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
$rs = $m->pageQuery(5);// 移动版只显示5条发票信息
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
public function add(){
|
||||
$m = new M();
|
||||
return $m->add();
|
||||
}
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
public function edit(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
}
|
15
hyhproject/mobile2/controller/Juhui.php
Executable file
15
hyhproject/mobile2/controller/Juhui.php
Executable file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 默认控制器
|
||||
*/
|
||||
class Juhui extends Base{
|
||||
/**
|
||||
* 首页
|
||||
*/
|
||||
public function index(){
|
||||
return $this->fetch('juhui');
|
||||
}
|
||||
|
||||
}
|
61
hyhproject/mobile2/controller/Logmoneys.php
Executable file
61
hyhproject/mobile2/controller/Logmoneys.php
Executable file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 资金流水控制器
|
||||
*/
|
||||
class Logmoneys extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth'
|
||||
];
|
||||
/**
|
||||
* 查看用户资金流水
|
||||
*/
|
||||
public function usermoneys(){
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$rs = model('Users')->getFieldsById($userId,['lockMoney','userMoney','payPwd']);
|
||||
$rs['isSetPayPwd'] = ($rs['payPwd']=='')?0:1;
|
||||
unset($rs['payPwd']);
|
||||
$rs['num'] = count(model('cashConfigs')->listQuery(0,$userId));
|
||||
$this->assign('rs',$rs);
|
||||
return $this->fetch('users/logmoneys/list');
|
||||
}
|
||||
/**
|
||||
* 资金流水
|
||||
*/
|
||||
public function record(){
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$rs = model('Users')->getFieldsById($userId,['lockMoney','userMoney','payPwd']);
|
||||
$this->assign('rs',$rs);
|
||||
return $this->fetch('users/logmoneys/record');
|
||||
}
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$data = model('LogMoneys')->pageQuery("",$userId);
|
||||
return WSTReturn("", 1,$data);
|
||||
}
|
||||
/**
|
||||
* 验证支付密码
|
||||
*/
|
||||
public function checkPayPwd(){
|
||||
return model('mobile/users')->checkPayPwd();
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值[用户]
|
||||
*/
|
||||
public function toRecharge(){
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$rs = model('Users')->getFieldsById($userId,'userMoney');
|
||||
$this->assign('rs',$rs);
|
||||
$payments = model('common/payments')->recharePayments('2');
|
||||
$this->assign('payments',$payments);
|
||||
$chargeItems = model('common/ChargeItems')->queryList();
|
||||
$this->assign('chargeItems',$chargeItems);
|
||||
return $this->fetch('users/recharge/recharge');
|
||||
}
|
||||
}
|
40
hyhproject/mobile2/controller/Messages.php
Executable file
40
hyhproject/mobile2/controller/Messages.php
Executable file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\Messages as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 商城消息控制器
|
||||
*/
|
||||
class Messages extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth'
|
||||
];
|
||||
/**
|
||||
* 查看商城消息
|
||||
*/
|
||||
public function index(){
|
||||
return $this->fetch('users/messages/list');
|
||||
}
|
||||
/**
|
||||
* 获取列表
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = new M();
|
||||
return $m->pageQuery();
|
||||
}
|
||||
/**
|
||||
* 获取列表详情
|
||||
*/
|
||||
public function getById(){
|
||||
$m = new M();
|
||||
return $m->getById();
|
||||
}
|
||||
/**
|
||||
* 删除地址
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->batchDel();
|
||||
}
|
||||
}
|
53
hyhproject/mobile2/controller/News.php
Executable file
53
hyhproject/mobile2/controller/News.php
Executable file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\mobile\model\Articles as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 新闻控制器
|
||||
*/
|
||||
class News extends Base{
|
||||
/**
|
||||
* 列表查询
|
||||
*/
|
||||
public function view(){
|
||||
$m = new M();
|
||||
$data = $m->getChildInfos();
|
||||
$catId = $data['0']['catId'];
|
||||
$articleId = (int)input('articleId');
|
||||
$this->assign('articleId',$articleId);
|
||||
$this->assign('catInfo',$data);
|
||||
$this->assign('catId',$catId);
|
||||
return $this->fetch('articles/news_list');
|
||||
}
|
||||
/**
|
||||
* 获取商城快讯列表
|
||||
*/
|
||||
public function getNewsList(){
|
||||
$m = new M();
|
||||
$data = $m->getArticles();
|
||||
foreach($data as $k=>$v){
|
||||
$data[$k]['articleContent'] = strip_tags(html_entity_decode($v['articleContent']));
|
||||
$data[$k]['createTime'] = date('Y-m-d',strtotime($data[$k]['createTime']));
|
||||
$data[$k]['coverImg'] = str_replace("_thumb.", ".", $data[$k]['coverImg']);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* 查看详情
|
||||
*/
|
||||
public function getNews(){
|
||||
$m = new M();
|
||||
$data = $m->getNewsById();
|
||||
$data['articleContent']=htmlspecialchars_decode($data['articleContent']);
|
||||
$data['createTime'] = date('Y-m-d',strtotime($data['createTime']));
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* 点赞
|
||||
*/
|
||||
public function like(){
|
||||
$m = new M();
|
||||
$data = $m->like();
|
||||
return $data;
|
||||
}
|
||||
}
|
55
hyhproject/mobile2/controller/Ordercomplains.php
Executable file
55
hyhproject/mobile2/controller/Ordercomplains.php
Executable file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\OrderComplains as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 投诉控制器
|
||||
*/
|
||||
class orderComplains extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth'
|
||||
];
|
||||
public function complain(){
|
||||
$oId = (int)input('oId');
|
||||
$this->assign('oId',$oId);
|
||||
return $this->fetch('users/orders/orders_complains');
|
||||
}
|
||||
/**
|
||||
* 保存订单投诉信息
|
||||
*/
|
||||
public function saveComplain(){
|
||||
return model('OrderComplains')->saveComplain();
|
||||
}
|
||||
/**
|
||||
* 用户投诉列表
|
||||
*/
|
||||
public function index(){
|
||||
return $this->fetch('users/orders/list_complains');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户投诉列表
|
||||
*/
|
||||
public function complainByPage(){
|
||||
$m = model('OrderComplains');
|
||||
return $m->queryUserComplainByPage();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户查投诉详情
|
||||
*/
|
||||
public function getComplainDetail(){
|
||||
$rs = model('OrderComplains')->getComplainDetail(0);
|
||||
$annex = $rs['complainAnnex'];
|
||||
if($annex){
|
||||
foreach($annex as $k=>$v){
|
||||
$annex1[] = WSTImg($v,2);
|
||||
}
|
||||
$rs['complainAnnex'] = $annex1;
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
}
|
25
hyhproject/mobile2/controller/Orderrefunds.php
Executable file
25
hyhproject/mobile2/controller/Orderrefunds.php
Executable file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\OrderRefunds as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 订单退款控制器
|
||||
*/
|
||||
class Orderrefunds extends Base{
|
||||
/**
|
||||
* 用户申请退款
|
||||
*/
|
||||
public function refund(){
|
||||
$m = new M();
|
||||
$rs = $m->refund();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 商家处理是否同意
|
||||
*/
|
||||
public function shopRefund(){
|
||||
$m = new M();
|
||||
$rs = $m->shopRefund();
|
||||
return $rs;
|
||||
}
|
||||
}
|
270
hyhproject/mobile2/controller/Orders.php
Executable file
270
hyhproject/mobile2/controller/Orders.php
Executable file
@ -0,0 +1,270 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\Orders as M;
|
||||
use wstmart\common\model\Payments;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 订单控制器
|
||||
*/
|
||||
class Orders extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth'
|
||||
];
|
||||
/*********************************************** 用户操作订单 ************************************************************/
|
||||
/**
|
||||
* 提醒发货
|
||||
*/
|
||||
public function noticeDeliver(){
|
||||
$m = new M();
|
||||
return $m->noticeDeliver();
|
||||
}
|
||||
/**
|
||||
* 提交订单
|
||||
*/
|
||||
public function submit(){
|
||||
$m = new M();
|
||||
$rs = $m->submit(2);
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 提交虚拟订单
|
||||
*/
|
||||
public function quickSubmit(){
|
||||
$m = new M();
|
||||
$rs = $m->quickSubmit();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 在线支付方式
|
||||
*/
|
||||
public function succeed(){
|
||||
//获取支付方式
|
||||
$pa = new Payments();
|
||||
$payments = $pa->getByGroup('2');
|
||||
$this->assign('payments',$payments);
|
||||
$this->assign('orderNo',input("get.orderNo"));
|
||||
$this->assign('isBatch',(int)input("get.isBatch/d",0));
|
||||
return $this->fetch("users/orders/orders_pay_list");
|
||||
}
|
||||
/**
|
||||
* 订单管理
|
||||
*/
|
||||
public function index(){
|
||||
$type = input('param.type','');
|
||||
$this->assign('type',$type);
|
||||
return $this->fetch("users/orders/orders_list");
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
*/
|
||||
public function getOrderList(){
|
||||
/*
|
||||
-3:拒收、退款列表
|
||||
-2:待付款列表
|
||||
-1:已取消订单
|
||||
0,1: 待收货
|
||||
2:待评价/已完成
|
||||
*/
|
||||
$flag = -1;
|
||||
$type = input('param.type');
|
||||
$status = [];
|
||||
switch ($type) {
|
||||
case 'waitPay':
|
||||
$status=[-2];
|
||||
break;
|
||||
case 'waitDeliver':
|
||||
$status=[0];
|
||||
break;
|
||||
case 'waitReceive':
|
||||
$status=[1];
|
||||
break;
|
||||
case 'waitAppraise':
|
||||
$status=[2];
|
||||
$flag=0;
|
||||
break;
|
||||
case 'finish':
|
||||
$status=[2];
|
||||
break;
|
||||
case 'abnormal': // 退款/拒收 与取消合并
|
||||
$status=[-1,-3];
|
||||
break;
|
||||
default:
|
||||
$status=[-5,-4,-3,-2,-1,0,1,2];
|
||||
break;
|
||||
}
|
||||
$m = new M();
|
||||
$rs = $m->userOrdersByPage($status,$flag);
|
||||
foreach($rs['Rows'] as $k=>$v){
|
||||
if(!empty($v['list'])){
|
||||
foreach($v['list'] as $k1=>$v1){
|
||||
$rs['Rows'][$k]['list'][$k1]['goodsImg'] = $v1['goodsImg'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
*/
|
||||
public function getDetail(){
|
||||
$m = new M();
|
||||
$rs = $m->getByView((int)input('id'));
|
||||
$rs['status'] = WSTLangOrderStatus($rs['orderStatus']);
|
||||
$rs['payInfo'] = WSTLangPayType($rs['payType']);
|
||||
$rs['deliverInfo'] = WSTLangDeliverType($rs['deliverType']);
|
||||
foreach($rs['goods'] as $k=>$v){
|
||||
$v['goodsImg'] = WSTImg($v['goodsImg'],3);
|
||||
}
|
||||
// 优惠券钩子
|
||||
hook('mobileDocumentOrderSummaryView',['rs'=>&$rs]);
|
||||
// 满就送钩子
|
||||
hook('mobileDocumentOrderViewGoodsPromotion',['rs'=>&$rs]);
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户确认收货
|
||||
*/
|
||||
public function receive(){
|
||||
$m = new M();
|
||||
$rs = $m->receive();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户-评价页
|
||||
*/
|
||||
public function orderAppraise(){
|
||||
$m = model('Orders');
|
||||
$oId = (int)input('oId');
|
||||
//根据订单id获取 商品信息
|
||||
$data = $m->getOrderInfoAndAppr();
|
||||
$data['shopName']=model('shops')->getShopName($oId);
|
||||
$this->assign('data',$data);
|
||||
$this->assign('oId',$oId);
|
||||
return $this->fetch('users/orders/orders_appraises');
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户取消订单
|
||||
*/
|
||||
public function cancellation(){
|
||||
$m = new M();
|
||||
$rs = $m->cancel();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户拒收订单
|
||||
*/
|
||||
public function reject(){
|
||||
$m = new M();
|
||||
$rs = $m->reject();
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户退款
|
||||
*/
|
||||
public function getRefund(){
|
||||
$m = new M();
|
||||
return $m->getMoneyByOrder((int)input('id'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************************** 商家操作订单 ************************************************************/
|
||||
|
||||
/**
|
||||
* 商家-查看订单列表
|
||||
*/
|
||||
public function sellerOrder(){
|
||||
$this->checkShopAuth("list");
|
||||
$type = input('param.type','all');
|
||||
$this->assign('type',$type);
|
||||
$express = model('Express')->listQuery();
|
||||
$this->assign('express',$express);
|
||||
return $this->fetch('users/sellerorders/orders_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* 商家-订单列表
|
||||
*/
|
||||
public function getSellerOrderList(){
|
||||
/*
|
||||
-3:拒收、退款列表
|
||||
-2:待付款列表
|
||||
-1:已取消订单
|
||||
0: 待发货
|
||||
1,2:待评价/已完成
|
||||
*/
|
||||
$type = input('param.type');
|
||||
$this->checkShopAuth($type);
|
||||
$status = [];
|
||||
switch ($type) {
|
||||
case 'waitPay':
|
||||
$status=-2;
|
||||
break;
|
||||
case 'waitDeliver':
|
||||
$status=0;
|
||||
break;
|
||||
case 'waitReceive':
|
||||
$status=1;
|
||||
break;
|
||||
case 'waitDelivery':
|
||||
$status=0;
|
||||
break;
|
||||
case 'finish':
|
||||
$status=2;
|
||||
break;
|
||||
case 'abnormal': // 退款/拒收 与取消合并
|
||||
$status=[-1,-3];
|
||||
break;
|
||||
default:
|
||||
$status=[-5,-4,-3,-2,-1,0,1,2];
|
||||
break;
|
||||
}
|
||||
$m = new M();
|
||||
$rs = $m->shopOrdersByPage($status);
|
||||
foreach($rs['Rows'] as $k=>$v){
|
||||
if(!empty($v['list'])){
|
||||
foreach($v['list'] as $k1=>$v1){
|
||||
$rs['Rows'][$k]['list'][$k1]['goodsImg'] = $v1['goodsImg'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return WSTReturn('操作成功',1,$rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商家发货
|
||||
*/
|
||||
public function deliver(){
|
||||
$this->checkShopAuth("waitDeliver");
|
||||
$m = new M();
|
||||
$rs = $m->deliver();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 商家修改订单价格
|
||||
*/
|
||||
public function editOrderMoney(){
|
||||
$this->checkShopAuth("waitPay");
|
||||
$m = new M();
|
||||
$rs = $m->editOrderMoney();
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 商家-操作退款
|
||||
*/
|
||||
public function toShopRefund(){
|
||||
$this->checkShopAuth("abnormal");
|
||||
return model('OrderRefunds')->getRefundMoneyByOrder((int)input('id'));
|
||||
}
|
||||
|
||||
|
||||
}
|
24
hyhproject/mobile2/controller/Promotion.php
Executable file
24
hyhproject/mobile2/controller/Promotion.php
Executable file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 默认控制器
|
||||
*/
|
||||
class Promotion extends Base{
|
||||
/**
|
||||
* 首页
|
||||
*/
|
||||
public function index(){
|
||||
//return $this->fetch('rebate');
|
||||
}
|
||||
public function rebate(){
|
||||
return $this->fetch('rebate');
|
||||
}
|
||||
public function day_new(){
|
||||
return $this->fetch('day_new');
|
||||
}
|
||||
public function bash(){
|
||||
return $this->fetch('bash');
|
||||
}
|
||||
|
||||
}
|
151
hyhproject/mobile2/controller/Shops.php
Executable file
151
hyhproject/mobile2/controller/Shops.php
Executable file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\GoodsCats;
|
||||
use wstmart\mobile\model\Goods;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 门店控制器
|
||||
*/
|
||||
class Shops extends Base{
|
||||
/**
|
||||
* 店铺街
|
||||
*/
|
||||
public function shopStreet(){
|
||||
$gc = new GoodsCats();
|
||||
$goodsCats = $gc->listQuery(0);
|
||||
$this->assign('goodscats',$goodsCats);
|
||||
$this->assign("keyword", input('keyword'));
|
||||
return $this->fetch('shop_street');
|
||||
}
|
||||
/**
|
||||
* 店铺首页
|
||||
*/
|
||||
public function index(){
|
||||
$s = model('shops');
|
||||
$shopId = (int)input('shopId',1);
|
||||
$data = $s->getShopSummary($shopId);
|
||||
$this->assign('data',$data);
|
||||
// 是否已关注
|
||||
$isFavor = model('favorites')->checkFavorite($shopId,1);
|
||||
$this->assign('isFavor',$isFavor);
|
||||
$this->assign("goodsName", input('goodsName'));
|
||||
return $this->fetch('shop_index');
|
||||
}
|
||||
/**
|
||||
* 店铺详情
|
||||
*/
|
||||
public function home(){
|
||||
$s = model('shops');
|
||||
$shopId = (int)input("param.shopId/d",1);
|
||||
$data['shop'] = $s->getShopInfo($shopId);
|
||||
hook("goShopAfterAddView",["shopId"=>$shopId,'path'=>3]);
|
||||
$ct1 = input("param.ct1/d",0);
|
||||
$ct2 = input("param.ct2/d",0);
|
||||
$goodsName = input("param.goodsName");
|
||||
if(($data['shop']['shopId']==1 || $shopId==0) && $ct1==0 && !isset($goodsName))
|
||||
$this->redirect('mobile/shops/selfShop');
|
||||
|
||||
$gcModel = model('ShopCats');
|
||||
$data['shopcats'] = $gcModel->getShopCats($shopId);
|
||||
|
||||
$this->assign('shopId',$shopId);//店铺id
|
||||
|
||||
$this->assign('ct1',$ct1);//一级分类
|
||||
$this->assign('ct2',$ct2);//二级分类
|
||||
|
||||
$this->assign('goodsName',urldecode($goodsName));//搜索
|
||||
$this->assign('data',$data);
|
||||
|
||||
// 是否已关注
|
||||
$isFavor = model('favorites')->checkFavorite($shopId,1);
|
||||
$this->assign('isFavor',$isFavor);
|
||||
$followNum = model('favorites')->followNum($shopId,1);
|
||||
$this->assign('followNum',$followNum);
|
||||
|
||||
$cart = model('carts')->getCartInfo();
|
||||
$this->assign('cart',$cart);
|
||||
return $this->fetch('shop_home');
|
||||
}
|
||||
/**
|
||||
* 店铺商品列表
|
||||
*/
|
||||
public function shopGoodsList(){
|
||||
$s = model('shops');
|
||||
$shopId = (int)input("param.shopId/d",1);
|
||||
|
||||
$ct1 = input("param.ct1/d",0);
|
||||
$ct2 = input("param.ct2/d",0);
|
||||
$goodsName = input("param.goodsName");
|
||||
$gcModel = model('ShopCats');
|
||||
$data['shopcats'] = $gcModel->getShopCats($shopId);
|
||||
|
||||
$this->assign('shopId',$shopId);//店铺id
|
||||
|
||||
$this->assign('ct1',$ct1);//一级分类
|
||||
$this->assign('ct2',$ct2);//二级分类
|
||||
|
||||
$this->assign('goodsName',urldecode($goodsName));//搜索
|
||||
$this->assign('data',$data);
|
||||
|
||||
return $this->fetch('shop_goods_list');
|
||||
}
|
||||
/**
|
||||
* 获取店铺商品
|
||||
*/
|
||||
public function getShopGoods(){
|
||||
$shopId = (int)input('shopId',1);
|
||||
$g = model('goods');
|
||||
$rs = $g->shopGoods($shopId);
|
||||
foreach($rs['Rows'] as $k=>$v){
|
||||
$rs['Rows'][$k]['goodsImg'] = WSTImg($v['goodsImg'],2);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自营店铺
|
||||
*/
|
||||
public function selfShop(){
|
||||
$s = model('shops');
|
||||
$data['shop'] = $s->getShopInfo(1);
|
||||
if(empty($data['shop']))return $this->fetch('error_lost');
|
||||
$this->assign('selfShop',1);
|
||||
$data['shopcats'] = model('ShopCats')->getShopCats(1);
|
||||
$this->assign('goodsName',urldecode(input("param.goodsName")));//搜索
|
||||
// 店长推荐
|
||||
$data['rec'] = $s->getRecGoods('rec');
|
||||
// 热销商品
|
||||
$data['hot'] = $s->getRecGoods('hot');
|
||||
$this->assign('data',$data);
|
||||
// 是否已关注
|
||||
$isFavor = model('favorites')->checkFavorite(1,1);
|
||||
$this->assign('isFavor',$isFavor);
|
||||
$followNum = model('favorites')->followNum(1,1);
|
||||
$this->assign('followNum',$followNum);
|
||||
$this->assign("keyword", input('keyword'));
|
||||
return $this->fetch('self_shop');
|
||||
}
|
||||
public function getFloorData(){
|
||||
$s = model('shops');
|
||||
$rs = $s->getFloorData();
|
||||
if(isset($rs['goods'])){
|
||||
foreach($rs['goods'] as $k=>$v){
|
||||
$rs['goods'][$k]['goodsImg'] = WSTImg($v['goodsImg'],2);
|
||||
}
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺街列表
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$m = model('shops');
|
||||
$rs = $m->pageQuery(input('pagesize/d'));
|
||||
foreach ($rs['Rows'] as $key =>$v){
|
||||
$rs['Rows'][$key]['shopImg'] = WSTImg($v['shopImg'],3);
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
|
||||
}
|
22
hyhproject/mobile2/controller/Switchs.php
Executable file
22
hyhproject/mobile2/controller/Switchs.php
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 关闭提示处理控制器
|
||||
*/
|
||||
use think\Controller;
|
||||
class Switchs extends Controller{
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
WSTConf('CONF',WSTConfig());
|
||||
$this->assign("v",WSTConf('CONF.wstVersion')."_".WSTConf('CONF.wstPcStyleId'));
|
||||
}
|
||||
protected function fetch($template = '', $vars = [], $replace = [], $config = []){
|
||||
$style = WSTConf('CONF.wstmobileStyle')?WSTConf('CONF.wstmobileStyle'):'default';
|
||||
$replace['__MOBILE__'] = str_replace('/index.php','',\think\Request::instance()->root()).'/hyhproject/mobile/view/'.$style;
|
||||
return $this->view->fetch($style."/".$template, $vars, $replace, $config);
|
||||
}
|
||||
public function index(){
|
||||
return $this->fetch('error_switch');
|
||||
}
|
||||
}
|
211
hyhproject/mobile2/controller/Unionpays.php
Executable file
211
hyhproject/mobile2/controller/Unionpays.php
Executable file
@ -0,0 +1,211 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use think\Loader;
|
||||
use wstmart\common\model\Payments as M;
|
||||
use wstmart\common\model\Orders as OM;
|
||||
use wstmart\common\model\LogMoneys as LM;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 银联支付控制器
|
||||
*/
|
||||
class Unionpays extends Base{
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
private $unionConfig;
|
||||
public function _initialize() {
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
Loader::import('unionpay.sdk.acp_service');
|
||||
$m = new M();
|
||||
$this->unionConfig = $m->getPayment("unionpays");
|
||||
|
||||
$config = array();
|
||||
$config["signCertPwd"] = $this->unionConfig["unionSignCertPwd"];//"000000"
|
||||
$config["signMethod"] = "01";
|
||||
|
||||
$config["frontUrl"] = url("mobile/orders/index","",true,true);
|
||||
$config["backUrl"] = url("mobile/unionpays/notify","",true,true);
|
||||
new \SDKConfig($config);
|
||||
}
|
||||
|
||||
|
||||
public function getUnionpaysUrl(){
|
||||
$m = new OM();
|
||||
$payObj = input("payObj/s");
|
||||
$data = array();
|
||||
if($payObj=="recharge"){
|
||||
$needPay = input("needPay/d");
|
||||
$data["status"] = $needPay>0?1:-1;
|
||||
}else{
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$data = $m->checkOrderPay();
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成支付代码
|
||||
* @param array $order 订单信息
|
||||
* @param array $config_value 支付方式信息
|
||||
*/
|
||||
public function toUnionpay(){
|
||||
|
||||
$payObj = input("payObj/s");
|
||||
$m = new OM();
|
||||
$obj = array();
|
||||
$data = array();
|
||||
$orderAmount = 0;
|
||||
$orderId = "";
|
||||
$extra_param = "";
|
||||
if($payObj=="recharge"){//充值
|
||||
$orderAmount = input("needPay/d");
|
||||
$targetType = (int)input("targetType/d");
|
||||
$targetId = (int)session('WST_USER.userId');
|
||||
if($targetType==1){//商家
|
||||
$targetId = (int)session('WST_USER.shopId');
|
||||
}
|
||||
$data["status"] = $orderAmount>0?1:-1;
|
||||
$orderId = WSTOrderNo();
|
||||
$extra_param = $payObj."|".$targetId."|".$targetType;
|
||||
|
||||
}else{
|
||||
$obj["orderNo"] = input("orderNo/s");
|
||||
$obj["isBatch"] = (int)input("isBatch/d");
|
||||
$data = $m->checkOrderPay($obj);
|
||||
if($data["status"]==1){
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$obj["userId"] = $userId;
|
||||
$order = $m->getPayOrders($obj);
|
||||
$orderAmount = $order["needPay"];
|
||||
$payRand = $order["payRand"];
|
||||
$orderId = $obj["orderNo"]."a".$payRand;
|
||||
$extra_param = $payObj."|".$userId."|".$obj["isBatch"];
|
||||
}
|
||||
}
|
||||
|
||||
if($data["status"]==1){
|
||||
$params = array(
|
||||
//以下信息非特殊情况不需要改动
|
||||
'version' => \SDKConfig::$version, //版本号
|
||||
'encoding' => 'utf-8', //编码方式
|
||||
'txnType' => '01', //交易类型
|
||||
'txnSubType' => '01', //交易子类
|
||||
'bizType' => '000201', //业务类型
|
||||
'frontUrl' => \SDKConfig::$frontUrl, //前台通知地址
|
||||
'backUrl' => \SDKConfig::$backUrl, //后台通知地址
|
||||
'signMethod' => \SDKConfig::$signMethod,//签名方法
|
||||
'channelType' => '08', //渠道类型,07-PC,08-手机
|
||||
'accessType' => '0', //接入类型
|
||||
'currencyCode' => '156', //交易币种,境内商户固定156
|
||||
//TODO 以下信息需要填写
|
||||
'merId' => $this->unionConfig["unionMerId"], //"777290058110048",//商户代码
|
||||
'orderId' => $orderId, //商户订单号,8-32位数字字母,不能含“-”或“_”
|
||||
'txnTime' => date('YmdHis'), //订单发送时间,格式为YYYYMMDDhhmmss,取北京时间
|
||||
'txnAmt' => $orderAmount*100, //交易金额,单位分,此处默认取demo演示页面传递的参数
|
||||
// 订单超时时间。
|
||||
//'payTimeout' => date('YmdHis', strtotime('+15 minutes')),
|
||||
|
||||
'reqReserved' => $extra_param,
|
||||
);
|
||||
$acpService = new \AcpService();
|
||||
$acpService::sign ( $params );
|
||||
$uri = \SDKConfig::$frontTransUrl;
|
||||
$html_form = $acpService::createAutoFormHtml( $params, $uri );
|
||||
echo $html_form;
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步回调接口
|
||||
*/
|
||||
public function notify(){
|
||||
|
||||
//计算得出通知验证结果
|
||||
$acpService = new \AcpService(); // 使用银联原生自带的累 和方法 这里只是引用了一下 而已
|
||||
$verify_result = $acpService->validate($_POST);
|
||||
|
||||
if($verify_result){//验证成功
|
||||
$out_trade_no = $_POST['orderId']; //商户订单号
|
||||
$queryId = $_POST['queryId']; //银联支付流水号
|
||||
// 解释: 交易成功且结束,即不可再做任何操作。
|
||||
if($_POST['respMsg'] == 'Success!'){
|
||||
$m = new OM();
|
||||
$extras = explode("|",$_POST['reqReserved']);
|
||||
$rs = array();
|
||||
if($extras[0]=="recharge"){//充值
|
||||
$targetId = (int)$extras [1];
|
||||
$targetType = (int)$extras [2];
|
||||
$obj = array ();
|
||||
$obj["trade_no"] = $_POST['trade_no'];
|
||||
$obj["out_trade_no"] = $_POST["out_trade_no"];;
|
||||
$obj["targetId"] = $targetId;
|
||||
$obj["targetType"] = $targetType;
|
||||
$obj["total_fee"] = $_POST['total_fee'];
|
||||
$obj["payFrom"] = 'unionpays';
|
||||
// 支付成功业务逻辑
|
||||
$m = new LM();
|
||||
$rs = $m->complateRecharge ( $obj );
|
||||
}else{
|
||||
//商户订单号
|
||||
$obj = array();
|
||||
$tradeNo = explode("a",$out_trade_no);
|
||||
$obj["trade_no"] = $_POST['trade_no'];
|
||||
$obj["out_trade_no"] = $tradeNo[0];
|
||||
$obj["total_fee"] = $_POST['total_fee'];
|
||||
|
||||
$obj["userId"] = $extras[1];
|
||||
$obj["isBatch"] = $extras[2];
|
||||
$obj["payFrom"] = 'unionpays';
|
||||
//支付成功业务逻辑
|
||||
$rs = $m->complatePay($obj);
|
||||
}
|
||||
if($rs["status"]==1){
|
||||
echo 'success';
|
||||
}else{
|
||||
echo 'fail';
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo "fail"; //验证失败
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步回调接口
|
||||
*/
|
||||
public function response(){
|
||||
//计算得出通知验证结果
|
||||
$acpService = new \AcpService(); // 使用银联原生自带的累 和方法 这里只是引用了一下 而已
|
||||
$verify_result = $acpService->validate($_POST);
|
||||
|
||||
if($verify_result){ //验证成功
|
||||
$order_sn = $out_trade_no = $_POST['orderId']; //商户订单号
|
||||
$queryId = $_POST['queryId']; //银联支付流水号
|
||||
$respMsg = $_POST['respMsg']; //交易状态
|
||||
|
||||
if($_POST['respMsg'] == 'success'){
|
||||
$m = new OM();
|
||||
$extras = explode("|",$_POST['extra_param']);
|
||||
if($extras[0]=="recharge"){//充值
|
||||
$this->redirect(url("mobile/users/index"));
|
||||
}else{
|
||||
$obj = array();
|
||||
$tradeNo = explode("a",$out_trade_no);
|
||||
$obj["orderNo"] = $tradeNo[0];
|
||||
$obj["userId"] = $extras[1];
|
||||
$obj["isBatch"] = $extras[2];
|
||||
$rs = $m->getOrderType($obj);
|
||||
$this->redirect(url("mobile/orders/index"));
|
||||
}
|
||||
}else {
|
||||
$this->error('支付失败');
|
||||
}
|
||||
}else {
|
||||
$this->error('支付失败');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
61
hyhproject/mobile2/controller/Useraddress.php
Executable file
61
hyhproject/mobile2/controller/Useraddress.php
Executable file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\UserAddress as M;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 用户地址控制器
|
||||
*/
|
||||
class UserAddress extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth'
|
||||
];
|
||||
/**
|
||||
* 地址管理
|
||||
*/
|
||||
public function index(){
|
||||
$m = new M();
|
||||
$userId = session('WST_USER.userId');
|
||||
$addressList = $m->listQuery($userId);
|
||||
//获取省级地区信息
|
||||
$area = model('mobile/Areas')->listQuery(0);
|
||||
$this->assign('area',$area);
|
||||
$this->assign('list', $addressList);
|
||||
$this->assign('type', (int)input('type'));
|
||||
$this->assign('addressId', (int)input('addressId'));//结算选中的地址
|
||||
return $this->fetch('users/useraddress/list');
|
||||
}
|
||||
/**
|
||||
* 获取地址信息
|
||||
*/
|
||||
public function getById(){
|
||||
$m = new M();
|
||||
return $m->getById(input('post.addressId/d'));
|
||||
}
|
||||
/**
|
||||
* 设置为默认地址
|
||||
*/
|
||||
public function setDefault(){
|
||||
$m = new M();
|
||||
return $m->setDefault();
|
||||
}
|
||||
/**
|
||||
* 新增/编辑地址
|
||||
*/
|
||||
public function edits(){
|
||||
$m = new M();
|
||||
if(input('post.addressId/d')){
|
||||
$rs = $m->edit();
|
||||
}else{
|
||||
$rs = $m->add();
|
||||
}
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 删除地址
|
||||
*/
|
||||
public function del(){
|
||||
$m = new M();
|
||||
return $m->del();
|
||||
}
|
||||
}
|
608
hyhproject/mobile2/controller/Users.php
Executable file
608
hyhproject/mobile2/controller/Users.php
Executable file
@ -0,0 +1,608 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\mobile\model\Users as M;
|
||||
use wstmart\mobile\model\Messages;
|
||||
use wstmart\common\model\LogSms;
|
||||
use wstmart\common\model\Users as MUsers;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 用户控制器
|
||||
*/
|
||||
class Users extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [// mark cheng 添加reg 20180321
|
||||
'checkAuth' => ['except'=>'reg,checklogin,login,register,getverify,toregister,forgetpass,forgetpasst,forgetpasss,forgetpassf,findpass,getfindphone,resetpass,getphoneverifycode,checkuserphone']// 访问这些except下的方法不需要执行前置操作
|
||||
];
|
||||
/**
|
||||
*跳转到合源惠联盟 mark 20170919 hsf
|
||||
*/
|
||||
|
||||
public function to_hyhlm(){
|
||||
session('to_hyhlm',null);
|
||||
hook('toHyhlm');
|
||||
die;
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员登录页
|
||||
*/
|
||||
public function login(){
|
||||
//如果已经登录了则直接跳去用户中心
|
||||
$USER = session('WST_USER');
|
||||
if(!empty($USER) && $USER['userId']!=''){
|
||||
$this->redirect("users/index");
|
||||
}
|
||||
return $this->fetch('login');
|
||||
}
|
||||
/**
|
||||
* 会员登录
|
||||
*/
|
||||
public function checkLogin(){
|
||||
$m = new M();
|
||||
$rs = $m->checkLogin(2);
|
||||
$rs['url'] = session('WST_MO_WlADDRESS');
|
||||
return $rs;
|
||||
}
|
||||
|
||||
public function toRegister(){
|
||||
return $this->fetch('register');
|
||||
}
|
||||
/**
|
||||
* 会员注册
|
||||
*/
|
||||
public function register(){
|
||||
$m = new M();
|
||||
$rs = $m->regist(2);
|
||||
$rs['url'] = session('WST_MO_WlADDRESS');
|
||||
return $rs;
|
||||
}
|
||||
/**
|
||||
* 手机号码是否存在
|
||||
*/
|
||||
public function checkUserPhone(){
|
||||
$userPhone = input("post.userPhone");
|
||||
$m = new M();
|
||||
$rs = $m->checkUserPhone($userPhone,(int)session('WST_USER.userId'));
|
||||
if($rs["status"]!=1){
|
||||
return WSTReturn("手机号已注册",-1);
|
||||
}else{
|
||||
return WSTReturn("",1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取验证码
|
||||
*/
|
||||
public function getPhoneVerifyCode(){
|
||||
$userPhone = input("post.userPhone");
|
||||
$rs = array();
|
||||
if(!WSTIsPhone($userPhone)){
|
||||
return WSTReturn("手机号格式不正确!");
|
||||
exit();
|
||||
}
|
||||
$m = new M();
|
||||
$rs = $m->checkUserPhone($userPhone,(int)session('WST_USER.userId'));
|
||||
if($rs["status"]!=1){
|
||||
return WSTReturn("手机号已存在!");
|
||||
exit();
|
||||
}
|
||||
$phoneVerify = rand(100000,999999);
|
||||
$tpl = WSTMsgTemplates('PHONE_USER_REGISTER_VERFIY');
|
||||
if( $tpl['tplContent']!='' && $tpl['status']=='1'){
|
||||
$params = ['tpl'=>$tpl,'params'=>['MALL_NAME'=>WSTConf("CONF.mallName"),'VERFIY_CODE'=>$phoneVerify,'VERFIY_TIME'=>10]];
|
||||
$m = new LogSms();
|
||||
$rv = $m->sendSMS(0,$userPhone,$params,'getPhoneVerifyCode',$phoneVerify);
|
||||
}
|
||||
if($rv['status']==1){
|
||||
session('VerifyCode_userPhone',$phoneVerify);
|
||||
session('VerifyCode_userPhone_Time',time());
|
||||
}
|
||||
return $rv;
|
||||
}
|
||||
/**
|
||||
* 会员中心
|
||||
*/
|
||||
public function index(){
|
||||
$userId = session('WST_USER.userId');
|
||||
$m = new M();
|
||||
$user = $m->getById($userId);
|
||||
if($user['userName']=='')
|
||||
$user['userName']=$user['loginName'];
|
||||
$this->assign('user', $user);
|
||||
//商城未读消息的数量 及 各订单状态数量
|
||||
$data = model('index')->getSysMsg('msg','order','follow','history');
|
||||
$this->assign('data',$data);
|
||||
return $this->fetch('users/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
public function edit(){
|
||||
$userId = session('WST_USER.userId');
|
||||
$m = new M();
|
||||
$user = $m->getById($userId);
|
||||
$this->assign('user', $user);
|
||||
return $this->fetch('users/edit');
|
||||
}
|
||||
/**
|
||||
* 编辑个人信息
|
||||
*/
|
||||
public function editUserInfo(){
|
||||
$m = new M();
|
||||
return $m->edit();
|
||||
}
|
||||
/**
|
||||
* 账户安全
|
||||
*/
|
||||
public function security(){
|
||||
$m = new M();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$user = $m->getById($userId);
|
||||
$payPwd = $user['payPwd'];
|
||||
$userPhone = $user['userPhone'];
|
||||
$loginPwd = $user['loginPwd'];
|
||||
$user['loginPwd'] = empty($loginPwd)?0:1;
|
||||
$user['payPwd'] = empty($payPwd)?0:1;
|
||||
$user['userPhone'] = empty($userPhone)?0:1;
|
||||
$this->assign('user', $user);
|
||||
session('Edit_userPhone_Time', null);
|
||||
return $this->fetch('users/security/index');
|
||||
}
|
||||
/**
|
||||
* 修改登录密码
|
||||
*/
|
||||
public function editLoginPass(){
|
||||
$m = new M();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$user = $m->getById($userId);
|
||||
$loginPwd = $user['loginPwd'];
|
||||
$user['loginPwd'] = empty($loginPwd)?0:1;
|
||||
$this->assign('user', $user);
|
||||
return $this->fetch('users/security/user_login_pass');
|
||||
}
|
||||
public function editloginPwd(){
|
||||
$m = new M();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
return $m->editPass($userId);
|
||||
}
|
||||
/**
|
||||
* 修改支付密码
|
||||
*/
|
||||
public function editPayPass(){
|
||||
$m = new M();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$user = $m->getById($userId);
|
||||
$payPwd = $user['payPwd'];
|
||||
$user['payPwd'] = empty($payPwd)?0:1;
|
||||
$this->assign('user', $user);
|
||||
return $this->fetch('users/security/user_pay_pass');
|
||||
}
|
||||
public function editpayPwd(){
|
||||
$m = new M();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
return $m->editPayPass($userId);
|
||||
}
|
||||
/**
|
||||
* 忘记支付密码
|
||||
*/
|
||||
public function backPayPass(){
|
||||
$m = new M();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$user = $m->getById($userId);
|
||||
$userPhone = $user['userPhone'];
|
||||
$user['userPhone'] = WSTStrReplace($user['userPhone'],'*',3);
|
||||
$user['phoneType'] = empty($userPhone)?0:1;
|
||||
$backType = (int)session('Type_backPaypwd');
|
||||
$timeVerify = session('Verify_backPaypwd_Time');
|
||||
$user['backType'] = ($backType==1 && time()<floatval($timeVerify)+10*60)?1:0;
|
||||
$this->assign('user', $user);
|
||||
return $this->fetch('users/security/user_back_paypwd');
|
||||
}
|
||||
/**
|
||||
* 忘记支付密码:发送短信
|
||||
*/
|
||||
public function backpayCode(){
|
||||
$m = new MUsers();
|
||||
$data = $m->getById(session('WST_USER.userId'));
|
||||
$userPhone = $data['userPhone'];
|
||||
$phoneVerify = rand(100000,999999);
|
||||
$rv = ['status'=>-1,'msg'=>'短信发送失败'];
|
||||
$tpl = WSTMsgTemplates('PHONE_FOTGET_PAY');
|
||||
if( $tpl['tplContent']!='' && $tpl['status']=='1'){
|
||||
$params = ['tpl'=>$tpl,'params'=>['LOGIN_NAME'=>$data['loginName'],'VERFIY_CODE'=>$phoneVerify,'VERFIY_TIME'=>10]];
|
||||
$m = new LogSms();
|
||||
$rv = $m->sendSMS(0,$userPhone,$params,'getPhoneVerifyt',$phoneVerify);
|
||||
}
|
||||
if($rv['status']==1){
|
||||
$USER = [];
|
||||
$USER['userPhone'] = $userPhone;
|
||||
$USER['phoneVerify'] = $phoneVerify;
|
||||
session('Verify_backPaypwd_info',$USER);
|
||||
session('Verify_backPaypwd_Time',time());
|
||||
return WSTReturn('短信发送成功!',1);
|
||||
}
|
||||
return $rv;
|
||||
}
|
||||
/**
|
||||
* 忘记支付密码:验证短信
|
||||
*/
|
||||
public function verifybackPay(){
|
||||
$phoneVerify = input("post.phoneCode");
|
||||
$timeVerify = session('Verify_backPaypwd_Time');
|
||||
if(!session('Verify_backPaypwd_info.phoneVerify') || time()>floatval($timeVerify)+10*60){
|
||||
return WSTReturn("校验码已失效,请重新发送!");
|
||||
exit();
|
||||
}
|
||||
if($phoneVerify==session('Verify_backPaypwd_info.phoneVerify')){
|
||||
session('Type_backPaypwd',1);
|
||||
return WSTReturn("验证成功",1);
|
||||
}
|
||||
return WSTReturn("校验码不一致,请重新输入!");
|
||||
}
|
||||
/**
|
||||
* 忘记支付密码:重置密码
|
||||
*/
|
||||
public function resetbackPay(){
|
||||
$m = new M();
|
||||
return $m->resetbackPay();
|
||||
}
|
||||
/**
|
||||
* 修改手机
|
||||
*/
|
||||
public function editPhone(){
|
||||
$m = new M();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$user = $m->getById($userId);
|
||||
$userPhone = $user['userPhone'];
|
||||
$user['userPhone'] = WSTStrReplace($user['userPhone'],'*',3);
|
||||
$user['phoneType'] = empty($userPhone)?0:1;
|
||||
$this->assign('user', $user);
|
||||
session('Edit_userPhone_Time', null);
|
||||
return $this->fetch('users/security/user_phone');
|
||||
}
|
||||
/**
|
||||
* 绑定手机:发送短信验证码
|
||||
*/
|
||||
public function sendCodeTie(){
|
||||
$userPhone = input("post.userPhone");
|
||||
if(!WSTIsPhone($userPhone)){
|
||||
return WSTReturn("手机号格式不正确!");
|
||||
exit();
|
||||
}
|
||||
$rs = array();
|
||||
$m = new MUsers();
|
||||
$rs = WSTCheckLoginKey($userPhone,(int)session('WST_USER.userId'));
|
||||
if($rs["status"]!=1){
|
||||
return WSTReturn("手机号已存在!");
|
||||
exit();
|
||||
}
|
||||
$data = $m->getById(session('WST_USER.userId'));
|
||||
$phoneVerify = rand(100000,999999);
|
||||
$rv = ['status'=>-1,'msg'=>'短信发送失败'];
|
||||
$tpl = WSTMsgTemplates('PHONE_BIND');
|
||||
if( $tpl['tplContent']!='' && $tpl['status']=='1'){
|
||||
$params = ['tpl'=>$tpl,'params'=>['LOGIN_NAME'=>$data['loginName'],'VERFIY_CODE'=>$phoneVerify,'VERFIY_TIME'=>10]];
|
||||
$m = new LogSms();
|
||||
$rv = $m->sendSMS(0,$userPhone,$params,'sendCodeTie',$phoneVerify);
|
||||
}
|
||||
if($rv['status']==1){
|
||||
$USER = '';
|
||||
$USER['userPhone'] = $userPhone;
|
||||
$USER['phoneVerify'] = $phoneVerify;
|
||||
session('Verify_info',$USER);
|
||||
session('Verify_userPhone_Time',time());
|
||||
return WSTReturn('短信发送成功!',1);
|
||||
}
|
||||
return $rv;
|
||||
}
|
||||
/**
|
||||
* 绑定手机
|
||||
*/
|
||||
public function phoneEdit(){
|
||||
$phoneVerify = input("post.phoneCode");
|
||||
$process = input("post.process");
|
||||
$timeVerify = session('Verify_userPhone_Time');
|
||||
if(!session('Verify_info.phoneVerify') || time()>floatval($timeVerify)+10*60){
|
||||
return WSTReturn("校验码已失效,请重新发送!");
|
||||
exit();
|
||||
}
|
||||
if($phoneVerify==session('Verify_info.phoneVerify')){
|
||||
$m = new M();
|
||||
$rs = $m->editPhone((int)session('WST_USER.userId'),session('Verify_info.userPhone'));
|
||||
return $rs;
|
||||
}
|
||||
return WSTReturn("校验码不一致,请重新输入!");
|
||||
}
|
||||
/**
|
||||
* 修改手机:发送短信验证码
|
||||
*/
|
||||
public function sendCodeEdit(){
|
||||
$m = new MUsers();
|
||||
$data = $m->getById(session('WST_USER.userId'));
|
||||
$userPhone = $data['userPhone'];
|
||||
$phoneVerify = rand(100000,999999);
|
||||
$rv = ['status'=>-1,'msg'=>'短信发送失败'];
|
||||
$tpl = WSTMsgTemplates('PHONE_EDIT');
|
||||
if( $tpl['tplContent']!='' && $tpl['status']=='1'){
|
||||
$params = ['tpl'=>$tpl,'params'=>['LOGIN_NAME'=>$data['loginName'],'VERFIY_CODE'=>$phoneVerify,'VERFIY_TIME'=>10]];
|
||||
$m = new LogSms();
|
||||
$rv = $m->sendSMS(0,$userPhone,$params,'getPhoneVerifyt',$phoneVerify);
|
||||
}
|
||||
if($rv['status']==1){
|
||||
$USER = '';
|
||||
$USER['userPhone'] = $userPhone;
|
||||
$USER['phoneVerify'] = $phoneVerify;
|
||||
session('Verify_info2',$USER);
|
||||
session('Verify_userPhone_Time2',time());
|
||||
return WSTReturn('短信发送成功!',1);
|
||||
}
|
||||
return $rv;
|
||||
}
|
||||
/**
|
||||
* 修改手机
|
||||
*/
|
||||
public function phoneEdito(){
|
||||
$phoneVerify = input("post.phoneCode");
|
||||
$timeVerify = session('Verify_userPhone_Time2');
|
||||
if(!session('Verify_info2.phoneVerify') || time()>floatval($timeVerify)+10*60){
|
||||
return WSTReturn("校验码已失效,请重新发送!");
|
||||
exit();
|
||||
}
|
||||
if($phoneVerify==session('Verify_info2.phoneVerify')){
|
||||
session('Edit_userPhone_Time',time());
|
||||
return WSTReturn("验证成功",1);
|
||||
return $rs;
|
||||
}
|
||||
return WSTReturn("校验码不一致,请重新输入!",-1);
|
||||
}
|
||||
public function editPhoneo(){
|
||||
$m = new M();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$user = $m->getById($userId);
|
||||
$userPhone = $user['userPhone'];
|
||||
$user['userPhone'] = WSTStrReplace($user['userPhone'],'*',3);
|
||||
$timeVerify = session('Edit_userPhone_Time');
|
||||
if(time()>floatval($timeVerify)+15*60){
|
||||
$user['phoneType'] = 1;
|
||||
}else{
|
||||
$user['phoneType'] = 0;
|
||||
}
|
||||
$this->assign('user', $user);
|
||||
return $this->fetch('users/security/user_phone');
|
||||
}
|
||||
/**
|
||||
* 用户退出
|
||||
*/
|
||||
public function logout(){
|
||||
session('WST_USER',null);
|
||||
setcookie("loginPwd", null);
|
||||
session('WST_MO_WlADDRESS',null);
|
||||
return WSTReturn("",1);
|
||||
}
|
||||
|
||||
/************************************************* 忘记密码 ********************************************************/
|
||||
// 页面过期/失效
|
||||
protected function expire($msg=''){
|
||||
$message = $msg?$msg:'页面已失效!';
|
||||
$html = '<h1>'.$message.'</h1><script>setTimeout(function(){location.href="'.url('mobile/users/index','','',true).'";},1000)</script>';
|
||||
return $this->display($html);
|
||||
}
|
||||
/**
|
||||
* 忘记密码
|
||||
*/
|
||||
public function forgetPass(){
|
||||
return $this->fetch('forget_pass');
|
||||
}
|
||||
public function forgetPasst(){
|
||||
if(time()<floatval(session('findPass.findTime'))+30*60){
|
||||
$userId = session('findPass.userId');
|
||||
$m = new M();
|
||||
$info = $m->getById($userId);
|
||||
if($info['userPhone']!='')$info['userPhone'] = WSTStrReplace($info['userPhone'],'*',3);
|
||||
if($info['userEmail']!='')$info['userEmail'] = WSTStrReplace($info['userEmail'],'*',2,'@');
|
||||
$this->assign('forgetInfo',$info);
|
||||
return $this->fetch('forget_pass2');
|
||||
}else{
|
||||
return $this->expire();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
public function resetPass(){
|
||||
if(!session('findPass')){
|
||||
return $this->expire();
|
||||
}
|
||||
return $this->fetch('forget_pass3');
|
||||
}
|
||||
public function forgetPasss(){
|
||||
if(!session('findPass')){
|
||||
return $this->expire();
|
||||
}
|
||||
$USER = session('findPass');
|
||||
if(empty($USER) && $USER['userId']!=''){
|
||||
$this->expire('请在同一浏览器操作!');
|
||||
}
|
||||
$uId = session('findPass.userId');
|
||||
$key = session("findPass.key");
|
||||
// 验证邮箱中的验证码
|
||||
$secretCode = input('secretCode');
|
||||
if($key==$secretCode){
|
||||
session('REST_userId',$uId);
|
||||
session('REST_success','1');
|
||||
return WSTReturn('验证成功',1);
|
||||
}else{
|
||||
return WSTReturn('校验码错误',-1);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 找回密码
|
||||
*/
|
||||
public function findPass(){
|
||||
//禁止缓存
|
||||
header('Cache-Control:no-cache,must-revalidate');
|
||||
header('Pragma:no-cache');
|
||||
$code = input("post.verifyCode");
|
||||
$step = input("post.step/d");
|
||||
switch ($step) {
|
||||
case 1:#第一步,验证身份
|
||||
if(!WSTVerifyCheck($code)){
|
||||
return WSTReturn('验证码错误!',-1);
|
||||
}
|
||||
$loginName = input("post.loginName");
|
||||
$rs = WSTCheckLoginKey($loginName);
|
||||
if($rs["status"]==1){
|
||||
return WSTReturn("用户名不存在!");
|
||||
exit();
|
||||
}
|
||||
$m = new M();
|
||||
$info = $m->checkAndGetLoginInfo($loginName);
|
||||
if ($info != false) {
|
||||
session('findPass',array('userId'=>$info['userId'],'loginName'=>$loginName,'userPhone'=>$info['userPhone'],'userEmail'=>$info['userEmail'],'loginSecret'=>$info['loginSecret'],'findTime'=>time()));
|
||||
return WSTReturn("操作成功",1);
|
||||
}else return WSTReturn("用户名不存在!");
|
||||
break;
|
||||
case 2:#第二步,验证方式
|
||||
if (session('findPass.loginName') != null ){
|
||||
if(input("post.modes")==1){
|
||||
if ( session('findPass.userPhone') == null) {
|
||||
return WSTReturn('你没有预留手机号码,请通过邮箱方式找回密码!',-1);
|
||||
}
|
||||
$phoneVerify = input("post.Checkcode");
|
||||
if(!$phoneVerify){
|
||||
return WSTReturn('校验码不能为空!',-1);
|
||||
}
|
||||
return $this->checkfindPhone($phoneVerify);
|
||||
}else{
|
||||
if (session('findPass.userEmail')==null) {
|
||||
return WSTReturn('你没有预留邮箱,请通过手机号码找回密码!',-1);
|
||||
}
|
||||
if(!WSTVerifyCheck($code)){
|
||||
return WSTReturn('验证码错误!',-1);
|
||||
}
|
||||
return $this->getfindEmail();
|
||||
}
|
||||
}else return $this->expire();
|
||||
break;
|
||||
case 3:#第三步,设置新密码
|
||||
$resetPass = session('REST_success');
|
||||
if($resetPass != 1)return $this->expire();
|
||||
$loginPwd = input("post.loginPwd");
|
||||
$repassword = input("post.repassword");
|
||||
$decrypt_data = WSTRSA($loginPwd);
|
||||
$decrypt_data2 = WSTRSA($repassword);
|
||||
if($decrypt_data['status']==1 && $decrypt_data2['status']==1){
|
||||
$loginPwd = $decrypt_data['data'];
|
||||
$repassword = $decrypt_data2['data'];
|
||||
}else{
|
||||
return WSTReturn('设置失败');
|
||||
}
|
||||
if ($loginPwd == $repassword) {
|
||||
$m = new M();
|
||||
$rs = $m->resetPass();
|
||||
if($rs['status']==1){
|
||||
return $rs;
|
||||
}else{
|
||||
return $rs;
|
||||
}
|
||||
}else return WSTReturn('两次密码不同!',-1);
|
||||
break;
|
||||
default:
|
||||
return $this->expire();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 手机验证码获取
|
||||
*/
|
||||
public function getfindPhone(){
|
||||
session('WST_USER',session('findPass.userId'));
|
||||
if(session('findPass.userPhone')==''){
|
||||
return WSTReturn('你没有预留手机号码,请通过邮箱方式找回密码!',-1);
|
||||
}
|
||||
$phoneVerify = rand(100000,999999);
|
||||
session('WST_USER',null);
|
||||
$rv = ['status'=>-1,'msg'=>'短信发送失败'];
|
||||
$tpl = WSTMsgTemplates('PHONE_FOTGET');
|
||||
if( $tpl['tplContent']!='' && $tpl['status']=='1'){
|
||||
$params = ['tpl'=>$tpl,'params'=>['VERFIY_CODE'=>$phoneVerify,'VERFIY_TIME'=>10]];
|
||||
$m = new LogSms();
|
||||
$rv = $m->sendSMS(0,session('findPass.userPhone'),$params,'getPhoneVerify',$phoneVerify);
|
||||
}
|
||||
if($rv['status']==1){
|
||||
// 记录发送短信的时间,用于验证是否过期
|
||||
session('REST_Time',time());
|
||||
$USER = '';
|
||||
$USER['phoneVerify'] = $phoneVerify;
|
||||
$USER['time'] = time();
|
||||
session('findPhone',$USER);
|
||||
return WSTReturn('短信发送成功!',1);
|
||||
}
|
||||
return $rv;
|
||||
}
|
||||
/**
|
||||
* 手机验证码检测
|
||||
* -1 错误,1正确
|
||||
*/
|
||||
public function checkfindPhone($phoneVerify){
|
||||
if(!session('findPhone.phoneVerify') || time()>floatval(session('findPhone.time'))+10*60){
|
||||
return WSTReturn("校验码已失效,请重新发送!");
|
||||
exit();
|
||||
}
|
||||
if (session('findPhone.phoneVerify') == $phoneVerify ) {
|
||||
$fuserId = session('findPass.userId');
|
||||
if(!empty($fuserId)){
|
||||
session('REST_userId',$fuserId);
|
||||
session('REST_success','1');
|
||||
$rs['status'] = 1;
|
||||
$rs['url'] = url('mobile/users/resetPass');
|
||||
return $rs;
|
||||
}
|
||||
return WSTReturn('无效用户',-1);
|
||||
}
|
||||
return WSTReturn('校验码错误!',-1);
|
||||
}
|
||||
/**
|
||||
* 发送验证邮件/找回密码
|
||||
*/
|
||||
public function getfindEmail(){
|
||||
$code = rand(0,999999);
|
||||
$sendRs = ['status'=>-1,'msg'=>'邮件发送失败'];
|
||||
$tpl = WSTMsgTemplates('EMAIL_FOTGET');
|
||||
if( $tpl['tplContent']!='' && $tpl['status']=='1'){
|
||||
$find = ['${LOGIN_NAME}','${SEND_TIME}','${VERFIY_CODE}','${VERFIY_TIME}'];
|
||||
$replace = [session('findPass.loginName'),date('Y-m-d H:i:s'),$code,30];
|
||||
$sendRs = WSTSendMail(session('findPass.userEmail'),'密码重置',str_replace($find,$replace,$tpl['content']));
|
||||
}
|
||||
if($sendRs['status']==1){
|
||||
$uId = session('findPass.userId');
|
||||
session("findPass.key", $code);
|
||||
// 发起重置密码的时间;
|
||||
session('REST_Time',time());
|
||||
return WSTReturn("发送成功",1);
|
||||
}else{
|
||||
return WSTReturn($sendRs['msg'],-1);
|
||||
}
|
||||
}
|
||||
public function userSet(){
|
||||
return $this->fetch('users/userset/list');
|
||||
}
|
||||
public function aboutUs(){
|
||||
return $this->fetch('users/userset/about');
|
||||
}
|
||||
// mark by cheng 添加手机版分享20180320
|
||||
public function share(){
|
||||
$name = session('WST_USER.loginName');
|
||||
$data['url'] = 'http://www.heyuanhui.cn/mobile/users/reg?pName='.$name;
|
||||
$data['title'] = '分享好友';
|
||||
$data['desc'] = '分享好友注册';
|
||||
$this->assign('data',$data);
|
||||
return $this->fetch('users/share');
|
||||
}
|
||||
// mark by cheng 新注册页20180320
|
||||
public function reg(){
|
||||
return $this->fetch('reg');
|
||||
}
|
||||
}
|
38
hyhproject/mobile2/controller/Userscores.php
Executable file
38
hyhproject/mobile2/controller/Userscores.php
Executable file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\UserScores as MUserscores;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 地区控制器
|
||||
*/
|
||||
class Userscores extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth'
|
||||
];
|
||||
/**
|
||||
* 查看
|
||||
*/
|
||||
public function index(){
|
||||
$rs = model('Users')->getFieldsById((int)session('WST_USER.userId'),['userScore','userTotalScore']);
|
||||
$this->assign('object',$rs);
|
||||
return $this->fetch('users/userscores/list');
|
||||
}
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
public function pageQuery(){
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$data = model('UserScores')->pageQuery($userId);
|
||||
return WSTReturn("", 1,$data);
|
||||
}
|
||||
/**
|
||||
* 签到惠宝
|
||||
*/
|
||||
public function signScore(){
|
||||
$m = new MUserscores();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$rs = $m->signScore($userId);
|
||||
return $rs;
|
||||
}
|
||||
}
|
49
hyhproject/mobile2/controller/Wallets.php
Executable file
49
hyhproject/mobile2/controller/Wallets.php
Executable file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use wstmart\common\model\Orders as OM;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 源宝控制器
|
||||
*/
|
||||
class Wallets extends Base{
|
||||
// 前置方法执行列表
|
||||
protected $beforeActionList = [
|
||||
'checkAuth'
|
||||
];
|
||||
/**
|
||||
* 跳去支付页面
|
||||
*/
|
||||
public function payment(){
|
||||
$data = [];
|
||||
$data['orderNo'] = input('orderNo');
|
||||
$data['isBatch'] = (int)input('isBatch');
|
||||
$data['userId'] = (int)session('WST_USER.userId');
|
||||
$this->assign('data',$data);
|
||||
$m = new OM();
|
||||
$rs = $m->getOrderPayInfo($data);
|
||||
|
||||
$list = $m->getByUnique();
|
||||
$this->assign('rs',$list);
|
||||
|
||||
if(empty($rs)){
|
||||
$this->assign('type','');
|
||||
return $this->fetch("users/orders/orders_list");
|
||||
}else{
|
||||
$this->assign('needPay',$rs['needPay']);
|
||||
//获取用户钱包
|
||||
$user = model('users')->getFieldsById($data['userId'],'userMoney,payPwd');
|
||||
$this->assign('userMoney',$user['userMoney']);
|
||||
$payPwd = $user['payPwd'];
|
||||
$payPwd = empty($payPwd)?0:1;
|
||||
$this->assign('payPwd',$payPwd);
|
||||
}
|
||||
return $this->fetch('users/orders/orders_pay_wallets');
|
||||
}
|
||||
/**
|
||||
* 钱包支付
|
||||
*/
|
||||
public function payByWallet(){
|
||||
$m = new OM();
|
||||
return $m->payByWallet();
|
||||
}
|
||||
}
|
185
hyhproject/mobile2/controller/Weixinpays.php
Executable file
185
hyhproject/mobile2/controller/Weixinpays.php
Executable file
@ -0,0 +1,185 @@
|
||||
<?php
|
||||
namespace wstmart\mobile\controller;
|
||||
use think\Loader;
|
||||
use wstmart\common\model\Payments as M;
|
||||
use wstmart\common\model\Orders as OM;
|
||||
use wstmart\common\model\LogMoneys as LM;
|
||||
use wstmart\common\model\ChargeItems as CM;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 微信支付控制器
|
||||
*/
|
||||
class Weixinpays extends Base{
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
private $wxpayConfig;
|
||||
private $wxpay;
|
||||
public function _initialize() {
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
Loader::import('wxpay.WxPayConf');
|
||||
Loader::import('wxpay.WxJsApiPay');
|
||||
|
||||
$this->wxpayConfig = array();
|
||||
$m = new M();
|
||||
$this->wxpay = $m->getPayment("weixinpays");
|
||||
$this->wxpayConfig['appid'] = $this->wxpay['appId']; // 微信公众号身份的唯一标识
|
||||
$this->wxpayConfig['appsecret'] = $this->wxpay['appsecret']; // JSAPI接口中获取openid
|
||||
$this->wxpayConfig['mchid'] = $this->wxpay['mchId']; // 受理商ID
|
||||
$this->wxpayConfig['key'] = $this->wxpay['apiKey']; // 商户支付密钥Key
|
||||
$this->wxpayConfig['notifyurl'] = url("mobile/weixinpays/notify","",true,true);
|
||||
$this->wxpayConfig['returnurl'] = url("mobile/orders/index","",true,true);
|
||||
$this->wxpayConfig['curl_timeout'] = 30;
|
||||
|
||||
// 初始化WxPayConf
|
||||
new \WxPayConf($this->wxpayConfig);
|
||||
}
|
||||
|
||||
|
||||
public function toWeixinPay(){
|
||||
$data = [];
|
||||
$payObj = input("payObj/s");
|
||||
if($payObj=="recharge"){
|
||||
$cm = new CM();
|
||||
$itemId = (int)input("itemId/d");
|
||||
$targetType = (int)input("targetType/d");
|
||||
$targetId = (int)session('WST_USER.userId');
|
||||
if($targetType==1){//商家
|
||||
$targetId = (int)session('WST_USER.shopId');
|
||||
}
|
||||
$needPay = 0;
|
||||
if($itemId>0){
|
||||
$item = $cm->getItemMoney($itemId);
|
||||
$needPay = isSet($item["chargeMoney"])?$item["chargeMoney"]:0;
|
||||
}else{
|
||||
$needPay = (int)input("needPay/d");
|
||||
}
|
||||
$out_trade_no = WSTOrderNo();
|
||||
$body = "钱包充值";
|
||||
$data["status"] = $needPay>0?1:-1;
|
||||
$attach = $payObj."@".$targetId."@".$targetType."@".$needPay."@".$itemId;
|
||||
$returnurl = url("mobile/logmoneys/usermoneys","",true,true);
|
||||
}else{
|
||||
|
||||
$data['orderNo'] = input('orderNo');
|
||||
$data['isBatch'] = (int)input('isBatch');
|
||||
$data['userId'] = (int)session('WST_USER.userId');
|
||||
$m = new OM();
|
||||
$rs = $m->getOrderPayInfo($data);
|
||||
if(empty($rs)){
|
||||
$this->assign('type','');
|
||||
return $this->fetch("users/orders/orders_list");
|
||||
}else{
|
||||
$pkey = base64_decode(input("pkey"));
|
||||
$extras = explode ( "@",$pkey);
|
||||
|
||||
$m = new OM();
|
||||
$userId = (int)session('WST_USER.userId');
|
||||
$obj["userId"] = $userId;
|
||||
$obj["orderNo"] = input("orderNo");
|
||||
$obj["isBatch"] = (int)input("isBatch");
|
||||
|
||||
$rs = $m->getByUnique();
|
||||
$this->assign('rs',$rs);
|
||||
$body = "支付订单";
|
||||
$order = $m->getPayOrders($obj);
|
||||
$needPay = $order["needPay"];
|
||||
$payRand = $order["payRand"];
|
||||
$out_trade_no = $obj["orderNo"]."a1".$payRand;
|
||||
$attach = $userId."@".$obj["orderNo"]."@".$obj["isBatch"];
|
||||
$returnurl = url("mobile/orders/index","",true,true);
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化WxPayConf
|
||||
new \WxPayConf ( $this->wxpayConfig );
|
||||
//使用统一支付接口
|
||||
$notify_url = $this->wxpayConfig ['notifyurl'];
|
||||
$unifiedOrder = new \UnifiedOrder();
|
||||
$unifiedOrder->setParameter("out_trade_no",$out_trade_no);//商户订单号
|
||||
$unifiedOrder->setParameter("notify_url",$notify_url);//通知地址
|
||||
$unifiedOrder->setParameter("trade_type","MWEB");//交易类型
|
||||
$unifiedOrder->setParameter("attach",$attach);//扩展参数
|
||||
$unifiedOrder->setParameter("body",$body);//商品描述
|
||||
$needPay = WSTBCMoney($needPay,0,2);
|
||||
$unifiedOrder->setParameter("total_fee", $needPay * 100);//总金额
|
||||
|
||||
$wap_name = WSTConf('CONF.mallName');
|
||||
$unifiedOrder->setParameter("scene_info", "{'h5_info': {'type':'Wap','wap_url': '".$notify_url."','wap_name': '".$wap_name."'}}");//总金额
|
||||
|
||||
$this->assign('needPay',$needPay);
|
||||
$this->assign('returnUrl',$returnurl );
|
||||
$this->assign('payObj',$payObj);
|
||||
$wxResult = $unifiedOrder->getResult();
|
||||
$this->assign('mweb_url',$wxResult['mweb_url']."&redirect_url".urlencode($returnurl));
|
||||
return $this->fetch('users/orders/orders_wxpay');
|
||||
}
|
||||
|
||||
|
||||
public function notify() {
|
||||
// 使用通用通知接口
|
||||
$notify = new \Notify();
|
||||
// 存储微信的回调
|
||||
$xml = file_get_contents("php://input");
|
||||
$notify->saveData ( $xml );
|
||||
if ($notify->checkSign () == FALSE) {
|
||||
$notify->setReturnParameter ( "return_code", "FAIL" ); // 返回状态码
|
||||
$notify->setReturnParameter ( "return_msg", "签名失败" ); // 返回信息
|
||||
} else {
|
||||
$notify->setReturnParameter ( "return_code", "SUCCESS" ); // 设置返回码
|
||||
}
|
||||
$returnXml = $notify->returnXml ();
|
||||
if ($notify->checkSign () == TRUE) {
|
||||
if ($notify->data ["return_code"] == "FAIL") {
|
||||
// 此处应该更新一下订单状态,商户自行增删操作
|
||||
} elseif ($notify->data ["result_code"] == "FAIL") {
|
||||
// 此处应该更新一下订单状态,商户自行增删操作
|
||||
} else {
|
||||
$order = $notify->getData ();
|
||||
$rs = $this->process($order);
|
||||
if($rs["status"]==1){
|
||||
echo "SUCCESS";
|
||||
}else{
|
||||
echo "FAIL";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//订单处理
|
||||
private function process($order) {
|
||||
|
||||
$obj = array();
|
||||
$obj["trade_no"] = $order['transaction_id'];
|
||||
|
||||
$obj["total_fee"] = (float)$order["total_fee"]/100;
|
||||
$extras = explode ( "@", $order ["attach"] );
|
||||
if($extras[0]=="recharge"){//充值
|
||||
$targetId = (int)$extras [1];
|
||||
$targetType = (int)$extras [2];
|
||||
$itemId = (int)$extras [4];
|
||||
|
||||
$obj["out_trade_no"] = $order['out_trade_no'];
|
||||
$obj["targetId"] = $targetId;
|
||||
$obj["targetType"] = $targetType;
|
||||
$obj["itemId"] = $itemId;
|
||||
$obj["payFrom"] = 'weixinpays';
|
||||
// 支付成功业务逻辑
|
||||
$m = new LM();
|
||||
$rs = $m->complateRecharge ( $obj );
|
||||
}else{
|
||||
$obj["userId"] = $extras[0];
|
||||
$obj["out_trade_no"] = $extras[1];
|
||||
$obj["isBatch"] = $extras[2];
|
||||
$obj["payFrom"] = "weixinpays";
|
||||
// 支付成功业务逻辑
|
||||
$m = new OM();
|
||||
$rs = $m->complatePay ( $obj );
|
||||
}
|
||||
|
||||
return $rs;
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user