|
|
@@ -8,7 +8,8 @@ use App\Models\SentHistory;
|
|
|
use App\Models\Sentence;
|
|
|
use App\Models\ProgressChapter;
|
|
|
use App\Models\PaliText;
|
|
|
-use Illuminate\Support\Facades\Cache;
|
|
|
+use App\Tools\RedisClusters;
|
|
|
+use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
class UpgradeChapterDynamicWeekly extends Command
|
|
|
{
|
|
|
@@ -46,6 +47,7 @@ class UpgradeChapterDynamicWeekly extends Command
|
|
|
if(\App\Tools\Tools::isStop()){
|
|
|
return 0;
|
|
|
}
|
|
|
+ Log::debug('upgrade:chapter.dynamic.weekly start.');
|
|
|
$this->info('upgrade:chapter.dynamic.weekly start.');
|
|
|
|
|
|
$startAt = time();
|
|
|
@@ -53,6 +55,7 @@ class UpgradeChapterDynamicWeekly extends Command
|
|
|
|
|
|
//更新总动态
|
|
|
$this->info("更新总动态");
|
|
|
+ Log::debug("task:更新总动态开始");
|
|
|
$table = ProgressChapter::select('book','para')
|
|
|
->groupBy('book','para')
|
|
|
->orderBy('book');
|
|
|
@@ -61,7 +64,7 @@ class UpgradeChapterDynamicWeekly extends Command
|
|
|
}
|
|
|
$chapters = $table->get();
|
|
|
$bar = $this->output->createProgressBar(count($chapters));
|
|
|
-
|
|
|
+ Log::debug('chapter {count} ',['count',count($chapters)]);
|
|
|
foreach ($chapters as $key => $chapter) {
|
|
|
#章节长度
|
|
|
$paraEnd = PaliText::where('book',$chapter->book)
|
|
|
@@ -82,20 +85,20 @@ class UpgradeChapterDynamicWeekly extends Command
|
|
|
$progress[] = $count;
|
|
|
}
|
|
|
$key="/chapter_dynamic/{$chapter->book}/{$chapter->para}/global";
|
|
|
- Cache::put($key,$progress,3600*24*7);
|
|
|
+ RedisClusters::put($key,$progress,3600*24*7);
|
|
|
|
|
|
$bar->advance();
|
|
|
- sleep(2);
|
|
|
|
|
|
if($this->option('test')){
|
|
|
$this->info("key:{$key}");
|
|
|
- if(Cache::has($key)){
|
|
|
+ if(RedisClusters::has($key)){
|
|
|
$this->info('has key '.$key);
|
|
|
}
|
|
|
break; //调试代码
|
|
|
}
|
|
|
}
|
|
|
$bar->finish();
|
|
|
+ Log::debug("task:更新总动态结束");
|
|
|
|
|
|
$time = time()- $startAt;
|
|
|
$this->info("用时 {$time}");
|
|
|
@@ -104,14 +107,15 @@ class UpgradeChapterDynamicWeekly extends Command
|
|
|
|
|
|
$startAt = time();
|
|
|
//更新chennel动态
|
|
|
- $this->info('更新chennel动态');
|
|
|
+ $this->info('更新channel动态');
|
|
|
+ Log::debug("task:更新channel动态开始");
|
|
|
|
|
|
$table = ProgressChapter::select('book','para','channel_id');
|
|
|
if($this->option('book')){
|
|
|
$table = $table->where('book',$this->option('book'));
|
|
|
}
|
|
|
$bar = $this->output->createProgressBar($table->count());
|
|
|
-
|
|
|
+ Log::debug("更新channel动态 {count}",['count'=>$table->count()]);
|
|
|
foreach ($table->cursor() as $chapter) {
|
|
|
# code...
|
|
|
$max=0;
|
|
|
@@ -134,23 +138,25 @@ class UpgradeChapterDynamicWeekly extends Command
|
|
|
$progress[] = $count;
|
|
|
}
|
|
|
$key="/chapter_dynamic/{$chapter->book}/{$chapter->para}/ch_{$chapter->channel_id}";
|
|
|
- Cache::put($key,$progress,3600*24*7);
|
|
|
+ RedisClusters::put($key,$progress,3600*24*7);
|
|
|
$bar->advance();
|
|
|
- sleep(2);
|
|
|
|
|
|
if($this->option('test')){
|
|
|
$this->info("key:{$key}");
|
|
|
- if(Cache::has($key)){
|
|
|
+ if(RedisClusters::has($key)){
|
|
|
$this->info('has key '.$key);
|
|
|
}
|
|
|
break; //调试代码
|
|
|
}
|
|
|
}
|
|
|
$bar->finish();
|
|
|
+ Log::debug("task:更新channel动态结束");
|
|
|
+
|
|
|
$time = time()- $startAt;
|
|
|
$this->info("用时 {$time}");
|
|
|
|
|
|
$this->info("upgrade:chapter.dynamic done");
|
|
|
+ Log::debug("task: upgrade:chapter.dynamic done");
|
|
|
|
|
|
return 0;
|
|
|
}
|