first commit

This commit is contained in:
2026-01-18 09:52:48 +08:00
commit 836bdc9409
584 changed files with 40891 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void {
Schema::create('member', function (Blueprint $table) {
$table->id('uid')->unique()->comment('用户ID');
$table->string('username')->comment('用户名');
$table->string('password')->comment('密码');
$table->string('nickname')->comment('昵称');
$table->string('mobile')->nullable()->comment('手机号');
$table->string('email')->nullable()->comment('邮箱');
$table->string('avatar')->nullable()->comment('头像');
$table->tinyInteger('gender')->default(0)->comment('性别');
$table->date('birthday')->nullable()->comment('生日');
$table->unsignedBigInteger('invite_uid')->default(0)->comment('邀请人UID');
$table->unsignedBigInteger('level_id')->default(0)->comment('会员等级ID');
$table->string('last_login_ip')->nullable()->comment('最后登录IP');
$table->timestamp('last_login_time')->nullable()->comment('最后登录时间');
$table->integer('login_count')->default(0)->comment('登录次数');
$table->tinyInteger('status')->default(1)->comment('状态 1正常 2禁用');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('会员表');
});
Schema::create('member_level', function (Blueprint $table) {
$table->id()->uniqid()->comment('主键id');
$table->string('title')->comment('会员等级名称');
$table->string('name')->comment('会员等级标识');
$table->string('icon')->nullable()->comment('会员等级图标');
$table->string('remark')->nullable()->comment('会员等级备注');
$table->string('sort')->default(0)->comment('排序');
$table->tinyInteger('status')->default(1)->comment('状态');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('会员等级表');
});
Schema::create('member_has_level', function (Blueprint $table) {
$table->unsignedBigInteger('level_id')->comment('等级id');
$table->unsignedBigInteger('member_id')->comment('用户id');
$table->primary(['level_id', 'member_id']);
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('会员等级关联表');
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('member');
Schema::dropIfExists('member_level');
Schema::dropIfExists('member_has_level');
}
};

View File

@@ -0,0 +1,71 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void {
Schema::create('member_extends', function (Blueprint $table) {
$table->id()->uniqid()->comment('主键id');
$table->unsignedBigInteger('member_id')->comment('用户id');
$table->tinyInteger('status')->default(1)->comment('状态');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('会员扩展表');
});
Schema::create('member_extends_fields', function (Blueprint $table) {
$table->id()->uniqid()->comment('主键id');
$table->string('title')->comment('字段名称');
$table->string('name')->comment('字段标识');
$table->string('type')->comment('字段类型');
$table->string('length')->nullable()->comment('字段长度');
$table->string('default_value')->nullable()->comment('默认值');
$table->string('after')->nullable()->comment('在字段后');
$table->string('remark')->nullable()->comment('字段备注');
$table->tinyInteger('required')->default(0)->comment('是否必填');
$table->string('sort')->default(0)->comment('排序');
$table->tinyInteger('status')->default(1)->comment('状态 1正常 2禁用');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('会员扩展字段表');
});
Schema::create('member_extends_log', function (Blueprint $table) {
$table->id()->uniqid()->comment('主键id');
$table->unsignedBigInteger('member_id')->comment('用户id');
$table->string('field')->comment('修改的字段');
$table->string('old_value')->nullable()->comment('旧值');
$table->string('new_value')->nullable()->comment('新值');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('会员扩展日志表');
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::dropIfExists('member_extends');
Schema::dropIfExists('member_extends_fields');
Schema::dropIfExists('member_extends_log');
}
};

View File

@@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void {
Schema::table('member_has_level', function (Blueprint $table) {
$table->timestamp('level_expire_time')->nullable()->after('level_id')->comment('等级到期时间');
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
}
};

View File

@@ -0,0 +1,72 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void {
Schema::table('member', function (Blueprint $table) {
$table->string('invite_code')->nullable()->after('login_count')->comment('推荐码');
$table->string('old_password')->nullable()->after('password')->comment('旧密码');
$table->string('salt')->nullable()->after('old_password')->comment('密码盐值');
$table->unsignedBigInteger('pm_uid')->nullable()->after('invite_code')->comment('健康管理师id');
$table->unsignedBigInteger('store_id')->nullable()->after('pm_uid')->comment('所属综合服务体');
});
Schema::create('member_pm', function (Blueprint $table) {
$table->id()->uniqid()->comment('主键id');
$table->unsignedBigInteger('member_id')->comment('用户id');
$table->tinyInteger('level')->default(1)->comment('等级');
$table->string('name')->nullable()->comment('名称');
$table->integer('sex')->default(0)->comment('内容');
$table->string('mobile')->nullable()->comment('电话');
$table->string('area')->nullable()->comment('区域');
$table->tinyInteger('store_id')->default(0)->comment('所属综合服务体');
$table->tinyInteger('status')->default(1)->comment('状态');
$table->bigInteger('end_time')->nullable()->comment('到期时间');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('会员工作室表');
});
Schema::create('member_store', function (Blueprint $table) {
$table->id()->uniqid()->comment('主键id');
$table->unsignedBigInteger('member_id')->comment('用户id');
$table->string('name')->nullable()->comment('名称');
$table->string('logo')->nullable()->comment('logo');
$table->string('mobile')->nullable()->comment('电话');
$table->string('area')->nullable()->comment('区域');
$table->string('address')->nullable()->comment('地址');
$table->string('map')->nullable()->comment('地图坐标');
$table->string('license')->nullable()->comment('营业执照');
$table->tinyInteger('status')->default(1)->comment('状态');
$table->timestamp('created_at')->nullable()->comment('创建时间');
$table->timestamp('updated_at')->nullable()->comment('更新时间');
$table->engine = 'InnoDB';
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
$table->comment('会员综合服务体表');
});
}
/**
* Reverse the migrations.
*/
public function down(): void {
Schema::table('member', function (Blueprint $table) {
$table->dropColumn('invite_code');
$table->dropColumn('old_password');
$table->dropColumn('salt');
});
Schema::dropIfExists('member_pm');
Schema::dropIfExists('member_store');
}
};

View File

@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('member', function (Blueprint $table) {
$table->string('date_type', 10)->default('lunar')->comment('会员生日类型')->after('birthday');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};

View File

View File

@@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Member\Database\Seeders;
use Illuminate\Database\Seeder;
class MemberDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$this->call([
MemberSeeder::class
]);
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Modules\Member\Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\Services\Auth\MenuService;
class MemberSeeder extends Seeder {
/**
* Run the database seeds.
*/
public function run(): void {
$this->addMemberMenu();
}
/**
* @title 商品菜单导入
*
* @return void
*/
public function addMemberMenu(){
$permissions = [
['title' => '会员', 'name' => 'member', 'path' => '/member', 'component' => '', 'type' => 'menu', 'sort' => 1, 'children' => [
['title' => '会员列表', 'name' => 'member.lists', 'path' => '/member/lists', 'component' => 'member/lists', 'type' => 'menu'],
['title' => '会员等级', 'name' => 'member.level', 'path' => '/member/level', 'component' => 'member/level', 'type' => 'menu'],
['title' => '会员字段', 'name' => 'member.field', 'path' => '/member/field', 'component' => 'member/field', 'type' => 'menu'],
]],
];
return app(MenuService::class)->importMenu($permissions, 0);
}
}