|
|
@@ -11086,6 +11086,10 @@ class StoreOrderRepository extends BaseRepository
|
|
11086
|
11086
|
throw new ValidateException('未查询到订单所属用户');
|
|
11087
|
11087
|
}
|
|
11088
|
11088
|
|
|
|
11089
|
+ /** @var SharedProsperityUserRepository $sharedProsperityUserRepository */
|
|
|
11090
|
+ $sharedProsperityUserRepository = app()->make(SharedProsperityUserRepository::class);
|
|
|
11091
|
+ $sharedProsperityUserEntity = $sharedProsperityUserRepository->getSharedProsperityUserEntityByUserId($userEntity->getUid());
|
|
|
11092
|
+
|
|
11089
|
11093
|
// 精彩生活区
|
|
11090
|
11094
|
if ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['WonderfulLiving']['code']) {
|
|
11091
|
11095
|
// 为消费者 初始化 添加养老金记录
|
|
|
@@ -11119,17 +11123,31 @@ class StoreOrderRepository extends BaseRepository
|
|
11119
|
11123
|
$storeOrderEntity->getOrderId()
|
|
11120
|
11124
|
);
|
|
11121
|
11125
|
|
|
11122
|
|
- // 初始化 PV
|
|
|
11126
|
+ // 初始化 PV 如果用户 在共富体系中存在 则 将此PV统计到 共富体系中
|
|
11123
|
11127
|
$pv = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Self']['Pv']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
|
|
11124
|
|
- /** @var UserPvLogRepository $userPvLogRepository */
|
|
11125
|
|
- $userPvLogRepository = app()->make(UserPvLogRepository::class);
|
|
11126
|
|
- $userPvLogRepository->addUserPvLog(
|
|
11127
|
|
- $storeOrderEntity->getUid(),
|
|
11128
|
|
- $pv,
|
|
11129
|
|
- '购买精彩生活商品获得PV值',
|
|
11130
|
|
- UserPvLogEnum::ORDER_TYPE['Platform']['code'],
|
|
11131
|
|
- $storeOrderEntity->getOrderId()
|
|
11132
|
|
- );
|
|
|
11128
|
+ if (empty($sharedProsperityUserEntity->getId())) {
|
|
|
11129
|
+ /** @var UserPvLogRepository $userPvLogRepository */
|
|
|
11130
|
+ $userPvLogRepository = app()->make(UserPvLogRepository::class);
|
|
|
11131
|
+ $userPvLogRepository->addUserPvLog(
|
|
|
11132
|
+ $storeOrderEntity->getUid(),
|
|
|
11133
|
+ $pv,
|
|
|
11134
|
+ '购买精彩生活商品获得PV值',
|
|
|
11135
|
+ UserPvLogEnum::ORDER_TYPE['Platform']['code'],
|
|
|
11136
|
+ $storeOrderEntity->getOrderId()
|
|
|
11137
|
+ );
|
|
|
11138
|
+ } else {
|
|
|
11139
|
+ /** @var SharedProsperityRewardRecordRepository $sharedProsperityRewardRecordRepository */
|
|
|
11140
|
+ $sharedProsperityRewardRecordRepository = app()->make(SharedProsperityRewardRecordRepository::class);
|
|
|
11141
|
+ $sharedProsperityRewardRecordRepository->addSharedProsperityRewardRecord(
|
|
|
11142
|
+ $sharedProsperityUserEntity->getUserId(),
|
|
|
11143
|
+ SharedProsperityRewardRecordEnum::TYPE['PV']['code'],
|
|
|
11144
|
+ SharedProsperityRewardRecordEnum::PM['INCOME']['code'],
|
|
|
11145
|
+ $pv,
|
|
|
11146
|
+ SharedProsperityRewardRecordEnum::TYPE_SHOP['Platform']['code'],
|
|
|
11147
|
+ $storeOrderEntity->getOrderSn(),
|
|
|
11148
|
+ '购买精彩生活商品获得PV值'
|
|
|
11149
|
+ );
|
|
|
11150
|
+ }
|
|
11133
|
11151
|
|
|
11134
|
11152
|
// 初始化积分
|
|
11135
|
11153
|
$score = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Self']['Score']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
|
|
|
@@ -11160,9 +11178,13 @@ class StoreOrderRepository extends BaseRepository
|
|
11160
|
11178
|
);
|
|
11161
|
11179
|
}
|
|
11162
|
11180
|
|
|
11163
|
|
- // 给推荐人的奖励
|
|
11164
|
|
- if (!empty($userEntity->getSpreadUid())) {
|
|
11165
|
|
- $userEntityBySpreadUid = $userRepository->getUserEntityByUid($userEntity->getSpreadUid());
|
|
|
11181
|
+ // 给推荐人的奖励 如果消费者 存在共富体系中,则推荐人采用共富体系内的 推荐人
|
|
|
11182
|
+ $spreadUid = $userEntity->getSpreadUid();
|
|
|
11183
|
+ if (!empty($sharedProsperityUserEntity->getId())) {
|
|
|
11184
|
+ $spreadUid = $sharedProsperityUserEntity->getParentId();
|
|
|
11185
|
+ }
|
|
|
11186
|
+ if (!empty($spreadUid)) {
|
|
|
11187
|
+ $userEntityBySpreadUid = $userRepository->getUserEntityByUid($spreadUid);
|
|
11166
|
11188
|
if (!empty($userEntityBySpreadUid->getUid()) && $userEntityBySpreadUid->getIsDel() == UserEnum::IS_DEL['No']['code']) {
|
|
11167
|
11189
|
// 后台设置中 可以设置 推荐人 直推收益 的比例
|
|
11168
|
11190
|
$rate = static::getUserGroupRate($userEntityBySpreadUid->getUserGroup());
|
|
|
@@ -11564,9 +11586,7 @@ class StoreOrderRepository extends BaseRepository
|
|
11564
|
11586
|
// }
|
|
11565
|
11587
|
// }
|
|
11566
|
11588
|
} else if ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['SharedProsperity']['code']) {
|
|
11567
|
|
- /** @var SharedProsperityUserRepository $sharedProsperityUserRepository */
|
|
11568
|
|
- $sharedProsperityUserRepository = app()->make(SharedProsperityUserRepository::class);
|
|
11569
|
|
- $sharedProsperityUserEntity = $sharedProsperityUserRepository->getSharedProsperityUserEntityByUserId($userEntity->getUid());
|
|
|
11589
|
+
|
|
11570
|
11590
|
// 如果当前 共富体系内 没有该用户信息,则需要为其创建 共富体系用户数据
|
|
11571
|
11591
|
if (empty($sharedProsperityUserEntity->getId())) {
|
|
11572
|
11592
|
// 生成 共富体系用户实体
|
|
|
@@ -11701,7 +11721,7 @@ class StoreOrderRepository extends BaseRepository
|
|
11701
|
11721
|
$userBillRepository = app()->make(UserBillRepository::class);
|
|
11702
|
11722
|
$userBillRepository->addUserBill(
|
|
11703
|
11723
|
$sharedProsperityUserEntityByParent->getUserId(),
|
|
11704
|
|
- UserBillEnum::COMMISSION_TYPE['SHARED_PROSPERITY_DIRECT_COMMISSION']['code'],
|
|
|
11724
|
+ UserBillEnum::COMMISSION_TYPE['DIRECT_REFERRAL']['code'],
|
|
11705
|
11725
|
UserBillEnum::PM['INCOME']['code'],
|
|
11706
|
11726
|
$brokeragePriceBySpreadUid,
|
|
11707
|
11727
|
UserBillEnum::CATEGORY['NowMoney']['code'],
|
|
|
@@ -11751,17 +11771,31 @@ class StoreOrderRepository extends BaseRepository
|
|
11751
|
11771
|
$storeOrderEntity->getOrderId()
|
|
11752
|
11772
|
);
|
|
11753
|
11773
|
|
|
11754
|
|
- // 初始化 PV
|
|
|
11774
|
+ // 初始化 PV 如果用户 在共富体系中存在 则 将此PV统计到 共富体系中
|
|
11755
|
11775
|
$pv = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['CommercialDistrict']['Self']['Pv']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
|
|
11756
|
|
- /** @var UserPvLogRepository $userPvLogRepository */
|
|
11757
|
|
- $userPvLogRepository = app()->make(UserPvLogRepository::class);
|
|
11758
|
|
- $userPvLogRepository->addUserPvLog(
|
|
11759
|
|
- $storeOrderEntity->getUid(),
|
|
11760
|
|
- $pv,
|
|
11761
|
|
- '购买商贸区商品获得PV值',
|
|
11762
|
|
- UserPvLogEnum::ORDER_TYPE['Platform']['code'],
|
|
11763
|
|
- $storeOrderEntity->getOrderId()
|
|
11764
|
|
- );
|
|
|
11776
|
+ if (empty($sharedProsperityUserEntity->getId())) {
|
|
|
11777
|
+ /** @var UserPvLogRepository $userPvLogRepository */
|
|
|
11778
|
+ $userPvLogRepository = app()->make(UserPvLogRepository::class);
|
|
|
11779
|
+ $userPvLogRepository->addUserPvLog(
|
|
|
11780
|
+ $storeOrderEntity->getUid(),
|
|
|
11781
|
+ $pv,
|
|
|
11782
|
+ '购买商贸区商品获得PV值',
|
|
|
11783
|
+ UserPvLogEnum::ORDER_TYPE['Platform']['code'],
|
|
|
11784
|
+ $storeOrderEntity->getOrderId()
|
|
|
11785
|
+ );
|
|
|
11786
|
+ } else {
|
|
|
11787
|
+ /** @var SharedProsperityRewardRecordRepository $sharedProsperityRewardRecordRepository */
|
|
|
11788
|
+ $sharedProsperityRewardRecordRepository = app()->make(SharedProsperityRewardRecordRepository::class);
|
|
|
11789
|
+ $sharedProsperityRewardRecordRepository->addSharedProsperityRewardRecord(
|
|
|
11790
|
+ $sharedProsperityUserEntity->getUserId(),
|
|
|
11791
|
+ SharedProsperityRewardRecordEnum::TYPE['PV']['code'],
|
|
|
11792
|
+ SharedProsperityRewardRecordEnum::PM['INCOME']['code'],
|
|
|
11793
|
+ $pv,
|
|
|
11794
|
+ SharedProsperityRewardRecordEnum::TYPE_SHOP['Platform']['code'],
|
|
|
11795
|
+ $storeOrderEntity->getOrderSn(),
|
|
|
11796
|
+ '购买商贸区商品获得PV值'
|
|
|
11797
|
+ );
|
|
|
11798
|
+ }
|
|
11765
|
11799
|
|
|
11766
|
11800
|
// 初始化积分
|
|
11767
|
11801
|
$score = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['CommercialDistrict']['Self']['Score']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
|
|
|
@@ -11805,9 +11839,13 @@ class StoreOrderRepository extends BaseRepository
|
|
11805
|
11839
|
);
|
|
11806
|
11840
|
}
|
|
11807
|
11841
|
|
|
11808
|
|
- // 给推荐人的奖励
|
|
11809
|
|
- if (!empty($userEntity->getSpreadUid())) {
|
|
11810
|
|
- $userEntityBySpreadUid = $userRepository->getUserEntityByUid($userEntity->getSpreadUid());
|
|
|
11842
|
+ // 给推荐人的奖励 如果消费者 存在共富体系中,则推荐人采用共富体系内的 推荐人
|
|
|
11843
|
+ $spreadUid = $userEntity->getSpreadUid();
|
|
|
11844
|
+ if (!empty($sharedProsperityUserEntity->getId())) {
|
|
|
11845
|
+ $spreadUid = $sharedProsperityUserEntity->getParentId();
|
|
|
11846
|
+ }
|
|
|
11847
|
+ if (!empty($spreadUid)) {
|
|
|
11848
|
+ $userEntityBySpreadUid = $userRepository->getUserEntityByUid($spreadUid);
|
|
11811
|
11849
|
if (!empty($userEntityBySpreadUid->getUid()) && $userEntityBySpreadUid->getIsDel() == UserEnum::IS_DEL['No']['code']) {
|
|
11812
|
11850
|
// 后台设置中 可以设置 推荐人 直推收益 的比例
|
|
11813
|
11851
|
$rate = static::getUserGroupRate($userEntityBySpreadUid->getUserGroup());
|