clientId =env('yz.clientid'); $this->clientSecret=env('yz.clientsecret'); $this->authorityId =env('yz.authorityid'); $this->Token =new Token($this->clientId,$this->clientSecret); $this->Client=new Client($this->GetToken()); } public function GetData($method,$params=[]){ return $this->Client->post($method,$this->apiVersion, $params); } private function GetToken(){ $token = Cache::get("YouZanToken"); if(isset($token['access_token'])&& $token['access_token']!=''){ return $token['access_token']; } $token =$this->Token->getSelfAppToken($this->authorityId,["refresh"=>true]); Cache::set("YouZanToken",$token,3500); return $token['access_token']; } }