Skip to content

二期微服务接口设计

二期微服务接口设计

订单列表获取

    url: order/list
    method: POST
    请求:                                   原名
        id                      O   str     _id         
        station_id              O   str 
        time_config_id          O   str
        receive_begin_time      O   str     customer.receive_begin_time
        receive_end_time        O   str     customer.receive_end_time
        address_id              O   str     customer.address_id
        address_sign_id         O   str     customer.address_sign_id
        user_id                 O   str     customer.uid
        detail_sku_id           O   str     details.id
        date_time               O   str 
        status                  O   int
        pay_status              O   int
        settle_way              O   int
        salemenu_ids            O   str
        remark                  O   str
        batch_remark            O   str     分拣备注
        district_code           O   str
        serials                 O   str
        out_order_id            O   str
        print_times             O   int
        -----------------------------------------
        projection              O   list
        sort                    O   list    必须是order主表的key,因为数据是按照订单每一条返还的  
        page_obj                O   string  起始页(不包含),默认第0页
        reverse                 O   bool    是否反向查询。1:是,0:不是。默认为否。
        limit                   O   int     返回条数,默认0。传0表示返回所有数据。
        offset                  O   int     查询起点偏移条数,默认 0 
        peek                    O   int     是否需要 peek,默认不需要 peek。peek 必须大于 limit。
        count                   O   bool    是否需要 count,默认不需要 count。

        $or
            pay_status
            settle_way
            expire_time
            create_time
            receive_begin_time                      customer.receive_begin_time
            date_time
            detail_search_text                      details.search_text
            detail_sku_id                           details.id
            address_id                              customer.address_id
            id

    说明:
    1. 每个key支持 '$in', '$gt', '$gte', '$lt', '$lte', '$regex','$eq', '$exists', '$ne'
    2. detail_ 开头的用来标识detail表的字段,不要随意取detail开头

    返回:
   {
        "code": 0
        "msg": "ok"
        "data": {
            ...
        },
        "pagination": {              M   dict
            "peek": 100,             O   int     传 peek 的话,就会返回这个字段
            "more": true,            M   bool    是否有更多数据
            "page_obj": "gtyuhbg",   M   string
            "count": 2000            O   int     传 count 的话,就会返回这个字段
        }
    }

    逻辑修改:
    station website/station/dals/refund.py:209  refunds字段
    station website/station/dals/order_sku.py:257  查询逻辑有点复杂 要重写
    station website/weight/dals/weigh_collect.py:472  查询逻辑有点复杂 要重写
    station website/station/stock/dals/in_stock_sku_logic.py:398 聚合查询,要重写
    ma      website/common/mongo/order.py:97 去掉refunds,abnormals筛选字段,放在逻辑里面筛选
    ma      website/services/order/__init__.py:202  查询逻辑有点复杂 要重写
    ma      website/ordermanage/dals/daily.py:204   聚合查询,要重写(已完成)

    涉及到的查询key的名称都要改


    # 测试,着重测试的接口
    # ordermanage/daily/search
    # ordermanage/daily/export
    # report/orders
    # ordermanage/orders/list
    ----------station-----------
    # /station/stock/refund_stock_sku
    # process/sort/sku/submit
    # process/sort/sku/cancel
    # 金蝶导入

订单修改

    url: order/update
    method: POST
    请求:                                     原名

        update_dict {'filter': {'id': '','detail_id':''}, data':{'detail_spu_remark':'','total_price':''}}

        filter:
        id                          M   str 
        detail_sku_id               O   str     details.id
        status                      O   int
        ----------------------------------------------------------------
        print_times                 O   int
        batch_remark                O   str
        status                      O   int
        pay_status                  O   int
        distribute_time             O   str
        serials                     O   str
        has_pic                     O   str
        delivery_time               O   str
        total_price                 O   str
        real_price                  O   str
        total_pay                   O   str
        coupon_id                   O   str
        coupon_min_total_price      O   str
        coupon_amount               O   str
        coupon_max_discount_percent O   str
        is_purchase_task_synced     O   str
        is_purchase_task_new_synced O   str
        remark                      O   str
        receive_begin_time          O   str     customer.receive_begin_time
        receive_end_time            O   str     customer.receive_end_time
        detail_std_real_count       O   str     details.material.real_std_count
        detail_std_accept_count     O   str     details.material.accept_std_count
        detail_sale_weighting_quantity  O   str details.sale_weighting_quantity
        detail_weighting_quantity   O   str     details.weighting_quantity
        detail_out_of_stock         O   str     details.out_of_stock
        detail_is_weight            O   str     details.is_weight
        detail_cost                 O   str     details.material.cost
        detail_stock_count          O   str     details.material.stock_count
        detail_real_is_weight       O   str     details.real_is_weight
        detail_sort_way             O   str     details.sort_way



    返回:
   {
        "code": 0
        "msg": "ok"
        "data": null
    }

    逻辑修改:
    station website/station/views/print_status.py:36    print_times修改
    station website/station/views/distribute_task.py:636
    station service/dals/order_deliver_info.py:83
    station service/order/real_quantity.py:165          称重修改订单逻辑移到order
    station website/driver_app/dals/exception.py:507    异常修改订单的接口移到order
    station website/station/dals/refund.py:539          退货修改订单的接口移到order
    station common/mongo/order.py:457                   订单价格(文档更新)移到order
    ma      website/ordermanage/dals/exception.py:444   异常退货修改订单的接口移到order
    涉及到的update都要改些逻辑。

订单批量更新bulk_write,对应多个sku_id的不同数据

    url: order/ 
    method: POST
    请求:                                     
        update_list [{'filter': {'id': '','detail_id':''}, data':{'detail_spu_remark':'','total_price':''}}]


    说明:filter里的id和detail_id必须有, data里的detail开头就是detail表里的字段,其他为主表字段


    返回:
   {
        "code": 0
        "msg": "ok"
        "data": null
    }

    涉及接口: 调用order_bulk_write相关接口

订单详情排序

url: order/ 
    method: POST
    请求:
    sku_sort                    M   list        特别字段用于details排序
    id                          M   str         订单id

    返回:
   {
        "code": 0
        "msg": "ok"
        "data": null
    }