1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Elton
- * Date: 2020/5/20
- * Time: 19:55
- */
- namespace app\admin\command;
- use app\common\library\Redis;
- use app\common\model\AdManage;
- use app\common\model\AdMaterial;
- use app\common\service\AdPlanService;
- use app\main\constants\AdConstants;
- use think\console\Command;
- use think\console\Input;
- use think\console\input\Option;
- use think\console\Output;
- use think\Exception;
- use think\Log;
- use think\Request;
- class SyncAdRedis extends Command
- {
- public function configure()
- {
- $this->setName('SyncAdRedis')
- ->setDescription('同步广告缓存');
- }
- public function execute(Input $input, Output $output)
- {
- Request::instance()->module('admin');
- try {
- AdPlanService::instance()->refreshAllAd();
- } catch (Exception $e) {
- Log::info("广告缓存维护 异常:" . $e->getMessage());
- }
- $output->write("广告缓存维护完成");
- }
- }
|