|
@@ -0,0 +1,72 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Console\Commands\CallBack;
|
|
|
+
|
|
|
+use Illuminate\Console\Command;
|
|
|
+use Illuminate\Database\Schema\Blueprint;
|
|
|
+use Illuminate\Support\Facades\Schema;
|
|
|
+
|
|
|
+class CreateTrackTable extends Command
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * The name and signature of the console command.
|
|
|
+ *
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $signature = 'create_track_table {--month=}';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * The console command description.
|
|
|
+ *
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $description = '每月创建track表';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Create a new command instance.
|
|
|
+ *
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ parent::__construct();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Execute the console command.
|
|
|
+ *
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function handle()
|
|
|
+ {
|
|
|
+ $month = $this->option('month');
|
|
|
+ $month = $month ? $month : date('Ym', strtotime('+1 month'));
|
|
|
+ $track_table = 'douyin_tracks' . $month;
|
|
|
+ $trackConn = Schema::connection('track');
|
|
|
+ if (!$trackConn->hasTable($track_table)) {
|
|
|
+ $trackConn->create($track_table, function (Blueprint $table) {
|
|
|
+ $table->increments('id');
|
|
|
+ $table->string('link_source', 16)->comment('去放渠道标识')->default('');
|
|
|
+ $table->string('link', 8000)->comment('落地页连接')->default('');
|
|
|
+ $table->string('source', 16)->comment('平台来源')->default('');
|
|
|
+ $table->string('ip_ua', 32);
|
|
|
+ $table->string('connection_id', 32)->comment('站点或者推广连接id')->default('');
|
|
|
+ $table->string('ua', 255);
|
|
|
+ $table->string('ip', 50);
|
|
|
+ $table->string('adid', 32)->comment('巨量1.0广告id')->default('');
|
|
|
+ $table->string('log_time', 20);
|
|
|
+ $table->string('callback', 2048)->comment('用户点击唯一标识')->default('');
|
|
|
+ $table->string('advertiser_id', 64)->comment('广告主id')->default('');
|
|
|
+ $table->string('campaign_id', 64)->comment('广告组id')->default('');
|
|
|
+ $table->string('creativeid', 64)->comment('创意id')->default('');
|
|
|
+ $table->timestamps();
|
|
|
+ $table->index(['connection_id', 'source'], 'idx_channel_id');
|
|
|
+ $table->index('ip', 'idx_ip');
|
|
|
+ $table->index('link_source', 'idx_link_source');
|
|
|
+ $table->index('created_at', 'idx_created_at');
|
|
|
+ $table->string('project_id', 64)->comment('广告项目id')->default('');
|
|
|
+ $table->string('promotion_id', 64)->comment('推销id,广告计划id的替代品')->default('');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|