12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: 小夏 < 449134904@qq.com>
- // +----------------------------------------------------------------------
- namespace app\teahouse\controller;
- use app\teahouse\model\LockBookModel;
- use app\teahouse\model\LockUserModel;
- use cmf\controller\AdminBaseController;
- class AdminUserController extends AdminBaseController
- {
- public function index()
- {
- $param = $this->request->param();
- //搜索条件
- $where = [];
- if (!empty($param['name'])) {
- $where[] = ['name', 'like', "%{$param['name']}%"];
- }
- if (!empty($param['mobile'])) {
- $where[] = ['mobile', 'like', "%{$param['mobile']}%"];
- }
- if (!empty($param['status'])) {
- $where[] = ['status', '=', $param['status']];
- }
- $list = LockUserModel::where($where)
- ->append(['sex_text', 'status_text'])
- ->order('status asc')
- ->paginate(10, false, ['query' => $param]);
- $this->assign('status', isset($param['status']) ? $param['status'] : 0);
- $this->assign('name', isset($param['name']) ? $param['name'] : '');
- $this->assign('mobile', isset($param['mobile']) ? $param['mobile'] : '');
- $this->assign('list', $list->items());
- $this->assign('page', $list->render());
- return $this->fetch();
- }
- public function examine()
- {
- $ids = $this->request->param('ids');
- return $this->fetch('', ['ids' => $ids]);
- }
- public function setStatus()
- {
- $ids = $this->request->param('ids');
- $status = $this->request->param('status');
- $comment = $this->request->param('comment', '');
- LockUserModel::update(['status' => $status, 'comment' => $comment], ['id' => $ids]);
- $this->success('操作成功');
- }
- }
|