修复京西门店的营业时间经过约束后为空时的bug
This commit is contained in:
@@ -257,8 +257,12 @@ func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, storeID int,
|
|||||||
if globals.EnableMtwmStoreWrite {
|
if globals.EnableMtwmStoreWrite {
|
||||||
err = api.MtwmAPI.PoiShipTimeUpdate(vendorStoreID, shippingTime)
|
err = api.MtwmAPI.PoiShipTimeUpdate(vendorStoreID, shippingTime)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
shippingTime = ""
|
||||||
if validOpTimeList := getOpTimeListFromErr(err); len(validOpTimeList) > 0 {
|
if validOpTimeList := getOpTimeListFromErr(err); len(validOpTimeList) > 0 {
|
||||||
err = api.MtwmAPI.PoiShipTimeUpdate(vendorStoreID, openTimeJX2Mtwm(constrainOpTimeList(opTimeList, validOpTimeList)))
|
shippingTime = openTimeJX2Mtwm(constrainOpTimeList(opTimeList, validOpTimeList))
|
||||||
|
}
|
||||||
|
if shippingTime != "" {
|
||||||
|
err = api.MtwmAPI.PoiShipTimeUpdate(vendorStoreID, shippingTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
|
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
// _ "git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
// _ "git.rosy.net.cn/jx-callback/business/jxcallback/orderman"
|
||||||
)
|
)
|
||||||
@@ -36,3 +37,9 @@ func TestConstrainOpTimeList(t *testing.T) {
|
|||||||
t.Fatal("constrainOpTimeList failed")
|
t.Fatal("constrainOpTimeList failed")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetOpTimeListFromErr(t *testing.T) {
|
||||||
|
err := utils.NewErrorIntCode("当前配送营业时间为:07:00~24:00", mtwmapi.ErrCodeOpFailed)
|
||||||
|
list := getOpTimeListFromErr(err)
|
||||||
|
t.Log(list)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user