Ken 1 ay önce
ebeveyn
işleme
7e0d364d05

+ 49 - 0
database/migrations/0001_01_01_000000_create_users_table.php

@@ -0,0 +1,49 @@
+<?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('users', function (Blueprint $table) {
+            $table->id();
+            $table->string('name');
+            $table->string('email',191)->unique();
+            $table->timestamp('email_verified_at')->nullable();
+            $table->string('password');
+            $table->rememberToken();
+            $table->timestamps();
+        });
+
+        Schema::create('password_reset_tokens', function (Blueprint $table) {
+            $table->string('email')->primary();
+            $table->string('token');
+            $table->timestamp('created_at')->nullable();
+        });
+
+        Schema::create('sessions', function (Blueprint $table) {
+            $table->string('id')->primary();
+            $table->foreignId('user_id')->nullable()->index();
+            $table->string('ip_address', 45)->nullable();
+            $table->text('user_agent')->nullable();
+            $table->longText('payload');
+            $table->integer('last_activity')->index();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('users');
+        Schema::dropIfExists('password_reset_tokens');
+        Schema::dropIfExists('sessions');
+    }
+};

+ 36 - 0
database/migrations/2025_12_12_072034_update_users_table.php

@@ -0,0 +1,36 @@
+<?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('users', function (Blueprint $table) {
+            //
+            // 删除 email 相关字段
+            $table->dropUnique('users_email_unique');
+            $table->dropColumn(['email', 'email_verified_at']);
+            
+            // 新增 username 和 nickname 字段
+            $table->string('username')->unique()->after('id');
+            $table->string('nickname')->nullable()->after('username');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('users', function (Blueprint $table) {
+            //
+        });
+    }
+};

+ 124 - 0
database/migrations/2025_12_12_085132_update_to_users_table.php

@@ -0,0 +1,124 @@
+<?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('users', function (Blueprint $table) {
+             $table->string('membership_level_code')
+                  ->default('silver') // 默认白银会员
+                  ->after('id')
+                  ->comment('会员等级编码,关联user_membership_levels表的code字段');
+            // 交易密码(加密存储)
+            $table->string('transaction_password', 255)
+                  ->nullable()
+                  ->after('password')
+                  ->comment('交易密码,加密存储');
+
+            $table->string('mobile', 20)
+                  ->nullable()
+                  ->after('transaction_password')  
+                  ->comment('手机号');
+            
+            // 手机号验证状态
+            $table->tinyInteger('mobile_verified')
+                  ->default(0)
+                  ->after('mobile')
+                  ->comment('手机号是否验证:0=未验证,1=已验证');
+            
+            // 手机号验证时间
+            $table->timestamp('mobile_verified_at')
+                  ->nullable()
+                  ->after('mobile_verified')
+                  ->comment('手机号验证时间');
+            
+            // 邀请码(唯一,用于邀请注册)
+            $table->string('invite_code', 32)
+                  ->unique()
+                  ->nullable()
+                  ->after('transaction_password')
+                  ->comment('用户邀请码,唯一');
+
+                  // 直接上级(一级代理)
+            $table->unsignedBigInteger('inviter_id_1')
+                  ->nullable()
+                  ->after('transaction_password')
+                  ->comment('一级邀请人ID');
+            
+            // 间接上级(二级代理)
+            $table->unsignedBigInteger('inviter_id_2')
+                  ->nullable()
+                  ->after('inviter_id_1')
+                  ->comment('二级邀请人ID');
+            
+            // 间接上级(三级代理)
+            $table->unsignedBigInteger('inviter_id_3')
+                  ->nullable()
+                  ->after('inviter_id_2')
+                  ->comment('三级邀请人ID');
+            
+            // 余额(decimal类型适合存储金额)
+            $table->decimal('balance', 15, 4)
+                  ->default(0.00)
+                  ->after('invite_code')
+                  ->comment('用户余额');
+            
+            // 信用分(用于信用体系)
+            $table->unsignedInteger('credit_score')
+                  ->default(100)
+                  ->after('balance')
+                  ->comment('信用分,默认100分');
+            
+            // 注册IP
+            $table->string('register_ip', 45)
+                  ->nullable()
+                  ->after('credit_score')
+                  ->comment('注册IP地址');
+            
+            // 最后登录IP
+            $table->string('last_login_ip', 45)
+                  ->nullable()
+                  ->after('register_ip')
+                  ->comment('最后登录IP地址');
+            
+            // 状态(1=正常,0=封禁)
+            $table->tinyInteger('status')
+                  ->default(1)
+                  ->after('last_login_ip')
+                  ->comment('状态:1=正常,0=封禁');
+            
+            // 备注(管理员备注)
+            $table->text('remark')
+                  ->nullable()
+                  ->after('status')
+                  ->comment('管理员备注信息');
+            
+            // 最后登录时间(如果还没有这个字段)
+            if (!Schema::hasColumn('users', 'last_login_at')) {
+                $table->timestamp('last_login_at')
+                      ->nullable()
+                      ->after('last_login_ip')
+                      ->comment('最后登录时间');
+            }
+            
+        
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::table('users', function (Blueprint $table) {
+            //
+        });
+    }
+};

+ 48 - 0
database/migrations/2025_12_14_025944_create_admin_table.php

@@ -0,0 +1,48 @@
+<?php
+
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\Hash; // 添加这个
+use Illuminate\Support\Facades\DB;    // 添加这个
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        Schema::create('admin', function (Blueprint $table) {
+            $table->id();
+            $table->string('account', 50)->unique()->comment('账号'); // 账号,唯一
+            $table->string('nickname', 50)->comment('昵称'); // 昵称
+            $table->string('password')->comment('密码'); // 密码
+            $table->tinyInteger('status')->default(1)->comment('状态:0-禁用,1-启用'); // 状态
+            $table->timestamps();
+
+            $table->index('account');
+            $table->index('status');
+
+        });
+
+         // 在表创建后插入超级管理员数据
+        DB::table('admin')->insert([
+            'account' => 'admin',
+            'nickname' => '超级管理员',
+            'password' => Hash::make('123456'), // 请修改这个默认密码
+            'status' => 1,
+            'created_at' => now(),
+            'updated_at' => now(),
+        ]);
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        Schema::dropIfExists('admin');
+    }
+};

+ 27 - 0
database/migrations/2025_12_17_103607_update_users_table.php

@@ -0,0 +1,27 @@
+<?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('users', function (Blueprint $table) {
+            $table->string('blocked_order')->default(20)->comment('卡单数')->after('remark');
+            $table->string('blocked_amount')->default(100)->comment('卡单金额')->after('remark');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};

+ 28 - 0
database/migrations/2025_12_17_155333_update_users_table.php

@@ -0,0 +1,28 @@
+<?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('users', function (Blueprint $table) {
+            $table->decimal('balance', 15, 4)->change()->comment('用户余额');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};

+ 30 - 0
database/migrations/2025_12_18_173552_update_users_table.php

@@ -0,0 +1,30 @@
+<?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('users', function (Blueprint $table) {
+             $table->string('flag')
+                  ->default(0) // 默认
+                  ->after('status')
+                  ->comment('人员类型:0=普通会员,1=管理会员');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};

+ 31 - 0
database/migrations/2025_12_18_211717_update_users_table.php

@@ -0,0 +1,31 @@
+<?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('users', function (Blueprint $table) {
+            $table->string('blocked_profit')
+                ->default(300)
+                ->comment('卡单佣金')
+                ->after('remark');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};

+ 26 - 0
database/migrations/2025_12_19_135428_update_users.php

@@ -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('users', function (Blueprint $table) {
+            $table->integer('last_active_time')->default(0)->comment('最后活跃时间');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};

+ 30 - 0
database/migrations/2025_12_22_170646_update_users_table.php

@@ -0,0 +1,30 @@
+<?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('users', function (Blueprint $table) {
+             $table->string('flag')
+                  ->change()
+                  ->default(0) // 默认
+                  ->comment('人员类型:0=玩家,1=主号,2=代玩号');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        //
+    }
+};