search_url = strtolower($this->request->controller()).'/index_search'; $this->title = '申请记录'; $sel_where = []; $sel_where[] = ['w.is_deleted','=',0]; if($name = $this->request->get('name')) $sel_where[] =['w.true_name','=',$name]; if($phone = $this->request->get('phone')) $sel_where[] =['w.phone','=',$phone]; $query = $this->_query($this->table) ->alias('w') ->where($sel_where) ->field('w.*,m.headimg,m.openid,m.name as m_name') ->join('store_member m','m.id = w.user_id'); $query->dateBetween('w.create_at')->order('w.id desc')->page(); } /** * 数据列表处理 * @auth true * @menu true * @param array $data * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ protected function _index_page_filter(&$data) { } /** * 审核 * @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 edit() { $this->title = '审核'; $this->_form($this->table, 'form'); } protected function _form_filter(&$data) { if($data['status'] > 0) $data['check_time'] = date('Y-m-d H:i:s'); } protected function _form_result($id) { $apply_info = RegionalAgency::where('id',$id)->find()->toArray(); switch ($apply_info['status']){ case 1: $user_info = User::field('is_agency,partner_lev,is_partner')->where('id',$apply_info['user_id'])->find() ; if($user_info->is_agency == 0) { if($user_info->partner_lev == 0) $user_info->partner_lev = 1; $user_info->is_agency = 1; $user_info->is_partner = 1; $user_info->save(); } break; case 2: $user_info = User::field('is_agency,partner_lev,is_partner')->where('id',$apply_info['user_id'])->find() ; if($user_info->is_agency > 0) { $user_info->is_agency = 0; $user_info->save(); } break; } } }