|
|
@@ -447,6 +447,44 @@ class ShopClass extends BaseClass
|
|
|
PtAssetClass::customKdAddBalance($shop, $amount, $order, $capitalType, $tx);
|
|
|
}
|
|
|
|
|
|
+ public static function customScanPayAddBalance($main, $shop, $amount, $order, $capitalType)
|
|
|
+ {
|
|
|
+ //门店余额增加
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+ $currentBalance = bcadd($main->balance, $amount, 2);
|
|
|
+ $main->balance = $currentBalance;
|
|
|
+ //可提现余额同步增加
|
|
|
+ $currentTx = bcadd($main->txBalance, $amount, 2);
|
|
|
+ $main->txBalance = $currentTx;
|
|
|
+ $main->save();
|
|
|
+
|
|
|
+ $customName = '客户';
|
|
|
+ $customId = $order->customId ?? 0;
|
|
|
+ $custom = \bizHd\custom\classes\CustomClass::getById($customId, true);
|
|
|
+ if (!empty($custom->name)) {
|
|
|
+ $customName = $custom->name;
|
|
|
+ }
|
|
|
+
|
|
|
+ //增加余额变动记录
|
|
|
+ $id = $order->id;
|
|
|
+ $event = $customName . "扫码付款" . floatval($amount) . "元";
|
|
|
+ $change = [
|
|
|
+ 'relateId' => $id,
|
|
|
+ 'capitalType' => $capitalType,
|
|
|
+ 'amount' => $amount,
|
|
|
+ 'balance' => $currentBalance,
|
|
|
+ 'txBalance' => $currentTx,
|
|
|
+ 'io' => 1,
|
|
|
+ 'payWay' => $order->payWay,
|
|
|
+ 'event' => $event,
|
|
|
+ 'mainId' => $mainId,
|
|
|
+ 'tx' => 2,
|
|
|
+ 'ptStyle' => $shop->ptStyle,
|
|
|
+ 'fromType' => 1,
|
|
|
+ ];
|
|
|
+ ShopYeChangeClass::addChange($change, true);
|
|
|
+ }
|
|
|
+
|
|
|
//门店充值增加余额 ssh 2021.2.21
|
|
|
//$fix = true 余额只能在指定门店使用
|
|
|
public static function rechargeAddBalance($shop, $amount, $order, $tx, $capitalType, $fix = false)
|