YouZan.php 660 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\admin\common;
  3. use Youzan\Open\Client;
  4. use Youzan\Open\Token;
  5. class YouZan
  6. {
  7. public $Client;
  8. public $Token;
  9. public $clientId='deaaebe6484c129787';
  10. public $clientSecret='3c654aa2fbc1b5da788ffdba45fb96f0';
  11. public function __construct()
  12. {
  13. $this->Token =new Token($this->clientId,$this->clientSecret);
  14. $this->Client=new Client($this->GetToken());
  15. }
  16. public function GetData($method,$apiVersion,$params){
  17. return $this->Client->post($method, $apiVersion, $params);
  18. }
  19. public function GetToken(){
  20. return $this->Token->getSelfAppToken("silent",["refresh"=>true]);
  21. }
  22. }