12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?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 cmf\controller\AdminBaseController;
- class AdminLockBookController extends AdminBaseController
- {
- public function index()
- {
- $param = $this->request->param();
- //搜索条件
- $where = [];
- if (!empty($param['lock_name'])) {
- $where[] = ['lock_name', 'like', "%{$param['lock_name']}%"];
- }
- if (!empty($param['user_name'])) {
- $where[] = ['user_name', 'like', "%{$param['user_name']}%"];
- }
- if (!empty($param['is_use'])) {
- $where[] = ['is_use', '=', $param['is_use']];
- }
- $list = LockBookModel::where($where)
- ->append(['is_use_text'])
- ->order('id desc')
- ->paginate(10, false, ['query' => $param]);
- $this->assign('is_use', isset($param['is_use']) ? $param['is_use'] : 0);
- $this->assign('lock_name', isset($param['lock_name']) ? $param['lock_name'] : '');
- $this->assign('user_name', isset($param['user_name']) ? $param['user_name'] : '');
- $this->assign('list', $list->items());
- $this->assign('page', $list->render());
- return $this->fetch();
- }
- public function setStatus()
- {
- $ids = $this->request->param('ids');
- LockBookModel::update(['is_use' => 1], ['id' => $ids]);
- $this->success('操作成功');
- }
- }
|