|
|
@@ -60,6 +60,56 @@ class PtAssetClass extends BaseClass
|
|
|
PtYeChangeClass::addChange($change, true);
|
|
|
}
|
|
|
|
|
|
+ //客户使用优惠券增加余额 shish 20210601
|
|
|
+ public static function customKdUseCouponAddBalance($shop, $order, $capitalType, $tx)
|
|
|
+ {
|
|
|
+ $amount = $order->discountAmount;
|
|
|
+ $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;
|
|
|
+
|
|
|
+ $currentTxBalance = bcadd($currentTxBalance, $amount, 2);
|
|
|
+ $txAsset->amount = $currentTxBalance;
|
|
|
+ $txAsset->save();
|
|
|
+
|
|
|
+ $id = $order->id;
|
|
|
+ $event = "【{$shop->merchantName} {$shop->shopName}】的客户下单 使用平台优惠券{$amount}元 订单号:{$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 20210519
|
|
|
public static function rechargeAddBalance($shop, $amount, $order, $capitalType, $tx)
|
|
|
{
|