testWechatMaterial.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Console\Commands\ActionTrigger\BatchWechatMaterial;
  3. use App\Http\Controllers\WechatController;
  4. use Illuminate\Console\Command;
  5. use DB;
  6. /**
  7. * 删除微信素材
  8. *
  9. */
  10. class testWechatMaterial extends Command
  11. {
  12. /**
  13. * The name and signature of the console command.
  14. *
  15. * @var string
  16. */
  17. protected $signature = 'get_wechat_material {--appid=}';
  18. /**
  19. * The console command description.
  20. *
  21. * @var string
  22. */
  23. protected $description = '删除微信素材';
  24. /**
  25. * Create a new command instance.
  26. *
  27. * @return void
  28. */
  29. public function __construct()
  30. {
  31. parent::__construct();
  32. }
  33. /**
  34. * Execute the console command.
  35. *
  36. * @return mixed
  37. */
  38. public function handle()
  39. {
  40. $appid = $this->option('appid');
  41. try{
  42. $WechatController = new WechatController($appid);
  43. $res = $WechatController->app->material->lists('news', 10, 20);
  44. dump($res['item'][0]['media_id']);
  45. dump($res['item'][1]['media_id']);
  46. dump($res['item'][2]['media_id']);
  47. dump($res['item'][3]['media_id']);
  48. dump($res['item'][4]['media_id']);
  49. dump($res['item'][5]['media_id']);
  50. dump($res['item'][6]['media_id']);
  51. dump($res['item'][7]['media_id']);
  52. dump($res['item'][8]['media_id']);
  53. dump($res['item'][9]['media_id']);
  54. // \Log::info('$res');
  55. // \Log::info($res);
  56. }catch(\Exception $e){
  57. \Log::error($e->getMessage());
  58. }
  59. return;
  60. }
  61. }