|
@@ -179,7 +179,7 @@ class xhPayToolService
|
|
|
}
|
|
}
|
|
|
$orderId = $order['id'];
|
|
$orderId = $order['id'];
|
|
|
$orderSn = $order['orderSn'];
|
|
$orderSn = $order['orderSn'];
|
|
|
- $userId = $order['userId'];
|
|
|
|
|
|
|
+ $userId = $order['userId'] ?? 0;
|
|
|
$totalFee = $order['actPrice'];
|
|
$totalFee = $order['actPrice'];
|
|
|
$merchantId = $order['merchantId'];
|
|
$merchantId = $order['merchantId'];
|
|
|
$alipayId = isset($alipayParams['alipayId']) ? $alipayParams['alipayId'] : '';
|
|
$alipayId = isset($alipayParams['alipayId']) ? $alipayParams['alipayId'] : '';
|
|
@@ -236,10 +236,10 @@ class xhPayToolService
|
|
|
$userAsset = xhUserAssetService::getByUserId($userId);
|
|
$userAsset = xhUserAssetService::getByUserId($userId);
|
|
|
}
|
|
}
|
|
|
if (empty($user)) {
|
|
if (empty($user)) {
|
|
|
- util::fail('没有客户信息');
|
|
|
|
|
|
|
+ //util::fail('没有客户信息');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $balance = $userAsset['balance'];
|
|
|
|
|
|
|
+ $balance = $userAsset['balance'] ?? 0;
|
|
|
if ($payWay == $balancePay && $balance < $totalFee) {
|
|
if ($payWay == $balancePay && $balance < $totalFee) {
|
|
|
Yii::warning('余额不足,capitalType:' . $capitalType . ' orderSn:' . $orderSn);
|
|
Yii::warning('余额不足,capitalType:' . $capitalType . ' orderSn:' . $orderSn);
|
|
|
util::fail('余额不足');
|
|
util::fail('余额不足');
|
|
@@ -332,30 +332,30 @@ class xhPayToolService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//累计消费
|
|
//累计消费
|
|
|
- $userTotalExpend = stringUtil::calcAdd($userAsset['totalExpend'], $totalFee);
|
|
|
|
|
|
|
+ //$userTotalExpend = stringUtil::calcAdd($userAsset['totalExpend'], $totalFee);
|
|
|
//成长值增加
|
|
//成长值增加
|
|
|
- $userGrowth = $userAsset['growth'] + floor($totalFee);
|
|
|
|
|
- $userTotalBuyNum = $userAsset['totalBuyNum'] + 1;
|
|
|
|
|
-
|
|
|
|
|
- $remainBalance = $payWay == $balancePay ? stringUtil::calcSub($balance, $totalFee) : $balance;
|
|
|
|
|
- $upAssetData = [];
|
|
|
|
|
- $upAssetData['balance'] = $remainBalance;
|
|
|
|
|
- $upAssetData['growth'] = $userGrowth;
|
|
|
|
|
- $upAssetData['totalExpend'] = $userTotalExpend;
|
|
|
|
|
- $upAssetData['totalBuyNum'] = $userTotalBuyNum;
|
|
|
|
|
- xhUserAssetService::ioChangeAsset($user, $userAsset, $upAssetData, $merchant, $merchantExtend, $order, $capitalType);//用户资产改变
|
|
|
|
|
|
|
+// $userGrowth = $userAsset['growth'] + floor($totalFee);
|
|
|
|
|
+// $userTotalBuyNum = $userAsset['totalBuyNum'] + 1;
|
|
|
|
|
+//
|
|
|
|
|
+// $remainBalance = $payWay == $balancePay ? stringUtil::calcSub($balance, $totalFee) : $balance;
|
|
|
|
|
+// $upAssetData = [];
|
|
|
|
|
+// $upAssetData['balance'] = $remainBalance;
|
|
|
|
|
+// $upAssetData['growth'] = $userGrowth;
|
|
|
|
|
+// $upAssetData['totalExpend'] = $userTotalExpend;
|
|
|
|
|
+// $upAssetData['totalBuyNum'] = $userTotalBuyNum;
|
|
|
|
|
+ //xhUserAssetService::ioChangeAsset($user, $userAsset, $upAssetData, $merchant, $merchantExtend, $order, $capitalType);//用户资产改变
|
|
|
|
|
|
|
|
$growData = [
|
|
$growData = [
|
|
|
'userId' => $userId,
|
|
'userId' => $userId,
|
|
|
'userName' => $userName,
|
|
'userName' => $userName,
|
|
|
'merchantId' => $merchantId,
|
|
'merchantId' => $merchantId,
|
|
|
'relateId' => $orderId,
|
|
'relateId' => $orderId,
|
|
|
- 'growth' => $userGrowth,
|
|
|
|
|
|
|
+ //'growth' => $userGrowth,
|
|
|
'num' => floor($totalFee),
|
|
'num' => floor($totalFee),
|
|
|
'io' => 1,
|
|
'io' => 1,
|
|
|
'payWay' => $payWay,
|
|
'payWay' => $payWay,
|
|
|
'alipayId' => $alipayId,
|
|
'alipayId' => $alipayId,
|
|
|
- 'event' => $uIntegralEvent,
|
|
|
|
|
|
|
+ //'event' => $uIntegralEvent,
|
|
|
'operatorId' => $userId,
|
|
'operatorId' => $userId,
|
|
|
'createTime' => $date,
|
|
'createTime' => $date,
|
|
|
'gainType' => 1,
|
|
'gainType' => 1,
|
|
@@ -365,13 +365,13 @@ class xhPayToolService
|
|
|
|
|
|
|
|
$userCapitalData = [
|
|
$userCapitalData = [
|
|
|
'relateId' => $orderId,
|
|
'relateId' => $orderId,
|
|
|
- 'balance' => $remainBalance,
|
|
|
|
|
- 'totalIncome' => $userAsset['totalIncome'],
|
|
|
|
|
|
|
+ //'balance' => $remainBalance,
|
|
|
|
|
+ 'totalIncome' => $userAsset['totalIncome'] ?? 0,
|
|
|
'totalExpend' => $userTotalExpend,
|
|
'totalExpend' => $userTotalExpend,
|
|
|
'amount' => $totalFee,
|
|
'amount' => $totalFee,
|
|
|
'io' => 0,
|
|
'io' => 0,
|
|
|
'payWay' => $payWay,
|
|
'payWay' => $payWay,
|
|
|
- 'event' => $uCapitalEvent,
|
|
|
|
|
|
|
+ //'event' => $uCapitalEvent,
|
|
|
'merchantId' => $merchantId,
|
|
'merchantId' => $merchantId,
|
|
|
'userId' => $userId,
|
|
'userId' => $userId,
|
|
|
'alipayId' => $alipayId,
|
|
'alipayId' => $alipayId,
|
|
@@ -387,10 +387,10 @@ class xhPayToolService
|
|
|
|
|
|
|
|
//如果是小程序支付可以获取unionId并进行更新关联
|
|
//如果是小程序支付可以获取unionId并进行更新关联
|
|
|
if ($payWay == $wxWay && $wxPayType == 1) {
|
|
if ($payWay == $wxWay && $wxPayType == 1) {
|
|
|
- OrderClass::payToUpdateUnionId($merchant, $merchantExtend, $orderSn, $user);
|
|
|
|
|
|
|
+ //OrderClass::payToUpdateUnionId($merchant, $merchantExtend, $orderSn, $user);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return ['balance' => $remainBalance];
|
|
|
|
|
|
|
+ return ['balance' => 0];
|
|
|
|
|
+ //return ['balance' => $remainBalance];
|
|
|
|
|
|
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
$transaction->rollBack();
|
|
$transaction->rollBack();
|