$op, 'task' => $task, 'version' => $version, 'appid' => config('console.thirdUP.appid') ]; //密钥 $sign = $this->sign($fixedParameter['op'], $fixedParameter['task'], $fixedParameter['version'], $parameter); //加入 $fixedParameter['sign'] = $sign; return $fixedParameter; } public function login(string $username, string $password) { //请求参数 $parameter = [ 'username' => $username, 'password' => $password ]; //固定参数 $fixedParameter = $this->fixedParameter('customer', 'login', $parameter); //请求地址 $url = config('console.thirdUP.url'); try { $parameter = array_merge($fixedParameter, $parameter); $client = new httpClient(); $res = $client->request('post', $url, ['form_params'=>$parameter]); $body = $res->getBody(); $this->setLog(self::TYPENAME.'login 远程请求成功', $this->startTime, [$body]); $data = json_decode($body); if ($data->status == FALSE){ $this->error()->fail($data->message); } return $this->response($data); } catch (\Exception $e) { $this->setLog(self::TYPENAME.'login 远程请求失败', $this->startTime, [$e->getMessage()]); $this->error()->fail($e->getMessage()); } } }