diff --git a/application/admin/controller/system/Express.php b/application/admin/controller/system/Express.php new file mode 100644 index 00000000..552aa97e --- /dev/null +++ b/application/admin/controller/system/Express.php @@ -0,0 +1,131 @@ +request); + $this->assign(ExpressModel::systemPage($params)); + $this->assign(compact('params')); + return $this->fetch(); + } + + + /** + * 显示创建资源表单页. + * + * @return \think\Response + */ + public function create($cid = 0) + { + $formbuider = [ + Form::input('name','公司名称')->required('公司名称名称必填'), + Form::input('code','编码'), + Form::number('sort','排序',0), + Form::radio('is_show','是否启用',1)->options([['value'=>0,'label'=>'隐藏'],['value'=>1,'label'=>'启用']]), + ]; + $form = Form::make_post_form('添加物流公司',$formbuider,Url::build('save'),2); + $this->assign(compact('form')); + return $this->fetch('public/form-builder'); + } + + /** + * 保存新建的资源 + * + * @param \think\Request $request + * @return \think\Response + */ + public function save(Request $request) + { + $data = Util::postMore([ + 'name', + 'code', + ['sort',0], + ['is_show',0]],$request); + if(!$data['name']) return Json::fail('请输入公司名称'); + ExpressModel::set($data); + return Json::successful('添加公司成功!'); + } + + /** + * 显示编辑资源表单页. + * + * @param int $id + * @return \think\Response + */ + public function edit($id) + { + $menu = ExpressModel::get($id); + if(!$menu) return Json::fail('数据不存在!'); + $formbuider = [ + Form::input('name','公司名称',$menu['name']), + Form::input('code','编码',$menu['code']), + Form::number('sort','排序',$menu['sort']), + Form::radio('is_show','是否启用',$menu['is_show'])->options([['value'=>0,'label'=>'隐藏'],['value'=>1,'label'=>'启用']]) + ]; + $form = Form::make_post_form('添加物流公司',$formbuider,Url::build('update',array('id'=>$id)),2); + $this->assign(compact('form')); + return $this->fetch('public/form-builder'); + } + + /** + * 保存更新的资源 + * + * @param \think\Request $request + * @param int $id + * @return \think\Response + */ + public function update(Request $request, $id) + { + $data = Util::postMore([ + 'name', + 'code', + ['sort',0], + ['is_show',0]],$request); + if(!$data['name']) return Json::fail('请输入公司名称'); + if(!ExpressModel::get($id)) return Json::fail('编辑的记录不存在!'); + ExpressModel::edit($data,$id); + return Json::successful('修改成功!'); + } + + /** + * 删除指定资源 + * + * @param int $id + * @return \think\Response + */ + public function delete($id) + { + if(!$id) return $this->failed('参数错误,请重新打开'); + $res = ExpressModel::destroy($id); + if(!$res) + return Json::fail(ExpressModel::getErrorInfo('删除失败,请稍候再试!')); + else + return Json::successful('删除成功!'); + } + +} diff --git a/application/admin/controller/system/SystemClear.php b/application/admin/controller/system/SystemClear.php deleted file mode 100644 index 6acbdd27..00000000 --- a/application/admin/controller/system/SystemClear.php +++ /dev/null @@ -1,53 +0,0 @@ -fetch(); - } - public function refresh_cache(){ - `php think optimize:schema`; - `php think optimize:autoload`; - `php think optimize:route`; - `php think optimize:config`; - return Json::successful('数据缓存刷新成功!'); - } - public function delete_cache(){ - $this->delDirAndFile("./runtime/temp"); - $this->delDirAndFile("./runtime/cache"); - return Json::successful('清除缓存成功!'); - } - public function delete_log(){ - $this->delDirAndFile("./runtime/log"); - return Json::successful('清除日志成功!'); - } - function delDirAndFile($dirName,$subdir=true){ - if ($handle = opendir("$dirName")){ - while(false !== ($item = readdir($handle))){ - if($item != "." && $item != ".."){ - if(is_dir("$dirName/$item")) - $this->delDirAndFile("$dirName/$item",false); - else - @unlink("$dirName/$item"); - } - } - closedir($handle); - if(!$subdir) @rmdir($dirName); - } - } -} - - diff --git a/application/admin/model/system/Express.php b/application/admin/model/system/Express.php new file mode 100644 index 00000000..4efe2238 --- /dev/null +++ b/application/admin/model/system/Express.php @@ -0,0 +1,27 @@ + + * @day: 2017/11/11 + */ + +namespace app\admin\model\system; + +use traits\ModelTrait; +use basic\ModelBasic; + +/** + * Class SystemAdmin + * @package app\admin\model\system + */ +class Express extends ModelBasic +{ + use ModelTrait; + public static function systemPage($params) + { + $model = new self; + if($params['keyword'] !== '') $model = $model->where('name|code','LIKE',"%$params[keyword]%"); + $model = $model->order('sort DESC,id DESC'); + return self::page($model,$params); + } +} \ No newline at end of file diff --git a/application/admin/view/setting/system_role/index.php b/application/admin/view/setting/system_role/index.php index 78853a38..45a18f5b 100644 --- a/application/admin/view/setting/system_role/index.php +++ b/application/admin/view/setting/system_role/index.php @@ -12,23 +12,6 @@
- - - - -
- - -
- */ ?>
+ +
+ +
+ +
+
+ + + + + + + + + + + + + + {volist name="list" id="vo"} + + + + + + + + + {/volist} + +
编号物流公司名称编目排序状态操作
+ {$vo.id} + + {$vo.name} + + {$vo.code} + + {$vo.sort} + + + + + +
+
+ {include file="public/inner_page"} + + + + +{/block} +{block name="script"} + +{/block}