setName('HandleServiceStatus')->setDescription('处理服务的活动状态'); } protected function execute(Input $input, Output $output) { $key = 'handle_service_status'; $redis = Cache::store('redis')->get($key); if (!$redis) { Cache::set($key, 1, 60); $date = date('Y-m-d H:i:s'); ServiceModel::where('is_del', CommonModel::$del_normal) ->where('starttime', '<=', $date) ->where('endtime', '>', $date) ->save(['activity_status' => ServiceModel::$activity_status_ing, 'updaterid' => 0, 'updater' => '脚本', 'updatetime' => $date]); ServiceModel::where('is_del', CommonModel::$del_normal) ->where('endtime', '<', $date) ->save(['activity_status' => ServiceModel::$activity_status_end, 'updaterid' => 0, 'updater' => '脚本', 'updatetime' => $date]); Cache::set($key, 0); } } }