Skip to content

商品 订单 商城迭代

商品-订单-商城迭代

数据库改动


一级分类图片权限管理 「Mysql」- xnn_core_product_2 「修改」

涉及到数据的增删,需要设置权限,只有拥有权限的人在可以执行增加和删除操作

涉及数据库:
    auth_permission
权限:
    查看图标管理  编辑图标管理
SQL 语句
    INSERT INTO auth_permission
        (id,name,name_en,codename,content_type_id,level2_id)
    VALUES
        (621,'查看图标管理','view icon manage','view_icon_manage',53,12),
        (622,'编辑图标管理','edit icon manage','edit_icon_manage',53,12);

    # content_type_id -> django_content_type -> 53 分类
    # level2_id -> tbl_permission_class -> 12 商品库索引

一级分类图片数据存储集合 「MongoDB」- merchandise - icon 「修改」

修改原因:
    需要支持用户自定义上传一级分类图片数据

修改逻辑:
    目前一级分类图片是所有用户共享的,用户只能够使用我们提供的图标,同一个用户组的用户共享一级分类图片设定数据

    增加字段:group_id  Int/None
        用户上传的数据通过 group_id 字段来进行区分
        默认的图片的 group_id 设置成 None

    增加字段:type  Int
        来标识公共图片和用户上传图片  1默认图片 2用户上传图片

修改方式:
    执行 mongo 语句实现

MongoDB 语句:
    db.getCollection('icon').updateMany(
        {}, 
        {'$set': {group_id: null, type: NumberInt(1)}}
    )

扩展后的文档字段如下:
    _id            Int           主键       
    name           String        图片名称    
    image          String        图片路径    
    group_id       Int/None      用户组id   
    type           Int           图片归属  1系统默认 2用户上传 

一级分类默认图标存储集合 「Mongo」 - merchansdise - default_icon 「新增」

增表原因:
    每个用户组都会设定一个默认的一级分类图标
    默认的一级分类图标使用的是系统默认的图标
    用户可以更改这个默认图标
    每个用户组只能创建一条默认图标数据 -- 需要创建一个唯一索引

文档字段:
    _id         ObjectId    mongo原生主键
    icon_id     Int         图片id
    group_id    Int         用户组id

唯一索引:
    group_id

索引创建语句:
    db.getCollection('default_icon').createIndex(
        {'group_id': 1}, 
        {'background': 1, 'unique': 1}
    )

Mongo自增键 「Mongo」 - merchansdise - system_key_generator

修改原因:
    现有的「icon」集合的 id 是 int 类型的(数据的增加是手工添加的)
    本需求中,用户上传自定义的一级分类图标,数据的存储时的主键应使用自增主键(与原来的主键保持一致)
    因「icon」集合中已有数据,所以需要在「system_key_generator」增加一个字段「category_first_icon_key」作为自增的基础

修改方式:
    执行 mongo 语句实现

MongoDB 语句:
    db.getCollection('system_key_generator').updateOne(
        {'_id': 'system_key_generator'},
        {'$set': {'category_first_icon_key': NumberInt(100)}},
        {'upsert': true}
    )

RMI_Client 模块


CategoryIconService 一级分类图标 - 增删查

目前一级分类icon的数据请求获取由 RMI_Client 下的 CategoryIconService 转发

支持用户自定义上传一级分类icon,需要修改 gm_rmiclient -> merchandise -> CategoryIconService

CategoryIconService create 「新增」
接口:
    category1/icons/create
class:
    gm_rmiclient/merchandise.py/CategoryIconService
方法:
    create
参数:
    group_id         M    Int       用户组id
    image_path_id    M    String    图片路径
    type             M    Int       图片归属  1系统 2用户自定义  默认为用户自定义
返回:
    _id              M    Int       一级分类icon_id
示例:
    参数:
        group_id: 356
        image_path_id: xxx.png
    返回:
        {
            _id: 88
        }
说明:

CategoryIconService delete「新增」
接口:
    category1/icons/delete
class:
    gm_rmiclient/merchandise.py/CategoryIconService
方法:
    delete
参数:
    ids              M    List<String>    待删除的一级分类icon_id
返回:
    None
示例:
    参数:
        ids:
        [
            88, 98
        ]
    返回:
        None
说明:
    不报错,则说明请求成功
CategoryIconService get「修改」
接口:
    category1/icon
class:
    gm_rmiclient/merchandise.py/CategoryIconService
方法:
    get
参数:
    group_id         O    Int       用户组id
返回:
    _id              M    String    一级分类icon_id
    image            M    String    图片路径
示例:
    参数:
        group_id: 356
    返回:
        [
            {
                _id: 88
                image: '//img.guanmai.cn/icon/xxx.png'
            },
            ...
        ]
说明:

CategoryDefaultIconService 默认一级分类图标 - 查改

需要一个新的类在来实现默认一级分类图标的查询和获取 CategoryDefaultIconService

CategoryDefaultIconService get 「新增」
接口:
    category1/icon/default/get
class:
    gm_rmiclient/merchandise.py/CategoryIconService
方法:
    get
参数:
    group_id           M    Int       用户组id
返回:
    dafault_icon_id    M    Int       用户默认一级图片icon_id
示例:
    参数:
        group_id: 356
    返回:
        dafault_icon_id: 2
说明:

CategoryDefaultIconService update 「新增」
接口:
    category1/icon/default/update
class:
    gm_rmiclient/merchandise.py/CategoryIconService
方法:
    update
参数:
    group_id           M    Int       用户组id
    dafault_icon_id    M    Int       用户默认一级图片icon_id
返回:
    None
示例:
    参数:
        group_id: 356
        dafault_icon_id: 3
    返回:
        None
说明:
    不报错,则说明请求成功

商品库微服务


/category/category1/icon 获取当前用户组下的所有一级分类icon 「修改」

接口:
    /category/category1/icon
class:
    category/views.py/Category1IconView
方法:
    GET
请求:
    group_id             O    Int                 用户组id
响应:
    code                 M    Int                 状态码
    msg                  M    String              状态消息
    date                 M    List<Dict>          响应数据
        [
            {
                _id      M    Int                 icon_id
                image    M    String              图片路径
                type     M    Int                 图片归属  1系统默认 2用户上传
            }
        ]
示例:
    请求:
        {
            group_id: 356
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: [
                {
                    _id: 88,
                    image: '//img.guanmai.cn/icon/xxx.png'
                    type: 2
                },
                ...
            ]
        }
说明:
    增加了一个 group_id 参数进行筛选,返回当前用户组上传的图片和默认的图片

/category/category1/icons/create 存储一级分类图片 「新增」

接口:
    /category/category1/icons/create
class:
    category/views.py/Category1IconCreateView
方法:
    GET
请求:
    group_id       M    Int           用户组id
    image          M    String        图片路径
    belong_type    M    Int           图片所属状态  1默认 2用户上传
响应:
    code           M    Int           状态码
    msg            M    String        状态消息
    data           M    Dict          响应消息
        {
            _id    M    Int           icon_id
        }
示例:
    请求:
        {
            group_id: 356,
            image: xxx.png
            belong_type: 2
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: {
                _id: '90'
            }
        }
说明:
    一级分类的图片数据是通过商品微服务来存储的,实现图片数据的存储,需要增加一个图片写入接口
    返回的 _id 数据用途:如果用户使用了刚上传的图片,存到数据库的就是这个 _id 数据

/category/category1/icons/delete 删除一级分类图片 「新增」

接口:
    /category/category1/icons/delete
class:
    category/views.py/Category1IconDeleteView
方法:
    POST
请求:
    ids            M    List<Int>     待删除的一级分类icon_id
响应:
    code           M    Int           状态码
    msg            M    String        状态消息
    data           M    None          响应消息
示例:
    请求:
        {
            ids:
                [
                    90, 69
                ]
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: null
        }
说明:
    根据 ids 中的 icon_id  删除用户自己上传的icon

    category1/icons/default/get
    category1/icons/default/update

category1/icons/default/get 获取默认一级分类图标 「新增」

接口:
    category1/icons/default/get
class:
    category/views.py/Category1DefaultIconGetView
方法:
    GET
请求:
    group_id      M    Int       用户组id
响应:
    code          M    Int       状态码
    msg           M    String    状态消息
    data          M    Dict      响应内容
        {
            default_icon_id    M    Int    默认一级图标id
        }
示例:
    请求:
        {
            group_id: 356
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: {
                default_icon_id: 1
            }
        }
说明:

category1/icons/default/update 设置默认一级分类图标 「新增」

接口:
    category1/icons/default/update
class:
    category/views.py/Category1DefaultIconUpdateView
方法:
    GET
请求:
    group_id           M    Int          用户组id
    default_icon_id    M    Int          默认一级分类icon_id
响应:
    code               M    Int          状态码
    msg                M    String       状态消息
    data               M    Dict/None    响应内容
示例:
    请求:
        {
            group_id: 356
            default_icon_id: 2
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: null
        }
说明:

station 工程


/image/upload 图片上传 「修改」

icon 数据关联的是 _id 而商品库的图片数据关联的是 image_path_id

在返回的字段中增加一个 _id 数据,通过判断,如果商品库的图片上传,那么将 _id 的值设置成 None

接口:
    /image/upload
class:
    website/utils/views/image.py/UploadImageView
方法:
    POST
请求:
    image_file     M    Binary    图片数据
    image_type     O    Int       图片类型  1商品库图片 2一级分类图片 默认值为1
响应:
    code           M    Int       状态码
    msg            M    String    状态消息
    data           M    Dict      响应消息
        {
            # 当图片类型为商品图片时,返回数据如下 
            image_url      M    String         CDN 链接
            img_path_id    M    String         image 名称

            # 当图片类型为一级分类图片时,返回数据如下
            _id            M    Int            一级分类图片 icon_id
            image_url      M    String         CDN 链接
            img_path_id    M    String         image 名称
        }
示例:
    请求:
        {
            image_file: (binary)
            image_type: 2
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data:
                {
                    "img_path_id": "0a92fcc0064d15ac.png",
                    "_id": 126,
                    "image_url": "http://gmfiles-1251112841.file.myqcloud.com/icon/0a92fcc0064d15ac.png"
                }
        }
说明:
    增加一个可选参数 image_type,通过 image_type 参数来指定上传的类型 -- 在后台指定上传的路径
    商品库的图片上传是保存到 product_pic 目录下
    预设:
        默认路径设置为 product_pic
        文件路径 icon 用于存储一级分类图的 icon

    兼容性:image_type 默认值1  商品库图片上传

    在设定类型为 2一级分类图片
    在图片上传成功后,调用商品微服务接口将图片数据写入到数据库中,并返回存储结果的 _id
        调用微服务的时候,需要获取到 group_id 数据

/merchandise/category1/icon 获取一级分类图片 「修改」

接口:
    /merchandise/category1/icon
class:
    website/merchandise/views/category1.py/Category1IconView
方法:
    GET
请求:
    无
响应:
    code         M    Int           状态码
    msg          M    String        状态消息
    data         M    List<Dict>    响应消息
        [
            {
                id          M   Int        一级分类icon_id
                type        M   Int        图片所属  1系统默认 2用户上传
                url         M   String     Icon 的 cdn 链接
            },
            ...
        ]
示例:
    请求:
        无
    响应:
        {
            code: 0,
            msg: 'ok',
            data: [
                {
                    id: 1
                    type: 1
                    url: "//img.guanmai.cn/icon/icon-veg.4fa23256.png"
                },
                ...
            ]
        }
说明:

/merchandise/category1/icons/default/get 获取默认一级分类图片 「新增」

接口:
    /merchandise/category1/icons/default/get
class:
    website/merchandise/views/category1.py/Category1IconDefaultGetView
方法:
    GET
请求:
    无
响应:
    code            M    Int       状态码   
    msg             M    String    状态消息 
    data            M    Dict      响应内容
        {
            default_icon_id    M    Int    当前 group_id 默认的一级分类图标 icon_id
        }
示例:
    请求:
        无
    响应:
        {
            code: 0,
            msg: 'ok',
            data: {
                default_icon_id: 3
            }
        }
说明:
    请求需要用到 group_id,但可以从 request 中获取

    用户进入图标管理界面时,应调用此接口获取用户设定的默认图标

    初始化:
        系统给用户默认的图标是:白菜,icon_id = 1

/merchandise/category1/icons/default/update 更新默认一级分类图片 「新增」

接口:
    /merchandise/category1/icons/default/update
class:
    website/merchandise/views/category1.py/Category1IconDefaultUpdateView
方法:
    GET
请求:
    default_icon_id    M    Int          一级分类图标icon_id
响应:
    code               M    Int          状态码   
    msg                M    String       状态消息 
    data               M    Dict/None    响应内容
示例:
    请求:
        {
            default_icon_id: 18
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: null
        }
说明:
    请求需要用到 group_id,但可以从 request 中获取

/merchandise/category1/icons/delete 删除用户上传的一级分类图片 「新增」

接口:
    /merchandise/category1/icons/delete
class:
    website/merchandise/views/category1.py/Category1IconDeleteView
方法:
    POST
请求:
    delete_icons         M    List<Dict>        待删除的一级分类icon
        [
            {
                id       M    Int/Float         待删除的一级分类icon_id
                name     M    String            待删除的一级分类icon_name
            },
            ...
        ]
    default_icon_id      M    Int/Float         默认图片id
    default_icon_name    M    String            默认图片的名称
响应:
    code                 M    Int               状态码
    msg                  M    String            状态消息
    data                 M    None              响应内容
示例:
    请求:
        {
            ids: [
                {
                    id: 89,
                    name: xxx.png
                }
            ],
            default_icon_id: 1
            defualt_name: zzz.png
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: null
        }
说明:
    支持批量删除用户自己上传的一级分类图标

    用户批量删除的时候,需要进行检测图片是否在使用中(营销活动和一级分类)
        > 在使用中:使用默认图标替换
        > 未在使用中:直接删除 

    group_id 可以从 request 中获取

/station/orders 获取订单数据-按订单查看 「修改」

接口:
    /station/orders
class:
    /website/station/views/order.py/TransportOrdersQueryView
方法:
    GET
请求:
    query_type        M    Int       查询类型  1下单时间 2运营时间 3收货时间

        部分参数跟查询类型关联,枚举如下:
        * query_type = 1 按下单时间查询,默认值为当天
            start_date            C    String     开始时间[注1]
            end_date              C    String     截止时间
        * query_type = 2 按运营时间查询
            time_config_id        C    String     运营时间id
            cycle_start_time      C    String     运营开始时间
            cycle_end_time        C    String     运营结束时间
        * query_type = 3 按收货时间查询
            receive_start_date    C    String     收货开始时间
            receive_end_date      C    String     收货结束时间

    search_text       O    String    搜索字段  支持订单号和商户搜索
    client            O    String    订单来源  不传默认全部[注2]
    status            O    Int       订单状态  1待分拣 5分拣中 10 配送中 15 已签收  不传默认全部
    pay_status        O    Int       支付状态  1未支付 5部分支付 10已支付  不传默认全部
    has_remark        O    Int       订单备注  1有备注 0无备注  不传默认全部
    inspect_status    O    Int       装车状态  1未装车 2已装车  不传默认全部
    stock_type        O    Int       出库状态  1未出库 2已出库  不传默认全部
    is_print          O    Int       打印状态  0未打印 1已打印  不传默认全部
    receive_way       O    Int       收货方式  1配送 2自提  不传默认全部
    pick_up_st_id     C    Int       自提点id  不传默认全部
    search_area       O    String    地理标签  不传默认全部
    route_id          O    Int       线路Id  不传默认全部
    carrier_id        O    Int       承运商id  不传默认全部
    driver_id         C    Int       配送司机id  不传默认全部
    salemenu_id       O    String    报价单id  不传默认全部
    offset            O    Int       分页 查询起点偏移条数
    limit             O    Int       分页 返回条数
响应:
    code              M    Int       状态码
    msg               M    String    状态消息
    data              M    Dict      响应内容
        {
            total_sale_money_with_freight    M    String        下单金额
            in_query                         M    Bool          是否在搜索范围内
            list                             M    List<Dict>    订单详情数据列表
                [
                    {
                        ######### 本次需求在返回中新增的两个字段 ###########
                        kind_of_sku          M    Int           商品种类数
                        number_of_sku        M    Float         商品下单数

                        abnormal_money       M    String        异常金额
                        client               M    Int           订单来源
                        client_desc          M    String        订单来源描述
                        coupon_amount        M    String        优惠金额
                        create_user          M    String        订单创建人
                        customer             M    Dict          商户信息
                            {
                                id                M    String        帐户id
                                address           M    String        地址信息
                                address_id        M    String        商户id
                                extender          M    Dict          扩展信息
                                    {
                                        resname             M    String     商户名称
                                        order_pay_method    M    string     支付方式
                                    }
                                new_consumer       M    Int           是否是新客[注3]
                                pick_up_st_name    M    String        自提点名称
                                receive_way        M    Int           收货方式
                                receiver_name      M    String        收货方姓名
                                receiver_phone     M    String        收货方电话
                                salemenu_id        M    String        报价单id
                                station_id         M    String        站点id
                                date_time          M    Int           下单时间(秒)
                                date_time_str      M    String        下单时间
                            }
                        details              M     List<Dict>    订单 sku 列表
                            [
                                {   
                                    id                         M    String    sku_id
                                    accept_quantity            M    Int       收货数量
                                    detail_tax                 M    String    商品税额
                                    exc_quantity               M    Int       异常数量
                                    quantity                   M    Int       下单数量
                                    real_item_price            M    String    真实总价(分)
                                    real_quantity              M    Int       称重后数量
                                    real_refund_quantity       M    Int       实际退货数
                                    request_refund_quantity    M    Int       请求退货数
                                    sale_price                 M    String    销售单位价格
                                    spu_id                     M    String    spu_id
                                    spu_remark                 M    String    spu备注
                                    sync_origin_id             M    String    真实交易id
                                    tax_rate                   M    Int       税率
                                    total_item_pay             M    String    商品应付金额
                                    total_item_price           M    String    商品出库金额
                                    unit_price                 M    String    基本单位价格
                                    version                    M    Int       版本号
                                },
                                ...
                            ]
                        driver_id            M    Int           配送司机id
                        driver_name          M    String        配送司机姓名
                        freeze               M    Int           订单状态  0未锁定 1锁定
                        freight              M    String        运费
                        id                   M    String        订单id
                        inspect_status       M    String        装车状态  1未装车 2已装车
                        order_tax            M    String        订单税率
                        origin_total_price   M    String        订单总金额
                        outstock_status      M    Int           出库状态  1未出库 2已出库        
                        pay_status           M    Int           支付状态
                        print_times          M    Int           打印次数
                        real_money           M    String        实际金额
                        receive_begin_time   M    String        收货开始时间
                        receive_end_time     M    String        收货结束时间
                        refund_kind          M    Int           退货商品种类数
                        refund_money         M    String        订单退货金额
                        remark               M    String        订单备注
                        route_name           M    String        配送线路名称
                        sale_money           M    String        订单金额
                        salemenu_ids         M    List<String>  报价单列表
                            [
                                salemenu_id        M    String        报价单id
                            ]
                        sale_money_with_freight    M    String        订单金额(加运费)
                        sale_money_without_tax     M    String        订单金额(无税)
                        settle_way           M     Int           结算方式  1先货 2先款  
                        sort_id              M     String        分拣序号
                        station_id           M     String        站点id
                        status               M     Int           订单处理状态
                        total_price          M     String        订单总金额
                        time_config_info     M     Dict          运营时间信息
                            {
                                desc                        M  String    运营时描述
                                final_distribute_time       M  String    最晚配送时间
                                final_distribute_time_span  M  Int       [注4]
                                name                        M  String    运营时间名称
                                order_time_limit            M  Dict      下单时间限制
                                    {
                                        start               M  String    开始时间
                                        end                 M  String    结束时间
                                        e_span_time         M  Int       下单起止时间跨天数 
                                    }
                                receive_time_limit          M  Dict      收货时间限制
                                    {
                                        start               M  String    开始时间
                                        end                 M  String    结束时间
                                        s_span_time         M  Int       [注5]
                                        e_span_time         M  Int       [注6]
                                        receiveTimeSpan     M  String    [注7]
                                    }
                                service_time_creator        M  String    服务时间创建站点
                                task_begin_time             M  String    任务开始时间
                                type                        M  Int       时间配置类型[注8]
                                _id                         M  Int       运营时间id
                            }
                    },
                    ...
                ]
            pagination                       M    Dict          分页对象
                {
                    count                    M    Int           查询结果条数
                    limit                    M    Int           返回条数
                    offset                   M    Int           查询起点偏移条数 
                }
        }
示例:
    请求:
        {
            start_date: 2019-08-28,
            end_date: 2019-08-30,
            query_type: 1,
            search_text: PL8288223,
            offset: 0,
            limit: 20
        }
    响应:
        {
            "msg": "ok"
            "code": 0,
            "data": {
                "total_sale_money_with_freight": "200.00",
                "in_query": false,
                "pagination": {
                    "offset": 0,
                    "count": 1,
                    "limit": 20
                },
                "list": [
                    {
                        "sale_money_with_freight": "205.00",
                        "settle_way": 1,
                        "coupon_amount": "0.00",
                        "date_time_str": "2019-08-29 20:22:56",
                        "refund_kind": 0,
                        "status": 10,
                        "details": [
                            {
                                "total_item_pay": "200.00",
                                "quantity": 2,
                                "unit_price": "100.00",
                                "total_item_price": "200.00",
                                "exc_quantity": 0,
                                "request_refund_quantity": 0,
                                "detail_tax": "0.00",
                                "real_item_price": "200.00",
                                "version": 2,
                                "sync_origin_id": "D8972178",
                                "real_refund_quantity": 0,
                                "spu_id": "C2091947",
                                "spu_remark": "",
                                "accept_quantity": 2,
                                "id": "D8972178",
                                "sale_price": "100.00",
                                "real_quantity": 2,
                                "tax_rate": 0
                            }
                        ],
                        "driver_name": "陈司机",
                        "outstock_status": 1,
                        "origin_total_price": "200.00",
                        "print_times": 0,
                        "pay_status": 1,
                        "driver_id": 3384,
                        "route_name": "B2线路",
                        "sort_id": "2",
                        "receive_begin_time": "2019-08-30 06:00",
                        "total_price": "200.00",
                        "time_config_info": {
                            "final_distribute_time_span": 1,
                            "receive_time_limit": {
                                "end": "23:00",
                                "start": "06:00",
                                "receiveTimeSpan": "15",
                                "e_span_time": 1,
                                "s_span_time": 1
                            },
                            "desc": "午市",
                            "type": 1,
                            "service_time_creator": "T17188",
                            "final_distribute_time": "06:00",
                            "name": "午市",
                            "_id": "ST1748",
                            "task_begin_time": "06:00",
                            "order_time_limit": {
                                "start": "06:00",
                                "end": "22:30",
                                "e_span_time": 0
                            }
                        },
                        "salemenu_ids": [
                            "S10144"
                        ],
                        "station_id": "T17188",
                        "date_time": 1567081376,
                        "sale_money": "200.00",
                        "freight": "5.00",
                        "real_money": "200.00",
                        "freeze": 0,
                        "remark": null,
                        "inspect_status": 1,
                        "client": 1,
                        "client_desc": "后台下单",
                        "abnormal_money": "0.00",
                        "sale_money_without_tax": "200.00",
                        "id": "PL8288223",
                        "create_user": "miaotest",
                        "receive_end_time": "2019-08-30 23:00",
                        "customer": {
                            "receiver_phone": "15909098765",
                            "address": "广东省深圳市福田区华强北街道振兴路366港澳城(华强北路)",
                            "extender": {
                                "order_pay_method": 2,
                                "resname": "店铺0725"
                            },
                            "pick_up_st_name": null,
                            "address_id": "260314",
                            "salemenu_id": "",
                            "station_id": "",
                            "id": "273918",
                            "receiver_name": "一一",
                            "new_consumer": 0,
                            "receive_way": 1
                        },
                        "refund_money": "0.00",
                        "order_tax": "0.00"
                    }
                ]
            }
        }
说明:
    本次改动  在订单请求的数据中,增加两个字段「商品总件数」和「商品种类数」
    > 商品种类数 kind_of_sku -- details 列表的长度
        len(order['details'])
    > 商品总件数 number_of_sku -- 循环遍历汇总一下 details 列表中元素的 quantity 字段的值
        sum((temp['quantity'] for temp in order['details']))

    参数说明:
    * 注1  C -> conditional -> 某些条件下必选
    * 注2  client -> 订单来源 
        1后台下单 2微信商城 3app 4微信小程序 5有赞推送 6开放平台 7后台补录 8云管家代客下单
    * 注3  new_consumer -> 是否是新客
        1首次下单 2下单次数在小于等于7次 0超过7次下单
    * 注4  final_distribute_time_span -> 最晚配送时间和下单时间比的跨天数  
    * 注5  s_span_time -> 开始时间跟下单时间相比跨几天
    * 注6  e_span_time -> 结束时间跟下单时间相比跨几天    
    * 注7  receiveTimeSpan -> 收货时间选项的时间间隔,单位分钟
    * 注8  type -> 时间配置类型
        0默认 1普通 2预售

/product/sku/smart_formula_pricing/update 批量定价公式 「修改」

接口:
    /product/sku/smart_formula_pricing/update
class
    website/product/views/sku.py/SkuSmartFormulaPricingUpdateView
方法:
    POST
请求:
    all                       M    Int             是否全选  0否 1是
    filter_price_region       O    Int             定价范围 0默认 1价格区间筛选
    price_region_min          C    Float           价格范围下限
    price_region_max          C    Float           价格范围上限
    formula_status            M    Int             是否开启定价公式  0关闭 1开启
    formula                   O    Int             定价公式开启状态  0关闭 1开启 不传默认全部
    cal_type                  O    Int             计算方式[注1]
    cal_num                   O    Float           价格增量因子

    ############## 本次修改的字段  扩展 5最近入库价 6最近询价 ##################
    price_type                O    Int             销售价格类型[注2]
    filter_price_type         C    Int             定价范围价格类型[注3]

    ################### 下面这些参数在 all 为 1 时起作用 #####################
    category1_ids             O    List<String>    一级分类id列表
    category2_ids             O    List<String>    二级分类id列表
    pinlei_ids                O    List<String>    品类id列表
    q                         O    String          搜索字段  支持商品名,spu_id, sku_id
    salemenu_is_active        O    Int             报价单状态  1已激活的 不传默认全部状态
    state                     O    Int             sku状态  0下架 1上架 不传默认全部
    salemenu_ids              O    List<String>    报价单id列表

    ################### 下面这些参数在 all 为 0 时起作用 #####################
    sku_list                  O    List<String>    sku_id列表
响应:
    code                      M    Int             状态码
    msg                       M    String          状态消息
    data                      M    Dict/null       响应内容
示例:
    请求:
        {
            all: 0
            sku_list: ["D4481617","D6891006"]
            formula_status: 1
            price_type: 4
            cal_type: 0
            cal_num: 200
            filter_price_region: 1
            filter_price_type: 3
            price_region_max: 400
            price_region_min: 100
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data: null
        }
说明:
    本次修改:增加批量定价公式的两个数据来源「最新入库价」和「最近询价」

    * 注1  cal_type -> 计算方式
        0加 1乘 2除
    * 注2  price_type -> 销售价格类型
        0现单价 1供应商最近询价 2供应商最近采购价 3供应商最近入库价 4库存均价 5最近询价 6最近入库价
    * 注3  filter_price_type -> 定价范围价格类型
        0现单价 1供应商最近询价 2供应商最近采购价 3供应商最近入库价 4库存均价 5最近询价 6最近入库价

/product/sku/smart_pricing/list 获取所选sku的智能定价信息「修改」

接口:
    /product/sku/smart_pricing/list
class:
    website/product/views/sku.py/SkuSmartPricingListView
方法:
    POST
请求:
    all                       M    Int            是否全新选  0否 1是
    formula_type              M    Int            定价公式类型  1预设公式定价 2自定义公式 
    filter_price_region       O    Int             定价范围 0默认 1价格区间筛选
    price_region_min          C    Float           价格范围下限
    price_region_max          C    Float           价格范围上限
    formula_status            M    Int             是否开启定价公式  0关闭 1开启
    formula                   O    Int             定价公式开启状态  0关闭 1开启 不传默认全部
    cal_type                  O    Int             计算方式[注1]
    cal_num                   O    Float           价格增量因子
    offset                    O    Int             分页 偏移量
    limit                     O    Int             分页 返回条数

    ############## 本次修改的字段  扩展 5最近入库价 6最近询价 ##################
    filter_price_type         C    Int             定价范围价格类型[注2]
    price_type                O    Int             销售价格类型[注3]


    ########### 下面这些参数为二次查询参数(页面展示后的二次查询) ###############
    re_category1_ids          O    List<String>    一级分类id列表
    re_category2_ids          O    List<String>    二级分类id列表
    re_pinlei_ids             O    List<String>    品类id列表
    re_q                      O    String          搜索字段  支持商品名,spu_id, sku_id

    ################### 下面这些参数在 all 为 1 时起作用 #####################
    category1_ids             O    List<String>    一级分类id列表
    category2_ids             O    List<String>    二级分类id列表
    pinlei_ids                O    List<String>    品类id列表
    q                         O    String          搜索字段  支持商品名,spu_id, sku_id
    salemenu_is_active        O    Int             报价单状态  1已激活的 不传默认全部状态
    state                     O    Int             sku状态  0下架 1上架 不传默认全部
    salemenu_ids              O    List<String>    报价单id列表

    ################### 下面这些参数在 all 为 0 时起作用 #####################
    sku_list                  O    List<String>    sku_id列表
响应:
    code                      M    Int             状态码
    msg                       M    String          状态消息
    data                      M    Dict            响应内容
        {
            sku_list          M    List<Dict>      sku智能定价数据列表
                [
                    {

                        last_in_stock_price      M    Int       供应商最近入库价
                        last_purchase_price      M    Int       供应商最近采购价
                        last_quote_price         M    Int       供应商最近询价
                        latest_in_stock_price    M    Int       最近入库价
                        latest_quote_price       M    Int       最近询价
                        name                     M    String    sku名称
                        new_price:               M    Int       更新后的单价
                        old_price                M    Int       现单价
                        over_suggest_price       M    Bool      是否在建议定价区间
                        ratio                    M    Int       销售规格
                        sale_price               M    Int       更新后的销售单价
                        sale_unit_name           M    String    销售规格单位名称
                        salemenu_name            M    String    报价单名称
                        sku_id                   M    String    sku_id
                        std_unit_name            M    String    基本规格单位名称
                        stock_avg_price          M    Float     库存均价
                        suggest_price_max        M    Int       建议定价上限
                        suggest_price_min        M    Int       建议定价下限
                    },
                    ...
                ]
        }
    code                      M    Int             状态码
    pagination                M    Dict            分页信息
        {
            count             M    Int             计数
            limit             M    Int             返回条数限制
            offset            M    Int             偏移量
        }
示例:
    请求:
        {
            all: 0,
            sku_list: ["D4481617","D6891006","D17340816"],
            formula_type: 1
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data:
                {
                    sku_list: 
                        [
                            {
                                last_in_stock_price: 500,
                                last_purchase_price: 600,
                                last_quote_price: null,
                                latest_in_stock_price: 500,
                                latest_quote_price: null,
                                name: "大白菜|件",
                                new_price: 2800,
                                old_price: 2700,
                                over_suggest_price: true,
                                ratio: 5,
                                sale_price: 14000,
                                sale_unit_name: "件",
                                salemenu_name: "蔬菜报价单",
                                sku_id: "D4481617",
                                std_unit_name: "斤",
                                stock_avg_price: 2826.5039890727344,
                                suggest_price_max: 400,
                                suggest_price_min: 100,
                            }
                        ]
                }
            pagination:
                {
                    count: 2
                    limit: 20
                    offset: 0
                }
        }
说明:
    * 注1  cal_type -> 计算方式
        0加 1乘 2除
    * 注2  filter_price_type -> 定价范围价格类型
        0现单价 1供应商最近询价 2供应商最近采购价 3供应商最近入库价 4库存均价 5最近询价 6最近入库价
    * 注3  price_type -> 销售价格类型
        0现单价 1供应商最近询价 2供应商最近采购价 3供应商最近入库价 4库存均价 5最近询价 6最近入库价    

/product/sku/smart_pricing/update 更新所选 sku 智能定价信息「修改」

接口:
    /product/sku/smart_pricing/update
class:
    website/product/views/sku.py/SkuSmartPricingUpdateView
方法:
    POST
请求:
    all                       M    Int    是否全新选  0否 1是
    formula_type              M    Int    定价公式类型  1预设公式定价 2自定义公式 
    filter_price_region       O    Int             定价范围 0默认 1价格区间筛选
    price_region_min          C    Float           价格范围下限
    price_region_max          C    Float           价格范围上限
    formula_status            M    Int             是否开启定价公式  0关闭 1开启
    formula                   O    Int             定价公式开启状态  0关闭 1开启 不传默认全部
    cal_type                  O    Int             计算方式[注1]
    cal_num                   O    Float           价格增量因子
    modify_sku_list           O    List<Dict>      自定义修改的基本单价
        [
            {
                sku_id        M    String          sku_id
                price         M    String          更改后基本单价             
                status        M    String          sku状态  0未删除 1已删除
            },
            ...
        ]
    offset                    O    Int             分页 偏移量
    limit                     O    Int             分页 返回条数

    ############## 本次修改的字段  扩展 5最近入库价 6最近询价 ##################
    filter_price_type         C    Int             定价范围价格类型[注2]
    price_type                O    Int             销售价格类型[注3]

    ########### 下面这些参数为二次查询参数(页面展示后的二次查询) ###############
    re_category1_ids          O    List<String>    一级分类id列表
    re_category2_ids          O    List<String>    二级分类id列表
    re_pinlei_ids             O    List<String>    品类id列表
    re_q                      O    String          搜索字段  支持商品名,spu_id, sku_id

    ################### 下面这些参数在 all 为 1 时起作用 #####################
    category1_ids             O    List<String>    一级分类id列表
    category2_ids             O    List<String>    二级分类id列表
    pinlei_ids                O    List<String>    品类id列表
    q                         O    String          搜索字段  支持商品名,spu_id, sku_id
    salemenu_is_active        O    Int             报价单状态  1已激活的 不传默认全部状态
    state                     O    Int             sku状态  0下架 1上架 不传默认全部
    salemenu_ids              O    List<String>    报价单id列表

    ################### 下面这些参数在 all 为 0 时起作用 #####################
    sku_list                  O    List<String>    sku_id列表
响应:
    code                      M    Int             状态码
    msg                       M    String          状态消息
    data                      M    Dict            响应内容
        {
            task_url          M    String          异步任务信息
        }
示例:
    请求:
        {
            all: 0,
            sku_list: ["D4481617","D6891006","D17340816"],
            formula_type: 1,
            re_category1_ids: [],
            re_category2_ids: [],
            re_pinlei_ids: [],
            re_q: 
            modify_sku_list: [{"sku_id":"D6891006","price":"9000.00","status":0}]
        }
    响应:
        {
            code: 0,
            msg: 'ok',
            data:
                {
                    task_url: "/task/get?user_task_id=591126"
                }
        }
说明:
    * 注1  cal_type -> 计算方式
        0加 1乘 2除
    * 注2  filter_price_type -> 定价范围价格类型
        0现单价 1供应商最近询价 2供应商最近采购价 3供应商最近入库价 4库存均价 5最近询价 6最近入库价
    * 注3  price_type -> 销售价格类型
        0现单价 1供应商最近询价 2供应商最近采购价 3供应商最近入库价 4库存均价 5最近询价 6最近入库价

bshop 工程


/product/category/get 获取一级分类icon「修改」

原来的逻辑是取出全部的 icon,然后根据 category1 存储的id数据来提取 image_path 数据,

先需要增加一个 group _id 来筛选 icon 数据

接口:
    /product/category/get
class:
    website/product/views/category.py/GetCategoryView
方法:
    GET
请求:
    无
响应:
    不变
示例:
    请求:
        待添加
    响应:
        待添加
说明:
    从 request 中获取 group_id
    修改部分逻辑:根据 group_id 从数据库中获取用户自定义和系统默认的icon数据