SyncAdRedis.php 981 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Elton
  5. * Date: 2020/5/20
  6. * Time: 19:55
  7. */
  8. namespace app\admin\command;
  9. use app\common\library\Redis;
  10. use app\common\model\AdManage;
  11. use app\common\model\AdMaterial;
  12. use app\common\service\AdPlanService;
  13. use app\main\constants\AdConstants;
  14. use think\console\Command;
  15. use think\console\Input;
  16. use think\console\input\Option;
  17. use think\console\Output;
  18. use think\Exception;
  19. use think\Log;
  20. use think\Request;
  21. class SyncAdRedis extends Command
  22. {
  23. public function configure()
  24. {
  25. $this->setName('SyncAdRedis')
  26. ->setDescription('同步广告缓存');
  27. }
  28. public function execute(Input $input, Output $output)
  29. {
  30. Request::instance()->module('admin');
  31. try {
  32. AdPlanService::instance()->refreshAllAd();
  33. } catch (Exception $e) {
  34. Log::info("广告缓存维护 异常:" . $e->getMessage());
  35. }
  36. $output->write("广告缓存维护完成");
  37. }
  38. }