|
|
@@ -60,6 +60,61 @@ class PtAssetClass extends BaseClass
|
|
|
PtYeChangeClass::addChange($change, true);
|
|
|
}
|
|
|
|
|
|
+ //客户结帐增加加余额 shish 20210729
|
|
|
+ public static function customClearAddBalance($shop, $order, $capitalType, $tx)
|
|
|
+ {
|
|
|
+ $amount = $order->actPrice ?? 0;
|
|
|
+ $ptStyle = $shop->ptStyle;
|
|
|
+ if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
|
|
|
+ $asset = self::getHdBalance();
|
|
|
+ } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
|
|
|
+ $asset = self::getGhsBalance();
|
|
|
+ } else {
|
|
|
+ util::fail('没有找到平台');
|
|
|
+ }
|
|
|
+ $currentAmount = bcadd($asset->amount, $amount, 2);
|
|
|
+ $asset->amount = $currentAmount;
|
|
|
+ $asset->save();
|
|
|
+
|
|
|
+ if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
|
|
|
+ $txAsset = self::getHdTxBalance();
|
|
|
+ } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
|
|
|
+ $txAsset = self::getGhsTxBalance();
|
|
|
+ } else {
|
|
|
+ util::fail('没有找到平台');
|
|
|
+ }
|
|
|
+ $currentTxBalance = $txAsset->amount;
|
|
|
+ if ($tx == dict::getDict('yeTx', 'can')) {
|
|
|
+ $currentTxBalance = bcadd($currentTxBalance, $amount, 2);
|
|
|
+ $txAsset->amount = $currentTxBalance;
|
|
|
+ $txAsset->save();
|
|
|
+ }
|
|
|
+ $sjName = $shop->merchantName ?? '';
|
|
|
+ if (isset($shop->default) == false || $shop->default != 1) {
|
|
|
+ $sjName .= ' ' . $shop->shopName;
|
|
|
+ }
|
|
|
+
|
|
|
+ $id = $order->id;
|
|
|
+ $event = "客户结帐给商家-{$sjName}(单号:{$order->orderSn})";
|
|
|
+ $change = [
|
|
|
+ 'relateId' => $id,
|
|
|
+ 'capitalType' => $capitalType,
|
|
|
+ 'amount' => $amount,
|
|
|
+ 'balance' => $currentAmount,
|
|
|
+ 'txBalance' => $currentTxBalance,
|
|
|
+ 'io' => 1,
|
|
|
+ 'payWay' => $order->payWay,
|
|
|
+ 'event' => $event,
|
|
|
+ 'sjId' => $order->sjId,
|
|
|
+ 'shopId' => $order->shopId,
|
|
|
+ 'tx' => $tx,
|
|
|
+ 'ptStyle' => $ptStyle,
|
|
|
+ 'shopName' => $shop->shopName,
|
|
|
+ 'sjName' => $shop->merchantName,
|
|
|
+ ];
|
|
|
+ PtYeChangeClass::addChange($change, true);
|
|
|
+ }
|
|
|
+
|
|
|
//客户使用优惠券增加余额 shish 20210601
|
|
|
public static function customKdUseCouponAddBalance($shop, $order, $capitalType, $tx)
|
|
|
{
|
|
|
@@ -274,7 +329,6 @@ class PtAssetClass extends BaseClass
|
|
|
PtYeChangeClass::addChange($change, true);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//零售平台余额对象 shish 20210519
|
|
|
public static function getHdBalance()
|
|
|
{
|