post(); $pageSize = request()->post('pageSize', 15); $datas = SupervisorsService::make()->getDataList($params, $pageSize); return showJson(1010, true, $datas); } /** * 分类 * @return array */ public function categorys() { $datas = [ ['id'=>1,'name'=>'专项导师'], ['id'=>2,'name'=>'研究导师'], ['id'=>3,'name'=>'发展导师'], ]; return message(1010, true, $datas); } /** * 详情 * @return array */ public function info() { $params = request()->all(); $id = isset($params['id'])? $params['id'] : 0; try { if(!$result = SupervisorsService::make()->getInfo($id, $this->userId)){ return showJson(1009, false); }else{ return showJson(1010, true, $result); } } catch (\Exception $exception) { $error = ['data' => $exception->getTrace(), 'err' => $exception->getMessage()]; return showJson(1046, false, $error); } } /** * 咨询提交 */ public function consult(ConsultValidator $validator) { $params = request()->post(); $params = $validator->check($params, 'submit'); if (!is_array($params)) { return showJson($params, false); } try { if (SupervisorsService::make()->consultSubmit($this->userId, $params)) { return showJson(SupervisorsService::make()->getError(), true); } else { return showJson(SupervisorsService::make()->getError(), false); } } catch (\Exception $exception) { $error = ['data' => $exception->getTrace(), 'err' => $exception->getMessage()]; return showJson(1046, false, $error); } } }