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

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

sunxbiao 1 год назад
Родитель
Сommit
b8aa78fd99

+ 33 - 0
app/common/dao/store/coupon/StoreCouponUserDao.php

@@ -12,8 +12,10 @@ namespace app\common\dao\store\coupon;
12 12
 
13 13
 
14 14
 use app\common\dao\BaseDao;
15
+use app\common\enum\store\StoreCouponUserEnum;
15 16
 use app\common\model\BaseModel;
16 17
 use app\common\model\store\coupon\StoreCouponUser;
18
+use app\entity\data\store\StoreCouponUserEntity;
17 19
 
18 20
 /**
19 21
  * Class StoreCouponUserDao
@@ -86,4 +88,35 @@ class StoreCouponUserDao extends BaseDao
86 88
     {
87 89
         return StoreCouponUser::getDB()->where('coupon_id', $couponId)->count();
88 90
     }
91
+
92
+    /**
93
+     * @param int $merId
94
+     * @param int $uid
95
+     * @return StoreCouponUserEntity[]
96
+     */
97
+    public function getValidStoreCouponUserEntityListByMerIdAndUid(int $merId, int $uid): array
98
+    {
99
+        $entityList = [];
100
+        try {
101
+            $dateTime = date('Y-m-d H:i:s');
102
+            /** @var StoreCouponUser $model */
103
+            $model = $this->getModel();
104
+            $dataListRes = $model::getDB()
105
+                ->where('mer_id', '=', $merId)
106
+                ->where('uid', '=', $uid)
107
+                ->where('status', '=', StoreCouponUserEnum::STATUS['Unused']['code'])
108
+                ->where('is_fail', '=', StoreCouponUserEnum::IS_FAIL['No']['code'])
109
+                ->where('start_time', '<=', $dateTime)
110
+                ->where('end_time', '>=', $dateTime)
111
+                ->select()
112
+                ->toArray();
113
+            if (!empty($dataListRes)) {
114
+                foreach ($dataListRes as $data) {
115
+                    $entityList[] = StoreCouponUserEntity::newInstance($data);
116
+                }
117
+            }
118
+        } catch (\Exception $e) {
119
+        }
120
+        return $entityList;
121
+    }
89 122
 }

+ 24 - 0
app/common/dao/store/shipping/ShippingTemplateDao.php

@@ -7,6 +7,8 @@
7 7
  */
8 8
 namespace app\common\dao\store\shipping;
9 9
 
10
+use app\common\model\store\shipping\ShippingTemplate;
11
+use app\entity\data\shipping\ShippingTemplateEntity;
10 12
 use think\facade\Db;
11 13
 use app\common\dao\BaseDao;
12 14
 use app\common\model\store\shipping\ShippingTemplate as model;
@@ -86,4 +88,26 @@ class ShippingTemplateDao  extends BaseDao
86 88
     {
87 89
         return ($this->getModel())::getDB()->where('mer_id',$merId)->field('shipping_template_id,name')->select();
88 90
     }
91
+
92
+    /**
93
+     * @param int $shippingTemplateId
94
+     * @return \app\entity\CommonEntity
95
+     */
96
+    public function getShippingTemplateEntityByShippingTemplateId(int $shippingTemplateId): \app\entity\CommonEntity
97
+    {
98
+        $data = [];
99
+        try {
100
+            /** @var ShippingTemplate $model */
101
+            $model = $this->getModel();
102
+            $dataRes = $model::getDB()
103
+                ->where('shipping_template_id', '=', $shippingTemplateId)
104
+                ->find();
105
+            if (!empty($dataRes)) {
106
+                $data = $dataRes->toArray();
107
+            }
108
+        } catch (\Exception $e) {
109
+
110
+        }
111
+        return ShippingTemplateEntity::newInstance($data);
112
+    }
89 113
 }

+ 26 - 0
app/common/dao/store/shipping/ShippingTemplateFreeDao.php

@@ -7,6 +7,7 @@
7 7
  */
8 8
 namespace app\common\dao\store\shipping;
9 9
 
10
+use app\entity\data\shipping\ShippingTemplateFreeEntity;
10 11
 use think\facade\Db;
11 12
 use app\common\dao\BaseDao;
12 13
 use app\common\model\store\shipping\ShippingTemplateFree as model;
@@ -64,4 +65,29 @@ class ShippingTemplateFreeDao  extends BaseDao
64 65
     {
65 66
         return ($this->getModel()::getDB())->insertAll($data);
66 67
     }
68
+
69
+    /**
70
+     * @param int $tempId
71
+     * @return ShippingTemplateFreeEntity[]
72
+     */
73
+    public function getShippingTemplateFreeEntityListByTempId(int $tempId): array
74
+    {
75
+        $entityList = [];
76
+        try {
77
+            /** @var model $model */
78
+            $model = $this->getModel();
79
+            $dataListRes = $model::getDB()
80
+                ->where('temp_id', '=', $tempId)
81
+                ->order('shipping_template_free_id DESC')
82
+                ->select()
83
+                ->toArray();
84
+            if (!empty($dataListRes)) {
85
+                foreach ($dataListRes as $data) {
86
+                    $entityList[] = ShippingTemplateFreeEntity::newInstance($data);
87
+                }
88
+            }
89
+        } catch (\Exception $e) {
90
+        }
91
+        return $entityList;
92
+    }
67 93
 }

+ 25 - 0
app/common/dao/store/shipping/ShippingTemplateRegionDao.php

@@ -7,6 +7,7 @@
7 7
  */
8 8
 namespace app\common\dao\store\shipping;
9 9
 
10
+use app\entity\data\shipping\ShippingTemplateRegionEntity;
10 11
 use think\facade\Db;
11 12
 use app\common\dao\BaseDao;
12 13
 use app\common\model\store\shipping\ShippingTemplateRegion as model;
@@ -64,4 +65,28 @@ class ShippingTemplateRegionDao  extends BaseDao
64 65
         return ($this->getModel()::getDB())->insertAll($data);
65 66
     }
66 67
 
68
+    /**
69
+     * @param int $tempId
70
+     * @return ShippingTemplateRegionEntity[]
71
+     */
72
+    public function getShippingTemplateRegionEntityListByTempId(int $tempId): array
73
+    {
74
+        $entityList = [];
75
+        try {
76
+            /** @var model $model */
77
+            $model = $this->getModel();
78
+            $dataListRes = $model::getDB()
79
+                ->where('temp_id', '=', $tempId)
80
+                ->order('shipping_template_region_id DESC')
81
+                ->select()
82
+                ->toArray();
83
+            if (!empty($dataListRes)) {
84
+                foreach ($dataListRes as $data) {
85
+                    $entityList[] = ShippingTemplateRegionEntity::newInstance($data);
86
+                }
87
+            }
88
+        } catch (\Exception $e) {
89
+        }
90
+        return $entityList;
91
+    }
67 92
 }

+ 25 - 0
app/common/dao/store/shipping/ShippingTemplateUndeliveryDao.php

@@ -8,6 +8,7 @@ namespace app\common\dao\store\shipping;
8 8
 
9 9
 use app\common\dao\BaseDao;
10 10
 use app\common\model\store\shipping\ShippingTemplateUndelivery as model;
11
+use app\entity\data\shipping\ShippingTemplateUndeliveryEntity;
11 12
 
12 13
 class ShippingTemplateUndeliveryDao  extends BaseDao
13 14
 {
@@ -51,4 +52,28 @@ class ShippingTemplateUndeliveryDao  extends BaseDao
51 52
         if($temp_id)
52 53
             ($this->getModel())::getDB()->where('temp_id','in',$temp_id)->delete();
53 54
     }
55
+
56
+    /**
57
+     * @param int $tempId
58
+     * @return ShippingTemplateUndeliveryEntity[]
59
+     */
60
+    public function getShippingTemplateUndeliveryEntityListByTempId(int $tempId): array
61
+    {
62
+        $entityList = [];
63
+        try {
64
+            /** @var model $model */
65
+            $model = $this->getModel();
66
+            $dataListRes = $model::getDB()
67
+                ->where('temp_id', '=', $tempId)
68
+                ->select()
69
+                ->toArray();
70
+            if (!empty($dataListRes)) {
71
+                foreach ($dataListRes as $data) {
72
+                    $entityList[] = ShippingTemplateUndeliveryEntity::newInstance($data);
73
+                }
74
+            }
75
+        } catch (\Exception $e) {
76
+        }
77
+        return $entityList;
78
+    }
54 79
 }

+ 33 - 0
app/common/enum/shipping/ShippingTemplateEnum.php

@@ -0,0 +1,33 @@
1
+<?php
2
+
3
+namespace app\common\enum\shipping;
4
+
5
+use app\common\enum\CommonEnum;
6
+
7
+class ShippingTemplateEnum extends CommonEnum
8
+{
9
+    // 计费方式
10
+    const TYPE = [
11
+        'Quantity' => ['code' => 0, 'name' => '数量'],
12
+        'Weight' => ['code' => 1, 'name' => '重量'],
13
+        'Volume' => ['code' => 2, 'name' => '体积'],
14
+    ];
15
+
16
+    // 开启指定包邮
17
+    const APPOINT = [
18
+        'No' => ['code' => 0, 'name' => '未开启'],
19
+        'Yes' => ['code' => 1, 'name' => '已开启']
20
+    ];
21
+
22
+    // 开启指定区域不配送
23
+    const UNDELIVERY = [
24
+        'No' => ['code' => 0, 'name' => '未开启'],
25
+        'Yes' => ['code' => 1, 'name' => '已开启']
26
+    ];
27
+
28
+    // 默认模板
29
+    const IS_DEFAULT = [
30
+        'No' => ['code' => 0, 'name' => '否'],
31
+        'Yes' => ['code' => 1, 'name' => '是']
32
+    ];
33
+}

+ 22 - 0
app/common/enum/store/StoreCouponUserEnum.php

@@ -0,0 +1,22 @@
1
+<?php
2
+
3
+namespace app\common\enum\store;
4
+
5
+use app\common\enum\CommonEnum;
6
+
7
+class StoreCouponUserEnum extends CommonEnum
8
+{
9
+
10
+    const STATUS = [
11
+        'Unused' => ['code' => 0, 'name' => '未使用'],
12
+        'Used' => ['code' => 1, 'name' => '已使用'],
13
+        'Expired' => ['code' => 2, 'name' => '已过期'],
14
+    ];
15
+
16
+    const IS_FAIL = [
17
+        'No' => ['code' => 0, 'name' => '未失效'],
18
+        'Yes' => ['code' => 1, 'name' => '失效']
19
+    ];
20
+
21
+
22
+}

+ 10 - 0
app/common/repositories/store/coupon/StoreCouponUserRepository.php

@@ -14,6 +14,7 @@ namespace app\common\repositories\store\coupon;
14 14
 use app\common\dao\store\coupon\StoreCouponUserDao;
15 15
 use app\common\model\store\coupon\StoreCoupon;
16 16
 use app\common\repositories\BaseRepository;
17
+use app\entity\data\store\StoreCouponUserEntity;
17 18
 use think\facade\Db;
18 19
 use think\db\exception\DataNotFoundException;
19 20
 use think\db\exception\DbException;
@@ -151,4 +152,13 @@ class StoreCouponUserRepository extends BaseRepository
151 152
         return compact('count', 'list',"query");
152 153
     }
153 154
 
155
+    /**
156
+     * @param int $merId
157
+     * @param int $uid
158
+     * @return StoreCouponUserEntity[]
159
+     */
160
+    public function getValidStoreCouponUserEntityListByMerIdAndUid(int $merId, int $uid): array
161
+    {
162
+        return $this->dao->getValidStoreCouponUserEntityListByMerIdAndUid($merId, $uid);
163
+    }
154 164
 }

+ 141 - 40
app/common/repositories/store/order/StoreOrderRepository.php

@@ -12,6 +12,7 @@ namespace app\common\repositories\store\order;
12 12
 
13 13
 
14 14
 use app\common\dao\store\order\StoreOrderDao;
15
+use app\common\enum\shipping\ShippingTemplateEnum;
15 16
 use app\common\enum\store\CartEnum;
16 17
 use app\common\enum\store\ProductEnum;
17 18
 use app\common\model\store\order\StoreGroupOrder;
@@ -31,6 +32,10 @@ use app\common\repositories\store\MerchantTakeRepository;
31 32
 use app\common\repositories\store\product\ProductAttrValueRepository;
32 33
 use app\common\repositories\store\product\ProductRepository;
33 34
 use app\common\repositories\store\shipping\ExpressRepository;
35
+use app\common\repositories\store\shipping\ShippingTemplateFreeRepository;
36
+use app\common\repositories\store\shipping\ShippingTemplateRegionRepository;
37
+use app\common\repositories\store\shipping\ShippingTemplateRepository;
38
+use app\common\repositories\store\shipping\ShippingTemplateUndeliveRepository;
34 39
 use app\common\repositories\store\StoreSeckillActiveRepository;
35 40
 use app\common\repositories\system\attachment\AttachmentRepository;
36 41
 use app\common\repositories\system\merchant\FinancialRecordRepository;
@@ -43,6 +48,7 @@ use app\common\repositories\user\UserThirdRepository;
43 48
 use app\common\repositories\wechat\RoutineQrcodeRepository;
44 49
 use app\common\repositories\wechat\WechatUserRepository;
45 50
 use app\controller\api\user\Volunteer;
51
+use app\entity\data\merchant\MerchantEntity;
46 52
 use app\entity\data\product\ShareEntity;
47 53
 use app\entity\data\store\CartEntity;
48 54
 use app\entity\data\user\AddressEntity;
@@ -11537,9 +11543,11 @@ class StoreOrderRepository extends BaseRepository
11537 11543
 
11538 11544
     /**
11539 11545
      * @param CartEntity[] $cartEntityList
11546
+     * @param AddressEntity $addressEntity
11547
+     * @param UserEntity $userEntity
11540 11548
      * @return array
11541 11549
      */
11542
-    public function cartIdByOrderInfoNew(array $cartEntityList)
11550
+    public function cartIdByOrderInfoNew(array $cartEntityList, AddressEntity $addressEntity, UserEntity $userEntity)
11543 11551
     {
11544 11552
         // 商户
11545 11553
         /** @var MerchantRepository $merchantRepository */
@@ -11556,22 +11564,42 @@ class StoreOrderRepository extends BaseRepository
11556 11564
         // 商户设置秒杀商品关联表
11557 11565
         /** @var StoreSeckillActiveRepository $storeSeckillActiveRepository */
11558 11566
         $storeSeckillActiveRepository = app()->make(StoreSeckillActiveRepository::class);
11567
+
11559 11568
         // 优惠券 列表(商户or平台)
11560 11569
         /** @var StoreCouponRepository $storeCouponRepository */
11561 11570
         $storeCouponRepository = app()->make(StoreCouponRepository::class);
11562 11571
         // 优惠券 商品 关联表
11563 11572
         /** @var StoreCouponProductRepository $storeCouponProductRepository */
11564 11573
         $storeCouponProductRepository = app()->make(StoreCouponProductRepository::class);
11565
-
11566
-        $list = [];
11574
+        // 用户的优惠券领取记录
11575
+        /** @var StoreCouponUserRepository $storeCouponUserRepository */
11576
+        $storeCouponUserRepository = app()->make(StoreCouponUserRepository::class);
11577
+
11578
+        // 获取 运费表数据  商品 对应的 运费模板
11579
+        /** @var ShippingTemplateRepository $shippingTemplateRepository */
11580
+        $shippingTemplateRepository = app()->make(ShippingTemplateRepository::class);
11581
+        // 获取  商品 对应的 运费模板 de 指定不配送区域表
11582
+        /** @var ShippingTemplateUndeliveRepository $shippingTemplateUndeliveRepository */
11583
+        $shippingTemplateUndeliveRepository = app()->make(ShippingTemplateUndeliveRepository::class);
11584
+        // 获取  商品 对应的 运费模板 de 指定包邮信息表
11585
+        /** @var ShippingTemplateFreeRepository $shippingTemplateFreeRepository */
11586
+        $shippingTemplateFreeRepository = app()->make(ShippingTemplateFreeRepository::class);
11587
+        // 获取  商品 对应的 运费模板 de 配送区域表
11588
+        /** @var ShippingTemplateRegionRepository $shippingTemplateRegionRepository */
11589
+        $shippingTemplateRegionRepository = app()->make(ShippingTemplateRegionRepository::class);
11590
+
11591
+        $merchantMap = [];
11567 11592
         $yanglaojin = 0.00;
11568
-        $price = 0.00;
11569 11593
         $totalPrice = 0.00;
11570 11594
         $totalNum = 0;
11571 11595
         $productPriceMap = [];
11572 11596
         $validTotalPrice = 0.00;
11573
-        $product_cart = [];
11597
+        $productCart = [];
11598
+        // $address ? ($noDeliver ? 'noDeliver' : 'finish') : 'noAddress'
11599
+        $status = 'noAddress';
11600
+        $postage = 0.00;
11574 11601
 
11602
+        // 循环购物车 对购物车内的商品 进行条件验证 以及根据不同的商品 计算邮费
11575 11603
         foreach ($cartEntityList as $cartEntity) {
11576 11604
             // 验证商户
11577 11605
             $merchantEntity = $merchantRepository->getMerchantEntityByMerchantId($cartEntity->getMerId());
@@ -11629,6 +11657,99 @@ class StoreOrderRepository extends BaseRepository
11629 11657
                 }
11630 11658
             }
11631 11659
 
11660
+            // ??? 暂时不理解这一步
11661
+            // type => '商品类型:1:普通商品。2:爆款商品。3:消费积分商品 。5:会员专享商品(城中大仓)6:每日免费领商品 7:商户特殊商品 8:共富会员商品 9:共富高级会员商品 10:高级会员商品 11村代理商品(废弃) 12镇代理商品(废弃) 13县代理商品(废弃)  14- 合伙人商品 15 股权商品 16合伙人+股权商品',
11662
+            // ProductType => 0.普通商品 1.秒杀商品
11663
+            $productEntity->setProductType($productEntity->getType());
11664
+            // 计算单价
11665
+            $price = bcmul($cartEntity->getCartNum(), $productAttrValueEntity->getPrice(), 2);
11666
+            // 计算总价
11667
+            $totalPrice = bcadd($totalPrice, $price, 2);
11668
+            // 计算总数
11669
+            $totalNum = bcadd($totalNum, $cartEntity->getCartNum(), 2);
11670
+
11671
+            // 如果是 普通商品 product_type 类型 0=普通产品
11672
+            if ($cartEntity->getProductType() == CartEnum::PRODUCT_TYPE['Ordinary']['code']) {
11673
+                $productPriceMap[$cartEntity->getProductId()] = bcadd($productPriceMap[$cartEntity->getProductId()] ?? 0, $price, 2);
11674
+                $validTotalPrice = bcadd($validTotalPrice, $price, 2);
11675
+            }
11676
+
11677
+            $productCart[$cartEntity->getProductId()][] = $cartEntity->getCartId();
11678
+
11679
+
11680
+            // 计算运费 获取该商品的运费模板 运费表
11681
+            // TODO  注意 这个地址好像有问题,我再 客户端->收货地址管理中 (rrx_user_address)增加的廊坊市 对应的城市编号是(code_list)315 且city_id 字段的值是 2,而我再后台设置 可配送地址时 ,廊坊市对应的编码是 58247
11682
+            // 判断商品是否是 供应链(微唯宝)商品
11683
+            if (!empty($productAttrValueEntity->getGongSkuId())) {
11684
+                $freight = GongApiRequest::freight($addressEntity->getCityId(), [['sku_id' => $productAttrValueEntity->getGongSkuId(), 'num' => $cartEntity->getCartNum()]]);
11685
+                $freight = $freight['freight'] ?? 0;
11686
+                $postage = bcadd($postage, $freight, 2);
11687
+            } else {
11688
+                $shippingTemplateEntity = $shippingTemplateRepository->getShippingTemplateEntityByShippingTemplateId($productEntity->getTempId());
11689
+                if (empty($shippingTemplateEntity->getShippingTemplateId())) {
11690
+                    throw new ValidateException('未查询到商品所绑定的运费模板');
11691
+                } else {
11692
+                    // 判断是否开启 开启指定区域不配送
11693
+                    if ($shippingTemplateEntity->getUndelivery() == ShippingTemplateEnum::UNDELIVERY['Yes']['code']) {
11694
+                        // 获取运费模板的 指定不配送区域列表
11695
+                        $shippingTemplateUndeliveryEntityList = $shippingTemplateUndeliveRepository->getShippingTemplateUndeliveryEntityListByTempId($shippingTemplateEntity->getShippingTemplateId());
11696
+                        foreach ($shippingTemplateUndeliveryEntityList as $shippingTemplateUndeliveryEntity) {
11697
+                            // 验证 此次配送地址 是否在不配送区域中
11698
+                            if (in_array($addressEntity->getCityId(), $shippingTemplateUndeliveryEntity->getCityIdList())) {
11699
+                                throw new ValidateException($productEntity->getStoreName() . '此商品不支持该配送区域');
11700
+                            }
11701
+                        }
11702
+                    }
11703
+
11704
+                    $isBaoYou = false;
11705
+                    $number = 0.00;
11706
+                    // 获取 当前商品的 计费方式 (计费方式 0=数量 1=重量 2=体积)
11707
+                    if ($shippingTemplateEntity->getType() == ShippingTemplateEnum::TYPE['Quantity']['code']) {
11708
+                        $number = $cartEntity->getCartNum();
11709
+                    } else if ($shippingTemplateEntity->getType() == ShippingTemplateEnum::TYPE['Weight']['code']) {
11710
+                        $number = bcmul($cartEntity->getCartNum(), $productAttrValueEntity->getWeight(), 2);
11711
+                    } else {
11712
+                        $number = bcmul($cartEntity->getCartNum(), $productAttrValueEntity->getVolume(), 2);
11713
+                    }
11714
+
11715
+                    // 获取 指定包邮信息 包邮信息表
11716
+                    $shippingTemplateFreeEntityList = $shippingTemplateFreeRepository->getShippingTemplateFreeEntityListByTempId($shippingTemplateEntity->getShippingTemplateId());
11717
+                    foreach ($shippingTemplateFreeEntityList as $shippingTemplateFreeEntity) {
11718
+                        // 判断当前收货地址 是不是 在 指定 包邮 地点内
11719
+                        if (in_array($addressEntity->getCityId(), $shippingTemplateFreeEntity->getCityIdList())) {
11720
+                            // 判断当前 商品 是否符合 最高包邮数量上限 和 最低包邮金额
11721
+                            if ($number <= $shippingTemplateFreeEntity->getNumber() && $price >= $shippingTemplateFreeEntity->getPrice()) {
11722
+                                $isBaoYou = true;
11723
+                            }
11724
+                        }
11725
+                    }
11726
+
11727
+                    // 如果不包邮 则需要计算邮费
11728
+                    if (!$isBaoYou){
11729
+                        // 配送区域表
11730
+                        $shippingTemplateRegionEntityList = $shippingTemplateRegionRepository->getShippingTemplateRegionEntityListByTempId($shippingTemplateEntity->getShippingTemplateId());
11731
+                        foreach ($shippingTemplateRegionEntityList as $shippingTemplateRegionEntity) {
11732
+                            // 判断当前收货地址 是否在可配送区域内
11733
+                            if (in_array($addressEntity->getCityId(), $shippingTemplateRegionEntity->getCityIdList())) {
11734
+                                // 比如 该商品 重量 5.03kg 首件重量 2kg 运费 2元  续件重量 3kg 续费3元
11735
+                                // 那本次 运费就是 首件运费 + ((重量 - 首件重量)/续件重量) * 续费单价
11736
+                                // 那本次 运费就是 2 + ((5.03 - 2)/3)向上取整 * 3 = 8
11737
+                                // 首件(重量or体积) 运费计算
11738
+                                $postage = bcadd($postage, $shippingTemplateRegionEntity->getFirstPrice(), 2);
11739
+                                if ($number > $shippingTemplateRegionEntity->getFirst()) {
11740
+                                    // 数量(重量or体积) 超出 首件部分 也就是续费部分
11741
+                                    $excess = bcsub($number, $shippingTemplateRegionEntity->getFirst(), 3);
11742
+                                    // 查看 需 续费几次 并向上取整
11743
+                                    $continueNum = ceil(bcdiv($excess, $shippingTemplateRegionEntity->getContinue(), 3));
11744
+                                    $continueCost = bcmul($continueNum, $shippingTemplateRegionEntity->getContinuePrice(), 2);
11745
+                                    $postage = bcadd($postage, $continueCost, 2);
11746
+                                }
11747
+                            }
11748
+                        }
11749
+                    }
11750
+                }
11751
+            }
11752
+
11632 11753
             // // 将商户 存贮
11633 11754
             // $merchantEntityArr = $merchantEntity->toArray();
11634 11755
             //
@@ -11650,51 +11771,31 @@ class StoreOrderRepository extends BaseRepository
11650 11771
             // $list[$cartEntity->getMerId()] = $merchantEntityArr;
11651 11772
             // $list[$cartEntity->getMerId()]['hasCoupon'] = 0;
11652 11773
             // // 应该还有商品信息等数据
11653
-            // $list[$cartEntity->getMerId()]['list'][] = $cartEntity->toArray();
11654
-
11655
-
11656
-            // ??? 暂时不理解这一步
11657
-            // type => '商品类型:1:普通商品。2:爆款商品。3:消费积分商品 。5:会员专享商品(城中大仓)6:每日免费领商品 7:商户特殊商品 8:共富会员商品 9:共富高级会员商品 10:高级会员商品 11村代理商品(废弃) 12镇代理商品(废弃) 13县代理商品(废弃)  14- 合伙人商品 15 股权商品 16合伙人+股权商品',
11658
-            // ProductType => 0.普通商品 1.秒杀商品
11659
-            $productEntity->setProductType($productEntity->getType());
11660
-            // 计算单价
11661
-            $price = bcmul($cartEntity->getCartNum(), $productAttrValueEntity->getPrice(), 2);
11662
-            // 计算总价
11663
-            $totalPrice = bcadd($totalPrice, $price, 2);
11664
-            // 计算总数
11665
-            $totalNum = bcadd($totalNum, $cartEntity->getCartNum(), 2);
11666 11774
 
11667
-            // 如果是 普通商品 product_type 类型 0=普通产品
11668
-            if ($cartEntity->getProductType() == CartEnum::PRODUCT_TYPE['Ordinary']['code']) {
11669
-                $productPriceMap[$cartEntity->getProductId()] = bcadd($productPriceMap[$cartEntity->getProductId()] ?? 0, $price, 2);
11670
-
11671
-            }
11672 11775
 
11673
-            $product_cart[$cartEntityList->getProductId()] = [$cartEntityList->getCartId()];
11674
-
11675
-            // unset($cartInfo['list'][$_k]['product']['temp']);
11676
-            // $cartInfo['list'][$_k] = $cart;
11677
-            // if (!$address || !$cart['product']['temp']) {
11678
-            //     $cartInfo['list'][$_k]['undelivered'] = true;
11679
-            //     $noDeliver = true;
11680
-            //     continue;
11681
-            // }
11776
+            $merchantMap[$cartEntity->getMerId()]['merchantEntity'] = $merchantEntity;
11682 11777
         }
11683 11778
 
11684 11779
 
11780
+        foreach ($merchantMap as $merId => $item) {
11781
+            /** @var MerchantEntity $merchantEntity */
11782
+            $merchantEntity = $item['merchantEntity'];
11783
+            // 计算优惠金额
11784
+            $storeCouponUserEntityList = $storeCouponUserRepository->getValidStoreCouponUserEntityListByMerIdAndUid($merchantEntity->getMerId(), $userEntity->getUid());
11685 11785
 
11786
+        }
11686 11787
 
11687 11788
 
11688 11789
 
11689 11790
         return [
11690
-            // 'youhui_price' => 0.00, // 随机减金额
11691
-            // 'order_price' => set_price_rtrim($order_price),
11692
-            // 'total_price' => set_price_rtrim($order_total_price), // 订单总价
11693
-            // 'address' => $address,
11694
-            // 'order' => $merchantInfo,
11695
-            // 'status' => $address ? ($noDeliver ? 'noDeliver' : 'finish') : 'noAddress',
11696
-            // 'is_dacang_vip_product' => $is_dacang_vip_product,
11697
-            // 'youhui_price_key' => $uid_youhui_price_str ?? ''
11791
+            'youhui_price' => 0.00, // 随机减金额
11792
+            'order_price' => 0.00,
11793
+            'total_price' => 0.00, // 订单总价
11794
+            'address' => $address,
11795
+            'order' => $merchantInfo,
11796
+            'status' => $status,
11797
+            'is_dacang_vip_product' => $is_dacang_vip_product,
11798
+            'youhui_price_key' => $uid_youhui_price_str ?? ''
11698 11799
         ];
11699 11800
     }
11700 11801
 }

Разница между файлами не показана из-за своего большого размера
+ 1425 - 2765
app/common/repositories/store/order/StoreOrderRepositoryCopy.php


+ 10 - 0
app/common/repositories/store/shipping/ShippingTemplateFreeRepository.php

@@ -8,6 +8,7 @@ namespace app\common\repositories\store\shipping;
8 8
 
9 9
 use app\common\repositories\BaseRepository;
10 10
 use app\common\dao\store\shipping\ShippingTemplateFreeDao as dao;
11
+use app\entity\data\shipping\ShippingTemplateFreeEntity;
11 12
 
12 13
 class ShippingTemplateFreeRepository extends BaseRepository
13 14
 {
@@ -66,4 +67,13 @@ class ShippingTemplateFreeRepository extends BaseRepository
66 67
     {
67 68
         return $this->dao->insertAll($data);
68 69
     }
70
+
71
+    /**
72
+     * @param int $tempId
73
+     * @return ShippingTemplateFreeEntity[]
74
+     */
75
+    public function getShippingTemplateFreeEntityListByTempId(int $tempId): array
76
+    {
77
+        return $this->dao->getShippingTemplateFreeEntityListByTempId($tempId);
78
+    }
69 79
 }

+ 9 - 0
app/common/repositories/store/shipping/ShippingTemplateRegionRepository.php

@@ -8,6 +8,7 @@ namespace app\common\repositories\store\shipping;
8 8
 
9 9
 use app\common\repositories\BaseRepository;
10 10
 use app\common\dao\store\shipping\ShippingTemplateRegionDao as dao;
11
+use app\entity\data\shipping\ShippingTemplateRegionEntity;
11 12
 
12 13
 class ShippingTemplateRegionRepository extends BaseRepository
13 14
 {
@@ -68,4 +69,12 @@ class ShippingTemplateRegionRepository extends BaseRepository
68 69
         return $this->dao->insertAll($data);
69 70
     }
70 71
 
72
+    /**
73
+     * @param int $tempId
74
+     * @return ShippingTemplateRegionEntity[]
75
+     */
76
+    public function getShippingTemplateRegionEntityListByTempId(int $tempId): array
77
+    {
78
+        return $this->dao->getShippingTemplateRegionEntityListByTempId($tempId);
79
+    }
71 80
 }

+ 11 - 0
app/common/repositories/store/shipping/ShippingTemplateRepository.php

@@ -10,6 +10,7 @@ namespace app\common\repositories\store\shipping;
10 10
 use app\common\repositories\BaseRepository;
11 11
 use app\common\dao\store\shipping\ShippingTemplateDao as dao;
12 12
 use app\common\repositories\store\product\ProductRepository;
13
+use app\entity\data\shipping\ShippingTemplateEntity;
13 14
 use think\facade\Db;
14 15
 
15 16
 class ShippingTemplateRepository extends BaseRepository
@@ -230,4 +231,14 @@ class ShippingTemplateRepository extends BaseRepository
230 231
         return $this->create($data);
231 232
     }
232 233
 
234
+    /**
235
+     * @param int $shippingTemplateId
236
+     * @return ShippingTemplateEntity
237
+     */
238
+    public function getShippingTemplateEntityByShippingTemplateId(int $shippingTemplateId): ShippingTemplateEntity
239
+    {
240
+        /** @var ShippingTemplateEntity $entity */
241
+        $entity = $this->dao->getShippingTemplateEntityByShippingTemplateId($shippingTemplateId);
242
+        return $entity;
243
+    }
233 244
 }

+ 9 - 1
app/common/repositories/store/shipping/ShippingTemplateUndeliveRepository.php

@@ -9,6 +9,7 @@ namespace app\common\repositories\store\shipping;
9 9
 
10 10
 use app\common\repositories\BaseRepository;
11 11
 use app\common\dao\store\shipping\ShippingTemplateUndeliveryDao as dao;
12
+use app\entity\data\shipping\ShippingTemplateUndeliveryEntity;
12 13
 
13 14
 class ShippingTemplateUndeliveRepository extends BaseRepository
14 15
 {
@@ -55,5 +56,12 @@ class ShippingTemplateUndeliveRepository extends BaseRepository
55 56
         }
56 57
     }
57 58
 
58
-
59
+    /**
60
+     * @param int $tempId
61
+     * @return ShippingTemplateUndeliveryEntity[]
62
+     */
63
+    public function getShippingTemplateUndeliveryEntityListByTempId(int $tempId): array
64
+    {
65
+        return $this->dao->getShippingTemplateUndeliveryEntityListByTempId($tempId);
66
+    }
59 67
 }

+ 180 - 0
app/entity/data/shipping/ShippingTemplateEntity.php

@@ -0,0 +1,180 @@
1
+<?php
2
+
3
+namespace app\entity\data\shipping;
4
+
5
+use app\entity\data\DataEntity;
6
+
7
+class ShippingTemplateEntity extends DataEntity
8
+{
9
+    public $shippingTemplateId = 0;  // 编号
10
+    public $name = '';  // 模板名称
11
+    public $type = 1;  // 计费方式 0=数量 1=重量 2=体积
12
+    public $appoint = 0;  // 开启指定包邮
13
+    public $undelivery = 0;  // 开启指定区域不配送
14
+    public $merId = 0;  // 商户 id
15
+    public $isDefault = 0;  // 默认模板
16
+    public $sort = 0;  // 排序
17
+    public $createTime = null;  // 添加时间
18
+
19
+    /**
20
+     * @return int
21
+     */
22
+    public function getShippingTemplateId(): int
23
+    {
24
+        return $this->shippingTemplateId;
25
+    }
26
+
27
+    /**
28
+     * @param int $shippingTemplateId
29
+     * @return ShippingTemplateEntity
30
+     */
31
+    public function setShippingTemplateId(int $shippingTemplateId): ShippingTemplateEntity
32
+    {
33
+        $this->shippingTemplateId = $shippingTemplateId;
34
+        return $this;
35
+    }
36
+
37
+    /**
38
+     * @return string
39
+     */
40
+    public function getName(): string
41
+    {
42
+        return $this->name;
43
+    }
44
+
45
+    /**
46
+     * @param string $name
47
+     * @return ShippingTemplateEntity
48
+     */
49
+    public function setName(string $name): ShippingTemplateEntity
50
+    {
51
+        $this->name = $name;
52
+        return $this;
53
+    }
54
+
55
+    /**
56
+     * @return int
57
+     */
58
+    public function getType(): int
59
+    {
60
+        return $this->type;
61
+    }
62
+
63
+    /**
64
+     * @param int $type
65
+     * @return ShippingTemplateEntity
66
+     */
67
+    public function setType(int $type): ShippingTemplateEntity
68
+    {
69
+        $this->type = $type;
70
+        return $this;
71
+    }
72
+
73
+    /**
74
+     * @return int
75
+     */
76
+    public function getAppoint(): int
77
+    {
78
+        return $this->appoint;
79
+    }
80
+
81
+    /**
82
+     * @param int $appoint
83
+     * @return ShippingTemplateEntity
84
+     */
85
+    public function setAppoint(int $appoint): ShippingTemplateEntity
86
+    {
87
+        $this->appoint = $appoint;
88
+        return $this;
89
+    }
90
+
91
+    /**
92
+     * @return int
93
+     */
94
+    public function getUndelivery(): int
95
+    {
96
+        return $this->undelivery;
97
+    }
98
+
99
+    /**
100
+     * @param int $undelivery
101
+     * @return ShippingTemplateEntity
102
+     */
103
+    public function setUndelivery(int $undelivery): ShippingTemplateEntity
104
+    {
105
+        $this->undelivery = $undelivery;
106
+        return $this;
107
+    }
108
+
109
+    /**
110
+     * @return int
111
+     */
112
+    public function getMerId(): int
113
+    {
114
+        return $this->merId;
115
+    }
116
+
117
+    /**
118
+     * @param int $merId
119
+     * @return ShippingTemplateEntity
120
+     */
121
+    public function setMerId(int $merId): ShippingTemplateEntity
122
+    {
123
+        $this->merId = $merId;
124
+        return $this;
125
+    }
126
+
127
+    /**
128
+     * @return int
129
+     */
130
+    public function getIsDefault(): int
131
+    {
132
+        return $this->isDefault;
133
+    }
134
+
135
+    /**
136
+     * @param int $isDefault
137
+     * @return ShippingTemplateEntity
138
+     */
139
+    public function setIsDefault(int $isDefault): ShippingTemplateEntity
140
+    {
141
+        $this->isDefault = $isDefault;
142
+        return $this;
143
+    }
144
+
145
+    /**
146
+     * @return int
147
+     */
148
+    public function getSort(): int
149
+    {
150
+        return $this->sort;
151
+    }
152
+
153
+    /**
154
+     * @param int $sort
155
+     * @return ShippingTemplateEntity
156
+     */
157
+    public function setSort(int $sort): ShippingTemplateEntity
158
+    {
159
+        $this->sort = $sort;
160
+        return $this;
161
+    }
162
+
163
+    /**
164
+     * @return null
165
+     */
166
+    public function getCreateTime()
167
+    {
168
+        return $this->createTime;
169
+    }
170
+
171
+    /**
172
+     * @param null $createTime
173
+     * @return ShippingTemplateEntity
174
+     */
175
+    public function setCreateTime($createTime)
176
+    {
177
+        $this->createTime = $createTime;
178
+        return $this;
179
+    }
180
+}

+ 127 - 0
app/entity/data/shipping/ShippingTemplateFreeEntity.php

@@ -0,0 +1,127 @@
1
+<?php
2
+
3
+namespace app\entity\data\shipping;
4
+
5
+use app\entity\data\DataEntity;
6
+
7
+class ShippingTemplateFreeEntity extends DataEntity
8
+{
9
+    public $shippingTemplateFreeId = 0;  // 编号
10
+    public $tempId = 0;  // 模板ID
11
+    public $cityId = '';  // 城市ID /id/id/id/id/
12
+    public $cityIdList = [];  // 城市ID []
13
+    public $number = 0;  // 包邮件数
14
+    public $price = 0.00;  // 包邮金额
15
+
16
+    /**
17
+     * @return int
18
+     */
19
+    public function getShippingTemplateFreeId(): int
20
+    {
21
+        return $this->shippingTemplateFreeId;
22
+    }
23
+
24
+    /**
25
+     * @param int $shippingTemplateFreeId
26
+     * @return ShippingTemplateFreeEntity
27
+     */
28
+    public function setShippingTemplateFreeId(int $shippingTemplateFreeId): ShippingTemplateFreeEntity
29
+    {
30
+        $this->shippingTemplateFreeId = $shippingTemplateFreeId;
31
+        return $this;
32
+    }
33
+
34
+    /**
35
+     * @return int
36
+     */
37
+    public function getTempId(): int
38
+    {
39
+        return $this->tempId;
40
+    }
41
+
42
+    /**
43
+     * @param int $tempId
44
+     * @return ShippingTemplateFreeEntity
45
+     */
46
+    public function setTempId(int $tempId): ShippingTemplateFreeEntity
47
+    {
48
+        $this->tempId = $tempId;
49
+        return $this;
50
+    }
51
+
52
+    /**
53
+     * @return string
54
+     */
55
+    public function getCityId(): string
56
+    {
57
+        return $this->cityId;
58
+    }
59
+
60
+    /**
61
+     * @param string $cityId
62
+     * @return ShippingTemplateFreeEntity
63
+     */
64
+    public function setCityId(string $cityId): ShippingTemplateFreeEntity
65
+    {
66
+        $this->cityId = $cityId;
67
+        $cityIdList = explode("/", $this->cityId);
68
+        $cityIdList = array_filter($cityIdList); // 删除空元素
69
+        $cityIdList = array_values($cityIdList); // 重建数组索引
70
+        $this->setCityIdList($cityIdList);
71
+        return $this;
72
+    }
73
+
74
+    /**
75
+     * @return array
76
+     */
77
+    public function getCityIdList(): array
78
+    {
79
+        return $this->cityIdList;
80
+    }
81
+
82
+    /**
83
+     * @param array $cityIdList
84
+     * @return ShippingTemplateFreeEntity
85
+     */
86
+    public function setCityIdList(array $cityIdList): ShippingTemplateFreeEntity
87
+    {
88
+        $this->cityIdList = $cityIdList;
89
+        return $this;
90
+    }
91
+
92
+    /**
93
+     * @return int
94
+     */
95
+    public function getNumber(): int
96
+    {
97
+        return $this->number;
98
+    }
99
+
100
+    /**
101
+     * @param int $number
102
+     * @return ShippingTemplateFreeEntity
103
+     */
104
+    public function setNumber(int $number): ShippingTemplateFreeEntity
105
+    {
106
+        $this->number = $number;
107
+        return $this;
108
+    }
109
+
110
+    /**
111
+     * @return float
112
+     */
113
+    public function getPrice(): float
114
+    {
115
+        return $this->price;
116
+    }
117
+
118
+    /**
119
+     * @param float $price
120
+     * @return ShippingTemplateFreeEntity
121
+     */
122
+    public function setPrice(float $price): ShippingTemplateFreeEntity
123
+    {
124
+        $this->price = $price;
125
+        return $this;
126
+    }
127
+}

+ 165 - 0
app/entity/data/shipping/ShippingTemplateRegionEntity.php

@@ -0,0 +1,165 @@
1
+<?php
2
+
3
+namespace app\entity\data\shipping;
4
+
5
+use app\entity\data\DataEntity;
6
+
7
+class ShippingTemplateRegionEntity extends DataEntity
8
+{
9
+    public $shippingTemplateRegionId = 0;  // 编号
10
+    public $tempId = 0;  // 模板ID
11
+    public $cityId = '';  // 城市ID /id/id/id/
12
+    public $cityIdList = [];  // 城市ID []
13
+    public $first = '0.00';  // 首件
14
+    public $firstPrice = '0.00';  // 首件运费
15
+    public $continue = '0.00';  // 续件
16
+    public $continuePrice = '0.00';  // 续件运费
17
+
18
+    /**
19
+     * @return int
20
+     */
21
+    public function getShippingTemplateRegionId(): int
22
+    {
23
+        return $this->shippingTemplateRegionId;
24
+    }
25
+
26
+    /**
27
+     * @param int $shippingTemplateRegionId
28
+     * @return ShippingTemplateRegionEntity
29
+     */
30
+    public function setShippingTemplateRegionId(int $shippingTemplateRegionId): ShippingTemplateRegionEntity
31
+    {
32
+        $this->shippingTemplateRegionId = $shippingTemplateRegionId;
33
+        return $this;
34
+    }
35
+
36
+    /**
37
+     * @return int
38
+     */
39
+    public function getTempId(): int
40
+    {
41
+        return $this->tempId;
42
+    }
43
+
44
+    /**
45
+     * @param int $tempId
46
+     * @return ShippingTemplateRegionEntity
47
+     */
48
+    public function setTempId(int $tempId): ShippingTemplateRegionEntity
49
+    {
50
+        $this->tempId = $tempId;
51
+        return $this;
52
+    }
53
+
54
+    /**
55
+     * @return string
56
+     */
57
+    public function getCityId(): string
58
+    {
59
+        return $this->cityId;
60
+    }
61
+
62
+    /**
63
+     * @param string $cityId
64
+     * @return ShippingTemplateRegionEntity
65
+     */
66
+    public function setCityId(string $cityId): ShippingTemplateRegionEntity
67
+    {
68
+        $this->cityId = $cityId;
69
+        $cityIdList = explode("/", $this->cityId);
70
+        $cityIdList = array_filter($cityIdList); // 删除空元素
71
+        $cityIdList = array_values($cityIdList); // 重建数组索引
72
+        $this->setCityIdList($cityIdList);
73
+        return $this;
74
+    }
75
+
76
+    /**
77
+     * @return array
78
+     */
79
+    public function getCityIdList(): array
80
+    {
81
+        return $this->cityIdList;
82
+    }
83
+
84
+    /**
85
+     * @param array $cityIdList
86
+     * @return ShippingTemplateRegionEntity
87
+     */
88
+    public function setCityIdList(array $cityIdList): ShippingTemplateRegionEntity
89
+    {
90
+        $this->cityIdList = $cityIdList;
91
+        return $this;
92
+    }
93
+
94
+    /**
95
+     * @return string
96
+     */
97
+    public function getFirst(): string
98
+    {
99
+        return $this->first;
100
+    }
101
+
102
+    /**
103
+     * @param string $first
104
+     * @return ShippingTemplateRegionEntity
105
+     */
106
+    public function setFirst(string $first): ShippingTemplateRegionEntity
107
+    {
108
+        $this->first = $first;
109
+        return $this;
110
+    }
111
+
112
+    /**
113
+     * @return string
114
+     */
115
+    public function getFirstPrice(): string
116
+    {
117
+        return $this->firstPrice;
118
+    }
119
+
120
+    /**
121
+     * @param string $firstPrice
122
+     * @return ShippingTemplateRegionEntity
123
+     */
124
+    public function setFirstPrice(string $firstPrice): ShippingTemplateRegionEntity
125
+    {
126
+        $this->firstPrice = $firstPrice;
127
+        return $this;
128
+    }
129
+
130
+    /**
131
+     * @return string
132
+     */
133
+    public function getContinue(): string
134
+    {
135
+        return $this->continue;
136
+    }
137
+
138
+    /**
139
+     * @param string $continue
140
+     * @return ShippingTemplateRegionEntity
141
+     */
142
+    public function setContinue(string $continue): ShippingTemplateRegionEntity
143
+    {
144
+        $this->continue = $continue;
145
+        return $this;
146
+    }
147
+
148
+    /**
149
+     * @return string
150
+     */
151
+    public function getContinuePrice(): string
152
+    {
153
+        return $this->continuePrice;
154
+    }
155
+
156
+    /**
157
+     * @param string $continuePrice
158
+     * @return ShippingTemplateRegionEntity
159
+     */
160
+    public function setContinuePrice(string $continuePrice): ShippingTemplateRegionEntity
161
+    {
162
+        $this->continuePrice = $continuePrice;
163
+        return $this;
164
+    }
165
+}

+ 89 - 0
app/entity/data/shipping/ShippingTemplateUndeliveryEntity.php

@@ -0,0 +1,89 @@
1
+<?php
2
+
3
+namespace app\entity\data\shipping;
4
+
5
+use app\entity\data\DataEntity;
6
+
7
+class ShippingTemplateUndeliveryEntity extends DataEntity
8
+{
9
+    public $shippingTemplateUndeliveryId = 0;  // 编号
10
+    public $tempId = 0;  // 模板ID
11
+    public $cityId = '';  // 城市ID /id/id/id/
12
+    public $cityIdList = [];  // 城市ID []
13
+
14
+    /**
15
+     * @return int
16
+     */
17
+    public function getShippingTemplateUndeliveryId(): int
18
+    {
19
+        return $this->shippingTemplateUndeliveryId;
20
+    }
21
+
22
+    /**
23
+     * @param int $shippingTemplateUndeliveryId
24
+     * @return ShippingTemplateUndeliveryEntity
25
+     */
26
+    public function setShippingTemplateUndeliveryId(int $shippingTemplateUndeliveryId): ShippingTemplateUndeliveryEntity
27
+    {
28
+        $this->shippingTemplateUndeliveryId = $shippingTemplateUndeliveryId;
29
+        return $this;
30
+    }
31
+
32
+    /**
33
+     * @return int
34
+     */
35
+    public function getTempId(): int
36
+    {
37
+        return $this->tempId;
38
+    }
39
+
40
+    /**
41
+     * @param int $tempId
42
+     * @return ShippingTemplateUndeliveryEntity
43
+     */
44
+    public function setTempId(int $tempId): ShippingTemplateUndeliveryEntity
45
+    {
46
+        $this->tempId = $tempId;
47
+        return $this;
48
+    }
49
+
50
+    /**
51
+     * @return string
52
+     */
53
+    public function getCityId(): string
54
+    {
55
+        return $this->cityId;
56
+    }
57
+
58
+    /**
59
+     * @param string $cityId
60
+     * @return ShippingTemplateUndeliveryEntity
61
+     */
62
+    public function setCityId(string $cityId): ShippingTemplateUndeliveryEntity
63
+    {
64
+        $this->cityId = $cityId;
65
+        $cityIdList = explode("/", $this->cityId);
66
+        $cityIdList = array_filter($cityIdList); // 删除空元素
67
+        $cityIdList = array_values($cityIdList); // 重建数组索引
68
+        $this->setCityIdList($cityIdList);
69
+        return $this;
70
+    }
71
+
72
+    /**
73
+     * @return array
74
+     */
75
+    public function getCityIdList(): array
76
+    {
77
+        return $this->cityIdList;
78
+    }
79
+
80
+    /**
81
+     * @param array $cityIdList
82
+     * @return ShippingTemplateUndeliveryEntity
83
+     */
84
+    public function setCityIdList(array $cityIdList): ShippingTemplateUndeliveryEntity
85
+    {
86
+        $this->cityIdList = $cityIdList;
87
+        return $this;
88
+    }
89
+}

+ 275 - 0
app/entity/data/store/StoreCouponUserEntity.php

@@ -0,0 +1,275 @@
1
+<?php
2
+
3
+namespace app\entity\data\store;
4
+
5
+use app\entity\data\DataEntity;
6
+
7
+class StoreCouponUserEntity extends DataEntity
8
+{
9
+    public $couponUserId = 0;  // 优惠券发放记录id
10
+    public $couponId = 0;  // 兑换的项目id
11
+    public $merId = 0;  // 商户 id
12
+    public $uid = 0;  // 优惠券所属用户
13
+    public $couponTitle = '';  // 优惠券名称
14
+    public $couponPrice = '0.00';  // 优惠券的面值
15
+    public $useMinPrice = '0.00';  // 最低消费多少金额可用优惠券
16
+    public $createTime = null;  // 优惠券创建时间
17
+    public $startTime = null;  // 优惠券开启时间
18
+    public $endTime = null;  // 优惠券结束时间
19
+    public $useTime = null;  // 使用时间
20
+    public $type = 'send';  // 获取方式
21
+    public $status = 0;  // 状态(0:未使用,1:已使用, 2:已过期)
22
+    public $isFail = 0;  // 是否有效
23
+
24
+    /**
25
+     * @return int
26
+     */
27
+    public function getCouponUserId(): int
28
+    {
29
+        return $this->couponUserId;
30
+    }
31
+
32
+    /**
33
+     * @param int $couponUserId
34
+     * @return StoreCouponUserEntity
35
+     */
36
+    public function setCouponUserId(int $couponUserId): StoreCouponUserEntity
37
+    {
38
+        $this->couponUserId = $couponUserId;
39
+        return $this;
40
+    }
41
+
42
+    /**
43
+     * @return int
44
+     */
45
+    public function getCouponId(): int
46
+    {
47
+        return $this->couponId;
48
+    }
49
+
50
+    /**
51
+     * @param int $couponId
52
+     * @return StoreCouponUserEntity
53
+     */
54
+    public function setCouponId(int $couponId): StoreCouponUserEntity
55
+    {
56
+        $this->couponId = $couponId;
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 StoreCouponUserEntity
71
+     */
72
+    public function setMerId(int $merId): StoreCouponUserEntity
73
+    {
74
+        $this->merId = $merId;
75
+        return $this;
76
+    }
77
+
78
+    /**
79
+     * @return int
80
+     */
81
+    public function getUid(): int
82
+    {
83
+        return $this->uid;
84
+    }
85
+
86
+    /**
87
+     * @param int $uid
88
+     * @return StoreCouponUserEntity
89
+     */
90
+    public function setUid(int $uid): StoreCouponUserEntity
91
+    {
92
+        $this->uid = $uid;
93
+        return $this;
94
+    }
95
+
96
+    /**
97
+     * @return string
98
+     */
99
+    public function getCouponTitle(): string
100
+    {
101
+        return $this->couponTitle;
102
+    }
103
+
104
+    /**
105
+     * @param string $couponTitle
106
+     * @return StoreCouponUserEntity
107
+     */
108
+    public function setCouponTitle(string $couponTitle): StoreCouponUserEntity
109
+    {
110
+        $this->couponTitle = $couponTitle;
111
+        return $this;
112
+    }
113
+
114
+    /**
115
+     * @return string
116
+     */
117
+    public function getCouponPrice(): string
118
+    {
119
+        return $this->couponPrice;
120
+    }
121
+
122
+    /**
123
+     * @param string $couponPrice
124
+     * @return StoreCouponUserEntity
125
+     */
126
+    public function setCouponPrice(string $couponPrice): StoreCouponUserEntity
127
+    {
128
+        $this->couponPrice = $couponPrice;
129
+        return $this;
130
+    }
131
+
132
+    /**
133
+     * @return string
134
+     */
135
+    public function getUseMinPrice(): string
136
+    {
137
+        return $this->useMinPrice;
138
+    }
139
+
140
+    /**
141
+     * @param string $useMinPrice
142
+     * @return StoreCouponUserEntity
143
+     */
144
+    public function setUseMinPrice(string $useMinPrice): StoreCouponUserEntity
145
+    {
146
+        $this->useMinPrice = $useMinPrice;
147
+        return $this;
148
+    }
149
+
150
+    /**
151
+     * @return null
152
+     */
153
+    public function getCreateTime()
154
+    {
155
+        return $this->createTime;
156
+    }
157
+
158
+    /**
159
+     * @param null $createTime
160
+     * @return StoreCouponUserEntity
161
+     */
162
+    public function setCreateTime($createTime)
163
+    {
164
+        $this->createTime = $createTime;
165
+        return $this;
166
+    }
167
+
168
+    /**
169
+     * @return null
170
+     */
171
+    public function getStartTime()
172
+    {
173
+        return $this->startTime;
174
+    }
175
+
176
+    /**
177
+     * @param null $startTime
178
+     * @return StoreCouponUserEntity
179
+     */
180
+    public function setStartTime($startTime)
181
+    {
182
+        $this->startTime = $startTime;
183
+        return $this;
184
+    }
185
+
186
+    /**
187
+     * @return null
188
+     */
189
+    public function getEndTime()
190
+    {
191
+        return $this->endTime;
192
+    }
193
+
194
+    /**
195
+     * @param null $endTime
196
+     * @return StoreCouponUserEntity
197
+     */
198
+    public function setEndTime($endTime)
199
+    {
200
+        $this->endTime = $endTime;
201
+        return $this;
202
+    }
203
+
204
+    /**
205
+     * @return null
206
+     */
207
+    public function getUseTime()
208
+    {
209
+        return $this->useTime;
210
+    }
211
+
212
+    /**
213
+     * @param null $useTime
214
+     * @return StoreCouponUserEntity
215
+     */
216
+    public function setUseTime($useTime)
217
+    {
218
+        $this->useTime = $useTime;
219
+        return $this;
220
+    }
221
+
222
+    /**
223
+     * @return string
224
+     */
225
+    public function getType(): string
226
+    {
227
+        return $this->type;
228
+    }
229
+
230
+    /**
231
+     * @param string $type
232
+     * @return StoreCouponUserEntity
233
+     */
234
+    public function setType(string $type): StoreCouponUserEntity
235
+    {
236
+        $this->type = $type;
237
+        return $this;
238
+    }
239
+
240
+    /**
241
+     * @return int
242
+     */
243
+    public function getStatus(): int
244
+    {
245
+        return $this->status;
246
+    }
247
+
248
+    /**
249
+     * @param int $status
250
+     * @return StoreCouponUserEntity
251
+     */
252
+    public function setStatus(int $status): StoreCouponUserEntity
253
+    {
254
+        $this->status = $status;
255
+        return $this;
256
+    }
257
+
258
+    /**
259
+     * @return int
260
+     */
261
+    public function getIsFail(): int
262
+    {
263
+        return $this->isFail;
264
+    }
265
+
266
+    /**
267
+     * @param int $isFail
268
+     * @return StoreCouponUserEntity
269
+     */
270
+    public function setIsFail(int $isFail): StoreCouponUserEntity
271
+    {
272
+        $this->isFail = $isFail;
273
+        return $this;
274
+    }
275
+}