|
|
@@ -10,6 +10,7 @@ use App\Jobs\Order;
|
|
|
use App\Notification\TelegramBot;
|
|
|
use App\Services\CreateLog;
|
|
|
use App\Services\OrderServices;
|
|
|
+use App\Services\PayConfig;
|
|
|
use App\Services\PayPlus;
|
|
|
use App\Util;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
@@ -171,12 +172,28 @@ class PayPlusLogic extends BaseApiLogic
|
|
|
];
|
|
|
|
|
|
if ($this->isSuccessfulPayment($post)) {
|
|
|
+ $AdId = $order->AdId ?: '';
|
|
|
+ $eventType = $order->eventType ?: '';
|
|
|
+
|
|
|
$payAmount = round((float) ($data['amount'] ?? 0), 2);
|
|
|
$body['pay_status'] = 1;
|
|
|
$body['pay_at'] = date('Y-m-d H:i:s');
|
|
|
$body['finished_at'] = date('Y-m-d H:i:s');
|
|
|
$body['amount'] = (int) round($payAmount * NumConfig::NUM_VALUE);
|
|
|
|
|
|
+ $config = (new PayConfig())->getConfig('PayPlus');
|
|
|
+ // 根据支付方式计算代收手续费: 费率% * 金额 + 固定$
|
|
|
+ // pay_rate 格式: [1=>[10,0.3], 2=>[13,0.3], 4=>[11,0.3], 8=>[12,0.3]]
|
|
|
+ $payRates = $config['pay_rate'] ?? null;
|
|
|
+ if (is_array($payRates)) {
|
|
|
+ $payMethod = $order->order_title ?? 1;
|
|
|
+ $payRate = $payRates[$payMethod] ?? ($payRates[1] ?? [10, 0.3]);
|
|
|
+ $feePercent = $payRate[0] ?? 10;
|
|
|
+ $feeFixed = $payRate[1] ?? 0.3;
|
|
|
+ $body['payment_fee'] = intval(($body['amount'] * $feePercent) / 100)
|
|
|
+ + (int)($feeFixed * NumConfig::NUM_VALUE);
|
|
|
+ }
|
|
|
+
|
|
|
$service = new OrderServices();
|
|
|
list($give, $favorablePrice, $recharge, $czReason, $cjReason) = $service->getPayInfo(
|
|
|
$order->GiftsID ?: '',
|
|
|
@@ -195,7 +212,7 @@ class PayPlusLogic extends BaseApiLogic
|
|
|
$cjReason,
|
|
|
$order->AdId ?: '',
|
|
|
$order->eventType ?: '',
|
|
|
- 0
|
|
|
+ $body['payment_fee'] ?? 0
|
|
|
);
|
|
|
|
|
|
Order::dispatch([
|