You've already forked qlg.tsgz.moe
							
							
		
			
				
	
	
		
			71 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			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();
 | 
						|
	}
 | 
						|
} |