mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update
This commit is contained in:
parent
20be5c3182
commit
453a078cd5
@ -12,7 +12,6 @@ use App\Models\Order;
|
|||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Coupon;
|
use App\Models\Coupon;
|
||||||
use App\Models\CouponLog;
|
|
||||||
use App\Utils\Helper;
|
use App\Utils\Helper;
|
||||||
use Omnipay\Omnipay;
|
use Omnipay\Omnipay;
|
||||||
use Stripe\Stripe;
|
use Stripe\Stripe;
|
||||||
@ -134,17 +133,6 @@ class OrderController extends Controller
|
|||||||
abort(500, '优惠券使用失败');
|
abort(500, '优惠券使用失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add coupon log
|
|
||||||
if (!CouponLog::create([
|
|
||||||
'coupon_id' => $coupon->id,
|
|
||||||
'user_id' => $order->user_id,
|
|
||||||
'order_trade_no' => $order->trade_no,
|
|
||||||
'total_amount' => $order->total_amount,
|
|
||||||
'discount_amount' => $order->discount_amount
|
|
||||||
])) {
|
|
||||||
DB::rollback();
|
|
||||||
abort(500, '优惠券使用失败');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// free process
|
// free process
|
||||||
if ($order->total_amount <= 0) {
|
if ($order->total_amount <= 0) {
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class CouponLog extends Model
|
|
||||||
{
|
|
||||||
protected $table = 'v2_coupon_log';
|
|
||||||
protected $dateFormat = 'U';
|
|
||||||
protected $guarded = ['id'];
|
|
||||||
}
|
|
11
update.sql
11
update.sql
@ -104,16 +104,5 @@ CREATE TABLE `v2_coupon` (
|
|||||||
`updated_at` int(11) NOT NULL,
|
`updated_at` int(11) NOT NULL,
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE `v2_coupon_log` (
|
|
||||||
`id` int NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
`user_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,
|
|
||||||
`updated_at` int(11) NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
ALTER TABLE `v2_order`
|
ALTER TABLE `v2_order`
|
||||||
ADD `discount_amount` int(11) NULL AFTER `total_amount`;
|
ADD `discount_amount` int(11) NULL AFTER `total_amount`;
|
Loading…
Reference in New Issue
Block a user