| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- // +----------------------------------------------------------------------
- // | EasyAdmin
- // +----------------------------------------------------------------------
- // | PHP交流群: 763822524
- // +----------------------------------------------------------------------
- // | 开源协议 https://mit-license.org
- // +----------------------------------------------------------------------
- // | github开源项目:https://github.com/zhongshaofa/EasyAdmin
- // +----------------------------------------------------------------------
- namespace app\admin\controller\system;
- use app\common\model\SystemConfig;
- use app\admin\service\TriggerService;
- use app\common\controller\AdminController;
- use EasyAdmin\annotation\ControllerAnnotation;
- use EasyAdmin\annotation\NodeAnotation;
- use services\CacheServices;
- use think\App;
- use think\facade\Db;
- /**
- * Class Config
- * @package app\admin\controller\system
- * @ControllerAnnotation(title="系统配置管理")
- */
- class Config extends AdminController
- {
- public function __construct(App $app)
- {
- parent::__construct($app);
- $this->model = new SystemConfig();
- }
- /**
- * @NodeAnotation(title="列表")
- */
- public function index()
- {
- $this->assign('total_renwu', 11);
- $this->assign('total_shouxu', 22);
- return $this->fetch();
- }
- /**
- * @NodeAnotation(title="保存")
- */
- public function save()
- {
- $this->checkPostRequest();
- $post = $this->request->post();
- sr_log(json_encode($post));
- try {
- foreach ($post as $key => $val) {
- $this->model
- ->where('name', $key)
- ->update([
- 'value' => $val,
- ]);
- }
- TriggerService::updateMenu();
- TriggerService::updateSysconfig();
- } catch (\Exception $e) {
- $this->error('保存失败');
- }
- $this->success('保存成功');
- }
- }
|