$code, 'msg' => $msg, 'data' => $data, ]; // 如果未设置类型则自动判断 $type = $type ?: $this->responseType; $code = 200; if (isset($header['statuscode'])) { $code = $header['statuscode']; unset($header['statuscode']); } $response = Response::create($result, $type, $code)->header($header)->options($options); throw new HttpResponseException($response); } /** * @param string $message * @param int $code * @param null $data */ public function error($message='',$code=1004,$data=null){ $this->result($message,$data,$code); } /** * @param string $message * @param int $code * @param null $data */ public function success($message='',$data=null,$code=0){ $this->result($message,$data,$code); } public function GetDepartId($derpar_id){ $uid=Cache::get("Report::depart_".$derpar_id); if($uid==false){ $uid = (new AccountItem())->GetUidByDepartId($derpar_id); Cache::set('Report::depart_'.$derpar_id,$uid,new \DateTime(date("Y-m-d 23:59:59"))); } return $uid; } }