From ab2123791914e69c0815a5874a4f6a97dbc06ffb Mon Sep 17 00:00:00 2001 From: tensent Date: Sun, 29 Mar 2020 21:54:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=AD=E5=BF=83=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/user/Base.php | 37 +++++++++++++++++++++ app/controller/user/Index.php | 60 +++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 app/controller/user/Base.php create mode 100644 app/controller/user/Index.php diff --git a/app/controller/user/Base.php b/app/controller/user/Base.php new file mode 100644 index 00000000..3570c258 --- /dev/null +++ b/app/controller/user/Base.php @@ -0,0 +1,37 @@ + +// +---------------------------------------------------------------------- +namespace app\controller\user; + +use think\facade\View; +use think\facade\Cache; +use \app\controller\Base as BaseC; + +class Base extends BaseC { + + protected function fetch($template = '') { + $config = Cache::get('system_config_data'); + $this->tpl_config['view_depr'] = '_'; + $pc_themes = $config['pc_themes'] ? $config['pc_themes'] . DIRECTORY_SEPARATOR : ""; + $this->tpl_config['view_dir_name'] = 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $pc_themes; + if ($this->isMobile() && $config['mobile_themes']) { + $mobile_themes = $config['mobile_themes'] ? $config['mobile_themes'] . DIRECTORY_SEPARATOR : ""; + $this->tpl_config['view_dir_name'] = 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $mobile_themes; + if (!is_dir($this->app->getRootPath() . $this->tpl_config['view_dir_name'])) { + $this->tpl_config['view_dir_name'] = 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $pc_themes; + } + } + if ($template == '') { + $template = str_replace(".", "@", strtolower($this->request->controller())) . "/" . $this->request->action(); + } + + View::config($this->tpl_config); + View::assign($this->data); + return View::fetch($template); + } +} \ No newline at end of file diff --git a/app/controller/user/Index.php b/app/controller/user/Index.php new file mode 100644 index 00000000..8c05b2e7 --- /dev/null +++ b/app/controller/user/Index.php @@ -0,0 +1,60 @@ + +// +---------------------------------------------------------------------- +namespace app\controller\user; + +class Index extends Base { + + /** + * @title 用户中心首页 + * @return [type] [description] + */ + public function index() { + return $this->fetch(); + } + + /** + * @title 用户登录 + * @return [type] [description] + */ + public function login() { + return $this->fetch(); + } + + /** + * @title 用户退出 + * @return [type] [description] + */ + public function logout() { + return $this->fetch(); + } + + /** + * @title 用户注册 + * @return [type] [description] + */ + public function register() { + return $this->fetch(); + } + + /** + * @title 忘记密码 + * @return [type] [description] + */ + public function forget() { + return $this->fetch(); + } + + /** + * @title 重置密码 + * @return [type] [description] + */ + public function resetpasswd() { + return $this->fetch(); + } +}