2019-09-06 23:53:10 +08:00

76 lines
1.9 KiB
PHP
Executable File

<?php
namespace wstmart\home\controller;
/**
* ============================================================================
* 基础控制器
*/
use think\Controller;
class Base extends Controller {
protected $is_icp = 1;
public function __construct(){
parent::__construct();
$this->assign("v",WSTConf('CONF.wstVersion')."_".WSTConf('CONF.wstPCStyleId'));
hook('homeControllerBase');
if(WSTConf('CONF.seoMallSwitch')==0){
$this->redirect('home/switchs/index');
exit;
}
$this->assign('is_icp',$this->is_icp);
}
protected function fetch($template = '', $vars = [], $replace = [], $config = [])
{
$style = WSTConf('CONF.wsthomeStyle')?WSTConf('CONF.wsthomeStyle'):'default';
$replace['__STYLE__'] = str_replace('/index.php','',\think\Request::instance()->root()).'/hyhproject/home/view/'.WSTConf('CONF.wsthomeStyle');
return $this->view->fetch($style."/".$template, $vars, $replace, $config);
}
/**
* 上传图片
*/
public function uploadPic(){
return WSTUploadPic(0);
}
/**
* 编辑器上传文件
*/
public function editorUpload(){
return WSTEditUpload(0);
}
/**
* 获取验证码
*/
public function getVerify(){
WSTVerify();
}
// 登录验证方法--用户
protected function checkAuth(){
$USER = session('WST_USER');
if(empty($USER)){
if(request()->isAjax()){
die('{"status":-999,"msg":"您还未登录"}');
}else{
$this->redirect('home/users/login');
exit;
}
}
}
//登录验证方法--商家
protected function checkShopAuth(){
$USER = session('WST_USER');
if(empty($USER) || $USER['userType']!=1){
if(request()->isAjax()){
die('{"status":-999,"msg":"您还未登录"}');
}else{
$this->redirect('home/shops/login');
exit;
}
}
}
}