diff --git a/app/Endpoint/Api/Filters/OrderFilter.php b/app/Endpoint/Api/Filters/OrderFilter.php index 5a3f920e..69692ee3 100644 --- a/app/Endpoint/Api/Filters/OrderFilter.php +++ b/app/Endpoint/Api/Filters/OrderFilter.php @@ -14,8 +14,8 @@ class OrderFilter extends ModelFilter $this->where('status', Order::STATUS_PENDING); break; - case 'paid': - $this->where('status', Order::STATUS_PAID); + case 'unreceived': + $this->where('status', [Order::STATUS_PAID, Order::STATUS_SHIPPED]); break; case 'completed': diff --git a/app/Models/Order.php b/app/Models/Order.php index e48d79ea..15472054 100644 --- a/app/Models/Order.php +++ b/app/Models/Order.php @@ -10,9 +10,10 @@ class Order extends Model { use Filterable; - public const STATUS_PENDING = 0; // 待付款 - public const STATUS_PAID = 1; // 已付款 - public const STATUS_COMPLETED = 9; // 已完成 + public const STATUS_PENDING = 0; // 待付款 + public const STATUS_PAID = 1; // 已付款 + public const STATUS_SHIPPED = 2; // 已发货 + public const STATUS_COMPLETED = 9; // 已完成 public const STATUS_CANCELLED = 10; // 已取消 /** diff --git a/database/migrations/2021_12_07_143655_create_orders_table.php b/database/migrations/2021_12_07_143655_create_orders_table.php index 1b26fd66..9daf33ae 100644 --- a/database/migrations/2021_12_07_143655_create_orders_table.php +++ b/database/migrations/2021_12_07_143655_create_orders_table.php @@ -39,6 +39,8 @@ class CreateOrdersTable extends Migration $table->timestamps(); $table->unique('sn'); + $table->index(['user_id', 'status']); + $table->index('status'); }); } diff --git a/database/migrations/2021_12_09_153242_add_coupon_amount_to_user_coupons_table.php b/database/migrations/2021_12_09_153242_add_coupon_amount_to_user_coupons_table.php deleted file mode 100644 index aea13eff..00000000 --- a/database/migrations/2021_12_09_153242_add_coupon_amount_to_user_coupons_table.php +++ /dev/null @@ -1,34 +0,0 @@ -dropColumn('coupon_value'); - $table->unsignedInteger('coupon_amount')->default(0)->comment('抵扣金额:分/折扣(100)'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('user_coupons', function (Blueprint $table) { - // - }); - } -}