diff --git a/platformapi/dadaapi/dadaapi.go b/platformapi/dadaapi/dadaapi.go index d77a38ff..00901b4a 100644 --- a/platformapi/dadaapi/dadaapi.go +++ b/platformapi/dadaapi/dadaapi.go @@ -186,3 +186,12 @@ func IsErrShopNotExist(err error) bool { } return false } + +func IsErrShopExist(err error) bool { + if err != nil { + if errExt, ok := err.(*utils.ErrorWithCode); ok && errExt.IntCode() == ResponseCodeShopAlreadyExist { + return true + } + } + return false +} diff --git a/platformapi/mtpsapi/mtpsapi.go b/platformapi/mtpsapi/mtpsapi.go index a7bd2a33..bbd54717 100644 --- a/platformapi/mtpsapi/mtpsapi.go +++ b/platformapi/mtpsapi/mtpsapi.go @@ -81,6 +81,7 @@ const ( // 错误码 const ( ResponseCodeSuccess = 0 + ResponseCodeInvalidParam = 4 // 参数格式错误 ResponseCodeShopNotExist = 112 // 门店不存在 ) diff --git a/platformapi/mtpsapi/shop.go b/platformapi/mtpsapi/shop.go index 505e6648..c8b337bf 100644 --- a/platformapi/mtpsapi/shop.go +++ b/platformapi/mtpsapi/shop.go @@ -74,6 +74,15 @@ func IsErrShopNotExist(err error) bool { return false } +func IsErrShopExist(err error) bool { + if err != nil { + return utils.IsErrMatch(err, utils.Int2Str(ResponseCodeInvalidParam), []string{ + "该合作方下已存在outerPoiId", + }) + } + return false +} + func (a *API) SimulateShopStatus(shopID string, status int) (err error) { params := map[string]interface{}{ "shop_id": shopID,