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) { // }); } };