فهرست منبع

Merge branch 'v4.7.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v4.7.0dev

From-wh 2 سال پیش
والد
کامیت
d990f35db0

+ 1 - 1
crmeb/app/adminapi/controller/v1/marketing/StoreSeckill.php

@@ -151,7 +151,7 @@ class StoreSeckill extends AuthController
     public function seckillPeople($id)
     public function seckillPeople($id)
     {
     {
         [$keyword] = $this->request->getMore([
         [$keyword] = $this->request->getMore([
-            ['keyword', '']
+            ['real_name', '', '', 'keyword']
         ], true);
         ], true);
         return app('json')->success($this->services->seckillPeople($id, $keyword));
         return app('json')->success($this->services->seckillPeople($id, $keyword));
     }
     }

+ 3 - 0
crmeb/app/adminapi/controller/v1/marketing/lottery/LuckLottery.php

@@ -85,6 +85,9 @@ class LuckLottery extends AuthController
     /**
     /**
      * 添加抽奖
      * 添加抽奖
      * @return mixed
      * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function add()
     public function add()
     {
     {

+ 6 - 2
crmeb/app/adminapi/controller/v1/setting/SystemNotification.php

@@ -34,8 +34,10 @@ class SystemNotification extends AuthController
 
 
     /**
     /**
      * 显示资源列表
      * 显示资源列表
-     *
      * @return \think\Response
      * @return \think\Response
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function index()
     public function index()
     {
     {
@@ -47,8 +49,10 @@ class SystemNotification extends AuthController
 
 
     /**
     /**
      * 显示编辑
      * 显示编辑
-     *
      * @return \think\Response
      * @return \think\Response
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function info()
     public function info()
     {
     {

+ 7 - 0
crmeb/app/api/controller/v2/activity/LuckLotteryController.php

@@ -102,7 +102,11 @@ class LuckLotteryController
     /**
     /**
      * 领取奖品
      * 领取奖品
      * @param Request $request
      * @param Request $request
+     * @param LuckLotteryRecordServices $lotteryRecordServices
      * @return mixed
      * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function lotteryReceive(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
     public function lotteryReceive(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
     {
     {
@@ -125,6 +129,9 @@ class LuckLotteryController
      * @param Request $request
      * @param Request $request
      * @param LuckLotteryRecordServices $lotteryRecordServices
      * @param LuckLotteryRecordServices $lotteryRecordServices
      * @return mixed
      * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function lotteryRecord(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
     public function lotteryRecord(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
     {
     {

+ 2 - 1
crmeb/app/dao/order/StoreOrderDao.php

@@ -894,7 +894,7 @@ class StoreOrderDao extends BaseDao
      */
      */
     public function seckillPeople($id, $keyword, $page = 0, $limit = 0)
     public function seckillPeople($id, $keyword, $page = 0, $limit = 0)
     {
     {
-        return $this->getModel()
+        return $this->getModel()->where('paid', 1)->whereIn('refund_type', [0, 3])
             ->when($id != 0, function ($query) use ($id) {
             ->when($id != 0, function ($query) use ($id) {
                 $query->where('seckill_id', $id);
                 $query->where('seckill_id', $id);
             })->when($keyword != '', function ($query) use ($keyword) {
             })->when($keyword != '', function ($query) use ($keyword) {
@@ -902,6 +902,7 @@ class StoreOrderDao extends BaseDao
             })->where('paid', 1)->field([
             })->where('paid', 1)->field([
                 'real_name',
                 'real_name',
                 'uid',
                 'uid',
+                'user_phone',
                 'SUM(total_num) as goods_num',
                 'SUM(total_num) as goods_num',
                 'COUNT(id) as order_num',
                 'COUNT(id) as order_num',
                 'SUM(pay_price) as total_price',
                 'SUM(pay_price) as total_price',

+ 5 - 4
crmeb/app/listener/notice/NoticeListener.php

@@ -70,6 +70,7 @@ class NoticeListener implements ListenerInterface
                     case 'bind_spread_uid':
                     case 'bind_spread_uid':
                         if (isset($data['spreadUid']) && $data['spreadUid']) {
                         if (isset($data['spreadUid']) && $data['spreadUid']) {
                             $name = $data['nickname'] ?? '';
                             $name = $data['nickname'] ?? '';
+                            crmebLog('绑定推广关系');
                             //站内信
                             //站内信
                             $SystemMsg->sendMsg($data['spreadUid'], ['nickname' => $name]);
                             $SystemMsg->sendMsg($data['spreadUid'], ['nickname' => $name]);
                             //模板消息公众号模版消息
                             //模板消息公众号模版消息
@@ -354,7 +355,7 @@ class NoticeListener implements ListenerInterface
                         $link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
                         $link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
                         $WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link);
                         $WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link);
                         //企业微信通知
                         //企业微信通知
-                        EnterpriseWechatJob::dispatch(['order_id' => $order['order_id']]);
+                        $EnterpriseWechat->weComSend(['order_id' => $order['order_id']]);
                         break;
                         break;
                     //确认收货给客服
                     //确认收货给客服
                     case 'send_admin_confirm_take_over':
                     case 'send_admin_confirm_take_over':
@@ -371,7 +372,7 @@ class NoticeListener implements ListenerInterface
                         $link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
                         $link = '/pages/admin/orderDetail/index?id=' . $order['order_id'];
                         $WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link);
                         $WechatTemplateList->sendAdminOrder($order['order_id'], $storeName, $title, $status, $link);
                         //企业微信通知
                         //企业微信通知
-                        EnterpriseWechatJob::dispatch(['storeTitle' => $storeTitle, 'order_id' => $order['order_id']]);
+                        $EnterpriseWechat->weComSend(['storeTitle' => $storeTitle, 'order_id' => $order['order_id']]);
                         break;
                         break;
                     //申请退款给客服发消息
                     //申请退款给客服发消息
                     case 'send_order_apply_refund':
                     case 'send_order_apply_refund':
@@ -381,7 +382,7 @@ class NoticeListener implements ListenerInterface
                         //短信
                         //短信
                         $NoticeSms->sendAdminRefund($order);
                         $NoticeSms->sendAdminRefund($order);
                         //企业微信通知
                         //企业微信通知
-                        EnterpriseWechatJob::dispatch(['order_id' => $order['order_id']]);
+                        $EnterpriseWechat->weComSend(['order_id' => $order['order_id']]);
                         //公众号
                         //公众号
                         $storeName = $orderInfoServices->getCarIdByProductTitle((int)$order['id']);
                         $storeName = $orderInfoServices->getCarIdByProductTitle((int)$order['id']);
                         $title = '亲,您有个退款订单待处理!';
                         $title = '亲,您有个退款订单待处理!';
@@ -394,7 +395,7 @@ class NoticeListener implements ListenerInterface
                         //站内信
                         //站内信
                         $SystemMsg->kefuSystemSend($data);
                         $SystemMsg->kefuSystemSend($data);
                         //企业微信通知
                         //企业微信通知
-                        EnterpriseWechatJob::dispatch($data);
+                        $EnterpriseWechat->weComSend($data);
                         break;
                         break;
                 }
                 }
 
 

+ 9 - 18
crmeb/app/services/activity/coupon/StoreCouponIssueServices.php

@@ -365,30 +365,13 @@ class StoreCouponIssueServices extends BaseServices
         $issueCouponInfo = $this->dao->getInfo((int)$id);
         $issueCouponInfo = $this->dao->getInfo((int)$id);
         $uid = $user->uid;
         $uid = $user->uid;
         if (!$issueCouponInfo) throw new ApiException(400516);
         if (!$issueCouponInfo) throw new ApiException(400516);
-        /** @var MemberRightServices $memberRightService */
-        $memberRightService = app()->make(MemberRightServices::class);
-        if ($issueCouponInfo->receive_type == 4 && (!$user->is_money_level || !$memberRightService->getMemberRightStatus("coupon"))) {
-            if (!$user->is_money_level) throw new ApiException(400097);
-            if (!$memberRightService->getMemberRightStatus("coupon")) throw new ApiException(400098);
-        }
         /** @var StoreCouponIssueUserServices $issueUserService */
         /** @var StoreCouponIssueUserServices $issueUserService */
         $issueUserService = app()->make(StoreCouponIssueUserServices::class);
         $issueUserService = app()->make(StoreCouponIssueUserServices::class);
-        if ($is_receive) {
-            $alreadyReceived = $issueUserService->count(['uid' => $uid, 'issue_coupon_id' => $id]);
-            if ($alreadyReceived >= $issueCouponInfo['receive_limit']) {
-                throw new ApiException(400518);
-            }
-        }
         /** @var StoreCouponUserServices $couponUserService */
         /** @var StoreCouponUserServices $couponUserService */
         $couponUserService = app()->make(StoreCouponUserServices::class);
         $couponUserService = app()->make(StoreCouponUserServices::class);
-        if ($issueCouponInfo->remain_count <= 0 && !$issueCouponInfo->is_permanent) throw new ApiException(400518);
         $this->transaction(function () use ($issueUserService, $uid, $id, $couponUserService, $issueCouponInfo) {
         $this->transaction(function () use ($issueUserService, $uid, $id, $couponUserService, $issueCouponInfo) {
             $issueUserService->save(['uid' => $uid, 'issue_coupon_id' => $id, 'add_time' => time()]);
             $issueUserService->save(['uid' => $uid, 'issue_coupon_id' => $id, 'add_time' => time()]);
-            $couponUserService->addUserCoupon($uid, $issueCouponInfo, "get");
-            if ($issueCouponInfo['total_count'] > 0) {
-                $issueCouponInfo['remain_count'] -= 1;
-                $issueCouponInfo->save();
-            }
+            $couponUserService->addUserCoupon($uid, $issueCouponInfo, "send");
         });
         });
     }
     }
 
 
@@ -429,6 +412,9 @@ class StoreCouponIssueServices extends BaseServices
      * @param int $uid
      * @param int $uid
      * @param $types
      * @param $types
      * @return array
      * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function getUserCouponList(int $uid, $types)
     public function getUserCouponList(int $uid, $types)
     {
     {
@@ -512,6 +498,9 @@ class StoreCouponIssueServices extends BaseServices
      * 获取单个优惠券类型
      * 获取单个优惠券类型
      * @param array $where
      * @param array $where
      * @return mixed
      * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function getOne(array $where)
     public function getOne(array $where)
     {
     {
@@ -538,6 +527,8 @@ class StoreCouponIssueServices extends BaseServices
     /**
     /**
      * 给会员发放优惠券
      * 给会员发放优惠券
      * @param $uid
      * @param $uid
+     * @param int $couponId
+     * @return bool
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\db\exception\ModelNotFoundException

+ 11 - 7
crmeb/app/services/activity/lottery/LuckLotteryRecordServices.php

@@ -46,6 +46,9 @@ class LuckLotteryRecordServices extends BaseServices
      * 获取抽奖记录列表
      * 获取抽奖记录列表
      * @param array $where
      * @param array $where
      * @return array
      * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function getList(array $where)
     public function getList(array $where)
     {
     {
@@ -108,7 +111,11 @@ class LuckLotteryRecordServices extends BaseServices
      * 写入中奖纪录
      * 写入中奖纪录
      * @param int $uid
      * @param int $uid
      * @param array $prize
      * @param array $prize
+     * @param array $userInfo
      * @return mixed
      * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function insertPrizeRecord(int $uid, array $prize, array $userInfo = [])
     public function insertPrizeRecord(int $uid, array $prize, array $userInfo = [])
     {
     {
@@ -218,13 +225,6 @@ class LuckLotteryRecordServices extends BaseServices
                         throw new ApiException(410053);
                         throw new ApiException(410053);
                     }
                     }
                     break;
                     break;
-                case 7:
-                    //TODO 未完善
-                    break;
-                case 8:
-                    break;
-                case 9:
-                    break;
             }
             }
             $this->dao->update($lottery_record_id, $data, 'id');
             $this->dao->update($lottery_record_id, $data, 'id');
         });
         });
@@ -272,7 +272,11 @@ class LuckLotteryRecordServices extends BaseServices
     /**
     /**
      * 获取中奖记录
      * 获取中奖记录
      * @param int $uid
      * @param int $uid
+     * @param array $where
      * @return array
      * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function getRecord(int $uid, $where = [])
     public function getRecord(int $uid, $where = [])
     {
     {

+ 11 - 1
crmeb/app/services/activity/lottery/LuckLotteryServices.php

@@ -154,7 +154,6 @@ class LuckLotteryServices extends BaseServices
         }
         }
         $lottery = $lottery->toArray();
         $lottery = $lottery->toArray();
         if (isset($lottery['prize']) && $lottery['prize']) {
         if (isset($lottery['prize']) && $lottery['prize']) {
-            $products = $coupons = [];
             $product_ids = array_unique(array_column($lottery['prize'], 'product_id'));
             $product_ids = array_unique(array_column($lottery['prize'], 'product_id'));
             $coupon_ids = array_unique(array_column($lottery['prize'], 'coupon_id'));
             $coupon_ids = array_unique(array_column($lottery['prize'], 'coupon_id'));
             /** @var StoreProductServices $productServices */
             /** @var StoreProductServices $productServices */
@@ -173,6 +172,9 @@ class LuckLotteryServices extends BaseServices
                 }
                 }
             }
             }
         }
         }
+        foreach ($lottery['user_level'] as &$item) {
+            $item = (int)$item;
+        }
         /** @var UserLabelServices $userLabelServices */
         /** @var UserLabelServices $userLabelServices */
         $userLabelServices = app()->make(UserLabelServices::class);
         $userLabelServices = app()->make(UserLabelServices::class);
         $lottery['user_label'] = !empty($lottery['user_label']) ? $userLabelServices->getLabelList(['ids' => $lottery['user_label']], ['id', 'label_name']) : [];
         $lottery['user_label'] = !empty($lottery['user_label']) ? $userLabelServices->getLabelList(['ids' => $lottery['user_label']], ['id', 'label_name']) : [];
@@ -183,6 +185,9 @@ class LuckLotteryServices extends BaseServices
      * 添加抽奖活动以及奖品
      * 添加抽奖活动以及奖品
      * @param array $data
      * @param array $data
      * @return mixed
      * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function add(array $data)
     public function add(array $data)
     {
     {
@@ -400,6 +405,11 @@ class LuckLotteryServices extends BaseServices
      * 抽奖
      * 抽奖
      * @param int $uid
      * @param int $uid
      * @param int $lottery_id
      * @param int $lottery_id
+     * @return mixed
+     * @throws \Psr\SimpleCache\InvalidArgumentException
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
      */
      */
     public function luckLottery(int $uid, int $lottery_id)
     public function luckLottery(int $uid, int $lottery_id)
     {
     {

+ 2 - 2
crmeb/app/services/activity/seckill/StoreSeckillServices.php

@@ -362,7 +362,7 @@ class StoreSeckillServices extends BaseServices
             $header[] = ['title' => $item['value'], 'key' => 'value' . ($key + 1), 'align' => 'center', 'minWidth' => 80];
             $header[] = ['title' => $item['value'], 'key' => 'value' . ($key + 1), 'align' => 'center', 'minWidth' => 80];
         }
         }
         $header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 120];
         $header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 120];
-        $header[] = ['title' => '秒杀价', 'slot' => 'price', 'align' => 'center', 'minWidth' => 80];
+        $header[] = ['title' => '秒杀价', 'type' => 1, 'key' => 'price', 'align' => 'center', 'minWidth' => 80];
         $header[] = ['title' => '成本价', 'key' => 'cost', 'align' => 'center', 'minWidth' => 80];
         $header[] = ['title' => '成本价', 'key' => 'cost', 'align' => 'center', 'minWidth' => 80];
         $header[] = ['title' => '原价', 'key' => 'ot_price', 'align' => 'center', 'minWidth' => 80];
         $header[] = ['title' => '原价', 'key' => 'ot_price', 'align' => 'center', 'minWidth' => 80];
         $header[] = ['title' => '库存', 'key' => 'stock', 'align' => 'center', 'minWidth' => 80];
         $header[] = ['title' => '库存', 'key' => 'stock', 'align' => 'center', 'minWidth' => 80];
@@ -732,7 +732,7 @@ class StoreSeckillServices extends BaseServices
         $orderServices = app()->make(StoreOrderServices::class);
         $orderServices = app()->make(StoreOrderServices::class);
         $pay_count = $orderServices->getDistinctCount([['seckill_id', '=', $id], ['paid', '=', 1]], 'uid', false);
         $pay_count = $orderServices->getDistinctCount([['seckill_id', '=', $id], ['paid', '=', 1]], 'uid', false);
         $order_count = $orderServices->getDistinctCount([['seckill_id', '=', $id]], 'uid', false);
         $order_count = $orderServices->getDistinctCount([['seckill_id', '=', $id]], 'uid', false);
-        $all_price = $orderServices->sum([['seckill_id', '=', $id], ['refund_type', 'in', [0, 3]]], 'pay_price');
+        $all_price = $orderServices->sum([['seckill_id', '=', $id], ['refund_type', 'in', [0, 3]], ['paid', '=', 1]], 'pay_price');
         $seckillInfo = $this->dao->get($id);
         $seckillInfo = $this->dao->get($id);
         $pay_rate = $seckillInfo['quota'] . '/' . $seckillInfo['quota_show'];
         $pay_rate = $seckillInfo['quota'] . '/' . $seckillInfo['quota_show'];
         return compact('pay_count', 'order_count', 'all_price', 'pay_rate');
         return compact('pay_count', 'order_count', 'all_price', 'pay_rate');

+ 1 - 1
crmeb/app/services/product/product/StoreProductServices.php

@@ -950,7 +950,7 @@ class StoreProductServices extends BaseServices
         }
         }
         $header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 120];
         $header[] = ['title' => '图片', 'slot' => 'pic', 'align' => 'center', 'minWidth' => 120];
         if ($type == 1) {
         if ($type == 1) {
-            $header[] = ['title' => '秒杀价', 'slot' => 'price', 'align' => 'center', 'minWidth' => 80];
+            $header[] = ['title' => '秒杀价', 'type' => 1, 'key' => 'price', 'align' => 'center', 'minWidth' => 80];
             $header[] = ['title' => '成本价', 'key' => 'cost', 'align' => 'center', 'minWidth' => 80];
             $header[] = ['title' => '成本价', 'key' => 'cost', 'align' => 'center', 'minWidth' => 80];
             $header[] = ['title' => '原价', 'key' => 'ot_price', 'align' => 'center', 'minWidth' => 80];
             $header[] = ['title' => '原价', 'key' => 'ot_price', 'align' => 'center', 'minWidth' => 80];
         } elseif ($type == 2) {
         } elseif ($type == 2) {

+ 5 - 1
crmeb/app/services/user/UserServices.php

@@ -1246,7 +1246,11 @@ class UserServices extends BaseServices
         $userInfo['birthday'] = $userInfo['birthday'] < 0 ? 0 : $userInfo['birthday'];
         $userInfo['birthday'] = $userInfo['birthday'] < 0 ? 0 : $userInfo['birthday'];
         if ($userInfo['addres'] == '') {
         if ($userInfo['addres'] == '') {
             $defaultAddressInfo = app()->make(UserAddressServices::class)->getUserDefaultAddress($uid);
             $defaultAddressInfo = app()->make(UserAddressServices::class)->getUserDefaultAddress($uid);
-            $userInfo['addres'] = $defaultAddressInfo['province'] . $defaultAddressInfo['city'] . $defaultAddressInfo['district'] . $defaultAddressInfo['detail'];
+            if ($defaultAddressInfo) {
+                $userInfo['addres'] = $defaultAddressInfo['province'] . $defaultAddressInfo['city'] . $defaultAddressInfo['district'] . $defaultAddressInfo['detail'];
+            } else {
+                $userInfo['addres'] = '';
+            }
         }
         }
         $userInfo['vip_name'] = app()->make(SystemUserLevelServices::class)->value(['grade' => $userInfo['level']], 'name');
         $userInfo['vip_name'] = app()->make(SystemUserLevelServices::class)->value(['grade' => $userInfo['level']], 'name');
         $userInfo['group_name'] = app()->make(UserGroupServices::class)->value(['id' => $userInfo['group_id']], 'group_name');
         $userInfo['group_name'] = app()->make(UserGroupServices::class)->value(['id' => $userInfo['group_id']], 'group_name');