1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace app\admin\controller;
- use app\common\model\Config;
- use app\common\model\User;
- use think\App;
- use think\Db;
- class WasteConfig extends Auth {
- public function index() {
- if (request()->isAjax()) {
- $data = request()->post();
- $model = (new Config());
- $res = $model->saveData($data);
- if ($res) {
- $this->success('保存成功', url('index'));
- }
- $this->error($model->getError());
- }
- else {
- $waste_status = db('config')
- ->where('name', 'waste_status')
- ->value('value');
- $waste_time = db('config')
- ->where('name', 'waste_time')
- ->value('value');
- $waste_user = db('config')
- ->where('name', 'waste_user')
- ->value('value');
- $waste_user = $waste_user ? explode(',', $waste_user) : [];
- $this->assign('user', (new User())->getWasteWorkerList());
- $this->assign('waste_status', $waste_status);
- $this->assign('waste_time', $waste_time);
- $this->assign('waste_user', $waste_user);
- return $this->fetch();
- }
- }
- }
|