root 5 years ago
parent
commit
20be5c3182
2 changed files with 3 additions and 3 deletions
  1. 1 1
      app/Http/Controllers/OrderController.php
  2. 2 2
      update.sql

+ 1 - 1
app/Http/Controllers/OrderController.php

@@ -138,7 +138,7 @@ class OrderController extends Controller
             if (!CouponLog::create([
                 'coupon_id' => $coupon->id,
                 'user_id' => $order->user_id,
-                'order_id' => $order->id,
+                'order_trade_no' => $order->trade_no,
                 'total_amount' => $order->total_amount,
                 'discount_amount' => $order->discount_amount
             ])) {

+ 2 - 2
update.sql

@@ -106,9 +106,9 @@ CREATE TABLE `v2_coupon` (
 
 CREATE TABLE `v2_coupon_log` (
   `id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
-  `coupon_id` int(11) NOT NULL,
   `user_id` int(11) NOT NULL,
-  `order_id` int(11) NOT NULL,
+  `coupon_id` int(11) NOT NULL,
+  `order_trade_no` char(32) NOT NULL,
   `total_amount` int(11) NOT NULL,
   `discount_amount` int(11) NOT NULL,
   `created_at` int(11) NOT NULL,