Skip to content

限购

限购

station

station/skus 限购规则里搜索sku

Method: GET
请求
    search_text             O string 在限购的营销活动搜索里,字段必传
响应
    salemenu_id             M string 销售单
    salemenu_name           M string 销售单名
    last_qoute_price        M int    最近询价
    last_purchase_price     M int    最近采购价
    last_in_stock_price     M int    最近入库价
    stock_avg_price         M int    库存均价

station/promotion/create 创建营销活动

Method: POST
请求
    新增字段
    skus M list [{
        price   C float 活动价
        limit_number        C int   限购数
    }]
    type M int 营销活动类型。1:默认,2:限购。
响应
    同一商品已经参与了其他的限购活动,会返回一下信息,否则正常返回。
    code M 4
    msg M null
    data M list[{
        sku_id          M str   sku_id
        sku_name        M str   sku名
        promotion_name  M str   活动名
        price           M float 活动价
        sale_unit_name  M str   销售单位
        limit_number    M int   限购数
    }]

逻辑
    1.添加营销活动,当营销活动是限购时。需要添加活动价和限购数量。当promotion_type是1时,promotion_price和limit_number必传。
    2.创建时需要判断同一商品是否已经参与了其他的有效限购活动,如有商品参加了其他活动会返回错误码4,和商品的活动信息。

station/promotion/get 获取营销活动详情

Method:GET
request:
    不变
response:
    type   M   营销活动类型。int 1:默认,2:限购。
    skus   M   list  sku信息
    [{
        price               C float  活动价
        limit_number        C int    限购数
        last_qoute_price    M int    最近询价
        last_purchase_price M int    最近采购价
        last_in_stock_price M int    最近入库价
        stock_avg_price     M int    库存均价
        sale_unit_name      M int    销售单价
        sale_price          M int    当前定价
    }]

逻辑:当营销活动是限购类型时,返回的skus文档里需要添加活动价和限购数。

station/promotion/update 营销活动更改

Method: POST
请求
    新增字段
    skus M list  sku信息
    [{
        price         C float 活动价
        limit_number  C int 限购数
    }]
    type          M int 1:默认,2:限购。
响应
  当同一商品已经参与了同类型有效活动
    code M 4
    msg M null
    data M list
    [{
        sku_id             M string
        sku_name           M string sku名
        promotion_name     M string 活动名
        price              M float 活动价
        sale_unit_name     M string 销售单位
        limit_number       M int 限购数
    }]

逻辑
    1.添加营销活动,当营销活动是限购时。需要添加活动价和限购数量。当promotion_type是1时,promotion_price和limit_number必传。
    2.创建时需要判断同一商品是否已经参与了其他的有效限购活动,如有商品参加了其他活动会返回错误码4,和商品的活动信息。

station/promotion/list 营销活动搜索

Method: POST
请求
    新增字段
    type O int 1:默认,2:限购。
响应
    code M 0
    msg M null
    data M list
    [{
        type  O int 1:默认,2:限购。
    }]

逻辑
    添加一个搜索条件,按活动类型搜索。

station/promotion/delete 营销活动删除

Method: POST
请求
    不变
响应
  不变
逻辑
    需要改变参加营销活动的sku状态

bshop

product/promotion_sku/get 获取营销规则里的商品

Method: POST
请求
    不变
响应
    code    M 0
    msg M null
    data    M list[
        skus O list sku信息
        [ {
            promotion_price C float 活动价
            limit_number    C int 限购数
        }]
    ]
逻辑
    当商品参加限购活动时,需要添加商品里添加活动价和限购数。

product/sku/search 商品搜索

Method: POST
请求
    不变
响应
    code M 4
    msg M null
    data M list[
        skus O list  sku信息
        [{
            promotion_price C float 活动价
            limit_number    C int 限购数
        }]
    ]
逻辑
    当商品参加限购活动时,需要添加商品里添加活动价和限购数。

product/sku/get 获取商品

Method: POST
请求
    不变
响应
    code    M 0
    msg M null
    data    M list[
        skus O list sku信息
        [{
            promotion_price C float 活动价
            limit_number    C int 限购数
        }]
    ]
逻辑
    当商品参加限购活动时,需要添加商品里添加活动价和限购数。

product/sku/detail 获取活动商品的详情页

Method: POST
request:
    不变
response:
        code    M 0
    msg M null
    data    M list[
        skus O list sku信息
        [{
            promotion_price C float 活动价
            limit_number    C int 限购数
        }]
    ]
逻辑
    当商品参加限购活动时,需要添加商品里添加活动价和限购数。

order/cart 获取购物车里的商品详情

Method: POST
request:
    不变
response:
    code  M 1
    msg   M null
    data  M dict{
        orders  M list[{
            discounted_price O float    订单的优惠金额
            salemenus        M list     salemenu信息
            [
                skus        M list      sku信息
                [{
                    promotion_price   M float 活动价
                    using_promotion_amount  O int sku此次参加限购活动的数量
                    promotion_amount  O int sku限购数
                    sku_discounted_price  O float sku优惠金额
                }]

            ]
        all_discounted_price O float 全部优惠金额
            }
逻辑
    order里的total_price和all_price显示的都是最终付款价,all_discounted_price是优惠价格。

order/confirm 验证订单下的商品是否有效

Method:
    GET
request:
    不变
response:
    code M 0
    msg M null
    data M dict{
        orders M list[
            {
            discounted_price    O float 订单的优惠金额
            }
        ]
        all_discounted_price        O float 全部优惠金额
    }
逻辑
    order里的total_price和all_price显示的都是最终付款价,all_discounted_price是优惠价格。

order/submit 提交订单

后台逻辑改动:
    1.当存在使用营销价格的sku时,需要在product中添加字段using_promotion_amount和promotion_price。
    2.直接根据需要修改表promotion_amount_history中的using_promotion_amount数量。

cart/update 更新购物车

逻辑
    保存购物车中商品信息时,计算总价的逻辑需要改动。需要判断商品有没有参加限购活动,若参加,计算总价的逻辑需要改变。

order

/order/create 创建订单

Method: POST
请求
    products M list 商品信息
    [{
        promotion_price   O  int 营销价格
        promotion_amount  O  int sku参加限购活动的数量
    }]
响应
    不变
逻辑
    当存在营销价格时,直接改变sale_price

/order/detail/update 更新订单里的商品

Method: POST
请求
    products M list 商品信息
    [{
        promotion_price   O  int 营销价格
        promotion_amount  O  int sku参加限购活动的数量
    }]
响应
    不变
逻辑
    当存在营销价格时,直接改变sale_price。

数据库

MySQL

表promotion_sku

添加字段(3个):
    price int(11) DEFAULT NULL COMMENT '营销价格',
    limit_number int(11) DEFAULT NULL COMMENT '营销数量',
    type int(11) DEFAULT NULL COMMENT '营销类型',
    active int(5) DEFAULT '1' COMMENT '1代表激活,0代表未激活',
    status int(5) DEFAULT '1' COMMENT '1代表存在,0代表删除',

表marketing_promotion

添加字段(1个):
    type int(11) DEFAULT NULL COMMENT '1:代表限购,2:代表默认'

MongoDB

表order_new

新增字段(3个):
    details
    [{
        promotion_price    int 营销价格
        using_promotion_amount  int sku参加限购活动的数量
    }]
    total_promotion_price  int 订单总的优惠价