|
|
@@ -10966,14 +10966,13 @@ class StoreOrderRepository extends BaseRepository
|
|
10966
|
10966
|
|
|
10967
|
10967
|
/**
|
|
10968
|
10968
|
* 订单支付成功后,更新订单信息
|
|
10969
|
|
- * @param array $storeOrderIdList
|
|
10970
|
|
- * @param string|null $payOpenId
|
|
10971
|
|
- * @return int
|
|
|
10969
|
+ * @param StoreOrderEntity[] $storeOrderEntityList
|
|
|
10970
|
+ * @return StoreOrderEntity[]
|
|
10972
|
10971
|
* @throws DbException
|
|
10973
|
10972
|
*/
|
|
10974
|
|
- public function paySuccessUpdateDB(array $storeOrderIdList, string $payOpenId = null): int
|
|
|
10973
|
+ public function paySuccessUpdateDB(array $storeOrderEntityList): array
|
|
10975
|
10974
|
{
|
|
10976
|
|
- return $this->dao->paySuccessUpdateDB($storeOrderIdList, $payOpenId);
|
|
|
10975
|
+ return $this->dao->paySuccessUpdateDB($storeOrderEntityList);
|
|
10977
|
10976
|
}
|
|
10978
|
10977
|
/**
|
|
10979
|
10978
|
* 根据 订单ID 来生 成奖励数据(待生效)
|
|
|
@@ -11736,71 +11735,77 @@ class StoreOrderRepository extends BaseRepository
|
|
11736
|
11735
|
if (empty($unsettledOrderIdList)) {
|
|
11737
|
11736
|
return;
|
|
11738
|
11737
|
}
|
|
|
11738
|
+ try {
|
|
|
11739
|
+ /** 结算 养老金 佣金 */
|
|
|
11740
|
+ /** @var UserBillRepository $userBillRepository */
|
|
|
11741
|
+ $userBillRepository = app()->make(UserBillRepository::class);
|
|
|
11742
|
+ $userBillEntityList = $userBillRepository->getUserBillEntityListByOrderIdListAndPending(UserBillEnum::TYPE_SHOP['Platform']['code'], $unsettledOrderIdList);
|
|
|
11743
|
+ if (!empty($userBillEntityList)) {
|
|
|
11744
|
+ $billIdList = array_map(function ($userBillEntity) {
|
|
|
11745
|
+ return $userBillEntity->getBillId();
|
|
|
11746
|
+ }, $userBillEntityList);
|
|
|
11747
|
+ // 去结算 养老金 和佣金
|
|
|
11748
|
+ $userBillRepository->executeByIdList($billIdList);
|
|
|
11749
|
+ }
|
|
|
11750
|
+
|
|
|
11751
|
+ /** @var UserSignFugouRepository $userSignFugouRepository */
|
|
|
11752
|
+ $userSignFugouRepository = app()->make(UserSignFugouRepository::class);
|
|
|
11753
|
+ $userSignFugouEntityList = $userSignFugouRepository->getUserSignFugouEntityListByOrderIdListAndPending(UserSignFugouEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
|
11754
|
+ if (!empty($userSignFugouEntityList)) {
|
|
|
11755
|
+ $fugouIdList = array_map(function ($userSignFugouEntity) {
|
|
|
11756
|
+ return $userSignFugouEntity->getId();
|
|
|
11757
|
+ }, $userSignFugouEntityList);
|
|
|
11758
|
+ // 去结算 养老金 和佣金
|
|
|
11759
|
+ $userSignFugouRepository->executeByIdList($fugouIdList);
|
|
|
11760
|
+ }
|
|
|
11761
|
+
|
|
|
11762
|
+ /** 结算 积分 */
|
|
|
11763
|
+ /** @var UserSignScoreRepository $userSignScoreRepository */
|
|
|
11764
|
+ $userSignScoreRepository = app()->make(UserSignScoreRepository::class);
|
|
|
11765
|
+ $userSignScoreEntityList = $userSignScoreRepository->getUserSignScoreEntityListByOrderIdListAndPending(UserSignScoreEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
|
11766
|
+ if (!empty($userSignScoreEntityList)) {
|
|
|
11767
|
+ $userSignScoreIdList = array_map(function ($userSignScoreEntity) {
|
|
|
11768
|
+ return $userSignScoreEntity->getId();
|
|
|
11769
|
+ }, $userSignScoreEntityList);
|
|
|
11770
|
+ $userSignScoreRepository->executeByIdList($userSignScoreIdList);
|
|
|
11771
|
+ }
|
|
|
11772
|
+ /** 结算 贡献值 */
|
|
|
11773
|
+ /** @var UserSignGongxianRepository $userSignGongxianRepository */
|
|
|
11774
|
+ $userSignGongxianRepository = app()->make(UserSignGongxianRepository::class);
|
|
|
11775
|
+ $userSignGongxianEntityList = $userSignGongxianRepository->getUserSignGongxianEntityListByOrderIdListAndPending(UserSignGongxianEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
|
11776
|
+ if (!empty($userSignGongxianEntityList)) {
|
|
|
11777
|
+ $userSignGongxianIdList = array_map(function ($userSignGongxianEntity) {
|
|
|
11778
|
+ return $userSignGongxianEntity->getId();
|
|
|
11779
|
+ }, $userSignGongxianEntityList);
|
|
|
11780
|
+ $userSignGongxianRepository->executeByIdList($userSignGongxianIdList);
|
|
|
11781
|
+ }
|
|
11739
|
11782
|
|
|
11740
|
|
- /** 结算 养老金 佣金 */
|
|
11741
|
|
- /** @var UserBillRepository $userBillRepository */
|
|
11742
|
|
- $userBillRepository = app()->make(UserBillRepository::class);
|
|
11743
|
|
- $userBillEntityList = $userBillRepository->getUserBillEntityListByOrderIdListAndPending(UserBillEnum::TYPE_SHOP['Platform']['code'], $unsettledOrderIdList);
|
|
11744
|
|
- if (!empty($userBillEntityList)) {
|
|
11745
|
|
- $billIdList = array_map(function ($userBillEntity) {
|
|
11746
|
|
- return $userBillEntity->getBillId();
|
|
11747
|
|
- }, $userBillEntityList);
|
|
11748
|
|
- // 去结算 养老金 和佣金
|
|
11749
|
|
- $userBillRepository->executeByIdList($billIdList);
|
|
11750
|
|
- }
|
|
11751
|
|
-
|
|
11752
|
|
- /** @var UserSignFugouRepository $userSignFugouRepository */
|
|
11753
|
|
- $userSignFugouRepository = app()->make(UserSignFugouRepository::class);
|
|
11754
|
|
- $userSignFugouEntityList = $userSignFugouRepository->getUserSignFugouEntityListByOrderIdListAndPending(UserSignFugouEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
11755
|
|
- if (!empty($userSignFugouEntityList)) {
|
|
11756
|
|
- $fugouIdList = array_map(function ($userSignFugouEntity) {
|
|
11757
|
|
- return $userSignFugouEntity->getId();
|
|
11758
|
|
- }, $userSignFugouEntityList);
|
|
11759
|
|
- // 去结算 养老金 和佣金
|
|
11760
|
|
- $userSignFugouRepository->executeByIdList($fugouIdList);
|
|
11761
|
|
- }
|
|
11762
|
|
-
|
|
11763
|
|
- /** 结算 积分 */
|
|
11764
|
|
- /** @var UserSignScoreRepository $userSignScoreRepository */
|
|
11765
|
|
- $userSignScoreRepository = app()->make(UserSignScoreRepository::class);
|
|
11766
|
|
- $userSignScoreEntityList = $userSignScoreRepository->getUserSignScoreEntityListByOrderIdListAndPending(UserSignScoreEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
11767
|
|
- if (!empty($userSignScoreEntityList)) {
|
|
11768
|
|
- $userSignScoreIdList = array_map(function ($userSignScoreEntity) {
|
|
11769
|
|
- return $userSignScoreEntity->getId();
|
|
11770
|
|
- }, $userSignScoreEntityList);
|
|
11771
|
|
- $userSignScoreRepository->executeByIdList($userSignScoreIdList);
|
|
11772
|
|
- }
|
|
11773
|
|
- /** 结算 贡献值 */
|
|
11774
|
|
- /** @var UserSignGongxianRepository $userSignGongxianRepository */
|
|
11775
|
|
- $userSignGongxianRepository = app()->make(UserSignGongxianRepository::class);
|
|
11776
|
|
- $userSignGongxianEntityList = $userSignGongxianRepository->getUserSignGongxianEntityListByOrderIdListAndPending(UserSignGongxianEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
11777
|
|
- if (!empty($userSignGongxianEntityList)) {
|
|
11778
|
|
- $userSignGongxianIdList = array_map(function ($userSignGongxianEntity) {
|
|
11779
|
|
- return $userSignGongxianEntity->getId();
|
|
11780
|
|
- }, $userSignGongxianEntityList);
|
|
11781
|
|
- $userSignGongxianRepository->executeByIdList($userSignGongxianIdList);
|
|
11782
|
|
- }
|
|
|
11783
|
+ /** 结算 PV */
|
|
|
11784
|
+ /** @var UserPvLogRepository $userPvLogRepository */
|
|
|
11785
|
+ $userPvLogRepository = app()->make(UserPvLogRepository::class);
|
|
|
11786
|
+ $userPvLogEntityList = $userPvLogRepository->getUserPvLogEntityListByOrderIdListAndPending(UserPvLogEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
|
11787
|
+ if (!empty($userPvLogEntityList)) {
|
|
|
11788
|
+ $userPvLogIdList = array_map(function ($userPvLogEntity) {
|
|
|
11789
|
+ return $userPvLogEntity->getId();
|
|
|
11790
|
+ }, $userPvLogEntityList);
|
|
|
11791
|
+ $userPvLogRepository->executeByIdList($userPvLogIdList);
|
|
|
11792
|
+ }
|
|
11783
|
11793
|
|
|
11784
|
|
- /** 结算 PV */
|
|
11785
|
|
- /** @var UserPvLogRepository $userPvLogRepository */
|
|
11786
|
|
- $userPvLogRepository = app()->make(UserPvLogRepository::class);
|
|
11787
|
|
- $userPvLogEntityList = $userPvLogRepository->getUserPvLogEntityListByOrderIdListAndPending(UserPvLogEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
11788
|
|
- if (!empty($userPvLogEntityList)) {
|
|
11789
|
|
- $userPvLogIdList = array_map(function ($userPvLogEntity) {
|
|
11790
|
|
- return $userPvLogEntity->getId();
|
|
11791
|
|
- }, $userPvLogEntityList);
|
|
11792
|
|
- $userPvLogRepository->executeByIdList($userPvLogIdList);
|
|
11793
|
|
- }
|
|
|
11794
|
+ /** 结算 红包 */
|
|
|
11795
|
+ /** @var UserSignHongbaoRepository $userSignHongbaoRepository */
|
|
|
11796
|
+ $userSignHongbaoRepository = app()->make(UserSignHongbaoRepository::class);
|
|
|
11797
|
+ $userSignHongbaoEntityList = $userSignHongbaoRepository->getUserSignHongbaoEntityListByOrderIdListAndPending(UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
|
11798
|
+ if (!empty($userSignHongbaoEntityList)) {
|
|
|
11799
|
+ $userSignHongbaoIdList = array_map(function ($userSignHongbaoEntity) {
|
|
|
11800
|
+ return $userSignHongbaoEntity->getId();
|
|
|
11801
|
+ }, $userSignHongbaoEntityList);
|
|
|
11802
|
+ $userSignHongbaoRepository->executeByIdList($userSignHongbaoIdList);
|
|
|
11803
|
+ }
|
|
11794
|
11804
|
|
|
11795
|
|
- /** 结算 红包 */
|
|
11796
|
|
- /** @var UserSignHongbaoRepository $userSignHongbaoRepository */
|
|
11797
|
|
- $userSignHongbaoRepository = app()->make(UserSignHongbaoRepository::class);
|
|
11798
|
|
- $userSignHongbaoEntityList = $userSignHongbaoRepository->getUserSignHongbaoEntityListByOrderIdListAndPending(UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'], $unsettledOrderIdList);
|
|
11799
|
|
- if (!empty($userSignHongbaoEntityList)) {
|
|
11800
|
|
- $userSignHongbaoIdList = array_map(function ($userSignHongbaoEntity) {
|
|
11801
|
|
- return $userSignHongbaoEntity->getId();
|
|
11802
|
|
- }, $userSignHongbaoEntityList);
|
|
11803
|
|
- $userSignHongbaoRepository->executeByIdList($userSignHongbaoIdList);
|
|
|
11805
|
+ // 订单奖励结算时 更新订单自身 结算字段
|
|
|
11806
|
+ $this->dao->settlementOrderByOrderIdList($unsettledOrderIdList);
|
|
|
11807
|
+ } catch (DbException $e) {
|
|
|
11808
|
+ throw new ValidateException('订单结算失败');
|
|
11804
|
11809
|
}
|
|
11805
|
11810
|
}
|
|
11806
|
11811
|
}
|
|
|
@@ -12152,4 +12157,40 @@ class StoreOrderRepository extends BaseRepository
|
|
12152
|
12157
|
}
|
|
12153
|
12158
|
return $paySuccess;
|
|
12154
|
12159
|
}
|
|
|
12160
|
+
|
|
|
12161
|
+ /**
|
|
|
12162
|
+ * 订单 分账 方法
|
|
|
12163
|
+ * @param array $orderIdList
|
|
|
12164
|
+ * @return void
|
|
|
12165
|
+ */
|
|
|
12166
|
+ public function independentAccountByOrderIdList(array $orderIdList)
|
|
|
12167
|
+ {
|
|
|
12168
|
+ /** @var StoreOrderRepository $storeOrderRepository */
|
|
|
12169
|
+ $storeOrderRepository = app()->make(StoreOrderRepository::class);
|
|
|
12170
|
+ $storeOrderEntityList = $storeOrderRepository->getStoreOrderEntityListByOrderIdList($orderIdList);
|
|
|
12171
|
+ if (!empty($storeOrderEntityList)) {
|
|
|
12172
|
+ // 筛选 未分账的 订单ID
|
|
|
12173
|
+ foreach ($storeOrderEntityList as $storeOrderEntity) {
|
|
|
12174
|
+ if ($storeOrderEntity->getIsIndependentaccount() == StoreOrderEnum::IS_INDEPENDENT_ACCOUNT['NO']['code']) {
|
|
|
12175
|
+ if (0.00 < (double)$storeOrderEntity->getFzonePayPrice()) {
|
|
|
12176
|
+ try {
|
|
|
12177
|
+ if ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['MemberZone']['code']) {
|
|
|
12178
|
+ // 会员专区分账
|
|
|
12179
|
+ $storeOrderRepository->vip_product_spiletnew($storeOrderEntity->getOrderSn(), $storeOrderEntity->getPayType());
|
|
|
12180
|
+ } elseif ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['WonderfulLiving']['code']) {
|
|
|
12181
|
+ // 精彩生活区 走宝塔定时任务 调用 great_life_order_independent_account 命令
|
|
|
12182
|
+ } elseif ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['Repurchase']['code']) {
|
|
|
12183
|
+ // 复购区不用分账,没有现金支付 只用复购金支付
|
|
|
12184
|
+ } else {
|
|
|
12185
|
+ // 商贸区 走宝塔定时任务 调用 commercial_area_order_independent_account 命令
|
|
|
12186
|
+ }
|
|
|
12187
|
+ } catch (DataNotFoundException|ModelNotFoundException|DbException $e) {
|
|
|
12188
|
+ Log::error('订单分账失败:' . $storeOrderEntity->getOrderSn());
|
|
|
12189
|
+ throw new ValidateException('分账失败');
|
|
|
12190
|
+ }
|
|
|
12191
|
+ }
|
|
|
12192
|
+ }
|
|
|
12193
|
+ }
|
|
|
12194
|
+ }
|
|
|
12195
|
+ }
|
|
12155
|
12196
|
}
|