小程序用户改用门店登录
This commit is contained in:
@@ -12,30 +12,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('user')) {
|
||||
Schema::create('user', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('用户ID');
|
||||
$table->string('username', 20)->nullable()->unique()->comment('用户名');
|
||||
$table->string('password', 100)->nullable()->comment('密码');
|
||||
$table->string('nickname', 20)->default('')->comment('昵称');
|
||||
$table->string('email', 50)->default('')->comment('邮箱');
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
// 小程序用户扩展字段
|
||||
$table->string('openid', 64)->nullable()->unique()->comment('微信OpenID');
|
||||
$table->string('unionid', 64)->default('')->comment('微信UnionID');
|
||||
$table->string('phone', 20)->default('')->comment('手机号');
|
||||
$table->string('avatar', 255)->default('')->comment('头像');
|
||||
$table->integer('store_id')->default(0)->comment('关联门店ID');
|
||||
$table->integer('status')->default(1)->comment('状态(1正常 0停用)');
|
||||
$table->timestamp('last_login_at')->nullable()->comment('最后登录时间');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
$table->index('store_id', 'user_type_index');
|
||||
$table->index('openid', 'user_openid_index');
|
||||
$table->comment('APP用户表(含小程序用户)');
|
||||
});
|
||||
}
|
||||
|
||||
// 客户等级表(价格体系按等级定价)
|
||||
if (! Schema::hasTable('customer_level')) {
|
||||
Schema::create('customer_level', function (Blueprint $table) {
|
||||
@@ -55,6 +31,11 @@ return new class extends Migration
|
||||
$table->increments('id')->comment('门店ID');
|
||||
$table->string('name', 100)->comment('门店名称');
|
||||
$table->string('code', 50)->unique()->comment('门店编码');
|
||||
// 登录账号字段(小程序端 账号 + 密码 登录)
|
||||
$table->string('username', 20)->unique()->comment('登录账号');
|
||||
$table->string('password', 100)->comment('登录密码');
|
||||
$table->string('avatar', 255)->default('')->comment('头像');
|
||||
$table->timestamp('last_login_at')->nullable()->comment('最后登录时间');
|
||||
$table->integer('level_id')->default(0)->comment('客户等级ID(决定商品价格)');
|
||||
$table->string('contact', 50)->default('')->comment('联系人');
|
||||
$table->string('phone', 20)->default('')->comment('联系电话');
|
||||
@@ -63,10 +44,11 @@ return new class extends Migration
|
||||
$table->decimal('total_purchase_amount', 12, 2)->default(0)->comment('总采购金额(只统计商品金额,账单支付后累加)');
|
||||
$table->integer('status')->default(1)->comment('状态(1正常 0停用)');
|
||||
$table->string('remark', 255)->nullable()->default('')->comment('备注');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->index(['level_id', 'status'], 'store_level_status_index');
|
||||
$table->comment('门店表');
|
||||
$table->comment('门店表(门店即用户,账号密码登录)');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -91,7 +73,7 @@ return new class extends Migration
|
||||
if (! Schema::hasTable('notice')) {
|
||||
Schema::create('notice', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('通知ID');
|
||||
$table->integer('user_id')->default(0)->comment('接收用户ID(user表,0为全员广播)');
|
||||
$table->integer('store_id')->default(0)->comment('接收门店ID(store表,0为全员广播)');
|
||||
$table->string('type', 20)->default('system')->comment('通知类型(order订单 price价格 system系统)');
|
||||
$table->string('title', 100)->comment('标题');
|
||||
$table->string('content', 500)->default('')->comment('内容');
|
||||
@@ -99,7 +81,7 @@ return new class extends Migration
|
||||
$table->integer('is_read')->default(0)->comment('是否已读(1已读 0未读)');
|
||||
$table->timestamp('read_at')->nullable()->comment('阅读时间');
|
||||
$table->timestamps();
|
||||
$table->index(['user_id', 'is_read'], 'notice_user_read_index');
|
||||
$table->index(['store_id', 'is_read'], 'notice_store_read_index');
|
||||
$table->comment('消息通知表');
|
||||
});
|
||||
}
|
||||
@@ -110,7 +92,6 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user');
|
||||
Schema::dropIfExists('customer_level');
|
||||
Schema::dropIfExists('store');
|
||||
Schema::dropIfExists('supplier');
|
||||
|
||||
@@ -8,19 +8,19 @@ return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
* 小程序购物车(门店订货车):按用户归属,同商品唯一行、加购合并累加
|
||||
* 小程序购物车(门店订货车):按门店归属,同商品唯一行、加购合并累加
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('cart')) {
|
||||
Schema::create('cart', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('购物车项ID');
|
||||
$table->integer('user_id')->comment('用户ID(购物车归属者)');
|
||||
$table->integer('store_id')->comment('门店ID(购物车归属者)');
|
||||
$table->integer('product_id')->comment('商品ID');
|
||||
$table->decimal('quantity', 10, 2)->default(0)->comment('订货量');
|
||||
$table->timestamps();
|
||||
$table->unique(['user_id', 'product_id'], 'cart_user_product_unique');
|
||||
$table->index(['user_id', 'created_at'], 'cart_user_created_index');
|
||||
$table->unique(['store_id', 'product_id'], 'cart_store_product_unique');
|
||||
$table->index(['store_id', 'created_at'], 'cart_store_created_index');
|
||||
$table->comment('小程序购物车表(门店订货车)');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@ return new class extends Migration
|
||||
Schema::create('payment', function (Blueprint $table) {
|
||||
$table->increments('id')->comment('支付记录ID');
|
||||
$table->string('payment_no', 32)->unique()->comment('支付单号');
|
||||
$table->integer('store_id')->comment('门店ID');
|
||||
$table->integer('user_id')->default(0)->comment('提交人(小程序用户ID)');
|
||||
$table->integer('store_id')->comment('门店ID(提交门店即支付人)');
|
||||
$table->decimal('amount', 10, 2)->default(0)->comment('支付金额(= 关联账单总金额合计,提交时快照)');
|
||||
$table->integer('pay_method')->comment('支付方式(1微信 2支付宝 3对公汇款)');
|
||||
$table->string('voucher_ids', 255)->default('')->comment('汇款凭证图片ID(逗号分隔)');
|
||||
|
||||
Reference in New Issue
Block a user