From 5d563592edbf766d1564f50e2082d8110f93abbe Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 6 Apr 2022 11:28:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=A0=8D=E4=BB=B7=E8=A1=A8?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/BargainActivity.php | 11 ++++++ app/Models/BargainOrder.php | 11 ++++++ app/Models/BargainOrderLog.php | 11 ++++++ app/Models/BargainSku.php | 13 +++++++ ...110305_create_bargain_activities_table.php | 39 +++++++++++++++++++ ..._06_110958_create_bargain_orders_table.php | 37 ++++++++++++++++++ ...04_06_111642_create_bargain_skus_table.php | 33 ++++++++++++++++ ..._06_112225_add_bargain_to_orders_table.php | 35 +++++++++++++++++ ...112539_create_bargain_order_logs_table.php | 34 ++++++++++++++++ 9 files changed, 224 insertions(+) create mode 100644 app/Models/BargainActivity.php create mode 100644 app/Models/BargainOrder.php create mode 100644 app/Models/BargainOrderLog.php create mode 100644 app/Models/BargainSku.php create mode 100644 database/migrations/2022_04_06_110305_create_bargain_activities_table.php create mode 100644 database/migrations/2022_04_06_110958_create_bargain_orders_table.php create mode 100644 database/migrations/2022_04_06_111642_create_bargain_skus_table.php create mode 100644 database/migrations/2022_04_06_112225_add_bargain_to_orders_table.php create mode 100644 database/migrations/2022_04_06_112539_create_bargain_order_logs_table.php 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'); + } +}