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

71 lines
2.0 KiB
PHP
Executable File

<?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();
}
}