修复GetProductInfoByBarCode中接口在维护时,返回错误结果中没有flag字段的问题(统一使用ret_code)
This commit is contained in:
@@ -9,6 +9,11 @@ import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
RetCodeFailed = -1
|
||||
RetCodeSuccess = 0
|
||||
)
|
||||
|
||||
type ProductInfo struct {
|
||||
OriginalName string `json:"originalName"`
|
||||
OriginalSpec string `json:"originalSpec"`
|
||||
@@ -73,9 +78,9 @@ func (a *API) GetProductInfoByBarCode(barCode string) (product *ProductInfo, err
|
||||
// baseapi.SugarLogger.Debug(utils.Format4Output(jsonResult, false))
|
||||
|
||||
showapiResBody := jsonResult["showapi_res_body"].(map[string]interface{})
|
||||
flag := showapiResBody["flag"].(bool)
|
||||
if !flag {
|
||||
return nil, utils.NewErrorIntCode(utils.Interface2String(showapiResBody["remark"]), int(utils.Str2Int64(utils.Interface2String(showapiResBody["ret_code"]))))
|
||||
retCode := int(utils.ForceInterface2Int64(showapiResBody["ret_code"]))
|
||||
if retCode != RetCodeSuccess {
|
||||
return nil, utils.NewErrorIntCode(utils.Interface2String(showapiResBody["remark"]), retCode)
|
||||
}
|
||||
product = &ProductInfo{
|
||||
OriginalName: showapiResBody["goodsName"].(string),
|
||||
|
||||
Reference in New Issue
Block a user