| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651 |
- <?php
- namespace biz\pt\classes;
- use biz\base\classes\BaseClass;
- use bizGhs\order\classes\OrderClass;
- use common\components\dict;
- use common\components\util;
- class PtAssetClass extends BaseClass
- {
- public static $baseFile = '\biz\pt\models\PtAsset';
- //客户下单增加商家余额 ssh 20210520
- public static function customKdAddBalance($shop, $amount, $order, $capitalType, $tx)
- {
- $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;
- $mainId = $shop->mainId ?? 0;
- $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,
- 'mainId' => $mainId,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- //客户充值增加余额 ssh 20240508
- public static function customRechargeAddBalance($shop, $order, $capitalType, $tx)
- {
- $amount = $order->amount ?? 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 || $shop->shopName != '首店') {
- $sjName .= ' ' . $shop->shopName;
- }
- $id = $order->id;
- $event = "客户向商家-{$sjName}充值,单号:{$order->orderSn}";
- $mainId = $shop->mainId ?? 0;
- $change = [
- 'relateId' => $id,
- 'capitalType' => $capitalType,
- 'amount' => $amount,
- 'balance' => $currentAmount,
- 'txBalance' => $currentTxBalance,
- 'io' => 1,
- 'payWay' => $order->payWay,
- 'event' => $event,
- 'sjId' => $order->sjId ?? 0,
- 'shopId' => $order->shopId ?? 0,
- 'mainId' => $order->mainId ?? 0,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- 'mainId' => $mainId,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- //客户结帐增加加余额 ssh 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 || $shop->shopName != '首店') {
- $sjName .= ' ' . $shop->shopName;
- }
- $id = $order->id;
- $event = "客户结帐给商家-{$sjName}(单号:{$order->orderSn})";
- $mainId = $shop->mainId ?? 0;
- $change = [
- 'relateId' => $id,
- 'capitalType' => $capitalType,
- 'amount' => $amount,
- 'balance' => $currentAmount,
- 'txBalance' => $currentTxBalance,
- 'io' => 1,
- 'payWay' => $order->payWay,
- 'event' => $event,
- 'sjId' => $order->sjId,
- 'shopId' => $order->shopId,
- 'mainId' => $order->mainId ?? 0,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- 'mainId' => $mainId,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- //客户使用优惠券增加余额 ssh 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;
- $mainId = $shop->mainId ?? 0;
- $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,
- 'mainId' => $mainId,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- //平台余额增加 ssh 20210519
- public static function rechargeAddBalance($shop, $amount, $order, $capitalType, $tx)
- {
- $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();
- }
- $id = $order->id;
- $mainId = $shop->mainId ?? 0;
- $event = "【{$shop->merchantName} {$shop->shopName}】 充值{$amount}元 订单号:{$order->orderSn}";
- if ($order->shopAdminId == 0) {
- $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,
- 'mainId' => $mainId,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- //平台余额减少 ssh 20210519
- public static function reduceBalance($shop, $amount, $order, $capitalType, $tx)
- {
- $ptStyle = $shop->ptStyle;
- if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
- $asset = self::getHdBalance();
- } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
- $asset = self::getGhsBalance();
- } else {
- util::fail('没有找到平台');
- }
- if (bccomp($amount, $asset->amount, 2) == 1) {
- //util::fail('平台余额不足哦');
- }
- $currentAmount = bcsub($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')) {
- if (!empty($currentTxBalance)) {
- $reduceTxBalance = $currentTxBalance > $amount ? $amount : $currentTxBalance;
- $currentTxBalance = bcsub($currentTxBalance, $reduceTxBalance, 2);
- $txAsset->amount = $currentTxBalance;
- $txAsset->save();
- }
- }
- $id = $order->id;
- $change = [
- 'relateId' => $id,
- 'capitalType' => $capitalType,
- 'amount' => $amount,
- 'balance' => $currentAmount,
- 'txBalance' => $currentTxBalance,
- 'io' => 0,
- 'payWay' => $order->payWay,
- 'event' => "【{$shop->merchantName} {$shop->shopName}】 {$amount}元 订单号:{$order->orderSn}",
- 'sjId' => $order->sjId,
- 'shopId' => $order->shopId,
- 'mainId' => $order->mainId ?? 0,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- //供货商预订被多付了退款减少余额 ssh 20220324
- public static function ghsBookOrderRefundReduceBalance($shop, $refund, $refundPrice)
- {
- $ptStyle = $shop->ptStyle;
- $asset = null;
- if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
- $asset = self::getHdBalance();
- } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
- $asset = self::getGhsBalance();
- } else {
- util::fail('没有找到平台');
- }
- if (bccomp($refundPrice, $asset->amount, 2) == 1) {
- //util::fail('平台余额不足!');
- }
- $currentAmount = bcsub($asset->amount, $refundPrice, 2);
- $asset->amount = $currentAmount;
- $asset->save();
- $txAsset = null;
- if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
- $txAsset = self::getHdTxBalance();
- } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
- $txAsset = self::getGhsTxBalance();
- } else {
- util::fail('没有找到平台');
- }
- $tx = dict::getDict('yeTx', 'can');
- $currentTxBalance = $txAsset->amount;
- if (!empty($currentTxBalance)) {
- $reduceTxBalance = $currentTxBalance > $refundPrice ? $refundPrice : $currentTxBalance;
- $currentTxBalance = bcsub($currentTxBalance, $reduceTxBalance, 2);
- $txAsset->amount = $currentTxBalance;
- $txAsset->save();
- }
- $merchantName = $shop->merchantName ?? '';
- if ($shop->default != 1 || $shop->shopName != '首店') {
- $shopName = $shop->shopName ?? '';
- $merchantName = $merchantName . '-' . $shopName;
- }
- $event = "{$merchantName} 预订单被多付退还(退款单 {$refund->orderSn} 订单{$refund->relateOrderSn})";
- $relateOrderSn = $refund->relateOrderSn ?? '';
- if (!empty($relateOrderSn)) {
- $relateOrder = OrderClass::getByCondition(['orderSn' => $relateOrderSn], true);
- $customName = $relateOrder->customName ?? '';
- if (!empty($customName)) {
- $event = "{$merchantName} 的预订单被{$customName}多付退还(退款单 {$refund->orderSn} 订单{$refund->relateOrderSn})";
- }
- }
- $id = $refund->id;
- $currentType = dict::getDict('capitalType', 'ghsBookRefund');
- $change = [
- 'relateId' => $id,
- 'capitalType' => $currentType,
- 'amount' => $refundPrice,
- 'balance' => $currentAmount,
- 'txBalance' => $currentTxBalance,
- 'io' => 0,
- 'payWay' => 0,
- 'event' => $event,
- 'sjId' => $shop->sjId,
- 'shopId' => $shop->id,
- 'mainId' => $shop->mainId,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- public static function hdSaleRefundReduceBalance($shop, $refund, $refundPrice)
- {
- $ptStyle = $shop->ptStyle;
- $asset = null;
- if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
- $asset = self::getHdBalance();
- } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
- $asset = self::getGhsBalance();
- } else {
- util::fail('没有找到平台');
- }
- if (bccomp($refundPrice, $asset->amount, 2) == 1) {
- //util::fail('平台余额不足呢');
- }
- $currentAmount = bcsub($asset->amount, $refundPrice, 2);
- $asset->amount = $currentAmount;
- $asset->save();
- $txAsset = null;
- if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
- $txAsset = self::getHdTxBalance();
- } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
- $txAsset = self::getGhsTxBalance();
- } else {
- util::fail('没有找到平台');
- }
- $tx = dict::getDict('yeTx', 'can');
- $currentTxBalance = $txAsset->amount;
- if (!empty($currentTxBalance)) {
- $reduceTxBalance = $currentTxBalance > $refundPrice ? $refundPrice : $currentTxBalance;
- $currentTxBalance = bcsub($currentTxBalance, $reduceTxBalance, 2);
- $txAsset->amount = $currentTxBalance;
- $txAsset->save();
- }
- $id = $refund->id;
- $currentType = dict::getDict('capitalType', 'hdOrderRefund');
- $change = [
- 'relateId' => $id,
- 'capitalType' => $currentType,
- 'amount' => $refundPrice,
- 'balance' => $currentAmount,
- 'txBalance' => $currentTxBalance,
- 'io' => 0,
- 'payWay' => 0,
- 'event' => "【{$shop->merchantName} {$shop->shopName}】的销售单发起退款",
- 'sjId' => $shop->sjId,
- 'shopId' => $shop->id,
- 'mainId' => $shop->mainId,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- public static function saleRefundReduceBalance($shop, $refund, $refundPrice)
- {
- $ptStyle = $shop->ptStyle;
- $asset = null;
- if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
- $asset = self::getHdBalance();
- } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
- $asset = self::getGhsBalance();
- } else {
- util::fail('没有找到平台');
- }
- if (bccomp($refundPrice, $asset->amount, 2) == 1) {
- //util::fail('平台余额不足哈');
- }
- $currentAmount = bcsub($asset->amount, $refundPrice, 2);
- $asset->amount = $currentAmount;
- $asset->save();
- $txAsset = null;
- if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
- $txAsset = self::getHdTxBalance();
- } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
- $txAsset = self::getGhsTxBalance();
- } else {
- util::fail('没有找到平台');
- }
- $tx = dict::getDict('yeTx', 'can');
- $currentTxBalance = $txAsset->amount;
- if (!empty($currentTxBalance)) {
- $reduceTxBalance = $currentTxBalance > $refundPrice ? $refundPrice : $currentTxBalance;
- $currentTxBalance = bcsub($currentTxBalance, $reduceTxBalance, 2);
- $txAsset->amount = $currentTxBalance;
- $txAsset->save();
- }
- $id = $refund->id;
- $currentType = dict::getDict('capitalType', 'saleRefund');
- $change = [
- 'relateId' => $id,
- 'capitalType' => $currentType,
- 'amount' => $refundPrice,
- 'balance' => $currentAmount,
- 'txBalance' => $currentTxBalance,
- 'io' => 0,
- 'payWay' => 0,
- 'event' => "【{$shop->merchantName} {$shop->shopName}】 的销售单发起退款",
- 'sjId' => $shop->sjId,
- 'shopId' => $shop->id,
- 'mainId' => $shop->mainId,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- //零售平台余额对象 ssh 20210519
- public static function getHdBalance()
- {
- $hd = dict::getDict('ptAsset', 'hdBalance');
- $id = $hd['id'];
- $name = $hd['name'];
- $asset = self::getLockById($id);
- if (empty($asset)) {
- $data = ['id' => $id, 'name' => $name, 'amount' => 0.00];
- self::add($data);
- $asset = self::getLockById($id);
- if (empty($asset)) {
- util::fail('没有找到零售平台余额,请先创建');
- }
- }
- return $asset;
- }
- //供货商平台余额对象 ssh 20210519
- public static function getGhsBalance()
- {
- $ghs = dict::getDict('ptAsset', 'ghsBalance');
- $id = $ghs['id'];
- $name = $ghs['name'];
- $asset = self::getLockById($id);
- if (empty($asset)) {
- $data = ['id' => $id, 'name' => $name, 'amount' => 0.00];
- self::add($data);
- $asset = self::getLockById($id);
- if (empty($asset)) {
- util::fail('没有找到供货商平台余额,请先创建');
- }
- }
- return $asset;
- }
- //零售平台余额对象 ssh 20210519
- public static function getHdTxBalance()
- {
- $txHd = dict::getDict('ptAsset', 'hdTxBalance');
- $id = $txHd['id'];
- $name = $txHd['name'];
- $asset = self::getLockById($id);
- if (empty($asset)) {
- $data = ['id' => $id, 'name' => $name, 'amount' => 0.00];
- self::add($data);
- $asset = self::getLockById($id);
- if (empty($asset)) {
- util::fail('没有找到零售平台可提现余额,请先创建');
- }
- }
- return $asset;
- }
- //供货商平台余额对象 ssh 20210519
- public static function getGhsTxBalance()
- {
- $txGhs = dict::getDict('ptAsset', 'ghsTxBalance');
- $id = $txGhs['id'];
- $name = $txGhs['name'];
- $asset = self::getLockById($id);
- if (empty($asset)) {
- $data = ['id' => $id, 'name' => $name, 'amount' => 0.00];
- self::add($data);
- $asset = self::getLockById($id);
- if (empty($asset)) {
- util::fail('没有找到供货商平台可提现余额,请先创建');
- }
- }
- return $asset;
- }
- //零售采购退款
- public static function cgRefundAddBalance($shop, $refundPrice, $cgRefund, $currentType, $tx)
- {
- $ptStyle = $shop->ptStyle;
- $asset = null;
- if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
- $asset = PtAssetClass::getHdBalance();
- } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
- $asset = PtAssetClass::getGhsBalance();
- } else {
- util::fail('没有找到平台');
- }
- $currentPtBalance = bcadd($asset->amount, $refundPrice, 2);
- $asset->amount = $currentPtBalance;
- $asset->save();
- $txAsset = null;
- if ($ptStyle == dict::getDict('ptStyle', 'hd')) {
- $txAsset = PtAssetClass::getHdTxBalance();
- } elseif ($ptStyle == dict::getDict('ptStyle', 'ghs')) {
- $txAsset = PtAssetClass::getGhsTxBalance();
- } else {
- util::fail('没有找到平台');
- }
- $currentPtTxBalance = $txAsset->amount;
- $id = $cgRefund->id;
- $sjId = $shop->sjId;
- $shopId = $shop->id;
- $mainId = $shop->mainId ?? 0;
- $change = [
- 'relateId' => $id,
- 'capitalType' => $currentType,
- 'amount' => $refundPrice,
- 'balance' => $currentPtBalance,
- 'txBalance' => $currentPtTxBalance,
- 'io' => 1,
- 'payWay' => 0,
- 'event' => "【{$shop->merchantName} {$shop->shopName}】的采购被退款",
- 'sjId' => $sjId,
- 'shopId' => $shopId,
- 'mainId' => $mainId,
- 'tx' => $tx,
- 'ptStyle' => $ptStyle,
- 'shopName' => $shop->shopName,
- 'sjName' => $shop->merchantName,
- ];
- PtYeChangeClass::addChange($change, true);
- }
- }
|