diff --git a/app/controller/Wechat.php b/app/controller/Wechat.php index 4d38887..a25e789 100644 --- a/app/controller/Wechat.php +++ b/app/controller/Wechat.php @@ -100,6 +100,7 @@ class Wechat ->build(); dump(Payment::create([ + 'trade_no' => time().rand(100000, 999999), 'order_id' => $order->id, ])); diff --git a/app/model/Payment.php b/app/model/Payment.php index 0f0163f..993ebc1 100644 --- a/app/model/Payment.php +++ b/app/model/Payment.php @@ -9,11 +9,6 @@ class Payment extends Model { protected $autoWriteTimestamp = true; - public function onBeforeInsert() - { - $this->trade_no = time(); - } - public function orders(): BelongsTo { return $this->belongsTo(Order::class);