Parcourir la source

Merge branch 'refs/heads/dev' into dev-sc-260204

shichen il y a 5 mois
Parent
commit
08eb4ab396

+ 53 - 1
app/command/MemberAreaOrderIndependentAccount.php

@@ -2,6 +2,7 @@
2 2
 
3 3
 namespace app\command;
4 4
 
5
+use app\common\enum\CommonEnum;
5 6
 use app\common\model\store\order\StoreOrder;
6 7
 use app\common\repositories\store\order\StoreOrderRepository;
7 8
 use think\console\Command;
@@ -21,7 +22,8 @@ class MemberAreaOrderIndependentAccount extends Command
21 22
     protected function execute(Input $input, Output $output)
22 23
     {
23 24
         // @todo 会员专区订单分账
24
-        $this->doMemberAreaOrderIndependentAccount([496]);
25
+        $this->doMemberAreaOrderIndependentAccount([CommonEnum::DESIGN_MERCHANT_ID['MemberZone']['code']]);
26
+        $this->doSharedProsperityOrderIndependentAccount([CommonEnum::DESIGN_MERCHANT_ID['SharedProsperity']['code']]);
25 27
     }
26 28
 
27 29
     /**
@@ -77,4 +79,54 @@ class MemberAreaOrderIndependentAccount extends Command
77 79
 
78 80
     }
79 81
 
82
+    /**
83
+     * 共富区订单分账
84
+     *
85
+     * @param $merId
86
+     * @param $timeLimit
87
+     * @return void
88
+     * @throws \think\db\exception\DataNotFoundException
89
+     * @throws \think\db\exception\DbException
90
+     * @throws \think\db\exception\ModelNotFoundException
91
+     */
92
+    private function doSharedProsperityOrderIndependentAccount($merId = [], $timeLimit = 30)
93
+    {
94
+        $dst_mer_id = CommonEnum::DESIGN_MERCHANT_ID['SharedProsperity']['code'];
95
+
96
+        // 商户信息
97
+        $merchants = [];
98
+
99
+        // 已支付、未结算  注意,会员专区之前可能没有去及时 更新结算状态 'is_settlement' => 1,
100
+        $where = ['paid' => 1, 'is_del' => 0, 'is_system_del' => 0, 'is_independentaccount' => 0];
101
+        // 订单状态(0:待发货;1:待收货;2:待评价;3:已完成;4已申请退款;-1:已退款)5未支付 6已取消'
102
+        // $status = [2, 3]; ->whereIn('status', $status)
103
+        // 普通订单
104
+        $cursor = Db::table('rrx_store_order')->where($where)->where('pay_type', 'in', '1,2,4')
105
+            ->where('fzone_pay_price', '>', 0.00)
106
+            ->whereIn('mer_id', $merId)->cursor();
107
+
108
+        /** @var StoreOrderRepository $storeOrderRepository */
109
+        $storeOrderRepository = app()->make(StoreOrderRepository::class);
110
+
111
+        foreach ($cursor as $key => $value) {
112
+            if (!isset($merchants[$value['mer_id']])) {
113
+                $merchants[$value['mer_id']] = Db::name('merchant')->where('mer_id', $value['mer_id'])->find();
114
+            }
115
+            $group_order = Db::name('store_group_order')->alias('sgo')->where('sgo.group_order_id', $value['group_order_id'])->find();
116
+
117
+            $independentAccount = $storeOrderRepository->getIndependentAccount($value, $group_order, $dst_mer_id, $merchants[$value['mer_id']]['hf_member_id']);
118
+
119
+            $isSuccessed = $storeOrderRepository->prepareExecuteIndependentAccount(
120
+                $value, $group_order, $independentAccount['api_key'], $independentAccount['hf_platform_member_id'], '', $value['fzone_pay_price'], 0
121
+            );
122
+            if ($isSuccessed) {
123
+                Db::name("log")->insert(array('data' => '共富区-订单分账:' . json_encode($value, JSON_FORCE_OBJECT)));// 日志记录
124
+
125
+                $order = StoreOrder::getInstance()->where('order_id', $value['order_id'])->find();
126
+                $order->is_independentaccount = 1;
127
+                $order->save();
128
+            }
129
+        }
130
+
131
+    }
80 132
 }

+ 11 - 0
app/common/enum/shared/SharedProsperityBalanceLogEnum.php

@@ -16,5 +16,16 @@ class SharedProsperityBalanceLogEnum extends CommonEnum
16 16
     const TYPE = [
17 17
         'PARTNER' => ['code' => 1, 'name' => '合伙人分红'],
18 18
         'GROUP' => ['code' => 2, 'name' => '共富奖'],
19
+        'DIRECT_REFERRAL' => ['code' => 3, 'name' => '直推奖'],
20
+        'LOCKED_CUSTOMER' => ['code' => 7, 'name' => '锁客收益'],
21
+        'PLATFORM_REWARD' => ['code' => 8, 'name' => '平台奖励'],
22
+        'SHARE_EARNINGS' => ['code' => 20, 'name' => '分享收益'],
23
+    ];
24
+
25
+    // 状态
26
+    const STATUS = [
27
+        'PENDING' => ['code' => 0, 'name' => '待确定'],
28
+        'VALID' => ['code' => 1, 'name' => '有效'],
29
+        'INVALID' => ['code' => -1, 'name' => '无效'],
19 30
     ];
20 31
 }

+ 15 - 5
app/common/repositories/store/order/StoreGroupOrderRepository.php

@@ -40,12 +40,14 @@ use app\entity\data\store\StoreProductEntity;
40 40
 use app\entity\data\user\UserAddressEntity;
41 41
 use app\entity\data\user\UserEntity;
42 42
 use app\entity\monomer\store\FzonePayTypeEntity;
43
+use app\entity\monomer\store\StoreOrderPensionJsonEntity;
43 44
 use app\entity\request\api\store\order\StoreOrderCreateRequestEntity;
44 45
 use think\db\exception\DbException;
45 46
 use think\exception\ValidateException;
46 47
 use think\facade\Db;
47 48
 use think\facade\Log;
48 49
 use think\model\Relation;
50
+use Throwable;
49 51
 
50 52
 /**
51 53
  * Class StoreGroupOrderRepository
@@ -196,7 +198,7 @@ class StoreGroupOrderRepository extends BaseRepository
196 198
                     $storeOrderRepository->closeStoreOrder($storeOrderEntity, $uid, $changeMessage, $remark);
197 199
                 }
198 200
             });
199
-        } catch (\Throwable $e) {
201
+        } catch (Throwable $e) {
200 202
             throw new ValidateException('关闭订单失败:' . json_encode([
201 203
                     'error_message' => $e->getMessage(),
202 204
                     'error_file' => $e->getFile(),
@@ -795,7 +797,14 @@ class StoreGroupOrderRepository extends BaseRepository
795 797
                 ->setDouhuomall(empty($productEntity->getSpuId()) ? StoreOrderEnum::DOHUOMALL['PlatformOrder']['code'] : StoreOrderEnum::DOHUOMALL['SupplyChainOrder']['code'])
796 798
                 ->setDouhuomallStatus(empty($productEntity->getSpuId()) ? null : StoreOrderEnum::DOHUOMALL_STATUS['NotSubmittedToWeiweiBao']['code'])
797 799
                 ->setFzonePaytype($storeOrderCreateRequestEntity->getFzonePayType())
798
-                ->setConPri($serviceMoney);
800
+                ->setConPri($serviceMoney)
801
+                ->setPensionJson(
802
+                    StoreOrderPensionJsonEntity::newInstance()
803
+                        ->setPensionIs($productEntity->getPensionIs())
804
+                        ->setPension($productEntity->getPension())
805
+                        ->setAttrValuePensionNum($productAttrValueEntity->getPensionNum())
806
+                        ->toArray()
807
+                );
799 808
             $storeOrderEntityList[] = $storeOrderEntity;
800 809
         }
801 810
 
@@ -913,7 +922,7 @@ class StoreGroupOrderRepository extends BaseRepository
913 922
                     $storeGroupOrderRepository->storeGroupOrderPaySuccess($storeGroupOrderEntity->getGroupOrderId());
914 923
                 }
915 924
             });
916
-        } catch (\Throwable  $e) {
925
+        } catch (Throwable  $e) {
917 926
             Log::error('StoreGroupOrderRepository-createStoreGroupOrder:' . $e->getMessage());
918 927
             return [
919 928
                 'code' => 10001,
@@ -933,7 +942,7 @@ class StoreGroupOrderRepository extends BaseRepository
933 942
      * @param string $rand 当现金支付时,汇付会在订单尾部跟一个随机数
934 943
      * @param string|null $payOpenId 当现金支付时,付款人的Id
935 944
      * @return void
936
-     * @throws DbException
945
+     * @throws Throwable
937 946
      */
938 947
     public function storeGroupOrderPaySuccess(int $groupOrderId, string $rand = '', string $payOpenId = null): void
939 948
     {
@@ -970,8 +979,9 @@ class StoreGroupOrderRepository extends BaseRepository
970 979
             // 生成奖励数据
971 980
             $storeOrderRepository->createRewardMechanismByStoreOrderId($storeOrderEntity->getOrderId());
972 981
 
973
-            if ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['MemberZone']['code']) {
982
+            if (in_array($storeOrderEntity->getMerId(), [CommonEnum::DESIGN_MERCHANT_ID['MemberZone']['code'], CommonEnum::DESIGN_MERCHANT_ID['SharedProsperity']['code']])) {
974 983
                 // 会员专区的 订单立即结算
984
+                // 共富区的订单立即结算
975 985
                 $settlementOrderIdList[] = $storeOrderEntity->getOrderId();
976 986
             }
977 987
 

+ 65 - 2
app/common/repositories/store/order/StoreOrderRepository.php

@@ -102,6 +102,7 @@ use app\entity\data\user\UserAddressEntity;
102 102
 use app\entity\data\user\UserBillEntity;
103 103
 use app\entity\data\user\UserEntity;
104 104
 use app\entity\monomer\store\FzonePayTypeEntity;
105
+use app\entity\monomer\store\StoreOrderPensionJsonEntity;
105 106
 use app\entity\request\api\store\order\CalculatePostageRequestEntity;
106 107
 use app\entity\request\api\store\order\StoreOrderCreateRequestEntity;
107 108
 use app\model\common\JdOrderModel;
@@ -11086,6 +11087,15 @@ class StoreOrderRepository extends BaseRepository
11086 11087
         /** @var StoreOrderRepository $storeOrderRepository */
11087 11088
         $storeOrderRepository = app()->make(StoreOrderRepository::class);
11088 11089
         $storeOrderEntity = $storeOrderRepository->getStoreOrderEntityByOrderId($orderId);
11090
+        $yanglaojin = null;
11091
+        if (!empty($storeOrderEntity->getPensionJson()) && is_array($storeOrderEntity->getPensionJson())) {
11092
+            // 当有商品单独设置养老金比例时,下单时,会将该商品 规格内 单独设置的养老金比例 保存下来,该养老金比例 是根据商品售价来计算的
11093
+            $storeOrderPensionJsonEntity = StoreOrderPensionJsonEntity::newInstance($storeOrderEntity->getPensionJson());
11094
+            if ($storeOrderPensionJsonEntity->getPensionIs()) {
11095
+                $pensionProportion = bcdiv((string)$storeOrderPensionJsonEntity->getAttrValuePensionNum(), '100', CommonEnum::CALCULATE_THE_NUMBER_OF_DECIMAL_PLACES);
11096
+                $yanglaojin = bcmul((string)$storeOrderEntity->getTotalPrice(), $pensionProportion, CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11097
+            }
11098
+        }
11089 11099
 
11090 11100
         /** @var UserRepository $userRepository */
11091 11101
         $userRepository = app()->make(UserRepository::class);
@@ -11101,7 +11111,9 @@ class StoreOrderRepository extends BaseRepository
11101 11111
         // 精彩生活区
11102 11112
         if ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['WonderfulLiving']['code']) {
11103 11113
             // 为消费者 初始化 添加养老金记录
11104
-            $yanglaojin = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Self']['YangLaoJin']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11114
+            if (is_null($yanglaojin)) {
11115
+                $yanglaojin = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Self']['YangLaoJin']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11116
+            }
11105 11117
             /** @var UserBillRepository $userBillRepository */
11106 11118
             $userBillRepository = app()->make(UserBillRepository::class);
11107 11119
             $userBillRepository->addUserBill(
@@ -11616,7 +11628,9 @@ class StoreOrderRepository extends BaseRepository
11616 11628
             }
11617 11629
 
11618 11630
             // 为消费者 初始化 添加养老金记录
11619
-            $yanglaojin = bcmul($storeOrderEntity->getTotalPrice(), CommonEnum::ORDER_EARNING_ALLOCATION['SharedProsperity']['Self']['YangLaoJin']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11631
+            if (is_null($yanglaojin)) {
11632
+                $yanglaojin = bcmul($storeOrderEntity->getTotalPrice(), CommonEnum::ORDER_EARNING_ALLOCATION['SharedProsperity']['Self']['YangLaoJin']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11633
+            }
11620 11634
             /** @var UserBillRepository $userBillRepository */
11621 11635
             $userBillRepository = app()->make(UserBillRepository::class);
11622 11636
             $userBillRepository->addUserBill(
@@ -12517,6 +12531,9 @@ class StoreOrderRepository extends BaseRepository
12517 12531
                                 // 精彩生活区 走宝塔定时任务 调用 great_life_order_independent_account 命令
12518 12532
                             } elseif ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['Repurchase']['code']) {
12519 12533
                                 // 复购区不用分账,没有现金支付 只用复购金支付
12534
+                            } elseif ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['SharedProsperity']['code']) {
12535
+                                // 共富区分账
12536
+                                $storeOrderRepository->sharedProsperityOrderIndependentAccount($storeOrderEntity->getOrderSn(), $storeOrderEntity->getPayType());
12520 12537
                             } else {
12521 12538
                                 // 商贸区 走宝塔定时任务 调用 commercial_area_order_independent_account 命令
12522 12539
                             }
@@ -12530,6 +12547,52 @@ class StoreOrderRepository extends BaseRepository
12530 12547
         }
12531 12548
     }
12532 12549
 
12550
+    /**
12551
+     * 共富区订单分账
12552
+     *
12553
+     * @param $merId
12554
+     * @param $timeLimit
12555
+     * @return void
12556
+     * @throws \think\db\exception\DataNotFoundException
12557
+     * @throws \think\db\exception\DbException
12558
+     * @throws \think\db\exception\ModelNotFoundException
12559
+     */
12560
+    private function sharedProsperityOrderIndependentAccount($orderSn, $payType)
12561
+    {
12562
+        $dst_mer_id = CommonEnum::DESIGN_MERCHANT_ID['SharedProsperity']['code'];
12563
+        // 商户信息
12564
+        $merchants = [];
12565
+        // 已支付、未结算  注意,会员专区之前可能没有去及时 更新结算状态 'is_settlement' => 1,
12566
+        $where = ['paid' => 1, 'is_del' => 0, 'is_system_del' => 0, 'is_independentaccount' => 0, 'order_sn' => $orderSn];
12567
+        // 订单状态(0:待发货;1:待收货;2:待评价;3:已完成;4已申请退款;-1:已退款)5未支付 6已取消'
12568
+        // $status = [2, 3]; ->whereIn('status', $status)
12569
+        // 普通订单
12570
+        $cursor = Db::table('rrx_store_order')->where($where)->where('pay_type', '=', $payType)
12571
+            ->where('fzone_pay_price', '>', 0.00)
12572
+            ->whereIn('mer_id', CommonEnum::DESIGN_MERCHANT_ID['SharedProsperity']['code'])->cursor();
12573
+        /** @var StoreOrderRepository $storeOrderRepository */
12574
+        $storeOrderRepository = app()->make(StoreOrderRepository::class);
12575
+        foreach ($cursor as $key => $value) {
12576
+            if (!isset($merchants[$value['mer_id']])) {
12577
+                $merchants[$value['mer_id']] = Db::name('merchant')->where('mer_id', $value['mer_id'])->find();
12578
+            }
12579
+            $group_order = Db::name('store_group_order')->alias('sgo')->where('sgo.group_order_id', $value['group_order_id'])->find();
12580
+
12581
+            $independentAccount = $storeOrderRepository->getIndependentAccount($value, $group_order, $dst_mer_id, $merchants[$value['mer_id']]['hf_member_id']);
12582
+
12583
+            $isSuccessed = $storeOrderRepository->prepareExecuteIndependentAccount(
12584
+                $value, $group_order, $independentAccount['api_key'], $independentAccount['hf_platform_member_id'], '', $value['fzone_pay_price'], 0
12585
+            );
12586
+            if ($isSuccessed) {
12587
+                Db::name("log")->insert(array('data' => '共富区-订单分账:' . json_encode($value, JSON_FORCE_OBJECT)));// 日志记录
12588
+
12589
+                $order = StoreOrder::getInstance()->where('order_id', $value['order_id'])->find();
12590
+                $order->is_independentaccount = 1;
12591
+                $order->save();
12592
+            }
12593
+        }
12594
+    }
12595
+
12533 12596
     public function useKillOrderRewards($groupOrderId, $orderId, $uid,$adminId)
12534 12597
     {
12535 12598
         if (empty($orderId) || empty($groupOrderId) || empty($uid)) {

+ 2 - 2
app/common/repositories/store/product/ProductRepository.php

@@ -177,7 +177,7 @@ class ProductRepository extends BaseRepository
177 177
             }
178 178
 
179 179
             if (is_array($data['icon_type'])) {
180
-                $data['icon_type'] = json_encode($data['icon_type'], JSON_UNESCAPED_UNICODE);
180
+                $data['icon_type'] = $data['icon_type'] ? json_encode($data['icon_type'], JSON_UNESCAPED_UNICODE) : null;
181 181
             }
182 182
 
183 183
             $pension = bcsub($data['attrValue'][0]['price'], bcmul($data['attrValue'][0]['price'], $data['commission'], 2), 2);
@@ -271,7 +271,7 @@ class ProductRepository extends BaseRepository
271 271
                 }
272 272
             }
273 273
             if (is_array($data['icon_type'])) {
274
-                $data['icon_type'] = json_encode($data['icon_type'], JSON_UNESCAPED_UNICODE);
274
+                $data['icon_type'] = $data['icon_type'] ? json_encode($data['icon_type'], JSON_UNESCAPED_UNICODE) : null;
275 275
             }
276 276
             $param['attr'] = $data['attr'] ?? '';
277 277
             $param['attrValue'] = $data['attrValue'] ?? '';

+ 11 - 1
app/common/repositories/user/UserBillRepository.php

@@ -12,14 +12,19 @@ namespace app\common\repositories\user;
12 12
 
13 13
 
14 14
 use app\common\dao\BaseDao;
15
+use app\common\dao\shared\SharedProsperityBalanceLogDao;
15 16
 use app\common\dao\user\UserBillDao;
16 17
 use app\common\enum\CommonEnum;
18
+use app\common\enum\shared\SharedProsperityBalanceLogEnum;
17 19
 use app\common\enum\user\UserBillEnum;
18 20
 use app\common\enum\user\UserCertificationEnum;
19 21
 use app\common\model\user\UserBill;
20 22
 use app\common\repositories\BaseRepository;
21 23
 use app\common\repositories\gzc\GzcLogRepository;
24
+use app\common\repositories\shared\SharedProsperityUserRepository;
22 25
 use app\common\repositories\store\order\StoreOrderRepository;
26
+use app\entity\data\shared\SharedProsperityBalanceLogEntity;
27
+use app\entity\data\shared\SharedProsperityUserEntity;
23 28
 use app\entity\data\user\UserBillEntity;
24 29
 use app\entity\data\user\UserCertificationEntity;
25 30
 use app\entity\data\user\UserEntity;
@@ -584,7 +589,12 @@ class UserBillRepository extends BaseRepository
584 589
                     ->setStatus(UserBillEnum::STATUS['VALID']['code'])
585 590
                     ->setTakeTime(time());
586 591
 
587
-                if ($userBillEntity->getCommissionType() == UserBillEnum::COMMISSION_TYPE['DIRECT_REFERRAL']['code']) {
592
+                if (in_array($userBillEntity->getCommissionType(), [
593
+                    UserBillEnum::COMMISSION_TYPE['DIRECT_REFERRAL']['code'],
594
+                    UserBillEnum::COMMISSION_TYPE['LOCKED_CUSTOMER']['code'],
595
+                    UserBillEnum::COMMISSION_TYPE['PLATFORM_REWARD']['code'],
596
+                    UserBillEnum::COMMISSION_TYPE['SHARE_EARNINGS']['code']
597
+                ])) {
588 598
                     // 直推奖
589 599
                     if (is_null($updateUserEntity->getBrokeragePrice())) {
590 600
                         $updateUserEntity->setBrokeragePrice($userEntity->getBrokeragePrice());

+ 18 - 2
app/controller/api/Auth.php

@@ -897,7 +897,7 @@ class Auth extends BaseController
897 897
         $SharedProsperityUserPv = 0;
898 898
         $SharedProsperityTeamPv = 0;
899 899
         $SharedProsperityGroupId = 0;
900
-        $SharedProsperityUser = Db::name('shared_prosperity_user')->where('user_id', $user['uid'])->value('id,partner_level,pv');
900
+        $SharedProsperityUser = Db::name('shared_prosperity_user')->where('user_id', $user['uid'])->field('id,partner_level,pv')->find();
901 901
         if ($SharedProsperityUser) {
902 902
             $isSharedProsperity = true;
903 903
             $SharedProsperityLevel = $SharedProsperityUser['partner_level'];
@@ -911,7 +911,6 @@ class Auth extends BaseController
911 911
             // 团员身份
912 912
             $groupId = Db::name('shared_prosperity_group_user')->where('user_id', $user['uid'])->value('group_id');
913 913
             if ($groupId) $SharedProsperityGroupId = $groupId;
914
-
915 914
         }
916 915
         $data['isSharedProsperity'] = $isSharedProsperity;
917 916
         $data['SharedProsperityLevel'] = $SharedProsperityLevel;
@@ -919,6 +918,23 @@ class Auth extends BaseController
919 918
         $data['SharedProsperityTeamPv'] = $SharedProsperityTeamPv;
920 919
         $data['SharedProsperityGroupId'] = $SharedProsperityGroupId;
921 920
 
921
+        // 查询会员体系团队pv
922
+        $memberTeamPvLog = false;
923
+        $sql = "select getUserLevelId({$user['uid']}) as uids";
924
+        try {
925
+            $spread_user_list = Db::query($sql);
926
+        } catch (\Exception $exception) {
927
+            return app('json')->fail($exception->getMessage());
928
+        }
929
+
930
+        $spread_user_list = explode(",", trim($spread_user_list[0]['uids'], '$,'));
931
+        $pvLog = Db::name('user_pv_log')
932
+            ->whereIn('uid',$spread_user_list)
933
+            ->limit(1)
934
+            ->select()
935
+            ->toArray();
936
+        if ($pvLog) $memberTeamPvLog = true;
937
+        $data['memberTeamPvLog'] = $memberTeamPvLog;
922 938
 
923 939
         return app('json')->success($data );
924 940
     }

+ 20 - 1
app/controller/api/Notify.php

@@ -202,7 +202,26 @@ class Notify
202 202
                             }
203 203
 
204 204
                             // 3、支付成功 处理逻辑
205
-                            $storeGroupOrderRepository->storeGroupOrderPaySuccess($storeGroupOrderEntity->getGroupOrderId());
205
+                            try {
206
+                                Db::transaction(function () use (
207
+                                    $storeGroupOrderRepository,
208
+                                    $storeGroupOrderEntity
209
+                                ) {
210
+                                    $storeGroupOrderRepository->storeGroupOrderPaySuccess($storeGroupOrderEntity->getGroupOrderId());
211
+                                });
212
+                            } catch (\Throwable $e) {
213
+                                Db::name("log")
214
+                                    ->insert([
215
+                                        'data' => '【订单支付回调】【结算订单失败】:时间:' . date('Y-m-d H:i:s', time()) . ';订单编号:' . $groupOrderSn_Rand . ';订单失败原因:' . json_encode([
216
+                                                'error_message' => $e->getMessage(),
217
+                                                'error_file' => $e->getFile(),
218
+                                                'error_line' => $e->getLine(),
219
+                                                'error_code' => $e->getCode(),
220
+                                                'exception_class' => get_class($e),
221
+                                                'trace' => $e->getTraceAsString()
222
+                                            ], JSON_UNESCAPED_UNICODE)
223
+                                    ]);
224
+                            }
206 225
                             /*
207 226
                             $group_order = Db::name('store_group_order')->where('group_order_sn', $requestId[0])->find();
208 227
                             $uid = $group_order['uid'];

+ 12 - 0
app/controller/api/user/User.php

@@ -13,6 +13,7 @@ namespace app\controller\api\user;
13 13
 use app\common\repositories\article\AgreementRepository;
14 14
 use app\common\repositories\merchant\order\OrderGzcRepository;
15 15
 use app\common\repositories\merchant\order\OrderMerchantRepository;
16
+use app\common\repositories\shared\SharedProsperityUserRepository;
16 17
 use app\common\repositories\store\product\ProductRepository;
17 18
 use app\common\repositories\user\UnionUsersRepository;
18 19
 use app\controller\api\merchant\sxy\Access;
@@ -182,6 +183,11 @@ class User extends BaseController
182 183
     {
183 184
         $user = $this->request->userInfo();
184 185
         $user->append(['one_level_count', 'lock_brokerage', 'two_level_count', 'spread_total', 'yesterday_brokerage', 'total_extract', 'total_brokerage']);
186
+
187
+        /** @var SharedProsperityUserRepository $sharedProsperityUserRepository */
188
+        $sharedProsperityUserRepository = app()->make(SharedProsperityUserRepository::class);
189
+        $sharedProsperityUserEntity = $sharedProsperityUserRepository->getSharedProsperityUserEntityByUserId($user->uid);
190
+
185 191
         $data = [
186 192
             'lock_brokerage'         => $user->lock_brokerage,
187 193
             'one_level_count'        => $user->one_level_count,
@@ -191,6 +197,7 @@ class User extends BaseController
191 197
             'total_extract'          => $user->total_extract,
192 198
             'total_brokerage'        => $user->total_brokerage,
193 199
             'brokerage_price'        => $user->brokerage_price,
200
+            'shared_prosperity_balance'        => $sharedProsperityUserEntity->getBalance()?:0.00,
194 201
             'member_brokerage_price' => $user->member_brokerage_price,
195 202
             'now_money'              => $user->now_money,
196 203
             'broken_day'             => (int)systemConfig('lock_brokerage_timer')
@@ -3819,6 +3826,11 @@ class User extends BaseController
3819 3826
         $uid = $this->request->uid();
3820 3827
         // 佣金余额
3821 3828
         $data['brokerage_price'] = Db::name('user')->where('uid', $uid)->value('brokerage_price');
3829
+
3830
+        /** @var SharedProsperityUserRepository $sharedProsperityUserRepository */
3831
+        $sharedProsperityUserRepository = app()->make(SharedProsperityUserRepository::class);
3832
+        $sharedProsperityUserEntity = $sharedProsperityUserRepository->getSharedProsperityUserEntityByUserId($uid);
3833
+        $data['shared_prosperity_balance'] = $sharedProsperityUserEntity->getBalance();
3822 3834
         // 总收益
3823 3835
         $data['sum_amount'] = Db::name('user_bill')
3824 3836
             ->where('uid', $uid)

+ 25 - 0
app/entity/data/store/StoreOrderEntity.php

@@ -99,6 +99,7 @@ class StoreOrderEntity extends DataEntity
99 99
     public $fzonePayOther = null;  // 组合支付other
100 100
     public $fzonePayNote = null;  // 组合支付备注
101 101
     public $fzonePayType = null;
102
+    public $pensionJson = null; // 养老金设置(将当前商品的养老金分配设置保存一份)
102 103
 
103 104
     /**
104 105
      * @return mixed
@@ -1746,6 +1747,30 @@ class StoreOrderEntity extends DataEntity
1746 1747
         return $this;
1747 1748
     }
1748 1749
 
1750
+    /**
1751
+     * @return mixed
1752
+     */
1753
+    public function getPensionJson()
1754
+    {
1755
+        if (is_json($this->pensionJson)) {
1756
+            return json_decode($this->pensionJson, true);
1757
+        }
1758
+        return $this->pensionJson;
1759
+    }
1760
+
1761
+    /**
1762
+     * @param mixed $pensionJson
1763
+     * @return StoreOrderEntity
1764
+     */
1765
+    public function setPensionJson($pensionJson): StoreOrderEntity
1766
+    {
1767
+        if (is_array($pensionJson)) {
1768
+            $pensionJson = json_encode($pensionJson, JSON_UNESCAPED_UNICODE);
1769
+        }
1770
+        $this->pensionJson = $pensionJson;
1771
+        return $this;
1772
+    }
1773
+
1749 1774
     public function deconstructionFzonePaytype()
1750 1775
     {
1751 1776
         if (!empty($this->getFzonePayType()) && is_array(json_decode($this->getFzonePayType(), true))) {

+ 2 - 2
app/entity/monomer/store/FzonePayTypeEntity.php

@@ -2,9 +2,9 @@
2 2
 
3 3
 namespace app\entity\monomer\store;
4 4
 
5
-use app\entity\data\DataEntity;
5
+use app\entity\monomer\MonomerEntity;
6 6
 
7
-class FzonePayTypeEntity extends DataEntity
7
+class FzonePayTypeEntity extends MonomerEntity
8 8
 {
9 9
     public $type = '';
10 10
     public $price = 0.00;

+ 66 - 0
app/entity/monomer/store/StoreOrderPensionJsonEntity.php

@@ -0,0 +1,66 @@
1
+<?php
2
+
3
+namespace app\entity\monomer\store;
4
+
5
+use app\entity\monomer\MonomerEntity;
6
+
7
+class StoreOrderPensionJsonEntity extends MonomerEntity
8
+{
9
+    public $pensionIs = 0; // 是否 单独设置百分比
10
+    public $pension = 0.00; // 商品外部展示的要老金数据
11
+    public $attrValuePensionNum = 0.00; // 针对每个规格设置的 该规格养老金分配比例
12
+
13
+    /**
14
+     * @return int
15
+     */
16
+    public function getPensionIs(): int
17
+    {
18
+        return $this->pensionIs;
19
+    }
20
+
21
+    /**
22
+     * @param mixed $pensionIs
23
+     * @return StoreOrderPensionJsonEntity
24
+     */
25
+    public function setPensionIs($pensionIs): StoreOrderPensionJsonEntity
26
+    {
27
+        $this->pensionIs = (int)$pensionIs;
28
+        return $this;
29
+    }
30
+
31
+    /**
32
+     * @return float
33
+     */
34
+    public function getPension(): float
35
+    {
36
+        return $this->pension;
37
+    }
38
+
39
+    /**
40
+     * @param mixed $pension
41
+     * @return StoreOrderPensionJsonEntity
42
+     */
43
+    public function setPension($pension): StoreOrderPensionJsonEntity
44
+    {
45
+        $this->pension = (float)$pension;
46
+        return $this;
47
+    }
48
+
49
+    /**
50
+     * @return float
51
+     */
52
+    public function getAttrValuePensionNum(): float
53
+    {
54
+        return $this->attrValuePensionNum;
55
+    }
56
+
57
+    /**
58
+     * @param mixed $attrValuePensionNum
59
+     * @return StoreOrderPensionJsonEntity
60
+     */
61
+    public function setAttrValuePensionNum($attrValuePensionNum): StoreOrderPensionJsonEntity
62
+    {
63
+        $this->attrValuePensionNum = (float)$attrValuePensionNum;
64
+        return $this;
65
+    }
66
+}