topic = $topic; } /** * Execute the console command. * * @return mixed */ public function handle() { $this->line("开始添加话题使用数"); $key = 'topic.just_use_count'; $ids = Redis::ZRANGE($key, 0 , -1, 'WITHSCORES'); foreach($ids as $topicId => $val){ try{ $value = Redis::ZSCORE($key, $topicId); Redis::ZREM ($key, $topicId); $this->topic->where('id', $topicId)->increment('use_count', $value); Log::debug('添加话题使用数成功'.$topicId.'-'.$value); }catch (\Exception $exception){ Log::error('添加话题使用数失败'.$topicId.'-'.$val.$exception->getMessage()); } usleep(10000); } $this->line("更新内容生成U米结束"); } }