添加mtwmapi.GetOrderIdByDaySeqSingle
This commit is contained in:
@@ -575,9 +575,23 @@ func (a *API) GetOrderDaySeq(poiCode string) (daySeq int, err error) {
|
|||||||
return daySeq, err
|
return daySeq, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *API) GetOrderIdByDaySeqSingle(poiCode string, dateTime time.Time, daySeq int) (vendorOrderID int64, err error) {
|
||||||
|
params := map[string]interface{}{
|
||||||
|
KeyAppPoiCode: poiCode,
|
||||||
|
"date_time": dateTime.Format("20060102"),
|
||||||
|
"day_seq": daySeq,
|
||||||
|
}
|
||||||
|
result, err := a.AccessAPI("order/getOrderIdByDaySeq", true, params)
|
||||||
|
if err == nil {
|
||||||
|
vendorOrderID = utils.ForceInterface2Int64(result.(map[string]interface{})["order_id"])
|
||||||
|
}
|
||||||
|
return vendorOrderID, err
|
||||||
|
}
|
||||||
|
|
||||||
// 订单流水号的开始序号,门店内每日的订单流水号都是从1开始。
|
// 订单流水号的开始序号,门店内每日的订单流水号都是从1开始。
|
||||||
// 订单流水号的结束序号,注意开始流水号与结束流水号的跨度需小于100,即差值最大为99
|
// 订单流水号的结束序号,注意开始流水号与结束流水号的跨度需小于100,即差值最大为99
|
||||||
// 这个函数在给定的区间范围全部没有订单时,返回错误808,但如果有部分订单,返回的错误是0
|
// 这个函数在给定的区间范围全部没有订单时,返回错误808,但如果有部分订单,返回的错误是0
|
||||||
|
// 此API速度与查询的区间范围直接相关,越大越慢(即使订单不存在),最大可到4,5秒级别
|
||||||
func (a *API) GetOrderIdByDaySeq(poiCode string, dateTime time.Time, seqStart, seqEnd int) (vendorOrderIDs []int64, err error) {
|
func (a *API) GetOrderIdByDaySeq(poiCode string, dateTime time.Time, seqStart, seqEnd int) (vendorOrderIDs []int64, err error) {
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
KeyAppPoiCode: poiCode,
|
KeyAppPoiCode: poiCode,
|
||||||
|
|||||||
@@ -121,7 +121,15 @@ func TestGetOrderActDetaill(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetOrderIdByDaySeq(t *testing.T) {
|
func TestGetOrderIdByDaySeq(t *testing.T) {
|
||||||
result, err := api.GetOrderIdByDaySeq("7111597", utils.Time2Date(time.Now()), 1, 100)
|
result, err := api.GetOrderIdByDaySeq("7111597", utils.Time2Date(time.Now()), 1, MaxGap4GetOrderIdByDaySeq)
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetOrderIdByDaySeqSingle(t *testing.T) {
|
||||||
|
result, err := api.GetOrderIdByDaySeqSingle("7111597", utils.Time2Date(time.Now()), 1)
|
||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user