123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?php
- namespace app\admin\controller;
- use library\Controller;
- use library\tools\Data;
- use think\Db;
- class Userorder extends Controller
- {
-
- public $table = 'user_order';
-
- public function index()
- {
- $id = $this->request->get('id');
- $this->uid=$id;
- $where['uid'] = $id;
- $this->title = '服务订单';
- $query = $this->_query($this->table)->where($where);
- $query->dateBetween('login_at,create_at')->where($where)->order('id desc')->page();
- }
-
- protected function _index_page_filter(&$data)
- {
- foreach ($data as &$v) {
- $v['images'] = explode('|',$v['image']);
- }
- }
-
- public function add()
- {
- $this->applyCsrfToken();
- $this->_form($this->table, 'form');
- }
-
- public function edit()
- {
- $this->applyCsrfToken();
- $this->_form($this->table, 'form');
- }
-
- public function _form_filter(&$data)
- {
- $uid = $this->request->get('uid');
- if (isset($uid)) $data['uid'] = $uid;
- if ($this->request->isPost()) {
- if (empty($data['create_time'])) $data['create_time'] = date('Y-m-d H:i:s',time());
- } else {
- $data['authorize'] = explode(',', isset($data['authorize']) ? $data['authorize'] : '');
- $this->authorizes = Db::name('SystemAuth')->where(['status' => '1'])->order('sort desc,id desc')->select();
- }
- }
-
- public function forbid()
- {
- if (in_array('10000', explode(',', $this->request->post('id')))) {
- $this->error('系统超级账号禁止操作!');
- }
- $this->applyCsrfToken();
- $this->_save($this->table, ['status' => '0']);
- }
-
- public function resume()
- {
- $this->applyCsrfToken();
- $this->_save($this->table, ['status' => '1']);
- }
-
- public function remove()
- {
- if (in_array('10000', explode(',', $this->request->post('id')))) {
- $this->error('系统超级账号禁止删除!');
- }
- $this->applyCsrfToken();
- $this->_delete($this->table);
- }
- }
|