Skip to content

修改的接口

/station/orders 拉取订单列表

接口名:/station/orde
Method:GET
请求:
    〖新增〗query_type  M   int     [1: 按照下单时间搜索, 2: 按照周期时间搜索; 3: 按照收货时间搜索]

    # 按照下单时间搜索
    start_date  C   string  开始下单日期
    end_date    C   string  截止下单日期

    # 按照周期时间搜索
    time_config_id   C   string  时间配置ID
    cycle_start_time C   string  开始周期时间
    cycle_end_time   C   string  结束周期时间

    # 按照收货时间搜索
    〖新增〗receive_start_date C string  开始收货时间
    〖新增〗receive_end_date   C string  结束收货时间

    # 其他搜索条件
    search_text M   string  搜索内容
    sort_type   O   string  排序类型(date_desc日期倒序(默认);date_asc日期升序;price_desc价格倒序;price_asc价格升序)
    status      O   int     订单状态
    offset      O   int     分页offset
    limit       O   int     分页limit
响应:
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   list    订单列表数据,数据字段为订单表字段;
示例:
    request:
        # 按照下单时间搜索
        http://station.guanmai.cn/station/orders?query_type=1&start_date=2016-10-10&end_date=2016-10-10&search_text=&offset=0&limit=20

        # 按照周期时间搜索
        http://station.guanmai.cn/station/orders?query_type=2&time_config_id=ST001&cycle_start_time=2017-05-03-06-00-00&cycle_end_time=2017-05-03-06-00-00&search_text=&offset=0&limit=20

        # 按照收货时间搜索
        http://station.guanmai.cn/station/orders?query_type=3receive_start_date=2017-04-19&receive_end_date=2017-04-21&search_text=&offset=0&limit=20

    response:
        {
            "code": 0,
            "data": {
                "pagination": {
                    "offset": 0,
                    "count": 8,
                    "limit": 20
                },
                "list": [
                    {
                        "freight": 20,
                        "details": [
                            {
                                "sync_origin_id": "D805892",
                                "spu_id": "C00935",
                                "total_item_pay": 25.76,
                                "accept_quantity": 7,
                                "version": 55,
                                "quantity": 7,
                                "spu_remark": "",
                                "real_item_price": 25.76,
                                "total_item_price": 25.76,
                                "sale_price": 3.68,
                                "id": "D805892",
                                "real_quantity": 7
                            }
                        ],
                        "time_config_info": {
                            "_id": "ST001",
                            "desc": "小农女默认服务时间",
                            "final_distribute_time": "06:00",
                            "order_time_limit": {
                                "end": "02:00",
                                "start": "06:00",
                                "e_span_time": 1
                            },
                            "type": 0,
                            "task_begin_time": "06:00",
                            "final_distribute_time_span": 1,
                            "receive_time_limit": {
                                "end": "23:30",
                                "receiveTimeSpan": "30",
                                "start": "06:00",
                                "s_span_time": 6,
                                "e_span_time": 6
                            },
                            "service_time_creator": "T001",
                            "name": "小农女默认服务时间"
                        },
                        "customer": {
                            "receiver_phone": "产品技术测试1111111",
                            "address": "产品技术测试1111111",
                            "station_id": "",
                            "new_consumer": 0,
                            "address_id": "10936",
                            "salemenu_id": "",
                            "receiver_name": "产品技术测试1111111",
                            "extender": {
                                "resname": "产品技术测试1111111"
                            },
                            "id": "22953"
                        },
                        "receive_end_time": "2016-10-16 23:30",
                        "status": 1,
                        "origin_total_price": 25.76,
                        "date_time": 1476065329.588,
                        "receive_begin_time": "2016-10-16 06:00",
                        "station_id": "T002",
                        "id": "PL316094",
                        "date_time_str": "2016-10-10 10:08:49",
                        "total_price": 25.76
                    },

                ]
            },
            "msg": "ok"
        }

/data_center/profit/daily/ 每日利润报表

描述
    拉取一定时间区间内的利润报表
Method
    GET
请求
    〖新增〗query_type  M   int     [1: 按照下单时间搜索, 2: 按照周期时间搜索; 3: 按照收货时间搜索]

    # 按照下单时间搜索
    <del>begin   M    datetime    开始下单日期</del>
    <del>end     M    datetime    开始下单日期</del>
    〖新增〗start_date       C   string  开始下单日期
    〖新增〗end_date         C   string  截止下单日期

    # 按照周期时间搜索
    〖新增〗time_config_id   C   string  时间配置ID
    〖新增〗cycle_start_time C   string  开始周期时间
    〖新增〗cycle_end_time   C   string  结束周期时间

    # 按照收货时间搜索
    〖新增〗receive_start_date C string  开始收货时间
    〖新增〗receive_end_date   C string  结束收货时间

    # 其他搜索条件
    export  O    bool        是否导出,默认为0不导出
    //session
    station_id  M   string  站点ID

响应
    code    M   int     返回码,0表示成功,其他表示错误
    msg     M   string  错误信息
    data    M   string  返回json数据

    [{
        "gross_profit_rate" M   string  毛利率
        "real_refund_money" M   float   实际退货金额
        "ASP"   M   float   ASP(订单均价)
        "freight"   M   float   运费
        "orderedtime"   M   datetime    下单日期
        "customer_ordered"  M   int 下单客户数
        "money_delivered"   M   float   送货金额
        "money_per_customer"    M   float   客单价
        "money_cost"    M   float   成本
        "gross_profit"  M   float   毛利
        "abnormal_money"    M   float   异常金额
        "sale_money_with_freight"   M   float   销售额(包括运费)
        "money_ordered" M   float   下单金额
        "sale_money"    M   float   销售额
        "amount_ordered"    M   int     下单数

        // iff request.query_type == 2:
        〖新增〗"time_config_name"   M  str  时间配置名
        〖新增〗"cycle_start_time"   M  str   周期开始时间
        〖新增〗"cycle_end_time"   M str   周期结束时间
    }]
示例
    request
        http://station.guanmai.cn/data_center/profit/daily/?begin=2016-10-28&end=2016-10-28&export=0
    response
        {
            "msg": "ok",
            "code": 0,
            "data": [{
                "gross_profit_rate": "100.00%",
                "real_refund_money": 0.0,
                "ASP": 96.7,
                "freight": 0.0,
                "orderedtime": "2016-10-28",
                "customer_ordered": 4,
                "money_delivered": 676.92,
                "money_per_customer": 169.23,
                "money_cost": 0.0,
                "gross_profit": 676.92,
                "abnormal_money": 0.0,
                "sale_money_with_freight": 676.92,
                "money_ordered": 676.92,
                "sale_money": 676.92,
                "amount_ordered": 7,

                // iff request.query_type == 2:
                〖新增〗"time_config_name": "金昌运营时间",
                〖新增〗"cycle_start_time": "2017-4-1 20:00",
                〖新增〗"cycle_end_time": "2017-4-2 10:00",

                // iff request.query_type == 3:
                〖新增〗"receive_begin_time": "2017-04-07",
            }]
        }
逻辑
    统计的日期包括近两天的
        近两天的那部分临时统计
            删除原有的统计数据
            生成新的统计数据
                统计信息以站点ID,下单日期,销售单ID为单位来统计
                每条统计下统计商品,商户,异常,退货几个维度的数据
                特殊逻辑是
                1.运费是重复记录在所有的统计数据中的
                2.非商品异常不对应任何一个销售单ID,所以非商品异常会随机的写到某个销售单的统计内,
                并且在总的统计下再写一遍,上游展示销售单统计时减去非商品异常的内容就可以得到正确的统计值
    拉取需要的时间区间的所有统计
    将相同日期的数据相加后生成最后的统计返回

/data_center/profit/detail/salemenu/ 每日利润报表

未完待续