From 2b73c922367f598f9656aa893fe9a077ddd26d5e Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Sat, 26 Nov 2022 22:01:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Append=20Description?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Host.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Models/Host.php b/app/Models/Host.php index a312ca4..7704d73 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -236,9 +236,11 @@ public function cost($amount = null, $auto = true): bool } } + $append_description = ''; if ($user_group) { if ($user_group->discount !== 100 && $user_group->discount !== null) { $real_price = $real_price * ($user_group->discount / 100); + $append_description = ' (折扣 ' . $user_group->discount . '%)'; } } @@ -285,6 +287,10 @@ public function cost($amount = null, $auto = true): bool $description = '自动扣费。'; } + if ($append_description) { + $description .= $append_description; + } + $left = $transaction->reduceHostAmount($this->user_id, $this->id, $this->module_id, $real_price, $description); $this->addLog($real_price);