- delivery.IsErrShopExist

This commit is contained in:
gazebo
2019-07-24 18:18:21 +08:00
parent 32b53c9c9e
commit 3af1d77500
3 changed files with 19 additions and 0 deletions

View File

@@ -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
}

View File

@@ -81,6 +81,7 @@ const (
// 错误码
const (
ResponseCodeSuccess = 0
ResponseCodeInvalidParam = 4 // 参数格式错误
ResponseCodeShopNotExist = 112 // 门店不存在
)

View File

@@ -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,