diff --git a/app/Models/BargainActivity.php b/app/Models/BargainActivity.php new file mode 100644 index 00000000..85a36932 --- /dev/null +++ b/app/Models/BargainActivity.php @@ -0,0 +1,11 @@ +id(); + $table->string('name')->comment('活动名称'); + $table->text('description')->nullable()->comment('活动描述'); + $table->boolean('is_enable')->nullable()->comment('是否开启'); + $table->text('rules')->nullable()->comment('砍价规则'); + $table->unsignedInteger('times')->default(0)->comment('有效刀,0为不限'); + $table->unsignedInteger('expire_hours')->default(0)->comment('过期小时'); + $table->timestamp('start_at')->nullable()->comment('开始时间'); + $table->timestamp('end_at')->nullable()->comment('结束时间'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('bargain_activities'); + } +} diff --git a/database/migrations/2022_04_06_110958_create_bargain_orders_table.php b/database/migrations/2022_04_06_110958_create_bargain_orders_table.php new file mode 100644 index 00000000..0160114b --- /dev/null +++ b/database/migrations/2022_04_06_110958_create_bargain_orders_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('activity_id')->comment('参与活动ID'); + $table->unsignedBigInteger('user_id')->comment('发起用户ID'); + $table->unsignedBigInteger('sku_id')->comment('砍价商品'); + $table->boolean('status')->default(false)->comment('状态:0未砍完,1已砍完'); + $table->timestamp('expire_at')->nullable()->comment('过期时间'); + $table->string('remark')->nullable()->comment('备注'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('bargain_orders'); + } +} diff --git a/database/migrations/2022_04_06_111642_create_bargain_skus_table.php b/database/migrations/2022_04_06_111642_create_bargain_skus_table.php new file mode 100644 index 00000000..26977b0d --- /dev/null +++ b/database/migrations/2022_04_06_111642_create_bargain_skus_table.php @@ -0,0 +1,33 @@ +id(); + $table->unsignedBigInteger('activity_id')->comment('活动ID'); + $table->unsignedBigInteger('sku_id')->comment('商品ID'); + // $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('bargain_skus'); + } +} diff --git a/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php new file mode 100644 index 00000000..227b692f --- /dev/null +++ b/database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php @@ -0,0 +1,35 @@ +unsignedBigInteger('bargain_amount')->default(0)->comment('砍价金额'); + $table->unsignedBigInteger('bargain_order_id')->nullable()->comment('关联砍价单ID'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('orders', function (Blueprint $table) { + // + $table->dropColumn(['bargain_amount', 'bargain_order_id']); + }); + } +} diff --git a/database/migrations/2022_04_06_112539_create_bargain_order_logs_table.php b/database/migrations/2022_04_06_112539_create_bargain_order_logs_table.php new file mode 100644 index 00000000..bc71a827 --- /dev/null +++ b/database/migrations/2022_04_06_112539_create_bargain_order_logs_table.php @@ -0,0 +1,34 @@ +id(); + $table->unsignedBigInteger('order_id')->comment('订单ID'); + $table->unsignedBigInteger('user_id')->comment('用户ID'); + $table->unsignedBigInteger('bargain_amount')->default(0)->comment('砍价金额'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('bargain_order_logs'); + } +}