分离后台和用户中心登录状态

This commit is contained in:
2020-04-27 08:10:23 +08:00
parent ab34ae6458
commit 246c95d956
6 changed files with 38 additions and 23 deletions

View File

@@ -8,11 +8,12 @@
// +----------------------------------------------------------------------
namespace app\controller\user;
use think\facade\View;
use think\facade\Cache;
use app\controller\Base as BaseC;
use app\model\Model;
use app\model\Form;
use app\model\Model;
use think\facade\Cache;
use think\facade\Config;
use think\facade\View;
class Base extends BaseC {
@@ -46,7 +47,7 @@ class Base extends BaseC {
$this->tpl_config['view_dir_name'] = 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . $pc_themes;
}
}
if(!file_exists($this->app->getRootPath() . $this->tpl_config['view_dir_name'] . DIRECTORY_SEPARATOR . 'user')){
if (!file_exists($this->app->getRootPath() . $this->tpl_config['view_dir_name'] . DIRECTORY_SEPARATOR . 'user')) {
$this->tpl_config['view_dir_name'] = 'public' . DIRECTORY_SEPARATOR . 'template' . DIRECTORY_SEPARATOR . 'default';
}
if ($template == '') {

View File

@@ -39,7 +39,7 @@ class Index extends Base {
} catch (Exception $e) {
return $this->error($e->getError(), '');
}
}else{
} else {
return $this->fetch();
}
}
@@ -62,10 +62,10 @@ class Index extends Base {
$result = (new Member())->register($this->request);
if (false !== $result) {
return $this->success("注册成功!", url('/user/index/login'));
}else{
} else {
return $this->error("注册失败!");
}
}else{
} else {
return $this->fetch();
}
}
@@ -90,13 +90,13 @@ class Index extends Base {
$result = Member::sendFindPaswd($user);
if (false !== $result) {
return $this->success("已发送找回密码邮件!", url('/user/index/login'));
}else{
} else {
return $this->error("发送邮件失败!");
}
}else{
} else {
return $this->error('无此用户!');
}
}else{
} else {
return $this->fetch();
}
}
@@ -124,13 +124,13 @@ class Index extends Base {
$result = Member::update($data, ['uid' => $user['uid']]);
if (false !== $result) {
return $this->success("已重置!", url('/user/index/login'));
}else{
} else {
return $this->error("发送邮件失败!");
}
}else{
} else {
return $this->error('无此用户!');
}
}else{
} else {
$token = $this->request->param('token');
return $this->fetch();
}