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

已处理 待处理 {{opt.name}}
已处理 待处理
分析中 已回复 待规划 {{opt.name}}
分析中 已回复 待规划
门店、供应商商品导出错误信息问题

管理 管理 编辑 删除

问题说明:门店、供应商商品导入后,导出错误信息有问题

修改文件:app/controller/store/export/ExportExcel.php

修改方法importUserExport()

    public function importUserExport(ImportRecordErrorServices $errorServices, ImportRecordServices $recordServices)
    {
        $where = $this->request->getMore([
            ['record_id', '',],
            ['type', '',],
        ]);
        if (!$where['record_id']) {
            return $this->fail('参数错误');
        }
        $type = $where['type'];
        unset($where['type']);
        $data = $errorServices->getErrorList($where);
        $recordServices->bcInc($where['record_id'],'down_count',1);
        if ($type == 'user') {
            return $this->success($this->services->importUser($data['list'] ?? []));
        } else {
            return $this->success($this->services->importProduct($data['list'] ?? [],1,1));
        }
    }


修改文件:app/controller/supplier/export/ExportExcel.php

修改方法importUserExport()

    public function importUserExport(ImportRecordErrorServices $errorServices, ImportRecordServices $recordServices)
    {
        $where = $this->request->getMore([
            ['record_id', '',],
            ['type', '',],
        ]);
        if (!$where['record_id']) {
            return $this->fail('参数错误');
        }
        $type = $where['type'];
        unset($where['type']);
        $data = $errorServices->getErrorList($where);
        $recordServices->bcInc($where['record_id'],'down_count',1);
        if($type == 'user') {
            return $this->success($this->services->importUser($data['list'] ?? []));
        }else{
            return $this->success($this->services->importProduct($data['list'] ?? [],1,2));
        }
    }

修改文件:app/services/other/export/ExportServices.php

修改方法importProduct()

/**
     * 商品导入错误信息导出
     * @param array $data
     * @param int $type
     * @param int $source
     * @return array|mixed
     */
    public function importProduct(array $data, int $type = 1, int $source = 0)
    {
        // 基础表头,价格相关字段按来源区分
        $header = [
            '商品编号', '商品名称', '商品类型', '商品分类(一级)', '商品分类(二级)', '商品分类(三级)', '商品单位', '商品图片', '商品视频', '商品详情',
            '已售数量', '规格类型', '规格类型值', '规格名称', '规格值组合', '规格图片'
        ];
        // source 为 2(结算价来源)时使用结算价,其余使用售价/划线价/成本价
        if ($source == 2) {
            $header[] = '结算价';
        } else {
            array_push($header, '售价', '划线价', '成本价');
        }
        array_push($header, '库存', '重量', '体积', '商品编码', '条形码', '商品简介', '商品关键字', '商品口令');
        // 主库来源额外导出购买送积分字段
        if ($source == 0) {
            $header[] = '购买送积分';
        }
        $header[] = '错误信息';
        $title = ['导入错误信息', '导入商品错误信息导出' . time(), '生成时间:' . date('Y-m-d H:i:s', time())];
        $filename = '导入商品错误信息导出' . date('YmdHis', time());
        $export = [];
        $filekey = [];
        if (!empty($data)) {
            $i = 0;
            foreach ($data as $item) {
                $original_data = $item['original_data'];
                $one_data = [
                    'id' => $original_data['id'],
                    'store_name' => $original_data['store_name'],
                    'product_type' => $original_data['product_type'],
                    'cate_name_one' => $original_data['cate_name_one'],
                    'cate_name_two' => $original_data['cate_name_two'],
                    'cate_name_three' => $original_data['cate_name_three'],
                    'unit_name' => $original_data['unit_name'],
                    'slider_image' => $original_data['slider_image'],
                    'video_link' => $original_data['video_link'],
                    'description' => htmlspecialchars_decode($original_data['description']),
                    'ficti' => intval($original_data['ficti']),
                    'spec_type' => $original_data['spec_type'],
                    'sku_type_value' => $original_data['sku_value'],
                    'sku_name' => $original_data['sku_name'],
                    'sku_value' => $original_data['sku_value'],
                    'pic' => $original_data['pic'],
                ];
                // 价格字段按来源区分:source 2 使用结算价,其余使用售价/划线价/成本价
                if ($source == 2) {
                    $one_data['settle_price'] = floatval($original_data['settle_price']);
                } else {
                    $one_data['price'] = floatval($original_data['price']);
                    $one_data['ot_price'] = floatval($original_data['ot_price']);
                    $one_data['cost'] = floatval($original_data['cost']);
                }
                $one_data += [
                    'stock' => intval($original_data['stock']),
                    'volume' => intval($original_data['volume'] ?? 0),
                    'weight' => intval($original_data['weight'] ?? 0),
                    'code' => $original_data['code'] ?? '',
                    'bar_code' => $original_data['bar_code'] ?? '',
                    'store_info' => $original_data['store_info'],
                    'keyword' => $original_data['keyword'],
                    'command_word' => $original_data['command_word'],
                ];
                // 主库来源额外导出购买送积分字段
                if ($source == 0) {
                    $one_data['give_integral'] = $original_data['give_integral'];
                }
                $one_data['fail_msg'] = $item['fail_msg'] ?? '';

                if ($type == 1) {
                    $export[] = $one_data;
                    if ($i == 0) {
                        $filekey = array_keys($one_data);
                    }
                } else {
                    $export[] = array_values($one_data);
                }
                $i++;
            }
        }
        if ($type == 1) {
            return compact('header', 'filekey', 'export', 'filename');
        } else {
            return $this->export($header, $title, $export, $filename);
        }
    }



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

全 最后编辑于2026-09-01 15:33:50

快捷回复
{{replySubmitting ? '提交中...' : '回复'}}
{{replySubmitting ? '提交中...' : '回复'}}
回复({{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 ? '取消回复' : '回复'}}
删除
{{replySubmitting ? '提交中...' : '回复'}}
{{replySubmitting ? '提交中...' : '回复'}}

{{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 ? '取消回复' : '回复'}}
删除
{{replySubmitting ? '提交中...' : '回复'}}
{{replySubmitting ? '提交中...' : '回复'}}
收起 展开更多
查看更多
打赏
已打赏¥{{reward_price}}
7
{{like_count}}
{{collect_count}}
添加回复 ({{post_count}})

相关推荐

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

微信登录/注册

{{ wechatLoginError }}
切换手机号登录

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

{{codeText}}
切换微信登录/注册
暂不绑定
CRMEB客服
CRMEB咨询热线 400-8888-794

扫码领取产品资料

功能清单
思维导图
安装教程
CRMEB开源商城下载 源码下载 CRMEB帮助文档 帮助文档
返回顶部 返回顶部
CRMEB客服