123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace App\Console\Commands\Upgrade;
- use App\Models\Log\FeedLogModel;
- use Illuminate\Console\Command;
- use Illuminate\Support\Facades\Redis;
- class SliceTableFeedLog extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'upgrade:sliceTableFeedLog';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'feedLog表分表操作的升级脚本';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- FeedLogModel::where('id', '>', 0)->orderBy('id', 'asc')->each(function (/** @var FeedLogModel $item */ $item) {
- FeedLogModel::create([
- 'created_at' => $item->created_at,
- 'updated_at' => $item->updated_at,
- 'uid' => $item->uid,
- 'partner_id' => $item->partner_id,
- 'ismock' => $item->ismock
- ]);
- Redis::set("upgrade:sliceTableFeedLog", $item->id);
- });
- }
- }
|