修改支付

This commit is contained in:
邹景立 2021-01-27 17:01:53 +08:00
parent d43178d1c6
commit 24e7781a7e
4 changed files with 11 additions and 16 deletions

View File

@ -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);
}
}
}

View File

@ -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();
}
/**

View File

@ -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'],
]));

View File

@ -37,7 +37,7 @@
</label>
</div>
<div data-payment-type="wechat">{include file='shop_payment/form_wechat'}</div>
<div data-payment-type="wechat" class="layui-hide">{include file='shop_payment/form_wechat'}</div>
<div data-payment-type="alipay" class="layui-hide">{include file='shop_payment/form_alipay'}</div>
<div data-payment-type="joinpay" class="layui-hide">{include file='shop_payment/form_joinpay'}</div>