|
|
@@ -63,8 +63,89 @@ class CustomClass extends BaseClass
|
|
|
self::LEVEL_ZS => 'zsAddPrice',
|
|
|
];
|
|
|
|
|
|
+ //消费余额 ssh 20240311
|
|
|
+ public static function clearConsumeBalance($amount, $custom, $ghs, $shop, $staff, $clear)
|
|
|
+ {
|
|
|
+ $customId = $custom->id ?? 0;
|
|
|
+ $ghsId = $ghs->id ?? 0;
|
|
|
+ $relateId = $clearInfo->id ?? 0;
|
|
|
+ $staffId = $staff->id ?? 0;
|
|
|
+ $staffName = $staff->name ?? '';
|
|
|
+ $clearSn = $clear->orderSn;
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+ $shopId = $shop->id ?? 0;
|
|
|
+ $sjId = $shop->sjId ?? 0;
|
|
|
+
|
|
|
+ $newGhsBalance = bcsub($ghs->balance, $amount, 2);
|
|
|
+ $ghs->balance = $newGhsBalance;
|
|
|
+ $ghs->save();
|
|
|
+
|
|
|
+ $newCustomBalance = bcsub($custom->balance, $amount, 2);
|
|
|
+ $custom->balance = $newCustomBalance;
|
|
|
+ $custom->save();
|
|
|
+
|
|
|
+ if ($newGhsBalance < 0) {
|
|
|
+ util::fail('余额有问题哦..');
|
|
|
+ }
|
|
|
+ if (floatval($newGhsBalance) != floatval($newCustomBalance)) {
|
|
|
+ util::fail('余额有问题...');
|
|
|
+ }
|
|
|
+
|
|
|
+ $capitalType = dict::getDict('capitalType', 'ghsHelpCustomUseBalanceClear', 'id');
|
|
|
+ $fromType = dict::getDict('fromType', 'shop');
|
|
|
+ $cbData = [
|
|
|
+ 'customId' => $customId,
|
|
|
+ 'relateId' => $relateId,
|
|
|
+ 'onlinePay' => 1,
|
|
|
+ 'ptStyle' => 2,
|
|
|
+ 'capitalType' => $capitalType,
|
|
|
+ 'amount' => $amount,
|
|
|
+ 'balance' => $newCustomBalance,
|
|
|
+ 'staffId' => $staffId,
|
|
|
+ 'staffName' => $staffName,
|
|
|
+ 'io' => 0,
|
|
|
+ 'side' => 0,
|
|
|
+ 'payWay' => 0,
|
|
|
+ 'fromType' => $fromType,
|
|
|
+ 'event' => '结账 ' . $clearSn,
|
|
|
+ 'mainId' => $mainId,
|
|
|
+ 'shopId' => $shopId,
|
|
|
+ 'sjId' => $sjId,
|
|
|
+ 'remark' => '',
|
|
|
+ ];
|
|
|
+ CustomBalanceChangeClass::add($cbData, true);
|
|
|
+
|
|
|
+ $customShopId = $custom->shopId ?? 0;
|
|
|
+ $customShop = ShopClass::getById($customShopId, true);
|
|
|
+ if (empty($customShop)) {
|
|
|
+ util::fail('没有找到客户门店呢..');
|
|
|
+ }
|
|
|
+ $customShopSjId = $customShop->sjId ?? 0;
|
|
|
+ $customShopMainId = $customShop->mainId ?? 0;
|
|
|
+ $capitalType = dict::getDict('capitalType', 'customAskGhsUseBalanceClear', 'id');
|
|
|
+ $gbData = [
|
|
|
+ 'ghsId' => $ghsId,
|
|
|
+ 'relateId' => $relateId,
|
|
|
+ 'ptStyle' => 2,
|
|
|
+ 'capitalType' => $capitalType,
|
|
|
+ 'amount' => $amount,
|
|
|
+ 'balance' => $newGhsBalance,
|
|
|
+ 'io' => 0,
|
|
|
+ 'side' => 0,
|
|
|
+ 'onlinePay' => 1,
|
|
|
+ 'payWay' => 0,
|
|
|
+ 'fromType' => $fromType,
|
|
|
+ 'event' => '结账 ' . $clearSn,
|
|
|
+ 'sjId' => $customShopSjId,
|
|
|
+ 'mainId' => $customShopMainId,
|
|
|
+ 'shopId' => $customShopId,
|
|
|
+ 'remark' => '',
|
|
|
+ ];
|
|
|
+ GhsBalanceChangeClass::add($gbData, true);
|
|
|
+ }
|
|
|
+
|
|
|
//充值金额 ssh 20240310
|
|
|
- public static function rechargeAmount($custom, $amount, $shop, $staff)
|
|
|
+ public static function rechargeBalance($custom, $amount, $shop, $staff)
|
|
|
{
|
|
|
$ghsId = $custom->ghsId ?? 0;
|
|
|
$ghsInfo = GhsClass::getLockById($ghsId);
|
|
|
@@ -128,6 +209,7 @@ class CustomClass extends BaseClass
|
|
|
'staffId' => $staffId,
|
|
|
'staffName' => $staffName,
|
|
|
'io' => 1,
|
|
|
+ 'side' => 0,
|
|
|
'payWay' => 0,
|
|
|
'fromType' => $fromType,
|
|
|
'event' => '充值',
|
|
|
@@ -165,7 +247,7 @@ class CustomClass extends BaseClass
|
|
|
];
|
|
|
$gRecharge = GhsRechargeClass::add($gData, true);
|
|
|
$gRechargeId = $gRecharge->id ?? 0;
|
|
|
- $capitalType = dict::getDict('capitalType', 'ghsCustomRecharge', 'id');
|
|
|
+ $capitalType = dict::getDict('capitalType', 'customAskGhsRecharge', 'id');
|
|
|
$gbData = [
|
|
|
'ghsId' => $ghsId,
|
|
|
'relateId' => $gRechargeId,
|
|
|
@@ -174,6 +256,7 @@ class CustomClass extends BaseClass
|
|
|
'amount' => $amount,
|
|
|
'balance' => $ghsInfo->balance,
|
|
|
'io' => 1,
|
|
|
+ 'side' => 0,
|
|
|
'onlinePay' => 1,
|
|
|
'payWay' => 0,
|
|
|
'fromType' => $fromType,
|