AdminUserController.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 小夏 < 449134904@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\teahouse\controller;
  12. use app\teahouse\model\LockBookModel;
  13. use app\teahouse\model\LockUserModel;
  14. use cmf\controller\AdminBaseController;
  15. class AdminUserController extends AdminBaseController
  16. {
  17. public function index()
  18. {
  19. $param = $this->request->param();
  20. //搜索条件
  21. $where = [];
  22. if (!empty($param['name'])) {
  23. $where[] = ['name', 'like', "%{$param['name']}%"];
  24. }
  25. if (!empty($param['mobile'])) {
  26. $where[] = ['mobile', 'like', "%{$param['mobile']}%"];
  27. }
  28. if (!empty($param['status'])) {
  29. $where[] = ['status', '=', $param['status']];
  30. }
  31. $list = LockUserModel::where($where)
  32. ->append(['sex_text', 'status_text'])
  33. ->order('status asc')
  34. ->paginate(10, false, ['query' => $param]);
  35. $this->assign('status', isset($param['status']) ? $param['status'] : 0);
  36. $this->assign('name', isset($param['name']) ? $param['name'] : '');
  37. $this->assign('mobile', isset($param['mobile']) ? $param['mobile'] : '');
  38. $this->assign('list', $list->items());
  39. $this->assign('page', $list->render());
  40. return $this->fetch();
  41. }
  42. public function examine()
  43. {
  44. $ids = $this->request->param('ids');
  45. return $this->fetch('', ['ids' => $ids]);
  46. }
  47. public function setStatus()
  48. {
  49. $ids = $this->request->param('ids');
  50. $status = $this->request->param('status');
  51. $comment = $this->request->param('comment', '');
  52. LockUserModel::update(['status' => $status, 'comment' => $comment], ['id' => $ids]);
  53. $this->success('操作成功');
  54. }
  55. }