|
|
@@ -4,8 +4,11 @@ namespace bizGhs\custom\services;
|
|
|
|
|
|
use biz\ghs\classes\GhsClass;
|
|
|
use biz\sj\classes\SjClass;
|
|
|
+use bizGhs\custom\classes\CustomRechargeClass;
|
|
|
+use bizGhs\ghs\classes\GhsRechargeClass;
|
|
|
use bizHd\base\services\BaseService;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
+use common\components\orderSn;
|
|
|
use common\components\util;
|
|
|
|
|
|
class CustomService extends BaseService
|
|
|
@@ -14,18 +17,75 @@ class CustomService extends BaseService
|
|
|
public static $baseFile = '\bizGhs\custom\classes\CustomClass';
|
|
|
|
|
|
//充值和结账 ssh 20240309
|
|
|
- public static function rechargeClear($custom, $amount)
|
|
|
+ public static function rechargeClear($custom, $amount, $shop, $staff)
|
|
|
{
|
|
|
- $custom->balance = bcadd($custom->balance, $amount, 2);
|
|
|
- $custom->save();
|
|
|
-
|
|
|
$ghsId = $custom->ghsId ?? 0;
|
|
|
$ghsInfo = GhsClass::getById($ghsId, true);
|
|
|
if (empty($ghsInfo)) {
|
|
|
util::fail('没有找到供货商');
|
|
|
}
|
|
|
+ $ghsShopId = $ghsInfo->shopId ?? 0;
|
|
|
+ $ghsName = $ghsInfo->name ?? '';
|
|
|
+ $customId = $custom->id ?? 0;
|
|
|
+ $customShopId = $custom->shopId ?? 0;
|
|
|
+ $customName = $custom->name ?? '';
|
|
|
+
|
|
|
+ $custom->balance = bcadd($custom->balance, $amount, 2);
|
|
|
+ $custom->save();
|
|
|
+ $orderSn = orderSn::getGhsCustomRechargeSn();
|
|
|
+ $shopId = $shop->id ?? 0;
|
|
|
+ $mainId = $shop->mainId ?? 0;
|
|
|
+ $staffId = $staff->id ?? 0;
|
|
|
+ $staffName = $staff->name ?? '';
|
|
|
+ $cData = [
|
|
|
+ 'orderSn' => $orderSn,
|
|
|
+ 'onlinePay' => 1,
|
|
|
+ 'payWay' => 0,
|
|
|
+ 'shopId' => $shopId,
|
|
|
+ 'mainId' => $mainId,
|
|
|
+ 'amount' => $amount,
|
|
|
+ 'balance' => $custom->balance,
|
|
|
+ 'side' => 0,
|
|
|
+ 'staffId' => $staffId,
|
|
|
+ 'staffName' => $staffName,
|
|
|
+ 'payStatus' => 1,
|
|
|
+ 'status' => 1,
|
|
|
+ 'remark' => '',
|
|
|
+ 'ghsId' => $ghsId,
|
|
|
+ 'ghsShopId' => $ghsShopId,
|
|
|
+ 'ghsName' => $ghsName,
|
|
|
+ 'customId' => $customId,
|
|
|
+ 'customShopId' => $customShopId,
|
|
|
+ 'customName' => $customName,
|
|
|
+ ];
|
|
|
+ $cRecharge = CustomRechargeClass::add($cData, true);
|
|
|
+
|
|
|
$ghsInfo->balance = bcadd($ghsInfo->balance, $amount, 2);
|
|
|
$ghsInfo->save();
|
|
|
+ $orderSn = orderSn::getGhsRechargeSn();
|
|
|
+ $customMainId = $custom->mainId ?? 0;
|
|
|
+ $gData = [
|
|
|
+ 'orderSn' => $orderSn,
|
|
|
+ 'onlinePay' => 1,
|
|
|
+ 'payWay' => 0,
|
|
|
+ 'shopId' => $customShopId,
|
|
|
+ 'mainId' => $customMainId,
|
|
|
+ 'amount' => $amount,
|
|
|
+ 'balance' => $ghsInfo->balance,
|
|
|
+ 'side' => 0,
|
|
|
+ 'staffId' => 0,
|
|
|
+ 'staffName' => '',
|
|
|
+ 'payStatus' => 1,
|
|
|
+ 'status' => 1,
|
|
|
+ 'remark' => '',
|
|
|
+ 'ghsId' => $ghsId,
|
|
|
+ 'ghsShopId' => $ghsShopId,
|
|
|
+ 'ghsName' => $ghsName,
|
|
|
+ 'customId' => $customId,
|
|
|
+ 'customShopId' => $customShopId,
|
|
|
+ 'customName' => $customName,
|
|
|
+ ];
|
|
|
+ $gRecharge = GhsRechargeClass::add($gData, true);
|
|
|
}
|
|
|
|
|
|
//分享建立客户和供货商关系 ssh 2021.2.28
|