From 24e7781a7e4aceedb2d342e69955997006895f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Wed, 27 Jan 2021 17:01:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/controller/UserLevel.php | 2 +- app/data/service/PaymentService.php | 9 ++------- app/data/service/PrizeService.php | 14 +++++++------- app/data/view/shop_payment/form.html | 2 +- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/data/controller/UserLevel.php b/app/data/controller/UserLevel.php index eda3976e6..cec985087 100644 --- a/app/data/controller/UserLevel.php +++ b/app/data/controller/UserLevel.php @@ -41,7 +41,7 @@ class UserLevel extends Controller foreach ($data as &$vo) { $vo['rebate_rule'] = str2arr($vo['rebate_rule']); foreach ($vo['rebate_rule'] as &$v) { - $v = PrizeService::instance()->getName($v); + $v = PrizeService::instance()->name($v); } } } diff --git a/app/data/service/PaymentService.php b/app/data/service/PaymentService.php index 5653d7750..c0f7d5e1f 100644 --- a/app/data/service/PaymentService.php +++ b/app/data/service/PaymentService.php @@ -149,13 +149,8 @@ abstract class PaymentService */ public function __construct(App $app, string $code, string $type, array $params) { - $this->app = $app; - $this->code = $code; - $this->type = $type; - $this->params = $params; - if (method_exists($this, 'initialize')) { - $this->initialize(); - } + [$this->app, $this->code, $this->type, $this->params] = [$app, $code, $type, $params]; + if (method_exists($this, 'initialize')) $this->initialize(); } /** diff --git a/app/data/service/PrizeService.php b/app/data/service/PrizeService.php index 37ff0111b..388848956 100644 --- a/app/data/service/PrizeService.php +++ b/app/data/service/PrizeService.php @@ -35,7 +35,7 @@ class PrizeService extends Service * @param string $prize * @return string */ - public function getName(string $prize): string + public function name(string $prize): string { return self::PRIZES[$prize]['name'] ?? $prize; } @@ -90,10 +90,10 @@ class PrizeService extends Service if ($this->app->db->name('DataUserRebate')->where($map)->count() < 1) { if (sysconf('shop.fristType') == 1) { $amount = sysconf('shop.fristValue') ?: '0.00'; - $name = PrizeService::instance()->getName(PrizeService::PRIZE_01) . ",每人 {$amount} 元"; + $name = PrizeService::instance()->name(PrizeService::PRIZE_01) . ",每人 {$amount} 元"; } else { $amount = sysconf('shop.fristValue') * $this->order['amount_total'] / 100; - $name = PrizeService::instance()->getName(PrizeService::PRIZE_01) . ",订单 " . sysconf('shop.fristValue') . '%'; + $name = PrizeService::instance()->name(PrizeService::PRIZE_01) . ",订单 " . sysconf('shop.fristValue') . '%'; } $this->app->db->name('DataUserRebate')->insert(array_merge($map, [ 'uid' => $this->fromer['id'], 'name' => $name, 'amount' => $amount, 'order_amount' => $this->order['amount_total'], @@ -122,10 +122,10 @@ class PrizeService extends Service if ($this->app->db->name('DataUserRebate')->where($map)->count() < 1) { if (sysconf('shop.repeatType') == 1) { $amount = sysconf('shop.repeatValue') ?: '0.00'; - $name = PrizeService::instance()->getName(PrizeService::PRIZE_02) . ",每人 {$amount} 元"; + $name = PrizeService::instance()->name(PrizeService::PRIZE_02) . ",每人 {$amount} 元"; } else { $amount = sysconf('shop.repeatValue') * $this->order['amount_total'] / 100; - $name = PrizeService::instance()->getName(PrizeService::PRIZE_02) . ",订单 " . sysconf('shop.repeatValue') . '%'; + $name = PrizeService::instance()->name(PrizeService::PRIZE_02) . ",订单 " . sysconf('shop.repeatValue') . '%'; } $this->app->db->name('DataUserRebate')->insert(array_merge($map, [ 'uid' => $this->fromer['id'], 'name' => $name, 'amount' => $amount, 'order_amount' => $this->order['amount_total'], @@ -151,7 +151,7 @@ class PrizeService extends Service $map = ['type' => PrizeService::PRIZE_03, 'order_no' => $this->order['order_no'], 'order_uid' => $this->order['uid']]; if ($this->app->db->name('DataUserRebate')->where($map)->count() < 1) { $amount = sysconf('shop.repeatValue') * $this->order['amount_total'] / 100; - $name = PrizeService::instance()->getName(PrizeService::PRIZE_03) . ",订单 " . sysconf('shop.repeatValue') . '%'; + $name = PrizeService::instance()->name(PrizeService::PRIZE_03) . ",订单 " . sysconf('shop.repeatValue') . '%'; $this->app->db->name('DataUserRebate')->insert(array_merge($map, [ 'uid' => $this->fromer['id'], 'name' => $name, 'amount' => $amount, 'order_amount' => $this->order['amount_total'], ])); @@ -177,7 +177,7 @@ class PrizeService extends Service $map = ['type' => PrizeService::PRIZE_04, 'order_no' => $this->order['order_no'], 'order_uid' => $this->order['uid']]; if ($this->app->db->name('DataUserRebate')->where($map)->count() < 1) { $amount = sysconf('shop.indirectValue') * $this->order['amount_total'] / 100; - $name = PrizeService::instance()->getName(PrizeService::PRIZE_04) . ",订单 " . sysconf('shop.indirectValue') . '%'; + $name = PrizeService::instance()->name(PrizeService::PRIZE_04) . ",订单 " . sysconf('shop.indirectValue') . '%'; $this->app->db->name('DataUserRebate')->insert(array_merge($map, [ 'uid' => $pm2['id'], 'name' => $name, 'amount' => $amount, 'order_amount' => $this->order['amount_total'], ])); diff --git a/app/data/view/shop_payment/form.html b/app/data/view/shop_payment/form.html index 950e0a2fa..4e72686a5 100644 --- a/app/data/view/shop_payment/form.html +++ b/app/data/view/shop_payment/form.html @@ -37,7 +37,7 @@ -
{include file='shop_payment/form_wechat'}
+
{include file='shop_payment/form_wechat'}
{include file='shop_payment/form_alipay'}
{include file='shop_payment/form_joinpay'}