全部
常见问题
产品动态
精选推荐
功能建议

分析中 已回复 待规划 {{opt.name}}
分析中 已回复 待规划
商品优惠券关联商品展示问题

管理 管理 编辑 删除

问题说明:单店模式-添加商品优惠券,一次性添加两个商品时,领取优惠券后,在优惠券列表不显示商品

解决方法:

修改文件:app/services/product/product/StoreProductServices.php

修改方法: getGoodsList()

public function getGoodsList(array $where, int $uid, int $promotions_type = 0, bool $isEntryRules = true)
    {
        $appendWhere = [];
        if (isset($where['coupon_id']) && $where['coupon_id']) {
            $isEntryRules = false;
            /** @var StoreCouponIssueServices $couponIssueService */
            $couponIssueService = app()->make(StoreCouponIssueServices::class);
            $where['relation_id'] = $couponIssueService->value(['id' => $where['coupon_id']], 'relation_id');
            $where['is_delivery_type'] = true;
        }
        //进店规则查询商品
        if ($isEntryRules) {
            $appendWhere = $this->getWhereByEntryRules($uid);
            if (isset($appendWhere['relation_id']) && isset($where['ids']) && $where['ids']) {//单店模式 商品列表diy选择商品ID
                //处理成适用门店
                $ids = $this->dao->getColumn(['is_verify' => 1, 'is_show' => 1, 'is_del' => 0, 'pid' => $where['ids'], 'type' => 1, 'relation_id' => $appendWhere['relation_id']], 'id');
                if (!$ids) {
                    return [];
                }
                $where['ids'] = $ids;
            }
        }
        $where = array_merge($where, $appendWhere);
        $where['is_verify'] = 1;
        $where['is_show'] = 1;
        $where['is_del'] = 0;
        $collate_code_id = 0;
        if (isset($where['collate_code_id'])) {
            $collate_code_id = $where['collate_code_id'];
        }
        if (isset($where['store_name']) && $where['store_name']) {
            /** @var UserSearchServices $userSearchServices */
            $userSearchServices = app()->make(UserSearchServices::class);
            $searchIds = $userSearchServices->vicSearch($uid, $where['store_name'], $where);
            if ($searchIds) {//之前查询结果记录
                $where['ids'] = $searchIds;
                unset($where['store_name']);
            }
        }
        $promotionsWhere = [];
        $list = [];
        //优惠活动凑单
        if (isset($where['promotions_id']) && $where['promotions_id']) {
            /** @var StorePromotionsServices $storePromotionsServices */
            $storePromotionsServices = app()->make(StorePromotionsServices::class);
            $promotionsWhere = $storePromotionsServices->collectProductById((int)$where['promotions_id']);
            unset($where['promotions_id']);
        } else if (isset($where['promotions_type']) && $where['promotions_type']) {
            /** @var StorePromotionsServices $storePromotionsServices */
            $storePromotionsServices = app()->make(StorePromotionsServices::class);
            $promotionsWhere = $storePromotionsServices->collectProductByType([(int)$where['promotions_type']]);
            unset($where['promotions_type']);
        }
        if (!$promotionsWhere || (isset($promotionsWhere['ids']) && $promotionsWhere['ids'])) {
            $where = array_merge($where, $promotionsWhere);
            unset($where['promotions_id']);
            if (isset($where['productId']) && $where['productId'] != '') {
                $where['ids'] = is_string($where['productId']) ? stringToIntArray($where['productId']) : $where['productId'];
                $where['ids'] = array_unique(array_map('intval', $where['ids']));
                unset($where['productId']);
            }
            $where['is_vip_product'] = 0;
            $discount = 100;
            $level_name = '';
            if (!$promotions_type && $uid) {
                /** @var UserServices $user */
                $user = app()->make(UserServices::class);
                $userInfo = $user->getUserCacheInfo($uid);
                $is_vip = $userInfo['is_money_level'] ?? 0;
                $where['is_vip_product'] = $is_vip ? -1 : 0;
                //用户等级是否开启
                /** @var SystemUserLevelServices $systemLevel */
                $systemLevel = app()->make(SystemUserLevelServices::class);
                $levelInfo = $systemLevel->getLevelCache((int)($userInfo['level'] ?? 0));
                if (sys_config('member_func_status', 1) && $levelInfo) {
                    $discount = $levelInfo['discount'] ?? 100;
                }
                $level_name = $levelInfo['name'] ?? '';
            }

            [$page, $limit] = $this->getPageValue();
            $field = ['id,relation_id,type,pid,delivery_type,product_type,store_name,cate_id,image,IFNULL(sales, 0) + IFNULL(ficti, 0) as sales,price,stock,activity,ot_price,spec_type,recommend_image,unit_name,is_vip,vip_price,is_presale_product,is_vip_product,system_form_id,system_form_type,is_presale_product,presale_start_time,presale_end_time,is_limit,limit_num,video_open,video_link,freight,star,store_label_id,brand_id'];
            $list = $this->dao->getSearchList($where, $page, $limit, $field, '', ['couponId']);
            if ($list) {
                /** @var MemberCardServices $memberCardService */
                $memberCardService = app()->make(MemberCardServices::class);
                $vipStatus = $memberCardService->isOpenMemberCardCache('vip_price') && sys_config('svip_price_status', 1);
                /** @var SystemFormServices $systemFormServices */
                $systemFormServices = app()->make(SystemFormServices::class);
                $systemForms = $systemFormServices->getColumn([['id', 'in', array_unique(array_column($list, 'system_form_id'))], ['is_del', '=', 0]], 'id,value', 'id');
                /** @var StoreProductLabelServices $storeProductLabelServices */
                $storeProductLabelServices = app()->make(StoreProductLabelServices::class);
                foreach ($list as &$item) {
                    $minData = $this->getMinPrice($uid, $item, $discount);
                    $item['price_type'] = $minData['price_type'] ?? '';
                    $item['level_name'] = $level_name;
                    $item['vip_price'] = $item['level_price'] = 0.00;
                    if ($item['price_type'] == 'member') {
                        $item['vip_price'] = $minData['vip_price'] ?? 0;
                        if (!$item['is_vip'] || !$vipStatus) {
                            $item['vip_price'] = 0;
                        }
                    } else {
                        $item['level_price'] = $minData['vip_price'] ?? 0;
                    }
                    $custom_form = $systemForms[$item['system_form_id']]['value'] ?? [];
                    $item['custom_form'] = is_string($custom_form) ? json_decode($custom_form, true) : $custom_form;
                    $item['cart_button'] = $item['product_type'] > 0 || $item['is_presale_product'] || $item['system_form_id'] ? 0 : 1;
                    $item['presale_pay_status'] = $this->checkPresaleProductPay((int)$item['id'], $item);
                    if (!$item['video_open']) {
                        $item['video_link'] = '';
                    }
                    $item['store_label'] = [];
                    if ($item['store_label_id']) {
                        $item['store_label'] = $storeProductLabelServices->getLabelCache($item['store_label_id'], ['id', 'label_name', 'style_type', 'color', 'bg_color', 'border_color', 'icon']);
                    }
                    if (isset($item['brand_id']) && $item['brand_id']) {
                        $item['brand_name'] = $this->productIdByBrandName((int)$item['id'], $item);
                    }
                    $item['activity'] = [];
                    if (isset($item['couponId'])) {
                        $item['checkCoupon'] = (bool)count($item['couponId']);
                        unset($item['couponId']);
                    } else {
                        $item['checkCoupon'] = false;
                    }
                }
//                if (!$collate_code_id) {
//                    $list = $this->getActivityList($list);
//                }
                $list = $this->getProduceOtherList($list, $uid, isset($where['status']) && !!$where['status'], $collate_code_id);
                $list = $this->getProductPromotions($list, $promotions_type ? [$promotions_type] : []);
            }
        }
        return $list;
    }



{{voteData.voteSum}} 人已参与
支持
反对
请登录后查看

全 最后编辑于2025-12-19 09:38:11

快捷回复
回复
回复
回复({{post_count}}) {{!is_user ? '我的回复' :'全部回复'}}
排序 默认正序 回复倒序 点赞倒序

{{item.user_info.nickname ? item.user_info.nickname : item.user_name}} LV.{{ item.user_info.bbs_level || item.bbs_level }}

作者 管理员 企业

{{item.floor}}# 同步到gitee 已同步到gitee {{item.is_suggest == 1? '取消推荐': '推荐'}}
{{item.is_suggest == 1? '取消推荐': '推荐'}} 【已收集】
{{item.floor}}# 沙发 板凳 地板 {{item.floor}}# 【已收集】
{{item.user_info.title || '暂无简介'}}
附件

{{itemf.name}}

{{item.created_at}}  {{item.ip_address}}
打赏
已打赏¥{{item.reward_price}}
{{item.like_count}}
分享
{{item.showReply ? '取消回复' : '回复'}}
删除
回复
回复

{{itemc.user_info.nickname}}

{{itemc.user_name}}

回复 {{itemc.comment_user_info.nickname}}

附件

{{itemf.name}}

{{itemc.created_at}}
打赏
已打赏¥{{itemc.reward_price}}
{{itemc.like_count}}
{{itemc.showReply ? '取消回复' : '回复'}}
删除
回复
回复
收起 展开更多
查看更多
打赏
已打赏¥{{reward_price}}
25
{{like_count}}
{{collect_count}}
添加回复 ({{post_count}})

相关推荐

快速安全登录

使用微信扫码登录
回复
回复
问题:
问题自动获取的帖子内容,不准确时需要手动修改. [获取答案]
答案:
提交
bug 需求 取 消 确 定
打赏金额
当前余额:¥{{rewardUserInfo.reward_price}}
{{item.price}}元
请输入 0.1-{{reward_max_price}} 范围内的数值
打赏成功
¥{{price}}
完成 确认打赏

微信登录/注册

切换手机号登录

{{ bind_phone ? '绑定手机' : '手机登录'}}

{{codeText}}
切换微信登录/注册
暂不绑定
CRMEB客服

CRMEB咨询热线 咨询热线

400-8888-794

微信扫码咨询

CRMEB开源商城下载 源码下载 CRMEB帮助文档 帮助文档
返回顶部 返回顶部
CRMEB客服