解决linux下文件名大小写的bug、完善用户中心
This commit is contained in:
@@ -10,17 +10,24 @@ namespace app\controller\user;
|
||||
|
||||
use think\facade\View;
|
||||
use think\facade\Cache;
|
||||
use \app\controller\Base as BaseC;
|
||||
use app\controller\Base as BaseC;
|
||||
use app\model\Model;
|
||||
use app\model\Form;
|
||||
|
||||
class Base extends BaseC {
|
||||
|
||||
protected function initialize() {
|
||||
$url = str_replace(".", "/", strtolower($this->request->controller())) . '/' . $this->request->action();
|
||||
if (!is_login() and !in_array($url, array('admin/index/login', 'admin/index/logout', 'admin/index/verify'))) {
|
||||
$this->redirect('/admin/index/login');
|
||||
$this->redirect('/user/index/login');
|
||||
}
|
||||
|
||||
if (!in_array($url, array('admin/index/login', 'admin/index/logout', 'admin/index/verify'))) {
|
||||
if (!in_array($url, array('user/index/login', 'user/index/logout', 'user/index/verify'))) {
|
||||
$map = [];
|
||||
$model = Model::where($map)->column('name, title, icon', 'name');
|
||||
View::assign('model', $model);
|
||||
$form = Form::where($map)->column('id, name, title', 'name');
|
||||
View::assign('form', $form);
|
||||
View::assign('meta_title', isset($this->data['meta_title']) ? $this->data['meta_title'] : $this->getCurrentTitle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,17 +8,54 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\user;
|
||||
|
||||
use think\facade\Db;
|
||||
use app\model\Model;
|
||||
use app\model\Attribute;
|
||||
|
||||
/**
|
||||
* @title 内容模块
|
||||
*/
|
||||
class Content extends Base {
|
||||
|
||||
public $modelInfo = [];
|
||||
public $model = null;
|
||||
|
||||
public function initialize() {
|
||||
parent::initialize();
|
||||
$this->modelInfo = Model::where('name', $this->request->param('name'))->find()->append(['grid_list', 'attr_group'])->toArray();
|
||||
$this->model = Db::name($this->modelInfo['name']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 内容首页
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function index() {
|
||||
return $this->fetch();
|
||||
if ($this->modelInfo['list_grid'] == '') {
|
||||
return $this->error("列表定义不正确!", url('/user/model/edit', array('id' => $this->modelInfo['id'])));
|
||||
}
|
||||
$order = "id desc";
|
||||
$map = [];
|
||||
$map[] = ['uid', '=', session('userInfo.uid')];
|
||||
|
||||
$list = $this->model->where($map)->order($order)->paginate($this->modelInfo['list_row'], false, array(
|
||||
'query' => $this->request->param(),
|
||||
));
|
||||
|
||||
$this->data = array(
|
||||
'grid' => $this->modelInfo['grid_list'],
|
||||
'list' => $list,
|
||||
'page' => $list->render(),
|
||||
'model_name' => $this->modelInfo['name'],
|
||||
'model_id' => $this->modelInfo['id'],
|
||||
'meta_title' => $this->modelInfo['title'].'列表'
|
||||
);
|
||||
if ($this->modelInfo['template_list']) {
|
||||
$template = 'user@content/' . $this->modelInfo['template_list'];
|
||||
} else {
|
||||
$template = 'user@content/index';
|
||||
}
|
||||
return $this->fetch($template);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
25
app/controller/user/Form.php
Normal file
25
app/controller/user/Form.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\user;
|
||||
|
||||
use app\model\Member;
|
||||
|
||||
/**
|
||||
* @title 表单管理
|
||||
*/
|
||||
class Form extends Base {
|
||||
|
||||
/**
|
||||
* @title 表单数据列表
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function index(){
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\user;
|
||||
|
||||
use app\model\Member;
|
||||
|
||||
/**
|
||||
* @title 用户中心
|
||||
*/
|
||||
@@ -24,40 +22,42 @@ class Index extends Base {
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 个人资料
|
||||
* @title 用户登录
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function profile() {
|
||||
if ($this->request->isPost()) {
|
||||
$reuslt = (new Member())->editUser($this->request, session('userInfo.uid'));
|
||||
if (false !== $reuslt) {
|
||||
return $this->success('修改成功!');
|
||||
} else {
|
||||
return $this->error('修改失败');
|
||||
}
|
||||
}else{
|
||||
$info = Member::find(session('userInfo.uid'));
|
||||
$this->data = [
|
||||
'info' => $info,
|
||||
'keyList' => Member::$useredit
|
||||
];
|
||||
return $this->fetch('user@/edit');
|
||||
}
|
||||
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 repasswd() {
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 上传头像
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function avatar() {
|
||||
public function resetpasswd() {
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
@@ -8,48 +8,47 @@
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\user;
|
||||
|
||||
use app\model\Member;
|
||||
|
||||
/**
|
||||
* @title 登录注册
|
||||
* @title 用户管理
|
||||
*/
|
||||
class Login extends Base {
|
||||
|
||||
class User extends Base {
|
||||
/**
|
||||
* @title 用户登录
|
||||
* @title 个人资料
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function index() {
|
||||
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();
|
||||
public function profile() {
|
||||
if ($this->request->isPost()) {
|
||||
$reuslt = (new Member())->editUser($this->request, session('userInfo.uid'));
|
||||
if (false !== $reuslt) {
|
||||
return $this->success('修改成功!');
|
||||
} else {
|
||||
return $this->error('修改失败');
|
||||
}
|
||||
}else{
|
||||
$info = Member::find(session('userInfo.uid'));
|
||||
$this->data = [
|
||||
'info' => $info,
|
||||
'keyList' => Member::$useredit
|
||||
];
|
||||
return $this->fetch('user@/edit');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 重置密码
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function resetpasswd() {
|
||||
public function repasswd() {
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 上传头像
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function avatar() {
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user