/** * 投资人获取约谈记录 */ public function interview() { $project_id = $this->request->get('project_id'); //获取用户约谈记录 $interview = Interview::where('investor_id', $this->user()->id)->where('project_id', $project_id)->get(); return return_rest('1', compact('interview'), '约谈记录'); }
/** *获取项目约谈记录 */ public function interviewList() { $type = 0; if ($this->request->has('type')) { $type = $this->request->get('type'); } $per_page = 15; if ($this->request->has('per_page')) { $per_page = $this->request->get('per_page'); } $project_id = $this->request->get('project_id'); //$customer = $this->user(); //获取项目约谈记录 $interview = Interview::where('project_id', $project_id)->where('state', $type)->withOnly('investor', array('id', 'avatar', 'user_name', 'name', 'company_id'))->orderBy('id', 'desc')->paginate($per_page)->toArray(); //获取每种类型的数量 $interview['count_0'] = Interview::where('project_id', $project_id)->where('state', 0)->count(); $interview['count_1'] = Interview::where('project_id', $project_id)->where('state', 1)->count(); $interview['count_2'] = Interview::where('project_id', $project_id)->where('state', 2)->count(); if ($interview['total'] == 0) { return return_rest('1', compact('interview'), '暂无记录'); } return return_rest('1', compact('interview'), '约谈记录'); }