取消订单时退优惠券
parent
9d6acd9df8
commit
cde7b6d836
|
|
@ -825,6 +825,13 @@ class OrderService
|
|||
}
|
||||
}
|
||||
|
||||
// 取消订单,退券
|
||||
if ($order->user_coupon_id) {
|
||||
UserCoupon::where('user_id', $order->user_id)->where('id', $order->user_coupon_id)->update([
|
||||
'is_use'=>false,
|
||||
]);
|
||||
}
|
||||
|
||||
$order->update([
|
||||
'status' => Order::STATUS_CANCELLED,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class AddCouponIdToOrdersTable extends Migration
|
|||
public function up()
|
||||
{
|
||||
Schema::table('orders', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('user_coupon_id')->unique()->nullable()->comment('用户优惠券ID');
|
||||
$table->unsignedBigInteger('user_coupon_id')->nullable()->comment('用户优惠券ID');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue