抖音小程序

AccessTokenDsUpdate.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Console\Commands;
  3. use App\Models\AuthorizeCorp;
  4. use App\RedisModel;
  5. use App\Service\AccessTokenService;
  6. use App\Service\TokenService;
  7. use App\Log;
  8. use Illuminate\Console\Command;
  9. class AccessTokenDsUpdate extends Command
  10. {
  11. /**
  12. * The name and signature of the console command.
  13. *
  14. * @var string
  15. */
  16. protected $signature = 'AccessTokenDsUpdate';
  17. /**
  18. * The console command description.
  19. *
  20. * @var string
  21. */
  22. protected $description = '每3分钟监测需要更新的抖音小程序accesstoken';
  23. public function handle()
  24. {
  25. \DB::connection()->disableQueryLog();
  26. $this->info(date('m-d H:i:s') . ' 开始整理');
  27. $this->stat();
  28. $this->info(date('m-d H:i:s') . ' 整理结束');
  29. }
  30. public function stat()
  31. {
  32. $res = config('douyin.app_info');
  33. foreach($res as $appInfo){
  34. $accesstoken = AccessTokenService::getAccessToken($appInfo['app_id'], 'AccessTokenDsUpdate');
  35. $this->info(date('m-d H:i:s') . '小程序appid:'. $appInfo['app_id'] .' accesstoken:'. $accesstoken);
  36. }
  37. }
  38. }