[更新]使用路由来限制测试环境的禁用操作

This commit is contained in:
Anyon 2017-04-27 10:51:48 +08:00
parent 587fc42105
commit 7212d77f59
6 changed files with 31 additions and 12 deletions

View File

@ -15,7 +15,6 @@
namespace app\admin\controller;
use controller\BasicAdmin;
use service\DataService;
use service\LogService;
/**
@ -67,5 +66,4 @@ class Config extends BasicAdmin {
$this->index();
}
}

View File

@ -60,9 +60,6 @@ class Menu extends BasicAdmin {
* 添加菜单
*/
public function add() {
if ($this->request->isPost()) {
$this->error('系统开发中,不要动菜单哦!');
}
return $this->_form($this->table, 'form');
}
@ -113,7 +110,6 @@ class Menu extends BasicAdmin {
* 删除菜单
*/
public function del() {
$this->error('别再删我菜单了...');
if (DataService::update($this->table)) {
$this->success("菜单删除成功!", '');
}
@ -124,7 +120,6 @@ class Menu extends BasicAdmin {
* 菜单禁用
*/
public function forbid() {
$this->error('请不要禁用菜单...');
if (DataService::update($this->table)) {
$this->success("菜单禁用成功!", '');
}

View File

@ -14,7 +14,7 @@
namespace app\admin\controller;
use app\admin\model\NodeModel as NodeModel;
use app\admin\model\NodeModel;
use controller\BasicAdmin;
use service\DataService;
use service\ToolsService;

View File

@ -40,11 +40,11 @@ class Plugs extends BasicAdmin {
/**
* 文件上传
* @param string $mode
* @return \think\response\View
*/
public function upfile($mode = 'one') {
public function upfile() {
$types = $this->request->get('type', 'jpg,png');
$mode = $this->request->get('mode', 'one');
$this->assign('mode', $mode);
$this->assign('types', $types);
if (!in_array(($uptype = $this->request->get('uptype')), ['local', 'qiniu'])) {

View File

@ -12,4 +12,32 @@
// | github开源项目https://github.com/zoujingli/Think.Admin
// +----------------------------------------------------------------------
/* 测试环境禁止操作路由绑定 */
think\Route::post([
'admin/config/index' => function() {
return json(['code' => 0, 'msg' => '测试环境禁修改系统配置操作!']);
},
'admin/config/file' => function() {
return json(['code' => 0, 'msg' => '测试环境禁修改文件配置操作!']);
},
'admin/menu/add' => function() {
return json(['code' => 0, 'msg' => '测试环境禁添加菜单操作!']);
},
'admin/menu/edit' => function() {
return json(['code' => 0, 'msg' => '测试环境禁编辑菜单操作!']);
},
'admin/menu/forbid' => function() {
return json(['code' => 0, 'msg' => '测试环境禁止禁用菜单操作!']);
},
'admin/menu/del' => function() {
return json(['code' => 0, 'msg' => '测试环境禁止删除菜单操作!']);
},
'wechat/config/index' => function() {
return json(['code' => 0, 'msg' => '测试环境禁止修改微信配置操作!']);
},
'wechat/config/pay' => function() {
return json(['code' => 0, 'msg' => '测试环境禁止修改微信支付操作!']);
}
]);
return [];

View File

@ -44,7 +44,6 @@ class Config extends BasicAdmin {
$this->assign('title', '微信接口配置');
return view();
}
$this->error('矜持点,别改测试参数哦!');
foreach ($this->request->post() as $key => $vo) {
sysconf($key, $vo);
}
@ -106,7 +105,6 @@ class Config extends BasicAdmin {
return view();
}
}
$this->error('矜持点,别改测试参数哦!');
$data = $this->request->post();
foreach ($data as $key => $vo) {
if (in_array($key, ['wechat_cert_key_md5', 'wechat_cert_cert_md5']) && !empty($vo)) {