title = '核销管理'; $where = []; $where[] = ['m.is_deleted','=',0]; $where[] = ['m.is_hx','=',1]; if($name = input('get.name')) $where[] = ['m.name','like','%'.$name.'%']; if($phone = input('get.phone')) $where[] = ['m.phone','like','%'.$phone.'%']; $field="m.id,m.openid,m.name,m.is_first,m.headimg,m.level_exp,m.phone,m.status,m.create_at,m.account_type"; $query = $this->_query($this->table) ->field($field) ->alias('m') ->where($where) ->order('id desc')->page(); } /** * 添加 * @auth true * @menu true * @throws \think\Exception * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException * @throws \think\exception\PDOException */ public function add() { $this->title = '添加'; if($this->request->post()) { $phone = input('phone'); $user_info = User::where('phone',$phone)->find(); if(empty($user_info))$this->error('用户不存在'); if($user_info->is_deleted || !$user_info->status) $this->error('用户已禁用'); User::where('id',$user_info->id)->update(['is_hx'=>1]); $this->success('添加成功'); } $this->_form($this->table, 'form'); } /** * 删除 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function del() { $this->_save($this->table, ['is_hx' => '0']); $this->success('删除成功'); } /** * 删除 * @auth true * @throws \think\Exception * @throws \think\exception\PDOException */ public function remove() { $this->_save($this->table, ['is_hx' => '0']); } }