Ver Fonte

Merge branch 'master' into liuzj-ranse-dev

# Conflicts:
#	app/Console/Kernel.php
#	composer.json
#	composer.lock
liuzejian há 1 ano atrás
pai
commit
8775b0c233

+ 1 - 0
.gitignore

@@ -17,3 +17,4 @@ yarn-error.log
 /.fleet
 /.idea
 /.vscode
+composer.lock

+ 72 - 0
app/Console/Commands/CallBack/CreateTrackTable.php

@@ -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('');
+            });
+        }
+    }
+}

+ 3 - 0
app/Console/Kernel.php

@@ -16,6 +16,9 @@ class Kernel extends ConsoleKernel
          * 刷新微信小程序的accessToken
          */
         $schedule->command('Miniprogram:WechatAccessToken')->everyMinute();
+        // $schedule->command('inspire')->hourly();
+        //每月24号执行创建表
+        $schedule->command('create_track_table')->monthlyOn(24);
     }
 
     /**

+ 2 - 1
composer.json

@@ -10,7 +10,8 @@
         "laravel/framework": "^10.8",
         "laravel/sanctum": "^3.2",
         "laravel/tinker": "^2.8",
-        "predis/predis": "^2.1"
+        "predis/predis": "^2.1",
+        "nwidart/laravel-modules": "^10.0"
     },
     "require-dev": {
         "fakerphp/faker": "^1.9.1",

+ 82 - 0
composer.lock

@@ -5,6 +5,7 @@
         "This file is @generated automatically"
     ],
     "content-hash": "6a77229974aee7110d16b94db07815e2",
+
     "packages": [
         {
             "name": "brick/math",
@@ -2197,6 +2198,87 @@
             "time": "2023-02-08T01:06:31+00:00"
         },
         {
+            "name": "nwidart/laravel-modules",
+            "version": "v10.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/nWidart/laravel-modules.git",
+                "reference": "35e514f13cb8ae8dce093e9794785fea27319d81"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/nWidart/laravel-modules/zipball/35e514f13cb8ae8dce093e9794785fea27319d81",
+                "reference": "35e514f13cb8ae8dce093e9794785fea27319d81",
+                "shasum": ""
+            },
+            "require": {
+                "ext-json": "*",
+                "php": ">=8.1"
+            },
+            "require-dev": {
+                "friendsofphp/php-cs-fixer": "^3.6",
+                "laravel/framework": "^10.0",
+                "mockery/mockery": "^1.5",
+                "orchestra/testbench": "^8.0",
+                "phpstan/phpstan": "^1.4",
+                "phpunit/phpunit": "^10.0",
+                "spatie/phpunit-snapshot-assertions": "^5.0"
+            },
+            "type": "library",
+            "extra": {
+                "laravel": {
+                    "providers": [
+                        "Nwidart\\Modules\\LaravelModulesServiceProvider"
+                    ],
+                    "aliases": {
+                        "Module": "Nwidart\\Modules\\Facades\\Module"
+                    }
+                },
+                "branch-alias": {
+                    "dev-master": "10.0-dev"
+                }
+            },
+            "autoload": {
+                "files": [
+                    "src/helpers.php"
+                ],
+                "psr-4": {
+                    "Nwidart\\Modules\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Nicolas Widart",
+                    "email": "n.widart@gmail.com",
+                    "homepage": "https://nicolaswidart.com",
+                    "role": "Developer"
+                }
+            ],
+            "description": "Laravel Module management",
+            "keywords": [
+                "laravel",
+                "module",
+                "modules",
+                "nwidart",
+                "rad"
+            ],
+            "support": {
+                "issues": "https://github.com/nWidart/laravel-modules/issues",
+                "source": "https://github.com/nWidart/laravel-modules/tree/v10.0.0"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/nwidart",
+                    "type": "github"
+                }
+            ],
+            "time": "2023-02-16T11:08:15+00:00"
+        },
+        {
             "name": "phpoption/phpoption",
             "version": "1.9.1",
             "source": {

+ 19 - 0
config/database.php

@@ -62,6 +62,25 @@ return [
                 PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
             ]) : [],
         ],
+        'track' => [
+            'driver' => 'mysql',
+            'url' => env('DATABASE_URL'),
+            'host' => env('DB_TRACK_HOST', '127.0.0.1'),
+            'port' => env('DB_TRACK_PORT', '3306'),
+            'database' => env('DB_TRACK_DATABASE', 'track'),
+            'username' => env('DB_TRACK_USERNAME', 'forge'),
+            'password' => env('DB_TRACK_PASSWORD', ''),
+            'unix_socket' => env('DB_SOCKET', ''),
+            'charset' => 'utf8mb4',
+            'collation' => 'utf8mb4_unicode_ci',
+            'prefix' => '',
+            'prefix_indexes' => true,
+            'strict' => true,
+            'engine' => null,
+            'options' => extension_loaded('pdo_mysql') ? array_filter([
+                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
+            ]) : [],
+        ],
 
         'pgsql' => [
             'driver' => 'pgsql',