Просмотр исходного кода

优化用户下单方法-进行中

sunxbiao 1 год назад
Родитель
Сommit
c28f2a49e7
31 измененных файлов с 2269 добавлено и 75 удалено
  1. 14 0
      app/common/dao/gzc/GzcLogDao.php
  2. 20 0
      app/common/dao/user/UserBillDao.php
  3. 14 0
      app/common/dao/user/UserPvLogDao.php
  4. 14 0
      app/common/dao/user/UserSignGongxianDao.php
  5. 14 0
      app/common/dao/user/UserSignHongbaoDao.php
  6. 50 4
      app/common/enum/CommonEnum.php
  7. 27 0
      app/common/enum/gzc/GzcLogEnum.php
  8. 2 0
      app/common/enum/user/UserEnum.php
  9. 17 0
      app/common/enum/user/UserPvLogEnum.php
  10. 2 0
      app/common/enum/user/UserSignFugouEnum.php
  11. 24 0
      app/common/enum/user/UserSignGongxianEnum.php
  12. 24 0
      app/common/enum/user/UserSignHongbaoEnum.php
  13. 2 0
      app/common/enum/user/UserSignScoreEnum.php
  14. 27 0
      app/common/model/gzc/GzcLog.php
  15. 19 0
      app/common/model/user/UserPvLog.php
  16. 19 0
      app/common/model/user/UserSignGongxian.php
  17. 19 0
      app/common/model/user/UserSignHongbao.php
  18. 85 0
      app/common/repositories/gzc/GzcLogRepository.php
  19. 165 59
      app/common/repositories/store/order/StoreOrderRepository.php
  20. 96 4
      app/common/repositories/user/UserBillRepository.php
  21. 73 0
      app/common/repositories/user/UserPvLogRepository.php
  22. 51 1
      app/common/repositories/user/UserRepository.php
  23. 56 0
      app/common/repositories/user/UserSignFugouRepository.php
  24. 79 0
      app/common/repositories/user/UserSignGongxianRepository.php
  25. 76 0
      app/common/repositories/user/UserSignHongbaoRepository.php
  26. 59 0
      app/common/repositories/user/UserSignScoreRepository.php
  27. 522 0
      app/entity/data/gzc/GzcLogEntity.php
  28. 7 7
      app/entity/data/store/StoreOrderEntity.php
  29. 180 0
      app/entity/data/user/UserPvLogEntity.php
  30. 275 0
      app/entity/data/user/UserSignGongxianEntity.php
  31. 237 0
      app/entity/data/user/UserSignHongbaoEntity.php

+ 14 - 0
app/common/dao/gzc/GzcLogDao.php

@@ -0,0 +1,14 @@
1
+<?php
2
+
3
+namespace app\common\dao\gzc;
4
+
5
+use app\common\dao\BaseDao;
6
+use app\common\model\gzc\GzcLog;
7
+
8
+class GzcLogDao extends BaseDao
9
+{
10
+    protected function getModel(): string
11
+    {
12
+        return GzcLog::class;
13
+    }
14
+}

+ 20 - 0
app/common/dao/user/UserBillDao.php

@@ -14,6 +14,8 @@ namespace app\common\dao\user;
14 14
 use app\common\dao\BaseDao;
15 15
 use app\common\model\BaseModel;
16 16
 use app\common\model\user\UserBill;
17
+use app\entity\CommonEntity;
18
+use app\entity\data\user\UserBillEntity;
17 19
 
18 20
 /**
19 21
  * Class UserBillDao
@@ -186,4 +188,22 @@ class UserBillDao extends BaseDao
186 188
         return UserBill::getDB()->group('type')->column('title,type');
187 189
     }
188 190
 
191
+    /**
192
+     * @param $uid
193
+     * @return CommonEntity
194
+     */
195
+    public function getUserBillEntityByBillId($uid): CommonEntity
196
+    {
197
+        $data = [];
198
+        try {
199
+            $dataRes = UserBill::getDB()
200
+                ->where('id', $uid)
201
+                ->find();
202
+            if (!empty($dataRes)) {
203
+                $data = $dataRes->toArray();
204
+            }
205
+        } catch (\Exception $e) {
206
+        }
207
+        return UserBillEntity::newInstance($data);
208
+    }
189 209
 }

+ 14 - 0
app/common/dao/user/UserPvLogDao.php

@@ -0,0 +1,14 @@
1
+<?php
2
+
3
+namespace app\common\dao\user;
4
+
5
+use app\common\dao\BaseDao;
6
+use app\common\model\user\UserPvLog;
7
+
8
+class UserPvLogDao extends BaseDao
9
+{
10
+    protected function getModel(): string
11
+    {
12
+        return UserPvLog::class;
13
+    }
14
+}

+ 14 - 0
app/common/dao/user/UserSignGongxianDao.php

@@ -0,0 +1,14 @@
1
+<?php
2
+
3
+namespace app\common\dao\user;
4
+
5
+use app\common\dao\BaseDao;
6
+use app\common\model\user\UserSignGongxian;
7
+
8
+class UserSignGongxianDao extends BaseDao
9
+{
10
+    protected function getModel(): string
11
+    {
12
+        return UserSignGongxian::class;
13
+    }
14
+}

+ 14 - 0
app/common/dao/user/UserSignHongbaoDao.php

@@ -0,0 +1,14 @@
1
+<?php
2
+
3
+namespace app\common\dao\user;
4
+
5
+use app\common\dao\BaseDao;
6
+use app\common\model\user\UserSignHongbao;
7
+
8
+class UserSignHongbaoDao extends BaseDao
9
+{
10
+    protected function getModel(): string
11
+    {
12
+        return UserSignHongbao::class;
13
+    }
14
+}

+ 50 - 4
app/common/enum/CommonEnum.php

@@ -36,12 +36,58 @@ class CommonEnum
36 36
         'XingfuXiaodian' => ['code' => 2001, 'name' => '幸福小店'],
37 37
     ];
38 38
 
39
-    CONST YANGLAOJIN = [
40
-        'Ratio' => ['code' => 0.3, 'name' => '30%']
39
+    // 直推奖励的分配比例
40
+    const DIRECT_REFERRAL_BONUS = [
41
+        'BrokeragePrice' => ['code' => 0.9, 'name' => '直推奖励的佣金部分'],
42
+        'Fugou' => ['code' => 0.1, 'name' => '直推奖励的佣金部分']
41 43
     ];
42 44
 
43
-    CONST PV = [
44
-        'Ratio' => ['code' => 0.35, 'name' => '35%']
45
+    // 计算式小数点保留位数 超出位数 舍弃
46
+    const CALCULATE_THE_NUMBER_OF_DECIMAL_PLACES = 5;
47
+    // 金额保留小数点位 超出部分舍弃
48
+    const DECIMAL_PLACES_OF_THE_AMOUNT = 2;
49
+
50
+    // 订单 收益 的分配
51
+    const ORDER_EARNING_ALLOCATION = [
52
+        // 精彩生活区
53
+        'WonderfulLiving' => [
54
+            'Self' => [
55
+                // 养老金比例
56
+                'YangLaoJin' => [
57
+                    'Ratio' => ['code' => 0.3, 'name' => '将利润的30%,当做养老金分配给下单人']
58
+                ],
59
+                'Pv' => [
60
+                    'Ratio' => ['code' => 0.35, 'name' => '将利润的35%,当做PV值分配给下单人']
61
+                ],
62
+                'Gongxian' => [
63
+                    'Ratio' => ['code' => 0.35, 'name' => '将利润的35%,当做贡献值分配给下单人']
64
+                ],
65
+                'Score' => [
66
+                    'Ratio' => ['code' => 0.35, 'name' => '将利润的35%,当做积分值分配给下单人']
67
+                ],
68
+                'Hongbao' => [
69
+                    'Ratio' => ['code' => 0.35, 'name' => '将利润的35%,当做红包分配给下单人,前提下单人是老用户']
70
+                ]
71
+            ],
72
+            'Spread' => [
73
+                'Basics' => [
74
+                    'Ratio' => ['code' => 0.35, 'name' => '将利润的35%,当做推荐人利润分配的基础,目前绑定的是下单人的PV值']
75
+                ],
76
+                'BrokeragePrice' =>[
77
+                    'Ratio' => ['code' => 0.9, 'name' => '直推奖励的佣金部分'],
78
+                ],
79
+                'Fugou' =>[
80
+                    'Ratio' => ['code' => 0.1, 'name' => '直推奖励的佣金部分'],
81
+                ],
82
+                'Gongxian' => [
83
+                    'Ratio' => ['code' => 0.35, 'name' => '将利润的35%,当做贡献值分配给推荐人']
84
+                ],
85
+                'Score' => [
86
+                    'Ratio' => ['code' => 0.35, 'name' => '将利润的35%,当做积分值分配给推荐人']
87
+                ]
88
+            ]
89
+        ]
90
+
45 91
     ];
46 92
 
47 93
 }

+ 27 - 0
app/common/enum/gzc/GzcLogEnum.php

@@ -0,0 +1,27 @@
1
+<?php
2
+
3
+namespace app\common\enum\gzc;
4
+
5
+use app\common\enum\CommonEnum;
6
+
7
+class GzcLogEnum extends CommonEnum
8
+{
9
+    // 账号类型
10
+    const ACCOUNT_TYPE = [
11
+        'Bank' => ['code' => 1, 'name' => '银行卡'],
12
+        'Alipay' => ['code' => 2, 'name' => '支付宝'],
13
+        'Wxpay' => ['code' => 3, 'name' => '微信'],
14
+    ];
15
+
16
+    // 公证处是否已发起入账
17
+    const GZC_STATUS = [
18
+        'NotInitiated' => ['code' => 0, 'name' => '未发起'],
19
+        'Initiated' => ['code' => 1, 'name' => '已发起'],
20
+    ];
21
+
22
+    // 是否入账成功
23
+    const SUCCESS_STATUS = [
24
+        'Failed' => ['code' => 0, 'name' => '入账失败'],
25
+        'Success' => ['code' => 1, 'name' => '入账成功'],
26
+    ];
27
+}

+ 2 - 0
app/common/enum/user/UserEnum.php

@@ -6,6 +6,8 @@ use app\common\enum\CommonEnum;
6 6
 
7 7
 class UserEnum extends CommonEnum
8 8
 {
9
+    const IS_DEL = parent::IS_DEL;
10
+
9 11
     const STATUS = [
10 12
         'Disabled' => ['code' => 0, 'name' => '禁用'],
11 13
         'Normal' => ['code' => 1, 'name' => '正常']

+ 17 - 0
app/common/enum/user/UserPvLogEnum.php

@@ -0,0 +1,17 @@
1
+<?php
2
+
3
+namespace app\common\enum\user;
4
+
5
+use app\common\enum\CommonEnum;
6
+
7
+class UserPvLogEnum extends CommonEnum
8
+{
9
+    // 1-有效,0-失效,-1-待确认
10
+    const STATUS = [
11
+        'Valid' => ['code' => 1, 'name' => '有效'],
12
+        'Invalid' => ['code' => 0, 'name' => '失效'],
13
+        'PendingConfirmation' => ['code' => -1, 'name' => '待确认'],
14
+    ];
15
+
16
+    const ORDER_TYPE = parent::ORDER_TYPE;
17
+}

+ 2 - 0
app/common/enum/user/UserSignFugouEnum.php

@@ -35,4 +35,6 @@ class UserSignFugouEnum extends CommonEnum
35 35
         'Give' => ['code' => 1, 'name' => '赠送'],
36 36
         'Consume' => ['code' => 2, 'name' => '消耗'],
37 37
     ];
38
+
39
+    const ORDER_TYPE = parent::ORDER_TYPE;
38 40
 }

+ 24 - 0
app/common/enum/user/UserSignGongxianEnum.php

@@ -0,0 +1,24 @@
1
+<?php
2
+
3
+namespace app\common\enum\user;
4
+
5
+use app\common\enum\CommonEnum;
6
+
7
+class UserSignGongxianEnum extends CommonEnum
8
+{
9
+    // 贡献值状态
10
+    const STATUS = [
11
+        'Valid' => ['code' => 1, 'name' => '有效'],
12
+        'Invalid' => ['code' => 0, 'name' => '失效'],
13
+        'PendingConfirmation' => ['code' => -1, 'name' => '待确认'],
14
+    ];
15
+
16
+    // 贡献值类型
17
+    const TYPE = [
18
+        'Give' => ['code' => 1, 'name' => '赠送'],
19
+        'Consume' => ['code' => 2, 'name' => '消耗'],
20
+    ];
21
+
22
+    // 订单类型(可以根据实际需求扩展订单类型)
23
+    const ORDER_TYPE = parent::ORDER_TYPE;
24
+}

+ 24 - 0
app/common/enum/user/UserSignHongbaoEnum.php

@@ -0,0 +1,24 @@
1
+<?php
2
+
3
+namespace app\common\enum\user;
4
+
5
+use app\common\enum\CommonEnum;
6
+
7
+class UserSignHongbaoEnum extends CommonEnum
8
+{
9
+    // 1-有效,0-失效,-1-待确认
10
+    const STATUS = [
11
+        'Valid' => ['code' => 1, 'name' => '有效'],
12
+        'Invalid' => ['code' => 0, 'name' => '失效'],
13
+        'PendingConfirmation' => ['code' => -1, 'name' => '待确认'],
14
+    ];
15
+
16
+    // 1-消费赠送,2-消耗
17
+    const TYPE = [
18
+        'ConsumptionGift' => ['code' => 1, 'name' => '消费赠送'],
19
+        'Consumption' => ['code' => 2, 'name' => '消耗'],
20
+    ];
21
+
22
+    // 订单类型(可以根据实际需求扩展订单类型)
23
+    const ORDER_TYPE = parent::ORDER_TYPE;
24
+}

+ 2 - 0
app/common/enum/user/UserSignScoreEnum.php

@@ -27,4 +27,6 @@ class UserSignScoreEnum extends CommonEnum
27 27
         'FriendOrder' => ['code' => 4, 'name' => '好友下单赠送'],
28 28
         'BuyProduct' => ['code' => 5, 'name' => '购买产品消耗'],
29 29
     ];
30
+
31
+    const ORDER_TYPE = parent::ORDER_TYPE;
30 32
 }

+ 27 - 0
app/common/model/gzc/GzcLog.php

@@ -0,0 +1,27 @@
1
+<?php
2
+/**
3
+ * @package merchant
4
+ *
5
+ * @author xaboy
6
+ * @day 2020/5/30
7
+ *
8
+ *
9
+ */
10
+
11
+namespace app\common\model\gzc;
12
+
13
+use app\common\model\BaseModel;
14
+
15
+class GzcLog extends BaseModel
16
+{
17
+
18
+    public static function tablePk(): string
19
+    {
20
+        return 'id';
21
+    }
22
+
23
+    public static function tableName(): string
24
+    {
25
+        return 'gzc_logs';
26
+    }
27
+}

+ 19 - 0
app/common/model/user/UserPvLog.php

@@ -0,0 +1,19 @@
1
+<?php
2
+
3
+namespace app\common\model\user;
4
+
5
+use app\common\model\BaseModel;
6
+
7
+class UserPvLog extends BaseModel
8
+{
9
+
10
+    public static function tablePk(): string
11
+    {
12
+        return 'id';
13
+    }
14
+
15
+    public static function tableName(): string
16
+    {
17
+        return 'user_pv_log';
18
+    }
19
+}

+ 19 - 0
app/common/model/user/UserSignGongxian.php

@@ -0,0 +1,19 @@
1
+<?php
2
+
3
+namespace app\common\model\user;
4
+
5
+use app\common\model\BaseModel;
6
+
7
+class UserSignGongxian extends BaseModel
8
+{
9
+
10
+    public static function tablePk(): string
11
+    {
12
+        return 'id';
13
+    }
14
+
15
+    public static function tableName(): string
16
+    {
17
+        return 'user_sign_gongxian';
18
+    }
19
+}

+ 19 - 0
app/common/model/user/UserSignHongbao.php

@@ -0,0 +1,19 @@
1
+<?php
2
+
3
+namespace app\common\model\user;
4
+
5
+use app\common\model\BaseModel;
6
+
7
+class UserSignHongbao extends BaseModel
8
+{
9
+
10
+    public static function tablePk(): string
11
+    {
12
+        return 'id';
13
+    }
14
+
15
+    public static function tableName(): string
16
+    {
17
+        return 'user_sign_hongbao';
18
+    }
19
+}

+ 85 - 0
app/common/repositories/gzc/GzcLogRepository.php

@@ -0,0 +1,85 @@
1
+<?php
2
+
3
+namespace app\common\repositories\gzc;
4
+
5
+use app\common\dao\gzc\GzcLogDao;
6
+use app\common\enum\CommonEnum;
7
+use app\common\repositories\BaseRepository;
8
+use app\common\repositories\store\order\StoreOrderRepository;
9
+use app\entity\data\gzc\GzcLogEntity;
10
+use think\exception\ValidateException;
11
+
12
+class GzcLogRepository extends BaseRepository
13
+{
14
+    public function __construct(GzcLogDao $dao)
15
+    {
16
+        $this->dao = $dao;
17
+    }
18
+
19
+    public function create($data)
20
+    {
21
+        return $this->dao->create($data);
22
+    }
23
+
24
+    /**
25
+     * @param GzcLogEntity $gzcLogEntity
26
+     * @return GzcLogEntity
27
+     */
28
+    public function createByEntity(GzcLogEntity $gzcLogEntity): GzcLogEntity
29
+    {
30
+        $result = $this->create($gzcLogEntity->toUnderlineArray())->toArray();
31
+        /** @var GzcLogEntity $entity */
32
+        $entity = GzcLogEntity::newInstance($result);
33
+        return $entity;
34
+    }
35
+
36
+    /**
37
+     * 添加 公证处记录
38
+     * @param int $uid
39
+     * @param string $userName
40
+     * @param string $mobile
41
+     * @param string $userCard
42
+     * @param int $orderType
43
+     * @param string $orderId
44
+     * @param float $pension
45
+     * @param int $payType
46
+     * @return GzcLogEntity
47
+     */
48
+    public function addGzcLog(int $uid, string $userName, string $mobile, string $userCard, int $orderType, string $orderId, float $pension, int $payType): GzcLogEntity
49
+    {
50
+        $orderSn = '';
51
+        $payTime = '';
52
+        if ($orderType == CommonEnum::ORDER_TYPE['Platform']['code']) {
53
+            /** @var StoreOrderRepository $storeOrderRepository */
54
+            $storeOrderRepository = app()->make(StoreOrderRepository::class);
55
+            $storeOrderEntity = $storeOrderRepository->getStoreOrderEntityByOrderId((int)$orderId);
56
+            if (empty($storeOrderEntity->getOrderId())) {
57
+                throw new ValidateException('未查询到订单信息');
58
+            }
59
+            $orderSn = $storeOrderEntity->getOrderSn();
60
+            $payTime = $storeOrderEntity->getPayTime();
61
+            $payType = 3;// 默认是微信
62
+            if ($storeOrderEntity->getFzonePayNote() != "现金") {
63
+                $payType = 4;
64
+            }
65
+        }
66
+
67
+        $createTime = date('Y-m-d H:i:s');
68
+        /** @var GzcLogEntity $gzcLogEntity */
69
+        $gzcLogEntity = GzcLogEntity::newInstance();
70
+        $gzcLogEntity->setUid($uid)
71
+            ->setUserName($userName)
72
+            ->setMobile($mobile)
73
+            ->setUserCard($userCard)
74
+            ->setPension($pension)
75
+            ->setOutTradeNo($orderSn)
76
+            ->setAccountType($payType)
77
+            ->setOrderType($orderType)
78
+            ->setPayTime($payTime)
79
+            ->setCreateTime($createTime)
80
+            ->setUpdateTime($createTime);
81
+
82
+        return $this->createByEntity($gzcLogEntity);
83
+    }
84
+
85
+}

+ 165 - 59
app/common/repositories/store/order/StoreOrderRepository.php

@@ -20,6 +20,11 @@ use app\common\enum\store\ProductEnum;
20 20
 use app\common\enum\store\StoreGroupOrderEnum;
21 21
 use app\common\enum\store\StoreOrderEnum;
22 22
 use app\common\enum\user\UserBillEnum;
23
+use app\common\enum\user\UserEnum;
24
+use app\common\enum\user\UserPvLogEnum;
25
+use app\common\enum\user\UserSignFugouEnum;
26
+use app\common\enum\user\UserSignGongxianEnum;
27
+use app\common\enum\user\UserSignHongbaoEnum;
23 28
 use app\common\enum\user\UserSignJingdouEnum;
24 29
 use app\common\enum\user\UserSignScoreEnum;
25 30
 use app\common\enum\user\UserSignVrEnum;
@@ -51,7 +56,12 @@ use app\common\repositories\system\merchant\MerchantRepository;
51 56
 use app\common\repositories\merchant\MerchantRepository as m;
52 57
 use app\common\repositories\user\UserAddressRepository;
53 58
 use app\common\repositories\user\UserBillRepository;
59
+use app\common\repositories\user\UserPvLogRepository;
54 60
 use app\common\repositories\user\UserRepository;
61
+use app\common\repositories\user\UserSignFugouRepository;
62
+use app\common\repositories\user\UserSignGongxianRepository;
63
+use app\common\repositories\user\UserSignHongbaoRepository;
64
+use app\common\repositories\user\UserSignScoreRepository;
55 65
 use app\common\repositories\user\UserThirdRepository;
56 66
 use app\common\repositories\wechat\RoutineQrcodeRepository;
57 67
 use app\common\repositories\wechat\WechatUserRepository;
@@ -11235,14 +11245,7 @@ class StoreOrderRepository extends BaseRepository
11235 11245
 
11236 11246
 
11237 11247
             foreach ($storeOrderEntityList as $storeOrderEntity) {
11238
-                // 精彩生活区
11239
-                if ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['WonderfulLiving']['code']) {
11240
-                    $ylj_pri = bcmul($storeOrderEntity->getConPri(), CommonEnum::YANGLAOJIN['Ratio']['code'], 2);
11241 11248
 
11242
-                    $pv = bcmul($storeOrderEntity->getConPri(), CommonEnum::PV['Ratio']['code'], 2);
11243
-
11244
-
11245
-                }
11246 11249
             }
11247 11250
         }
11248 11251
 
@@ -11260,60 +11263,163 @@ class StoreOrderRepository extends BaseRepository
11260 11263
         return $storeOrderEntity;
11261 11264
     }
11262 11265
 
11263
-    public function addGzcLog(int $uid, string $userName, string $mobile, string $userCard, float $pension, string $orderSn, int $payType, int $orderType)
11264
-    {
11265
-
11266
-    }
11267
-
11268
-    public function addUserBillLog(int $uid, int $typeShop, int $orderId, int $commissionType, float $number, string $mark, int $status = 0, int $gzc = 0)
11266
+    public function createCommissionByStoreOrderEntity(StoreOrderEntity $storeOrderEntity)
11269 11267
     {
11270 11268
         /** @var UserRepository $userRepository */
11271 11269
         $userRepository = app()->make(UserRepository::class);
11272
-        $userEntity = $userRepository->getUserEntityByUid($uid);
11273
-        if (empty($userEntity->getUid())) {
11274
-            throw new ValidateException('未查询到用户信息');
11275
-        }
11276
-
11277
-        $orderSn = '';
11278
-        $merId = 0;
11279
-
11280
-        if ($typeShop == UserBillEnum::TYPE_SHOP['Platform']['code']) {
11281
-            /** @var StoreOrderRepository $storeOrderRepository */
11282
-            $storeOrderRepository = app()->make(StoreOrderRepository::class);
11283
-            $storeOrderEntity = $storeOrderRepository->getStoreOrderEntityByOrderId($orderId);
11284
-            if (empty($storeOrderEntity->getOrderId())) {
11285
-                throw new ValidateException('未查询到订单信息');
11286
-            }
11287
-            $orderId = $storeOrderEntity->getOrderId();
11288
-            $orderSn = $storeOrderEntity->getOrderSn();
11289
-            $merId = $storeOrderEntity->getMerId();
11290
-        }
11291
-
11292
-
11293
-        $takeTime = 0;
11294
-        if ($status == UserBillEnum::STATUS['VALID']['code']) {
11295
-            $takeTime = time();
11296
-        }
11297
-
11298
-        /** @var UserBillEntity $userBillEntity */
11299
-        $userBillEntity = UserBillEntity::newInstance();
11300
-        $userBillEntity->setUid($userEntity->getUid())
11301
-            ->setLinkId($orderId)
11302
-            ->setPm(UserBillEnum::PM['INCOME']['code'])
11303
-            ->setTitle(ArrayUtil::getEnumNameByCode($commissionType, UserBillEnum::COMMISSION_TYPE))
11304
-            ->setCategory('now_money')
11305
-            ->setType('commission')
11306
-            ->setNumber($number)
11307
-            ->setMark($mark)
11308
-            ->setStatus($status)
11309
-            ->setCommissionType($commissionType)
11310
-            ->setOrderSn($orderSn)
11311
-            ->setTypeShop($typeShop)
11312
-            ->setMerId($merId)
11313
-            ->setSource(UserBillEnum::SOURCE['ONLINE']['code'])
11314
-            ->setOrderType(UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'])
11315
-            ->setIsRedBrokerage(UserBillEnum::IS_RED_BROKERAGE['NORMAL']['code'])
11316
-            ->setGzc($gzc)
11317
-            ->setTakeTime($takeTime);
11270
+        $userEntity = $userRepository->getUserEntityByUid($storeOrderEntity->getUid());
11271
+        if (empty($userEntity->getUid()) || $userEntity->getIsDel() == UserEnum::IS_DEL['Yes']['code']) {
11272
+            throw new ValidateException('未查询到订单所属用户');
11273
+        }
11274
+
11275
+        // 精彩生活区
11276
+        if ($storeOrderEntity->getMerId() == CommonEnum::DESIGN_MERCHANT_ID['WonderfulLiving']['Self']['code']) {
11277
+            // 为消费者 初始化 添加养老金记录
11278
+            $yanglaojin = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Self']['YangLaoJin']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11279
+            /** @var UserBillRepository $userBillRepository */
11280
+            $userBillRepository = app()->make(UserBillRepository::class);
11281
+            $userBillEntity = $userBillRepository->addUserBill(
11282
+                $storeOrderEntity->getUid(),
11283
+                UserBillEnum::TYPE_SHOP['Platform']['code'],
11284
+                $storeOrderEntity->getOrderId(),
11285
+                UserBillEnum::COMMISSION_TYPE['PENSION']['code'],
11286
+                $yanglaojin,
11287
+                '消费获得养老金'
11288
+            );
11289
+
11290
+            // 为用户初始胡 贡献值
11291
+            $gongxian = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Self']['Gongxian']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11292
+            /** @var UserSignGongxianRepository $userSignGongxianRepository */
11293
+            $userSignGongxianRepository = app()->make(UserSignGongxianRepository::class);
11294
+            $userSignGongxianEntity = $userSignGongxianRepository->addUserSingGongxian(
11295
+                $storeOrderEntity->getUid(),
11296
+                UserSignGongxianEnum::TYPE['Give']['code'],
11297
+                $gongxian,
11298
+                '购买精彩生活商品赠送贡献值',
11299
+                UserSignGongxianEnum::ORDER_TYPE['Platform']['code'],
11300
+                $storeOrderEntity->getOrderId()
11301
+            );
11302
+
11303
+            // 初始化 PV
11304
+            $pv = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Self']['Pv']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11305
+            /** @var UserPvLogRepository $userPvLogRepository */
11306
+            $userPvLogRepository = app()->make(UserPvLogRepository::class);
11307
+            $userPvLogEntity = $userPvLogRepository->addUserPvLog(
11308
+                $storeOrderEntity->getUid(),
11309
+                $pv,
11310
+                '购买精彩生活商品赠送PV值',
11311
+                UserPvLogEnum::ORDER_TYPE['Platform']['code'],
11312
+                $storeOrderEntity->getOrderId()
11313
+            );
11314
+
11315
+            // 初始化积分
11316
+            $score = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Self']['Score']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11317
+            /** @var UserSignScoreRepository $userSignScoreRepository */
11318
+            $userSignScoreRepository = app()->make(UserSignScoreRepository::class);
11319
+            $userSignScoreRepository->addUserSingScore(
11320
+                $storeOrderEntity->getUid(),
11321
+                UserSignScoreEnum::SOURCE_TYPE['SelfOrder']['code'],
11322
+                UserSignScoreEnum::PM['Income']['code'],
11323
+                $score,
11324
+                '购买精彩生活商品赠送积分',
11325
+                UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
11326
+                $storeOrderEntity->getOrderId()
11327
+            );
11328
+
11329
+            // 给老用户的奖励
11330
+            if ($userEntity->getIsOld()) {
11331
+                $hongbao =  bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Self']['Hongbao']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11332
+                /** @var UserSignHongbaoRepository $userSignHongbaoRepository */
11333
+                $userSignHongbaoRepository = app()->make(UserSignHongbaoRepository::class);
11334
+                $userSignHongbaoRepository->addUserSingHongbao(
11335
+                    $storeOrderEntity->getUid(),
11336
+                    UserSignHongbaoEnum::TYPE['ConsumptionGift']['code'],
11337
+                    $hongbao,
11338
+                    '购买精彩生活商品赠送红包',
11339
+                    UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
11340
+                    $storeOrderEntity->getOrderId()
11341
+                );
11342
+            }
11343
+
11344
+            // 给推荐人的奖励
11345
+            if (!empty($userEntity->getSpreadUid())) {
11346
+                $userEntityBySpreadUid = $userRepository->getUserEntityByUid($userEntity->getSpreadUid());
11347
+                if (!empty($userEntityBySpreadUid->getUid()) && $userEntityBySpreadUid->getIsDel() == UserEnum::IS_DEL['No']['code']) {
11348
+                    // 推荐人 数据分配的 基础值
11349
+                    $basics = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Spread']['Basics']['Ratio']['code'], CommonEnum::CALCULATE_THE_NUMBER_OF_DECIMAL_PLACES);
11350
+
11351
+                    // 后台设置中 可以设置  直推收益 的比例
11352
+                    $rate = static::getUserGroupRate($userEntityBySpreadUid->getUserGroup());
11353
+                    // 推荐 奖金 目前需要将 奖金按比例 分成佣金和复购金
11354
+                    $directReferralBonus = bcmul($basics, $rate, CommonEnum::CALCULATE_THE_NUMBER_OF_DECIMAL_PLACES);
11355
+
11356
+                    // 计算 复购金
11357
+                    $fugouBySpreadUid = bcmul($directReferralBonus, CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Spread']['Fugou']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11358
+                    // 添加复购金记录
11359
+                    /** @var UserSignFugouRepository $userSignFugouRepository */
11360
+                    $userSignFugouRepository = app()->make(UserSignFugouRepository::class);
11361
+                    $userSignFugouRepository->addUserSingFugou(
11362
+                        $userEntityBySpreadUid->getUid(),
11363
+                        UserSignFugouEnum::TYPE['Give']['code'],
11364
+                        $fugouBySpreadUid,
11365
+                        '用户购买精彩生活区商品',
11366
+                        UserSignFugouEnum::ORDER_TYPE['Platform']['code'],
11367
+                        $storeOrderEntity->getOrderId()
11368
+                    );
11369
+
11370
+                    // 计算 佣金
11371
+                    $brokeragePriceBySpreadUid = bcmul($directReferralBonus, CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Spread']['BrokeragePrice']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11372
+                    // 添加佣金记录
11373
+                    /** @var UserBillRepository $userBillRepository */
11374
+                    $userBillRepository = app()->make(UserBillRepository::class);
11375
+                    $userBillRepository->addUserBill(
11376
+                        $userEntityBySpreadUid->getUid(),
11377
+                        UserBillEnum::TYPE_SHOP['Platform']['code'],
11378
+                        $storeOrderEntity->getOrderId(),
11379
+                        UserBillEnum::COMMISSION_TYPE['DIRECT_REFERRAL']['code'],
11380
+                        $brokeragePriceBySpreadUid,
11381
+                        '推广获得佣金'
11382
+                    );
11383
+
11384
+                    // 初始胡 贡献值
11385
+                    $gongxianBySpreadUid = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Spread']['Gongxian']['Ratio']['code'], CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11386
+                    // 赠送贡献值
11387
+                    /** @var UserSignGongxianRepository $userSignGongxianRepository */
11388
+                    $userSignGongxianRepository = app()->make(UserSignGongxianRepository::class);
11389
+                    $userSignGongxianRepository->addUserSingGongxian(
11390
+                        $userEntityBySpreadUid->getUid(),
11391
+                        UserSignGongxianEnum::TYPE['Give']['code'],
11392
+                        $gongxianBySpreadUid,
11393
+                        '推广精彩生活商品赠送贡献值',
11394
+                        UserSignGongxianEnum::ORDER_TYPE['Platform']['code'],
11395
+                        $storeOrderEntity->getOrderId()
11396
+                    );
11397
+
11398
+                    // 计算积分值
11399
+                    $basicsScoreBySpreadUid = bcmul($storeOrderEntity->getConPri(), CommonEnum::ORDER_EARNING_ALLOCATION['WonderfulLiving']['Spread']['Score']['Ratio']['code'], CommonEnum::CALCULATE_THE_NUMBER_OF_DECIMAL_PLACES);
11400
+                    $scoreBySpreadUid = bcmul($basicsScoreBySpreadUid, $rate, CommonEnum::DECIMAL_PLACES_OF_THE_AMOUNT);
11401
+                    // 赠送积分
11402
+                    /** @var UserSignScoreRepository $userSignScoreRepository */
11403
+                    $userSignScoreRepository = app()->make(UserSignScoreRepository::class);
11404
+                    $userSignScoreRepository->addUserSingScore(
11405
+                        $userEntityBySpreadUid->getUid(),
11406
+                        UserSignScoreEnum::SOURCE_TYPE['SelfOrder']['code'],
11407
+                        UserSignScoreEnum::PM['Income']['code'],
11408
+                        $scoreBySpreadUid,
11409
+                        '推广精彩生活区商品赠送积分',
11410
+                        UserSignHongbaoEnum::ORDER_TYPE['Platform']['code'],
11411
+                        $storeOrderEntity->getOrderId()
11412
+                    );
11413
+                }
11414
+            }
11415
+
11416
+            // 分享收益
11417
+            if (!empty($storeOrderEntity->getShareUid())) {
11418
+                $userEntityByShareUid = $userRepository->getUserEntityByUid($storeOrderEntity->getShareUid());
11419
+                if (!empty($userEntityByShareUid->getUid()) && $userEntityByShareUid->getIsDel() == UserEnum::IS_DEL['No']['code']) {
11420
+                    
11421
+                }
11422
+            }
11423
+        }
11318 11424
     }
11319 11425
 }

+ 96 - 4
app/common/repositories/user/UserBillRepository.php

@@ -13,14 +13,16 @@ namespace app\common\repositories\user;
13 13
 
14 14
 use app\common\dao\BaseDao;
15 15
 use app\common\dao\user\UserBillDao;
16
-use app\common\model\store\order\StoreOrder;
16
+use app\common\enum\user\UserBillEnum;
17 17
 use app\common\model\user\UserBill;
18 18
 use app\common\repositories\BaseRepository;
19
-use crmeb\jobs\SendTemplateMessageJob;
19
+use app\common\repositories\store\order\StoreOrderRepository;
20
+use app\entity\data\user\UserBillEntity;
21
+use app\utils\ArrayUtil;
22
+use think\db\exception\DbException;
23
+use think\exception\ValidateException;
20 24
 use think\facade\Cache;
21
-use function Symfony\Component\String\s;
22 25
 use think\facade\Db;
23
-use think\facade\Queue;
24 26
 use think\Model;
25 27
 
26 28
 /**
@@ -376,4 +378,94 @@ class UserBillRepository extends BaseRepository
376 378
     {
377 379
         return $this->bill($uid, $category, $type, 0, $data);
378 380
     }
381
+
382
+    /**
383
+     * 添加 bill 数据
384
+     * @param int $uid
385
+     * @param int $typeShop
386
+     * @param int $orderId
387
+     * @param int $commissionType
388
+     * @param float $number
389
+     * @param string $mark
390
+     * @return UserBillEntity
391
+     */
392
+    public function addUserBill(int $uid, int $typeShop, int $orderId, int $commissionType, float $number, string $mark): UserBillEntity
393
+    {
394
+
395
+        $orderSn = '';
396
+        $merId = 0;
397
+        if ($typeShop == UserBillEnum::TYPE_SHOP['Platform']['code']) {
398
+            /** @var StoreOrderRepository $storeOrderRepository */
399
+            $storeOrderRepository = app()->make(StoreOrderRepository::class);
400
+            $storeOrderEntity = $storeOrderRepository->getStoreOrderEntityByOrderId($orderId);
401
+            if (empty($storeOrderEntity->getOrderId())) {
402
+                throw new ValidateException('未查询到订单信息');
403
+            }
404
+            $orderId = $storeOrderEntity->getOrderId();
405
+            $orderSn = $storeOrderEntity->getOrderSn();
406
+            $merId = $storeOrderEntity->getMerId();
407
+        }
408
+
409
+        /** @var UserBillEntity $userBillEntity */
410
+        $userBillEntity = UserBillEntity::newInstance();
411
+        $userBillEntity->setUid($uid)
412
+            ->setLinkId($orderId)
413
+            ->setPm(UserBillEnum::PM['INCOME']['code'])
414
+            ->setTitle(ArrayUtil::getEnumNameByCode($commissionType, UserBillEnum::COMMISSION_TYPE))
415
+            ->setCategory('now_money')
416
+            ->setType('commission')
417
+            ->setNumber($number)
418
+            ->setMark($mark)
419
+            ->setStatus(UserBillEnum::STATUS['PENDING']['code'])
420
+            ->setCommissionType($commissionType)
421
+            ->setOrderSn($orderSn)
422
+            ->setTypeShop($typeShop)
423
+            ->setMerId($merId)
424
+            ->setSource(UserBillEnum::SOURCE['ONLINE']['code'])
425
+            ->setOrderType(UserBillEnum::ORDER_TYPE['SELF_OPERATED']['code'])
426
+            ->setIsRedBrokerage(UserBillEnum::IS_RED_BROKERAGE['NORMAL']['code'])
427
+            ->setGzc(UserBillEnum::GZC_STATUS['NOT_ENTERED']['code'])
428
+            ->setIsGzc(UserBillEnum::IS_GZC['NOT_STARTED']['code']);
429
+
430
+        return $this->createByEntity($userBillEntity);
431
+    }
432
+
433
+    /**
434
+     * 写入 数据
435
+     * @param UserBillEntity $userBillEntity
436
+     * @return UserBillEntity
437
+     */
438
+    public function createByEntity(UserBillEntity $userBillEntity): UserBillEntity
439
+    {
440
+        $result = $this->dao->create($userBillEntity->toUnderlineArray())->toArray();
441
+        /** @var UserBillEntity $entity */
442
+        $entity = UserBillEntity::newInstance($result);
443
+        return $entity;
444
+    }
445
+
446
+    /**
447
+     * @param int $billId
448
+     * @return UserBillEntity
449
+     */
450
+    public function getUserBillEntityByBillId(int $billId): UserBillEntity
451
+    {
452
+        /** @var UserBillEntity $entity */
453
+        $entity = $this->dao->getUserBillEntityByBillId($billId);
454
+        return $entity;
455
+    }
456
+
457
+    /**
458
+     * 更新记录的状态
459
+     * @param int $billId
460
+     * @param int $status
461
+     * @return int
462
+     */
463
+    public function updateStatusByBillId(int $billId, int $status): int
464
+    {
465
+        try {
466
+            return $this->dao->update($billId, ['status' => $status]);
467
+        } catch (DbException $e) {
468
+            throw new ValidateException('更新记录状态失败');
469
+        }
470
+    }
379 471
 }

+ 73 - 0
app/common/repositories/user/UserPvLogRepository.php

@@ -0,0 +1,73 @@
1
+<?php
2
+
3
+namespace app\common\repositories\user;
4
+
5
+use app\common\dao\user\UserPvLogDao;
6
+use app\common\enum\user\UserPvLogEnum;
7
+use app\common\repositories\BaseRepository;
8
+use app\common\repositories\store\order\StoreOrderRepository;
9
+use app\entity\data\user\UserPvLogEntity;
10
+use think\exception\ValidateException;
11
+
12
+class UserPvLogRepository extends BaseRepository
13
+{
14
+    public function __construct(UserPvLogDao $dao)
15
+    {
16
+        $this->dao = $dao;
17
+    }
18
+
19
+    public function create($data)
20
+    {
21
+        return $this->dao->create($data);
22
+    }
23
+
24
+    /**
25
+     * 写入 PV记录
26
+     * @param UserPvLogEntity $userPvLogEntity
27
+     * @return UserPvLogEntity
28
+     */
29
+    public function createByEntity(UserPvLogEntity $userPvLogEntity): UserPvLogEntity
30
+    {
31
+        $result = $this->dao->create($userPvLogEntity->toUnderlineArray())->toArray();
32
+        /** @var UserPvLogEntity $entity */
33
+        $entity = UserPvLogEntity::newInstance($result);
34
+        return $entity;
35
+    }
36
+
37
+    /**
38
+     * 添加Pv 记录
39
+     * @param int $uid
40
+     * @param float $pv
41
+     * @param string $mark
42
+     * @param string $orderType
43
+     * @param string $orderId
44
+     * @return UserPvLogEntity
45
+     */
46
+    public function addUserPvLog(int $uid, float $pv, string $mark = '', string $orderType = '', string $orderId = ''): UserPvLogEntity
47
+    {
48
+        if (!empty($orderType)) {
49
+            if (!empty($orderId)) {
50
+                if ($orderType == UserPvLogEnum::ORDER_TYPE['Platform']['code']) {
51
+                    /** @var StoreOrderRepository $storeOrderRepository */
52
+                    $storeOrderRepository = app()->make(StoreOrderRepository::class);
53
+                    $storeOrderEntity = $storeOrderRepository->getStoreOrderEntityByOrderId((int)$orderId);
54
+                    if (empty($storeOrderEntity->getOrderId())) {
55
+                        throw new ValidateException('未查询到订单信息');
56
+                    }
57
+                }
58
+            }
59
+        }
60
+
61
+        /** @var UserPvLogEntity $userPvLogEntity */
62
+        $userPvLogEntity = UserPvLogEntity::newInstance();
63
+        $userPvLogEntity->setUid($uid)
64
+            ->setPv($pv)
65
+            ->setMark($mark)
66
+            ->setOrderType($orderType)
67
+            ->setOrderId($orderId)
68
+            ->setAddtime(time())
69
+            ->setStatus(UserPvLogEnum::STATUS['PendingConfirmation']['code']);
70
+
71
+        return $this->createByEntity($userPvLogEntity);
72
+    }
73
+}

+ 51 - 1
app/common/repositories/user/UserRepository.php

@@ -15,6 +15,7 @@ use alipay\aop\AlipayConfig;
15 15
 use alipay\aop\AopCertClient;
16 16
 use app\common\dao\BaseDao;
17 17
 use app\common\dao\user\UserDao;
18
+use app\common\enum\user\UserBillEnum;
18 19
 use app\common\enum\user\UserSignFugouEnum;
19 20
 use app\common\enum\user\UserSignJingdouEnum;
20 21
 use app\common\enum\user\UserSignScoreEnum;
@@ -4565,7 +4566,7 @@ class UserRepository extends BaseRepository
4565 4566
         if ($type == UserSignFugouEnum::TYPE['Consume']['code']) {
4566 4567
             $surplus = bcsub($userEntity->getFugou(), $fugou, 2);
4567 4568
             if ($surplus < 0.00) {
4568
-                throw new ValidateException('用户京豆不足');
4569
+                throw new ValidateException('用户复购金不足');
4569 4570
             }
4570 4571
         } else {
4571 4572
             $surplus = bcadd($userEntity->getFugou(), $fugou, 2);
@@ -4593,4 +4594,53 @@ class UserRepository extends BaseRepository
4593 4594
         }
4594 4595
         return (float)$surplus;
4595 4596
     }
4597
+
4598
+    /**
4599
+     * 更新用户复购金 并 写入 复购金变动记录
4600
+     * @param int $uid
4601
+     * @param int $type
4602
+     * @param float $fugou
4603
+     * @param string $mark
4604
+     * @param string $orderType
4605
+     * @param string $orderId
4606
+     * @return float
4607
+     */
4608
+    public function updateUserBrokeragePriceByRecordId(int $uid, int $recordId): float
4609
+    {
4610
+        $userEntity = $this->getUserEntityByUid($uid);
4611
+        if (empty($userEntity->getUid())) {
4612
+            throw new ValidateException('未查询到用户信息');
4613
+        }
4614
+
4615
+        /** @var UserBillRepository $userBillRepository */
4616
+        $userBillRepository = app()->make(UserBillRepository::class);
4617
+        $userBillEntity = $userBillRepository->getUserBillEntityByBillId($recordId);
4618
+        if (empty($userBillEntity->getBillId())) {
4619
+            throw new ValidateException('未查询到佣金记录信息');
4620
+        }
4621
+        if ($userBillEntity->getCommissionType() != UserBillEnum::COMMISSION_TYPE['DIRECT_REFERRAL']['code'] && $userBillEntity->getCommissionType() != UserBillEnum::COMMISSION_TYPE['SHARE_EARNINGS']['code']) {
4622
+            throw new ValidateException('该记录信息非佣金记录');
4623
+        }
4624
+        if ($userBillEntity->getStatus() != UserBillEnum::STATUS['PENDING']['code']) {
4625
+            throw new ValidateException('该记录信息非待分配状态');
4626
+        }
4627
+
4628
+        if ($userBillEntity->getPm() == UserBillEnum::PM['EXPEND']['code']) {
4629
+            $surplus = bcsub($userEntity->getBrokeragePrice(), $userBillEntity->getNumber(), 2);
4630
+            if ($surplus < 0.00) {
4631
+                throw new ValidateException('用户佣金不足');
4632
+            }
4633
+        } else {
4634
+            $surplus = bcadd($userEntity->getBrokeragePrice(), $userBillEntity->getNumber(), 2);
4635
+        }
4636
+        try {
4637
+            $this->dao->update($uid, ['brokerage_price' => $surplus]);
4638
+
4639
+            // 注意 单一
4640
+            // $userBillRepository->updateStatusByBillId($userBillEntity->getBillId(), UserBillEnum::STATUS['VALID']['code']);
4641
+        } catch (DbException $e) {
4642
+            throw new ValidateException('更新京豆失败');
4643
+        }
4644
+        return (float)$surplus;
4645
+    }
4596 4646
 }

+ 56 - 0
app/common/repositories/user/UserSignFugouRepository.php

@@ -3,7 +3,11 @@
3 3
 namespace app\common\repositories\user;
4 4
 
5 5
 use app\common\dao\user\UserSignFugouDao;
6
+use app\common\enum\user\UserSignFugouEnum;
6 7
 use app\common\repositories\BaseRepository;
8
+use app\common\repositories\store\order\StoreOrderRepository;
9
+use app\entity\data\user\UserSignFugouEntity;
10
+use think\exception\ValidateException;
7 11
 
8 12
 class UserSignFugouRepository extends BaseRepository
9 13
 {
@@ -16,4 +20,56 @@ class UserSignFugouRepository extends BaseRepository
16 20
     {
17 21
         return $this->dao->create($data);
18 22
     }
23
+
24
+    /**
25
+     * 写入 复购金 记录
26
+     * @param UserSignFugouEntity $userSignFugouEntity
27
+     * @return UserSignFugouEntity
28
+     */
29
+    public function createByEntity(UserSignFugouEntity $userSignFugouEntity): UserSignFugouEntity
30
+    {
31
+        $result = $this->dao->create($userSignFugouEntity->toUnderlineArray())->toArray();
32
+        /** @var UserSignFugouEntity $entity */
33
+        $entity = UserSignFugouEntity::newInstance($result);
34
+        return $entity;
35
+    }
36
+
37
+    /**
38
+     * 添加 复购金记录
39
+     * @param int $uid
40
+     * @param int $type
41
+     * @param float $number
42
+     * @param string $mark
43
+     * @param string $orderType
44
+     * @param string $orderId
45
+     * @return UserSignFugouEntity
46
+     */
47
+    public function addUserSingFugou(int $uid, int $type, float $number, string $mark = '', string $orderType = '', string $orderId = ''): UserSignFugouEntity
48
+    {
49
+        if (!empty($orderType)) {
50
+            if (!empty($orderId)) {
51
+                if ($orderType == UserSignFugouEnum::ORDER_TYPE['Platform']['code']) {
52
+                    /** @var StoreOrderRepository $storeOrderRepository */
53
+                    $storeOrderRepository = app()->make(StoreOrderRepository::class);
54
+                    $storeOrderEntity = $storeOrderRepository->getStoreOrderEntityByOrderId((int)$orderId);
55
+                    if (empty($storeOrderEntity->getOrderId())) {
56
+                        throw new ValidateException('未查询到订单信息');
57
+                    }
58
+                }
59
+            }
60
+        }
61
+
62
+        /** @var UserSignFugouEntity $userSignFugouEntity */
63
+        $userSignFugouEntity = UserSignFugouEntity::newInstance();
64
+        $userSignFugouEntity->setUid($uid)
65
+            ->setType($type)
66
+            ->setNumber($number)
67
+            ->setMark($mark)
68
+            ->setOrderType($orderType)
69
+            ->setOrderId($orderId)
70
+            ->setAddtime(time())
71
+            ->setStatus(UserSignFugouEnum::STATUS['Pending']['code']);
72
+
73
+        return $this->createByEntity($userSignFugouEntity);
74
+    }
19 75
 }

+ 79 - 0
app/common/repositories/user/UserSignGongxianRepository.php

@@ -0,0 +1,79 @@
1
+<?php
2
+
3
+namespace app\common\repositories\user;
4
+
5
+use app\common\dao\user\UserSignGongxianDao;
6
+use app\common\enum\user\UserSignGongxianEnum;
7
+use app\common\repositories\BaseRepository;
8
+use app\common\repositories\store\order\StoreOrderRepository;
9
+use app\entity\data\user\UserSignGongxianEntity;
10
+use think\exception\ValidateException;
11
+
12
+class UserSignGongxianRepository extends BaseRepository
13
+{
14
+    public function __construct(UserSignGongxianDao $dao)
15
+    {
16
+        $this->dao = $dao;
17
+    }
18
+
19
+    public function create($data)
20
+    {
21
+        return $this->dao->create($data);
22
+    }
23
+
24
+    /**
25
+     * 写入贡献值记录
26
+     * @param UserSignGongxianEntity $userSignGongxianEntity
27
+     * @return UserSignGongxianEntity
28
+     */
29
+    public function createByEntity(UserSignGongxianEntity $userSignGongxianEntity): UserSignGongxianEntity
30
+    {
31
+        $result = $this->dao->create($userSignGongxianEntity->toUnderlineArray())->toArray();
32
+        /** @var UserSignGongxianEntity $entity */
33
+        $entity = UserSignGongxianEntity::newInstance($result);
34
+        return $entity;
35
+    }
36
+
37
+    /**
38
+     * 添加贡献值记录
39
+     * @param int $uid
40
+     * @param int $type
41
+     * @param float $number
42
+     * @param string $mark
43
+     * @param string $orderType
44
+     * @param string $orderId
45
+     * @return UserSignGongxianEntity
46
+     */
47
+    public function addUserSingGongxian(int $uid, int $type, float $number, string $mark = '', string $orderType = '', string $orderId = ''): UserSignGongxianEntity
48
+    {
49
+        $merId = 0;
50
+        if (!empty($orderType)) {
51
+            if (!empty($orderId)) {
52
+                if ($orderType == UserSignGongxianEnum::ORDER_TYPE['Platform']['code']) {
53
+                    /** @var StoreOrderRepository $storeOrderRepository */
54
+                    $storeOrderRepository = app()->make(StoreOrderRepository::class);
55
+                    $storeOrderEntity = $storeOrderRepository->getStoreOrderEntityByOrderId((int)$orderId);
56
+                    if (empty($storeOrderEntity->getOrderId())) {
57
+                        throw new ValidateException('未查询到订单信息');
58
+                    }
59
+                    $merId = $storeOrderEntity->getMerId();
60
+                }
61
+            }
62
+        }
63
+
64
+        /** @var UserSignGongxianEntity $userSignGongxianEntity */
65
+        $userSignGongxianEntity = UserSignGongxianEntity::newInstance();
66
+        $userSignGongxianEntity->setUid($uid)
67
+            ->setType($type)
68
+            ->setNumber($number)
69
+            ->setMark($mark)
70
+            ->setOrderType($orderType)
71
+            ->setOrderId($orderId)
72
+            ->setMerId($merId)
73
+            ->setAddtime(time())
74
+            ->setStatus(UserSignGongxianEnum::STATUS['PendingConfirmation']['code']);
75
+
76
+        return $this->createByEntity($userSignGongxianEntity);
77
+    }
78
+
79
+}

+ 76 - 0
app/common/repositories/user/UserSignHongbaoRepository.php

@@ -0,0 +1,76 @@
1
+<?php
2
+
3
+namespace app\common\repositories\user;
4
+
5
+use app\common\dao\user\UserSignHongbaoDao;
6
+use app\common\enum\user\UserSignHongbaoEnum;
7
+use app\common\repositories\BaseRepository;
8
+use app\common\repositories\store\order\StoreOrderRepository;
9
+use app\entity\data\user\UserSignHongbaoEntity;
10
+use think\exception\ValidateException;
11
+
12
+class UserSignHongbaoRepository extends BaseRepository
13
+{
14
+    public function __construct(UserSignHongbaoDao $dao)
15
+    {
16
+        $this->dao = $dao;
17
+    }
18
+
19
+    public function create($data)
20
+    {
21
+        return $this->dao->create($data);
22
+    }
23
+
24
+    /**
25
+     * 写入红包记录
26
+     * @param UserSignHongbaoEntity $userSignHongbaoEntity
27
+     * @return UserSignHongbaoEntity
28
+     */
29
+    public function createByEntity(UserSignHongbaoEntity $userSignHongbaoEntity): UserSignHongbaoEntity
30
+    {
31
+        $result = $this->dao->create($userSignHongbaoEntity->toUnderlineArray())->toArray();
32
+        /** @var UserSignHongbaoEntity $entity */
33
+        $entity = UserSignHongbaoEntity::newInstance($result);
34
+        return $entity;
35
+    }
36
+
37
+    /**
38
+     * 添加红包记录
39
+     * @param int $uid
40
+     * @param int $type
41
+     * @param float $number
42
+     * @param string $mark
43
+     * @param string $orderType
44
+     * @param string $orderId
45
+     * @return UserSignHongbaoEntity
46
+     */
47
+    public function addUserSingHongbao(int $uid, int $type, float $number, string $mark = '', string $orderType = '', string $orderId = ''): UserSignHongbaoEntity
48
+    {
49
+        if (!empty($orderType)) {
50
+            if (!empty($orderId)) {
51
+                if ($orderType == UserSignHongbaoEnum::ORDER_TYPE['Platform']['code']) {
52
+                    /** @var StoreOrderRepository $storeOrderRepository */
53
+                    $storeOrderRepository = app()->make(StoreOrderRepository::class);
54
+                    $storeOrderEntity = $storeOrderRepository->getStoreOrderEntityByOrderId((int)$orderId);
55
+                    if (empty($storeOrderEntity->getOrderId())) {
56
+                        throw new ValidateException('未查询到订单信息');
57
+                    }
58
+                }
59
+            }
60
+        }
61
+
62
+        /** @var UserSignHongbaoEntity $userSignHongbaoEntity */
63
+        $userSignHongbaoEntity = UserSignHongbaoEntity::newInstance();
64
+        $userSignHongbaoEntity->setUid($uid)
65
+            ->setType($type)
66
+            ->setNumber($number)
67
+            ->setMark($mark)
68
+            ->setOrderType($orderType)
69
+            ->setOrderId($orderId)
70
+            ->setAddtime(time())
71
+            ->setStatus(UserSignHongbaoEnum::STATUS['PendingConfirmation']['code']);
72
+
73
+        return $this->createByEntity($userSignHongbaoEntity);
74
+    }
75
+
76
+}

+ 59 - 0
app/common/repositories/user/UserSignScoreRepository.php

@@ -3,7 +3,11 @@
3 3
 namespace app\common\repositories\user;
4 4
 
5 5
 use app\common\dao\user\UserSignScoreDao;
6
+use app\common\enum\user\UserSignScoreEnum;
6 7
 use app\common\repositories\BaseRepository;
8
+use app\common\repositories\store\order\StoreOrderRepository;
9
+use app\entity\data\user\UserSignScoreEntity;
10
+use think\exception\ValidateException;
7 11
 
8 12
 class UserSignScoreRepository extends BaseRepository
9 13
 {
@@ -16,4 +20,59 @@ class UserSignScoreRepository extends BaseRepository
16 20
     {
17 21
         return $this->dao->create($data);
18 22
     }
23
+
24
+    /**
25
+     * 写入贡献值记录
26
+     * @param UserSignScoreEntity $userSignScoreEntity
27
+     * @return UserSignScoreEntity
28
+     */
29
+    public function createByEntity(UserSignScoreEntity $userSignScoreEntity): UserSignScoreEntity
30
+    {
31
+        $result = $this->dao->create($userSignScoreEntity->toUnderlineArray())->toArray();
32
+        /** @var UserSignScoreEntity $entity */
33
+        $entity = UserSignScoreEntity::newInstance($result);
34
+        return $entity;
35
+    }
36
+
37
+    /**
38
+     * 添加 积分记录
39
+     * @param int $uid
40
+     * @param int $sourceType
41
+     * @param int $type
42
+     * @param float $number
43
+     * @param string $mark
44
+     * @param string $orderType
45
+     * @param string $orderId
46
+     * @return UserSignScoreEntity
47
+     */
48
+    public function addUserSingScore(int $uid, int $sourceType, int $type, float $number, string $mark = '', string $orderType = '', string $orderId = ''): UserSignScoreEntity
49
+    {
50
+
51
+        if (!empty($orderType)) {
52
+            if (!empty($orderId)) {
53
+                if ($orderType == UserSignScoreEnum::ORDER_TYPE['Platform']['code']) {
54
+                    /** @var StoreOrderRepository $storeOrderRepository */
55
+                    $storeOrderRepository = app()->make(StoreOrderRepository::class);
56
+                    $storeOrderEntity = $storeOrderRepository->getStoreOrderEntityByOrderId((int)$orderId);
57
+                    if (empty($storeOrderEntity->getOrderId())) {
58
+                        throw new ValidateException('未查询到订单信息');
59
+                    }
60
+                }
61
+            }
62
+        }
63
+
64
+        /** @var UserSignScoreEntity $userSignScoreEntity */
65
+        $userSignScoreEntity = UserSignScoreEntity::newInstance();
66
+        $userSignScoreEntity->setUid($uid)
67
+            ->setSourceType($sourceType)
68
+            ->setPm($type)
69
+            ->setRewardScore($number)
70
+            ->setMark($mark)
71
+            ->setOrderType($orderType)
72
+            ->setOrderId($orderId)
73
+            ->setAddtime(time())
74
+            ->setStatus(UserSignScoreEnum::STATUS['Pending']['code']);
75
+
76
+        return $this->createByEntity($userSignScoreEntity);
77
+    }
19 78
 }

+ 522 - 0
app/entity/data/gzc/GzcLogEntity.php

@@ -0,0 +1,522 @@
1
+<?php
2
+
3
+namespace app\entity\data\gzc;
4
+
5
+use app\entity\data\DataEntity;
6
+
7
+class GzcLogEntity extends DataEntity
8
+{
9
+    public $id = 0;  // 日志ID
10
+    public $uid = 0;  // 用户ID
11
+    public $platformNo = '';  // 平台申请单号
12
+    public $accountType = 0;  // 账号类型 1银行卡 2支付宝 3微信
13
+    public $bankName = '';  // 开户银行名称
14
+    public $branchName = '';  // 支行名称
15
+    public $bankAccount = '';  // 开户银行账号
16
+    public $bankNo = '';  // 银行流水号
17
+    public $alipayAccount = '';  // 支付宝支付账号
18
+    public $alipayNo = '';  // 支付宝流水号
19
+    public $wxpayAccount = '';  // 微信账号
20
+    public $wxpayNo = '';  // 交易流水号
21
+    public $userName = '';  // 消费者姓名
22
+    public $mobile = '';  // 消费者电话
23
+    public $userCard = '';  // 消费者证件号
24
+    public $pension = 0.00;  // 存入的养老金金额
25
+    public $gzc = 0;  // 公证处是否已发起入账 0否 1是
26
+    public $gzcDepositNo = '';  // 公证处入账明细编号
27
+    public $gzcConfirmResult = '';  // 公证处入账结果
28
+    public $success = 0;  // 是否入账成功 0否 1是
29
+    public $orderType = 0;  // 订单类型 1-线下支付 2-线上支付 3-拼多多 4-京东 5-苏宁 6-淘宝 7-唯品会 8-抖音 9-话费
30
+    public $outTradeNo = '';  // 单号
31
+    public $depositDt = null;  // 存入时间
32
+    public $payTime = null;  // 支付时间
33
+    public $createTime = null;  // 创建时间
34
+    public $updateTime = null;  // 更新时间
35
+    public $linkId = 0;  // 关联账单id
36
+
37
+    /**
38
+     * @return int
39
+     */
40
+    public function getId(): int
41
+    {
42
+        return $this->id;
43
+    }
44
+
45
+    /**
46
+     * @param int $id
47
+     * @return GzcLogEntity
48
+     */
49
+    public function setId(int $id): GzcLogEntity
50
+    {
51
+        $this->id = $id;
52
+        return $this;
53
+    }
54
+
55
+    /**
56
+     * @return int
57
+     */
58
+    public function getUid(): int
59
+    {
60
+        return $this->uid;
61
+    }
62
+
63
+    /**
64
+     * @param int $uid
65
+     * @return GzcLogEntity
66
+     */
67
+    public function setUid(int $uid): GzcLogEntity
68
+    {
69
+        $this->uid = $uid;
70
+        return $this;
71
+    }
72
+
73
+    /**
74
+     * @return string
75
+     */
76
+    public function getPlatformNo(): string
77
+    {
78
+        return $this->platformNo;
79
+    }
80
+
81
+    /**
82
+     * @param string $platformNo
83
+     * @return GzcLogEntity
84
+     */
85
+    public function setPlatformNo(string $platformNo): GzcLogEntity
86
+    {
87
+        $this->platformNo = $platformNo;
88
+        return $this;
89
+    }
90
+
91
+    /**
92
+     * @return int
93
+     */
94
+    public function getAccountType(): int
95
+    {
96
+        return $this->accountType;
97
+    }
98
+
99
+    /**
100
+     * @param int $accountType
101
+     * @return GzcLogEntity
102
+     */
103
+    public function setAccountType(int $accountType): GzcLogEntity
104
+    {
105
+        $this->accountType = $accountType;
106
+        return $this;
107
+    }
108
+
109
+    /**
110
+     * @return string
111
+     */
112
+    public function getBankName(): string
113
+    {
114
+        return $this->bankName;
115
+    }
116
+
117
+    /**
118
+     * @param string $bankName
119
+     * @return GzcLogEntity
120
+     */
121
+    public function setBankName(string $bankName): GzcLogEntity
122
+    {
123
+        $this->bankName = $bankName;
124
+        return $this;
125
+    }
126
+
127
+    /**
128
+     * @return string
129
+     */
130
+    public function getBranchName(): string
131
+    {
132
+        return $this->branchName;
133
+    }
134
+
135
+    /**
136
+     * @param string $branchName
137
+     * @return GzcLogEntity
138
+     */
139
+    public function setBranchName(string $branchName): GzcLogEntity
140
+    {
141
+        $this->branchName = $branchName;
142
+        return $this;
143
+    }
144
+
145
+    /**
146
+     * @return string
147
+     */
148
+    public function getBankAccount(): string
149
+    {
150
+        return $this->bankAccount;
151
+    }
152
+
153
+    /**
154
+     * @param string $bankAccount
155
+     * @return GzcLogEntity
156
+     */
157
+    public function setBankAccount(string $bankAccount): GzcLogEntity
158
+    {
159
+        $this->bankAccount = $bankAccount;
160
+        return $this;
161
+    }
162
+
163
+    /**
164
+     * @return string
165
+     */
166
+    public function getBankNo(): string
167
+    {
168
+        return $this->bankNo;
169
+    }
170
+
171
+    /**
172
+     * @param string $bankNo
173
+     * @return GzcLogEntity
174
+     */
175
+    public function setBankNo(string $bankNo): GzcLogEntity
176
+    {
177
+        $this->bankNo = $bankNo;
178
+        return $this;
179
+    }
180
+
181
+    /**
182
+     * @return string
183
+     */
184
+    public function getAlipayAccount(): string
185
+    {
186
+        return $this->alipayAccount;
187
+    }
188
+
189
+    /**
190
+     * @param string $alipayAccount
191
+     * @return GzcLogEntity
192
+     */
193
+    public function setAlipayAccount(string $alipayAccount): GzcLogEntity
194
+    {
195
+        $this->alipayAccount = $alipayAccount;
196
+        return $this;
197
+    }
198
+
199
+    /**
200
+     * @return string
201
+     */
202
+    public function getAlipayNo(): string
203
+    {
204
+        return $this->alipayNo;
205
+    }
206
+
207
+    /**
208
+     * @param string $alipayNo
209
+     * @return GzcLogEntity
210
+     */
211
+    public function setAlipayNo(string $alipayNo): GzcLogEntity
212
+    {
213
+        $this->alipayNo = $alipayNo;
214
+        return $this;
215
+    }
216
+
217
+    /**
218
+     * @return string
219
+     */
220
+    public function getWxpayAccount(): string
221
+    {
222
+        return $this->wxpayAccount;
223
+    }
224
+
225
+    /**
226
+     * @param string $wxpayAccount
227
+     * @return GzcLogEntity
228
+     */
229
+    public function setWxpayAccount(string $wxpayAccount): GzcLogEntity
230
+    {
231
+        $this->wxpayAccount = $wxpayAccount;
232
+        return $this;
233
+    }
234
+
235
+    /**
236
+     * @return string
237
+     */
238
+    public function getWxpayNo(): string
239
+    {
240
+        return $this->wxpayNo;
241
+    }
242
+
243
+    /**
244
+     * @param string $wxpayNo
245
+     * @return GzcLogEntity
246
+     */
247
+    public function setWxpayNo(string $wxpayNo): GzcLogEntity
248
+    {
249
+        $this->wxpayNo = $wxpayNo;
250
+        return $this;
251
+    }
252
+
253
+    /**
254
+     * @return string
255
+     */
256
+    public function getUserName(): string
257
+    {
258
+        return $this->userName;
259
+    }
260
+
261
+    /**
262
+     * @param string $userName
263
+     * @return GzcLogEntity
264
+     */
265
+    public function setUserName(string $userName): GzcLogEntity
266
+    {
267
+        $this->userName = $userName;
268
+        return $this;
269
+    }
270
+
271
+    /**
272
+     * @return string
273
+     */
274
+    public function getMobile(): string
275
+    {
276
+        return $this->mobile;
277
+    }
278
+
279
+    /**
280
+     * @param string $mobile
281
+     * @return GzcLogEntity
282
+     */
283
+    public function setMobile(string $mobile): GzcLogEntity
284
+    {
285
+        $this->mobile = $mobile;
286
+        return $this;
287
+    }
288
+
289
+    /**
290
+     * @return string
291
+     */
292
+    public function getUserCard(): string
293
+    {
294
+        return $this->userCard;
295
+    }
296
+
297
+    /**
298
+     * @param string $userCard
299
+     * @return GzcLogEntity
300
+     */
301
+    public function setUserCard(string $userCard): GzcLogEntity
302
+    {
303
+        $this->userCard = $userCard;
304
+        return $this;
305
+    }
306
+
307
+    /**
308
+     * @return float
309
+     */
310
+    public function getPension(): float
311
+    {
312
+        return $this->pension;
313
+    }
314
+
315
+    /**
316
+     * @param float $pension
317
+     * @return GzcLogEntity
318
+     */
319
+    public function setPension(float $pension): GzcLogEntity
320
+    {
321
+        $this->pension = $pension;
322
+        return $this;
323
+    }
324
+
325
+    /**
326
+     * @return int
327
+     */
328
+    public function getGzc(): int
329
+    {
330
+        return $this->gzc;
331
+    }
332
+
333
+    /**
334
+     * @param int $gzc
335
+     * @return GzcLogEntity
336
+     */
337
+    public function setGzc(int $gzc): GzcLogEntity
338
+    {
339
+        $this->gzc = $gzc;
340
+        return $this;
341
+    }
342
+
343
+    /**
344
+     * @return string
345
+     */
346
+    public function getGzcDepositNo(): string
347
+    {
348
+        return $this->gzcDepositNo;
349
+    }
350
+
351
+    /**
352
+     * @param string $gzcDepositNo
353
+     * @return GzcLogEntity
354
+     */
355
+    public function setGzcDepositNo(string $gzcDepositNo): GzcLogEntity
356
+    {
357
+        $this->gzcDepositNo = $gzcDepositNo;
358
+        return $this;
359
+    }
360
+
361
+    /**
362
+     * @return string
363
+     */
364
+    public function getGzcConfirmResult(): string
365
+    {
366
+        return $this->gzcConfirmResult;
367
+    }
368
+
369
+    /**
370
+     * @param string $gzcConfirmResult
371
+     * @return GzcLogEntity
372
+     */
373
+    public function setGzcConfirmResult(string $gzcConfirmResult): GzcLogEntity
374
+    {
375
+        $this->gzcConfirmResult = $gzcConfirmResult;
376
+        return $this;
377
+    }
378
+
379
+    /**
380
+     * @return int
381
+     */
382
+    public function getSuccess(): int
383
+    {
384
+        return $this->success;
385
+    }
386
+
387
+    /**
388
+     * @param int $success
389
+     * @return GzcLogEntity
390
+     */
391
+    public function setSuccess(int $success): GzcLogEntity
392
+    {
393
+        $this->success = $success;
394
+        return $this;
395
+    }
396
+
397
+    /**
398
+     * @return int
399
+     */
400
+    public function getOrderType(): int
401
+    {
402
+        return $this->orderType;
403
+    }
404
+
405
+    /**
406
+     * @param int $orderType
407
+     * @return GzcLogEntity
408
+     */
409
+    public function setOrderType(int $orderType): GzcLogEntity
410
+    {
411
+        $this->orderType = $orderType;
412
+        return $this;
413
+    }
414
+
415
+    /**
416
+     * @return string
417
+     */
418
+    public function getOutTradeNo(): string
419
+    {
420
+        return $this->outTradeNo;
421
+    }
422
+
423
+    /**
424
+     * @param string $outTradeNo
425
+     * @return GzcLogEntity
426
+     */
427
+    public function setOutTradeNo(string $outTradeNo): GzcLogEntity
428
+    {
429
+        $this->outTradeNo = $outTradeNo;
430
+        return $this;
431
+    }
432
+
433
+    /**
434
+     * @return null
435
+     */
436
+    public function getDepositDt()
437
+    {
438
+        return $this->depositDt;
439
+    }
440
+
441
+    /**
442
+     * @param null $depositDt
443
+     * @return GzcLogEntity
444
+     */
445
+    public function setDepositDt($depositDt)
446
+    {
447
+        $this->depositDt = $depositDt;
448
+        return $this;
449
+    }
450
+
451
+    /**
452
+     * @return null
453
+     */
454
+    public function getPayTime()
455
+    {
456
+        return $this->payTime;
457
+    }
458
+
459
+    /**
460
+     * @param null $payTime
461
+     * @return GzcLogEntity
462
+     */
463
+    public function setPayTime($payTime)
464
+    {
465
+        $this->payTime = $payTime;
466
+        return $this;
467
+    }
468
+
469
+    /**
470
+     * @return null
471
+     */
472
+    public function getCreateTime()
473
+    {
474
+        return $this->createTime;
475
+    }
476
+
477
+    /**
478
+     * @param null $createTime
479
+     * @return GzcLogEntity
480
+     */
481
+    public function setCreateTime($createTime)
482
+    {
483
+        $this->createTime = $createTime;
484
+        return $this;
485
+    }
486
+
487
+    /**
488
+     * @return null
489
+     */
490
+    public function getUpdateTime()
491
+    {
492
+        return $this->updateTime;
493
+    }
494
+
495
+    /**
496
+     * @param null $updateTime
497
+     * @return GzcLogEntity
498
+     */
499
+    public function setUpdateTime($updateTime)
500
+    {
501
+        $this->updateTime = $updateTime;
502
+        return $this;
503
+    }
504
+
505
+    /**
506
+     * @return int
507
+     */
508
+    public function getLinkId(): int
509
+    {
510
+        return $this->linkId;
511
+    }
512
+
513
+    /**
514
+     * @param int $linkId
515
+     * @return GzcLogEntity
516
+     */
517
+    public function setLinkId(int $linkId): GzcLogEntity
518
+    {
519
+        $this->linkId = $linkId;
520
+        return $this;
521
+    }
522
+}

+ 7 - 7
app/entity/data/store/StoreOrderEntity.php

@@ -86,7 +86,7 @@ class StoreOrderEntity extends DataEntity
86 86
     public $isDayPay = null;  // 是否代付订单
87 87
     public $isSettlement = 0;  // 是否已结算
88 88
     public $settlementTime = null;  // 结算时间
89
-    public $shareUid = null;  // 分享用户uid
89
+    public $shareUid = 0;  // 分享用户uid
90 90
     public $conPri = null;  // 利润
91 91
     public $userOfGoodsId = '';  // 会员区升级权限的ID
92 92
     public $fzonePaytype = '';  // 组合支付
@@ -1539,20 +1539,20 @@ class StoreOrderEntity extends DataEntity
1539 1539
     }
1540 1540
 
1541 1541
     /**
1542
-     * @return null
1542
+     * @return int
1543 1543
      */
1544
-    public function getShareUid()
1544
+    public function getShareUid(): int
1545 1545
     {
1546
-        return $this->shareUid;
1546
+        return (int)$this->shareUid;
1547 1547
     }
1548 1548
 
1549 1549
     /**
1550
-     * @param null $shareUid
1550
+     * @param mixed $shareUid
1551 1551
      * @return StoreOrderEntity
1552 1552
      */
1553
-    public function setShareUid($shareUid)
1553
+    public function setShareUid($shareUid): StoreOrderEntity
1554 1554
     {
1555
-        $this->shareUid = $shareUid;
1555
+        $this->shareUid = (int)$shareUid;
1556 1556
         return $this;
1557 1557
     }
1558 1558
 

+ 180 - 0
app/entity/data/user/UserPvLogEntity.php

@@ -0,0 +1,180 @@
1
+<?php
2
+
3
+namespace app\entity\data\user;
4
+
5
+use app\entity\data\DataEntity;
6
+
7
+class UserPvLogEntity extends DataEntity
8
+{
9
+    public $id = 0;  // 自增id
10
+    public $uid = 0;  // 会员id
11
+    public $pv = 0.00;  // pv值
12
+    public $status = 0;  // pv状态: 1-有效 0-失效 -1待确认
13
+    public $mark = '';  // 备注
14
+    public $orderId = '';  // 订单id
15
+    public $orderType = '';  // 订单类型
16
+    public $settlementTime = null;  // 结算时间
17
+    public $addtime = 0;  // 添加时间
18
+
19
+    /**
20
+     * @return int
21
+     */
22
+    public function getId(): int
23
+    {
24
+        return $this->id;
25
+    }
26
+
27
+    /**
28
+     * @param int $id
29
+     * @return UserPvLogEntity
30
+     */
31
+    public function setId(int $id): UserPvLogEntity
32
+    {
33
+        $this->id = $id;
34
+        return $this;
35
+    }
36
+
37
+    /**
38
+     * @return int
39
+     */
40
+    public function getUid(): int
41
+    {
42
+        return $this->uid;
43
+    }
44
+
45
+    /**
46
+     * @param int $uid
47
+     * @return UserPvLogEntity
48
+     */
49
+    public function setUid(int $uid): UserPvLogEntity
50
+    {
51
+        $this->uid = $uid;
52
+        return $this;
53
+    }
54
+
55
+    /**
56
+     * @return float
57
+     */
58
+    public function getPv(): float
59
+    {
60
+        return $this->pv;
61
+    }
62
+
63
+    /**
64
+     * @param float $pv
65
+     * @return UserPvLogEntity
66
+     */
67
+    public function setPv(float $pv): UserPvLogEntity
68
+    {
69
+        $this->pv = $pv;
70
+        return $this;
71
+    }
72
+
73
+    /**
74
+     * @return int
75
+     */
76
+    public function getStatus(): int
77
+    {
78
+        return $this->status;
79
+    }
80
+
81
+    /**
82
+     * @param int $status
83
+     * @return UserPvLogEntity
84
+     */
85
+    public function setStatus(int $status): UserPvLogEntity
86
+    {
87
+        $this->status = $status;
88
+        return $this;
89
+    }
90
+
91
+    /**
92
+     * @return string
93
+     */
94
+    public function getMark(): string
95
+    {
96
+        return $this->mark;
97
+    }
98
+
99
+    /**
100
+     * @param string $mark
101
+     * @return UserPvLogEntity
102
+     */
103
+    public function setMark(string $mark): UserPvLogEntity
104
+    {
105
+        $this->mark = $mark;
106
+        return $this;
107
+    }
108
+
109
+    /**
110
+     * @return string
111
+     */
112
+    public function getOrderId(): string
113
+    {
114
+        return $this->orderId;
115
+    }
116
+
117
+    /**
118
+     * @param string $orderId
119
+     * @return UserPvLogEntity
120
+     */
121
+    public function setOrderId(string $orderId): UserPvLogEntity
122
+    {
123
+        $this->orderId = $orderId;
124
+        return $this;
125
+    }
126
+
127
+    /**
128
+     * @return string
129
+     */
130
+    public function getOrderType(): string
131
+    {
132
+        return $this->orderType;
133
+    }
134
+
135
+    /**
136
+     * @param string $orderType
137
+     * @return UserPvLogEntity
138
+     */
139
+    public function setOrderType(string $orderType): UserPvLogEntity
140
+    {
141
+        $this->orderType = $orderType;
142
+        return $this;
143
+    }
144
+
145
+    /**
146
+     * @return null
147
+     */
148
+    public function getSettlementTime()
149
+    {
150
+        return $this->settlementTime;
151
+    }
152
+
153
+    /**
154
+     * @param null $settlementTime
155
+     * @return UserPvLogEntity
156
+     */
157
+    public function setSettlementTime($settlementTime)
158
+    {
159
+        $this->settlementTime = $settlementTime;
160
+        return $this;
161
+    }
162
+
163
+    /**
164
+     * @return int
165
+     */
166
+    public function getAddtime(): int
167
+    {
168
+        return $this->addtime;
169
+    }
170
+
171
+    /**
172
+     * @param int $addtime
173
+     * @return UserPvLogEntity
174
+     */
175
+    public function setAddtime(int $addtime): UserPvLogEntity
176
+    {
177
+        $this->addtime = $addtime;
178
+        return $this;
179
+    }
180
+}

+ 275 - 0
app/entity/data/user/UserSignGongxianEntity.php

@@ -0,0 +1,275 @@
1
+<?php
2
+
3
+namespace app\entity\data\user;
4
+
5
+use app\entity\data\DataEntity;
6
+
7
+class UserSignGongxianEntity extends DataEntity
8
+{
9
+    public $id = 0;  // 自增id
10
+    public $uid = 0;  // 会员id
11
+    public $merId = 0;  // 商户id
12
+    public $number = 0.00;  // 赠送数量
13
+    public $status = 0;  // 贡献值状态: 1-有效 0-失效 -1待确认
14
+    public $mark = '';  // 备注
15
+    public $desc = '';  // 描述
16
+    public $orderId = '';  // 订单id
17
+    public $surplus = 0.00;  // 剩余
18
+    public $orderType = '';  // 订单类型
19
+    public $type = null;  // 贡献值类型: 1-赠送 2-消耗
20
+    public $settlementTime = null;  // 结算时间
21
+    public $addtime = 0;  // 添加时间
22
+    public $pv = 0.00;  // pv值
23
+
24
+    /**
25
+     * @return int
26
+     */
27
+    public function getId(): int
28
+    {
29
+        return $this->id;
30
+    }
31
+
32
+    /**
33
+     * @param int $id
34
+     * @return UserSignGongxianEntity
35
+     */
36
+    public function setId(int $id): UserSignGongxianEntity
37
+    {
38
+        $this->id = $id;
39
+        return $this;
40
+    }
41
+
42
+    /**
43
+     * @return int
44
+     */
45
+    public function getUid(): int
46
+    {
47
+        return $this->uid;
48
+    }
49
+
50
+    /**
51
+     * @param int $uid
52
+     * @return UserSignGongxianEntity
53
+     */
54
+    public function setUid(int $uid): UserSignGongxianEntity
55
+    {
56
+        $this->uid = $uid;
57
+        return $this;
58
+    }
59
+
60
+    /**
61
+     * @return int
62
+     */
63
+    public function getMerId(): int
64
+    {
65
+        return $this->merId;
66
+    }
67
+
68
+    /**
69
+     * @param int $merId
70
+     * @return UserSignGongxianEntity
71
+     */
72
+    public function setMerId(int $merId): UserSignGongxianEntity
73
+    {
74
+        $this->merId = $merId;
75
+        return $this;
76
+    }
77
+
78
+    /**
79
+     * @return float
80
+     */
81
+    public function getNumber(): float
82
+    {
83
+        return $this->number;
84
+    }
85
+
86
+    /**
87
+     * @param float $number
88
+     * @return UserSignGongxianEntity
89
+     */
90
+    public function setNumber(float $number): UserSignGongxianEntity
91
+    {
92
+        $this->number = $number;
93
+        return $this;
94
+    }
95
+
96
+    /**
97
+     * @return int
98
+     */
99
+    public function getStatus(): int
100
+    {
101
+        return $this->status;
102
+    }
103
+
104
+    /**
105
+     * @param int $status
106
+     * @return UserSignGongxianEntity
107
+     */
108
+    public function setStatus(int $status): UserSignGongxianEntity
109
+    {
110
+        $this->status = $status;
111
+        return $this;
112
+    }
113
+
114
+    /**
115
+     * @return string
116
+     */
117
+    public function getMark(): string
118
+    {
119
+        return $this->mark;
120
+    }
121
+
122
+    /**
123
+     * @param string $mark
124
+     * @return UserSignGongxianEntity
125
+     */
126
+    public function setMark(string $mark): UserSignGongxianEntity
127
+    {
128
+        $this->mark = $mark;
129
+        return $this;
130
+    }
131
+
132
+    /**
133
+     * @return string
134
+     */
135
+    public function getDesc(): string
136
+    {
137
+        return $this->desc;
138
+    }
139
+
140
+    /**
141
+     * @param string $desc
142
+     * @return UserSignGongxianEntity
143
+     */
144
+    public function setDesc(string $desc): UserSignGongxianEntity
145
+    {
146
+        $this->desc = $desc;
147
+        return $this;
148
+    }
149
+
150
+    /**
151
+     * @return string
152
+     */
153
+    public function getOrderId(): string
154
+    {
155
+        return $this->orderId;
156
+    }
157
+
158
+    /**
159
+     * @param string $orderId
160
+     * @return UserSignGongxianEntity
161
+     */
162
+    public function setOrderId(string $orderId): UserSignGongxianEntity
163
+    {
164
+        $this->orderId = $orderId;
165
+        return $this;
166
+    }
167
+
168
+    /**
169
+     * @return float
170
+     */
171
+    public function getSurplus(): float
172
+    {
173
+        return $this->surplus;
174
+    }
175
+
176
+    /**
177
+     * @param float $surplus
178
+     * @return UserSignGongxianEntity
179
+     */
180
+    public function setSurplus(float $surplus): UserSignGongxianEntity
181
+    {
182
+        $this->surplus = $surplus;
183
+        return $this;
184
+    }
185
+
186
+    /**
187
+     * @return string
188
+     */
189
+    public function getOrderType(): string
190
+    {
191
+        return $this->orderType;
192
+    }
193
+
194
+    /**
195
+     * @param string $orderType
196
+     * @return UserSignGongxianEntity
197
+     */
198
+    public function setOrderType(string $orderType): UserSignGongxianEntity
199
+    {
200
+        $this->orderType = $orderType;
201
+        return $this;
202
+    }
203
+
204
+    /**
205
+     * @return null
206
+     */
207
+    public function getType()
208
+    {
209
+        return $this->type;
210
+    }
211
+
212
+    /**
213
+     * @param mixed $type
214
+     * @return UserSignGongxianEntity
215
+     */
216
+    public function setType($type): UserSignGongxianEntity
217
+    {
218
+        $this->type = $type;
219
+        return $this;
220
+    }
221
+
222
+    /**
223
+     * @return null
224
+     */
225
+    public function getSettlementTime()
226
+    {
227
+        return $this->settlementTime;
228
+    }
229
+
230
+    /**
231
+     * @param mixed $settlementTime
232
+     * @return UserSignGongxianEntity
233
+     */
234
+    public function setSettlementTime($settlementTime): UserSignGongxianEntity
235
+    {
236
+        $this->settlementTime = $settlementTime;
237
+        return $this;
238
+    }
239
+
240
+    /**
241
+     * @return int
242
+     */
243
+    public function getAddtime(): int
244
+    {
245
+        return $this->addtime;
246
+    }
247
+
248
+    /**
249
+     * @param int $addtime
250
+     * @return UserSignGongxianEntity
251
+     */
252
+    public function setAddtime(int $addtime): UserSignGongxianEntity
253
+    {
254
+        $this->addtime = $addtime;
255
+        return $this;
256
+    }
257
+
258
+    /**
259
+     * @return float
260
+     */
261
+    public function getPv(): float
262
+    {
263
+        return $this->pv;
264
+    }
265
+
266
+    /**
267
+     * @param float $pv
268
+     * @return UserSignGongxianEntity
269
+     */
270
+    public function setPv(float $pv): UserSignGongxianEntity
271
+    {
272
+        $this->pv = $pv;
273
+        return $this;
274
+    }
275
+}

+ 237 - 0
app/entity/data/user/UserSignHongbaoEntity.php

@@ -0,0 +1,237 @@
1
+<?php
2
+
3
+namespace app\entity\data\user;
4
+
5
+use app\entity\data\DataEntity;
6
+
7
+class UserSignHongbaoEntity extends DataEntity
8
+{
9
+    public $id = 0;  // 自增id
10
+    public $uid = 0;  // 会员id
11
+    public $number = 0.00;  // 赠送数量
12
+    public $status = 0;  // 红包状态: 1-有效 0-失效 -1待确认
13
+    public $mark = '';  // 备注
14
+    public $desc = '';  // 描述
15
+    public $orderId = '';  // 订单id
16
+    public $surplus = 0.00;  // 剩余
17
+    public $orderType = '';  // 订单类型
18
+    public $type = null;  // 京豆类型: 1-消费赠送,2-消耗
19
+    public $settlementTime = null;  // 结算时间
20
+    public $addtime = 0;  // 添加时间
21
+
22
+    /**
23
+     * @return int
24
+     */
25
+    public function getId(): int
26
+    {
27
+        return $this->id;
28
+    }
29
+
30
+    /**
31
+     * @param int $id
32
+     * @return UserSignHongbaoEntity
33
+     */
34
+    public function setId(int $id): UserSignHongbaoEntity
35
+    {
36
+        $this->id = $id;
37
+        return $this;
38
+    }
39
+
40
+    /**
41
+     * @return int
42
+     */
43
+    public function getUid(): int
44
+    {
45
+        return $this->uid;
46
+    }
47
+
48
+    /**
49
+     * @param int $uid
50
+     * @return UserSignHongbaoEntity
51
+     */
52
+    public function setUid(int $uid): UserSignHongbaoEntity
53
+    {
54
+        $this->uid = $uid;
55
+        return $this;
56
+    }
57
+
58
+    /**
59
+     * @return float
60
+     */
61
+    public function getNumber(): float
62
+    {
63
+        return $this->number;
64
+    }
65
+
66
+    /**
67
+     * @param float $number
68
+     * @return UserSignHongbaoEntity
69
+     */
70
+    public function setNumber(float $number): UserSignHongbaoEntity
71
+    {
72
+        $this->number = $number;
73
+        return $this;
74
+    }
75
+
76
+    /**
77
+     * @return int
78
+     */
79
+    public function getStatus(): int
80
+    {
81
+        return $this->status;
82
+    }
83
+
84
+    /**
85
+     * @param int $status
86
+     * @return UserSignHongbaoEntity
87
+     */
88
+    public function setStatus(int $status): UserSignHongbaoEntity
89
+    {
90
+        $this->status = $status;
91
+        return $this;
92
+    }
93
+
94
+    /**
95
+     * @return string
96
+     */
97
+    public function getMark(): string
98
+    {
99
+        return $this->mark;
100
+    }
101
+
102
+    /**
103
+     * @param string $mark
104
+     * @return UserSignHongbaoEntity
105
+     */
106
+    public function setMark(string $mark): UserSignHongbaoEntity
107
+    {
108
+        $this->mark = $mark;
109
+        return $this;
110
+    }
111
+
112
+    /**
113
+     * @return string
114
+     */
115
+    public function getDesc(): string
116
+    {
117
+        return $this->desc;
118
+    }
119
+
120
+    /**
121
+     * @param string $desc
122
+     * @return UserSignHongbaoEntity
123
+     */
124
+    public function setDesc(string $desc): UserSignHongbaoEntity
125
+    {
126
+        $this->desc = $desc;
127
+        return $this;
128
+    }
129
+
130
+    /**
131
+     * @return string
132
+     */
133
+    public function getOrderId(): string
134
+    {
135
+        return $this->orderId;
136
+    }
137
+
138
+    /**
139
+     * @param string $orderId
140
+     * @return UserSignHongbaoEntity
141
+     */
142
+    public function setOrderId(string $orderId): UserSignHongbaoEntity
143
+    {
144
+        $this->orderId = $orderId;
145
+        return $this;
146
+    }
147
+
148
+    /**
149
+     * @return float
150
+     */
151
+    public function getSurplus(): float
152
+    {
153
+        return $this->surplus;
154
+    }
155
+
156
+    /**
157
+     * @param float $surplus
158
+     * @return UserSignHongbaoEntity
159
+     */
160
+    public function setSurplus(float $surplus): UserSignHongbaoEntity
161
+    {
162
+        $this->surplus = $surplus;
163
+        return $this;
164
+    }
165
+
166
+    /**
167
+     * @return string
168
+     */
169
+    public function getOrderType(): string
170
+    {
171
+        return $this->orderType;
172
+    }
173
+
174
+    /**
175
+     * @param string $orderType
176
+     * @return UserSignHongbaoEntity
177
+     */
178
+    public function setOrderType(string $orderType): UserSignHongbaoEntity
179
+    {
180
+        $this->orderType = $orderType;
181
+        return $this;
182
+    }
183
+
184
+    /**
185
+     * @return null
186
+     */
187
+    public function getType()
188
+    {
189
+        return $this->type;
190
+    }
191
+
192
+    /**
193
+     * @param null $type
194
+     * @return UserSignHongbaoEntity
195
+     */
196
+    public function setType($type)
197
+    {
198
+        $this->type = $type;
199
+        return $this;
200
+    }
201
+
202
+    /**
203
+     * @return null
204
+     */
205
+    public function getSettlementTime()
206
+    {
207
+        return $this->settlementTime;
208
+    }
209
+
210
+    /**
211
+     * @param null $settlementTime
212
+     * @return UserSignHongbaoEntity
213
+     */
214
+    public function setSettlementTime($settlementTime)
215
+    {
216
+        $this->settlementTime = $settlementTime;
217
+        return $this;
218
+    }
219
+
220
+    /**
221
+     * @return int
222
+     */
223
+    public function getAddtime(): int
224
+    {
225
+        return $this->addtime;
226
+    }
227
+
228
+    /**
229
+     * @param int $addtime
230
+     * @return UserSignHongbaoEntity
231
+     */
232
+    public function setAddtime(int $addtime): UserSignHongbaoEntity
233
+    {
234
+        $this->addtime = $addtime;
235
+        return $this;
236
+    }
237
+}