目录结构更新,增加composer支持

This commit is contained in:
2018-01-14 09:40:04 +08:00
parent 3818619504
commit ae46a73172
945 changed files with 421 additions and 210179 deletions

View File

@@ -40,7 +40,7 @@ class Action extends Admin {
*/
public function add() {
$model = model('Action');
if (IS_POST) {
if ($this->request->isPost()) {
$data = input('post.');
$result = $model->save($data);
if (false != $result) {
@@ -65,7 +65,7 @@ class Action extends Admin {
*/
public function edit($id = null) {
$model = model('Action');
if (IS_POST) {
if ($this->request->isPost()) {
$data = input('post.');
$result = $model->save($data, array('id' => $data['id']));
if ($result !== false) {

View File

@@ -42,7 +42,7 @@ class Ad extends Admin {
*/
public function add() {
$place = model('AdPlace');
if (IS_POST) {
if ($this->request->isPost()) {
$result = $place->change();
if (false !== false) {
return $this->success("添加成功!");
@@ -61,7 +61,7 @@ class Ad extends Admin {
public function edit($id = null) {
$place = model('AdPlace');
if (IS_POST) {
if ($this->request->isPost()) {
$result = $place->change();
if ($result) {
return $this->success("修改成功!", url('admin/ad/index'));
@@ -115,7 +115,7 @@ class Ad extends Admin {
public function addad($id) {
$ad = model('ad');
if (IS_POST) {
if ($this->request->isPost()) {
$result = $ad->change();
if ($result) {
return $this->success("添加成功!", url('admin/ad/lists', array('id' => $this->param['place_id'])));
@@ -136,7 +136,7 @@ class Ad extends Admin {
public function editad($id = null) {
$ad = model('ad');
if (IS_POST) {
if ($this->request->isPost()) {
$result = $ad->change();
if ($result) {
return $this->success("修改成功!", url('admin/ad/lists', array('id' => $this->param['place_id'])));

View File

@@ -43,7 +43,7 @@ class Addons extends Admin {
//创建向导首页
public function add() {
if (IS_POST) {
if ($this->request->isPost()) {
$data = $this->addons->create();
if ($data) {
if ($result) {
@@ -150,7 +150,7 @@ class Addons extends Admin {
* 设置插件页面
*/
public function config() {
if (IS_POST) {
if ($this->request->isPost()) {
# code...
} else {
$id = input('id', '', 'trim,intval');
@@ -232,7 +232,7 @@ class Addons extends Admin {
public function addhook() {
$hooks = model('Hooks');
if (IS_POST) {
if ($this->request->isPost()) {
$result = $hooks->change();
if ($result !== false) {
return $this->success("修改成功");
@@ -253,7 +253,7 @@ class Addons extends Admin {
//钩子出编辑挂载插件页面
public function edithook($id) {
$hooks = model('Hooks');
if (IS_POST) {
if ($this->request->isPost()) {
$result = $hooks->change();
if ($result !== false) {
return $this->success("修改成功");

View File

@@ -66,7 +66,7 @@ class Attribute extends Admin {
* @author colin <colin@tensent.cn>
*/
public function add($model_id = '') {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->model->validate('attribute.add')->save($this->param);
if (false !== $result) {
return $this->success("创建成功!", url('Attribute/index', array('model_id' => $model_id)));
@@ -89,7 +89,7 @@ class Attribute extends Admin {
* @author colin <colin@tensent.cn>
*/
public function edit($id = '', $model_id = '') {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->model->validate('attribute.edit')->save($this->param, array('id'=>$id));
if ($result) {
return $this->success("修改成功!", url('Attribute/index', array('model_id' => $model_id)));

View File

@@ -47,7 +47,7 @@ class Category extends Admin {
/* 编辑分类 */
public function edit($id = null, $pid = 0) {
if (IS_POST) {
if ($this->request->isPost()) {
$category = model('Category');
//提交表单
$result = $category->change();
@@ -85,7 +85,7 @@ class Category extends Admin {
public function add($pid = 0) {
$Category = model('Category');
if (IS_POST) {
if ($this->request->isPost()) {
//提交表单
$id = $Category->change();
if (false !== $id) {
@@ -250,7 +250,7 @@ class Category extends Admin {
}
public function add_channel() {
if (IS_POST) {
if ($this->request->isPost()) {
$Channel = model('Channel');
$data = $this->request->param();
if ($data) {

View File

@@ -53,7 +53,7 @@ class Channel extends Admin {
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
public function add() {
if (IS_POST) {
if ($this->request->isPost()) {
$Channel = model('Channel');
$data = $this->request->post();
if ($data) {
@@ -89,7 +89,7 @@ class Channel extends Admin {
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
public function edit($id = 0) {
if (IS_POST) {
if ($this->request->isPost()) {
$Channel = model('Channel');
$data = $this->request->post();
if ($data) {
@@ -155,7 +155,7 @@ class Channel extends Admin {
* @author huajie <banhuajie@163.com>
*/
public function sort() {
if (IS_GET) {
if ($this->request->isGet()) {
$ids = input('ids');
$pid = input('pid');
//获取排序的数据
@@ -172,7 +172,7 @@ class Channel extends Admin {
$this->assign('list', $list);
$this->setMeta('导航排序');
return $this->fetch();
} elseif (IS_POST) {
} elseif ($this->request->isPost()) {
$ids = input('post.ids');
$ids = explode(',', $ids);
foreach ($ids as $key => $value) {

View File

@@ -30,7 +30,7 @@ class Client extends Admin {
}
public function add(\think\Request $request){
if (IS_POST) {
if ($this->request->isPost()) {
$data = $request->param();
$result = $this->model->validate(true)->save($data);
if (false !== $result) {
@@ -51,7 +51,7 @@ class Client extends Admin {
}
public function edit(\think\Request $request){
if (IS_POST) {
if ($this->request->isPost()) {
$data = $request->param();
$result = $this->model->validate(true)->save($data, array('id'=>$request->param('id')));
if (false !== $result) {

View File

@@ -52,7 +52,7 @@ class Config extends Admin {
}
public function group($id = 1) {
if (IS_POST) {
if ($this->request->isPost()) {
$config = $this->request->post('config/a');
$model = model('Config');
foreach ($config as $key => $value) {
@@ -78,7 +78,7 @@ class Config extends Admin {
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
public function add() {
if (IS_POST) {
if ($this->request->isPost()) {
$config = model('Config');
$data = $this->request->post();
if ($data) {
@@ -106,7 +106,7 @@ class Config extends Admin {
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
public function edit($id = 0) {
if (IS_POST) {
if ($this->request->isPost()) {
$config = model('Config');
$data = $this->request->post();
if ($data) {
@@ -177,7 +177,7 @@ class Config extends Admin {
* @author huajie <banhuajie@163.com>
*/
public function sort() {
if (IS_GET) {
if ($this->request->isGet()) {
$ids = input('ids');
//获取排序的数据
$map = array('status' => array('gt', -1));
@@ -191,7 +191,7 @@ class Config extends Admin {
$this->assign('list', $list);
$this->setMeta('配置排序');
return $this->fetch();
} elseif (IS_POST) {
} elseif ($this->request->isPost()) {
$ids = input('post.ids');
$ids = explode(',', $ids);
foreach ($ids as $key => $value) {

View File

@@ -66,7 +66,7 @@ class Content extends Admin {
* @author molong <ycgpp@126.com>
*/
public function add() {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->model->save($this->param);
if ($result) {
//记录行为
@@ -99,7 +99,7 @@ class Content extends Admin {
* @author molong <ycgpp@126.com>
*/
public function edit($id) {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->model->save($this->param, array('id'=> $id));
if ($result !== false) {
//记录行为

View File

@@ -155,7 +155,7 @@ class Database extends Admin {
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
public function export($tables = null, $id = null, $start = null) {
if (IS_POST && !empty($tables) && is_array($tables)) {
if ($this->request->isPost() && !empty($tables) && is_array($tables)) {
//初始化
$path = config('data_backup_path');
if (!is_dir($path)) {
@@ -189,7 +189,7 @@ class Database extends Admin {
} else {
return $this->error('初始化失败,备份文件创建失败!');
}
} elseif (IS_GET && is_numeric($id) && is_numeric($start)) {
} elseif ($this->request->isGet() && is_numeric($id) && is_numeric($start)) {
//备份数据
$tables = session('backup_tables');
//备份指定表

View File

@@ -42,7 +42,7 @@ class Form extends Admin {
* 添加表单
*/
public function add(\think\Request $request) {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->model->validate('Form')->save($request->post());
if (false !== $result) {
return $this->success('添加成功!', url('admin/form/index'));
@@ -63,7 +63,7 @@ class Form extends Admin {
* 编辑表单
*/
public function edit(\think\Request $request) {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->model->validate('Form')->save($request->post(), array('id' => $request->post('id')));
if (false !== $result) {
return $this->success('修改成功!', url('admin/form/index'));
@@ -170,7 +170,7 @@ class Form extends Admin {
if (!$form_id) {
return $this->error('非法操作!');
}
if (IS_POST) {
if ($this->request->isPost()) {
$data = $request->post();
$result = $this->Fattr->save($data);
if (false !== $result) {
@@ -198,7 +198,7 @@ class Form extends Admin {
if (!$form_id || !$id) {
return $this->error('非法操作!');
}
if (IS_POST) {
if ($this->request->isPost()) {
$data = $request->post();
$result = $this->Fattr->save($data, array('id'=>$data['id']));
if (false !== $result) {

View File

@@ -39,7 +39,7 @@ class Group extends Admin {
//会员分组添加控制器
public function add($type = 'admin') {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->group->change();
if ($result) {
return $this->success("添加成功!", url('admin/group/index'));
@@ -62,7 +62,7 @@ class Group extends Admin {
if (!$id) {
return $this->error("非法操作!");
}
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->group->change();
if ($result) {
return $this->success("编辑成功!", url('admin/group/index'));
@@ -138,7 +138,7 @@ class Group extends Admin {
if (!$id) {
return $this->error("非法操作!");
}
if (IS_POST) {
if ($this->request->isPost()) {
$rule = $this->request->post('rule/a', array());
$extend_rule = $this->request->post('extend_rule/a', array());
$extend_result = $rule_result = false;
@@ -194,7 +194,7 @@ class Group extends Admin {
}
public function addnode($type = 'admin') {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->rule->change();
if ($result) {
return $this->success("创建成功!", url('admin/group/access'));
@@ -213,7 +213,7 @@ class Group extends Admin {
}
public function editnode($id) {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->rule->change();
if (false !== $result) {
return $this->success("更新成功!", url('admin/group/access'));

View File

@@ -8,6 +8,7 @@
// +----------------------------------------------------------------------
namespace app\admin\controller;
use app\common\controller\Admin;
class Index extends Admin {
@@ -18,15 +19,17 @@ class Index extends Admin {
}
public function login($username = '', $password = '', $verify = '') {
if (IS_POST) {
if ($this->request->isPost()) {
if (!$username || !$password) {
return $this->error('用户名或者密码不能为空!', '');
}
//验证码验证
$this->checkVerify($verify);
if(!captcha_check($verify)){
return $this->error('验证码错误!', '');
}
$user = model('User');
$user = model('Member');
$uid = $user->login($username, $password);
if ($uid > 0) {
return $this->success('登录成功!', url('admin/index/index'));
@@ -46,14 +49,23 @@ class Index extends Admin {
}
}
/**
* title : 后台退出
*
*/
public function logout() {
$user = model('User');
$user = model('Member');
$user->logout();
$this->redirect('admin/index/login');
}
/**
* title : 清除缓存
*
*/
public function clear() {
if (IS_POST) {
if ($this->request->isPost()) {
$clear = input('post.clear/a', array());
foreach ($clear as $key => $value) {
if ($value == 'cache') {
@@ -79,4 +91,4 @@ class Index extends Admin {
return $this->fetch('public/edit');
}
}
}
}

View File

@@ -30,7 +30,7 @@ class Link extends Admin {
//添加
public function add() {
$link = model('Link');
if (IS_POST) {
if ($this->request->isPost()) {
$data = input('post.');
if ($data) {
unset($data['id']);
@@ -57,7 +57,7 @@ class Link extends Admin {
public function edit() {
$link = model('Link');
$id = input('id', '', 'trim,intval');
if (IS_POST) {
if ($this->request->isPost()) {
$data = input('post.');
if ($data) {
$result = $link->save($data, array('id' => $data['id']));

View File

@@ -46,7 +46,7 @@ class Menu extends Admin {
* @author yangweijie <yangweijiester@gmail.com>
*/
public function add() {
if (IS_POST) {
if ($this->request->isPost()) {
$Menu = model('Menu');
$data = input('post.');
$id = $Menu->save($data);
@@ -80,7 +80,7 @@ class Menu extends Admin {
* @author yangweijie <yangweijiester@gmail.com>
*/
public function edit($id = 0) {
if (IS_POST) {
if ($this->request->isPost()) {
$Menu = model('Menu');
$data = input('post.');
if ($Menu->save($data, array('id' => $data['id'])) !== false) {
@@ -176,7 +176,7 @@ class Menu extends Admin {
}
public function import() {
if (IS_POST) {
if ($this->request->isPost()) {
$tree = input('post.tree');
$lists = explode(PHP_EOL, $tree);
$menuModel = db('Menu');
@@ -217,7 +217,7 @@ class Menu extends Admin {
* @author huajie <banhuajie@163.com>
*/
public function sort() {
if (IS_GET) {
if ($this->request->isGet()) {
$ids = input('ids');
$pid = input('pid');
@@ -235,7 +235,7 @@ class Menu extends Admin {
$this->assign('list', $list);
$this->setMeta('菜单排序');
return $this->fetch();
} elseif (IS_POST) {
} elseif ($this->request->isPost()) {
$ids = input('post.ids');
$ids = explode(',', $ids);
foreach ($ids as $key => $value) {

View File

@@ -46,7 +46,7 @@ class Model extends Admin {
* @author huajie <banhuajie@163.com>
*/
public function add(\think\Request $request) {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->model->validate('Model.add')->save($request->post());
if (false !== $result) {
//记录行为
@@ -66,7 +66,7 @@ class Model extends Admin {
* @author molong <molong@tensent.cn>
*/
public function edit(\think\Request $request) {
if (IS_POST) {
if ($this->request->isPost()) {
$result = $this->model->validate('Model.edit')->save($request->post(), array('id' => $request->post('id')));
if (false !== $result) {
//记录行为

View File

@@ -37,7 +37,7 @@ class Seo extends Admin {
}
public function add() {
if (IS_POST) {
if ($this->request->isPost()) {
$data = $this->request->post();
$result = $this->seo->save($data);
if ($result) {
@@ -56,7 +56,7 @@ class Seo extends Admin {
}
public function edit($id = null) {
if (IS_POST) {
if ($this->request->isPost()) {
$data = $this->request->post();
$result = $this->seo->save($data, array('id' => $data['id']));
if (false !== $result) {
@@ -103,7 +103,7 @@ class Seo extends Admin {
}
public function addrewrite() {
if (IS_POST) {
if ($this->request->isPost()) {
$result = model('Rewrite')->change();
if (false != $result) {
return $this->success("添加成功!", url('admin/seo/rewrite'));
@@ -121,7 +121,7 @@ class Seo extends Admin {
}
public function editrewrite() {
if (IS_POST) {
if ($this->request->isPost()) {
$result = model('Rewrite')->change();
if (false != $result) {
return $this->success("更新成功!", url('admin/seo/rewrite'));

View File

@@ -26,7 +26,7 @@ class User extends Admin {
}
$order = "uid desc";
$list = model('User')->where($map)->order($order)->paginate(15);
$list = model('Member')->where($map)->order($order)->paginate(15);
$data = array(
'list' => $list,
@@ -42,8 +42,8 @@ class User extends Admin {
* @author colin <molong@tensent.cn>
*/
public function add() {
$model = \think\Loader::model('User');
if (IS_POST) {
$model = \think\Loader::model('Member');
if ($this->request->isPost()) {
$data = $this->request->param();
//创建注册用户
$result = $model->register($data['username'], $data['password'], $data['repassword'], $data['email'], false);
@@ -67,8 +67,8 @@ class User extends Admin {
* @author huajie <banhuajie@163.com>
*/
public function edit() {
$model = model('User');
if (IS_POST) {
$model = model('Member');
if ($this->request->isPost()) {
$data = $this->request->post();
$reuslt = $model->editUser($data, true);
@@ -99,14 +99,14 @@ class User extends Admin {
$uid = array('IN', is_array($id) ? implode(',', $id) : $id);
//获取用户信息
$find = $this->getUserinfo($uid);
model('User')->where(array('uid' => $uid))->delete();
model('Member')->where(array('uid' => $uid))->delete();
return $this->success('删除用户成功!');
}
public function auth() {
$access = model('AuthGroupAccess');
$group = model('AuthGroup');
if (IS_POST) {
if ($this->request->isPost()) {
$uid = input('uid', '', 'trim,intval');
$access->where(array('uid' => $uid))->delete();
$group_type = config('user_group_type');
@@ -152,7 +152,7 @@ class User extends Admin {
* @author colin <colin@tensent.cn>
*/
private function getUserinfo($uid = null, $pass = null, $errormsg = null) {
$user = model('User');
$user = model('Member');
$uid = $uid ? $uid : input('id');
//如果无UID则修改当前用户
$uid = $uid ? $uid : session('user_auth.uid');
@@ -215,7 +215,7 @@ class User extends Admin {
* @author huajie <banhuajie@163.com>
*/
public function editpwd() {
if (IS_POST) {
if ($this->request->isPost()) {
$user = model('User');
$data = $this->request->post();