小程序首页配置
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
* 小程序首页配置:轮播图 / 宫格导航 / 促销推荐卡片(后台维护图片、名称、跳转链接)
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('mini_home_banner')) {
|
||||
Schema::create('mini_home_banner', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('轮播图ID');
|
||||
$table->string('title', 50)->nullable()->comment('标题');
|
||||
$table->integer('image_id')->nullable()->default(0)->comment('轮播图片(sys_file ID)');
|
||||
$table->string('link', 255)->nullable()->default('')->comment('小程序跳转链接(如 /pages/goods/detail?id=1)');
|
||||
$table->integer('sort')->default(0)->comment('排序(越小越靠前)');
|
||||
$table->integer('status')->default(1)->comment('状态(1正常 0停用)');
|
||||
$table->timestamps();
|
||||
$table->comment('小程序首页轮播图');
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('mini_home_nav')) {
|
||||
Schema::create('mini_home_nav', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('导航ID');
|
||||
$table->string('name', 50)->nullable()->comment('导航名称');
|
||||
$table->integer('image_id')->nullable()->default(0)->comment('导航图标(sys_file ID)');
|
||||
$table->string('link', 255)->nullable()->default('')->comment('小程序跳转链接');
|
||||
$table->integer('sort')->default(0)->comment('排序(越小越靠前)');
|
||||
$table->integer('status')->default(1)->comment('状态(1正常 0停用)');
|
||||
$table->timestamps();
|
||||
$table->comment('小程序首页宫格导航');
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('mini_home_promo')) {
|
||||
Schema::create('mini_home_promo', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('卡片ID');
|
||||
$table->string('title', 50)->nullable()->comment('卡片标题');
|
||||
$table->string('sub_title', 100)->nullable()->default('')->comment('副标题/促销文案');
|
||||
$table->integer('image_id')->nullable()->default(0)->comment('卡片图片(sys_file ID)');
|
||||
$table->string('link', 255)->nullable()->default('')->comment('小程序跳转链接');
|
||||
$table->integer('sort')->default(0)->comment('排序(越小越靠前)');
|
||||
$table->integer('status')->default(1)->comment('状态(1正常 0停用)');
|
||||
$table->timestamps();
|
||||
$table->comment('小程序首页促销推荐卡片');
|
||||
});
|
||||
}
|
||||
|
||||
// 文件分组:客户端配置图片(幂等,已有库补充分组记录)
|
||||
DB::table('sys_file_group')->insertOrIgnore([
|
||||
'id' => 12,
|
||||
'name' => '客户端配置',
|
||||
'sort' => 11,
|
||||
'describe' => '小程序首页轮播图/宫格导航/促销卡片图片',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mini_home_promo');
|
||||
Schema::dropIfExists('mini_home_nav');
|
||||
Schema::dropIfExists('mini_home_banner');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user