+ jxutils/jsonerr用于JSON描述的错误
+ ErrCodeJsonFormat - ActStoreSkuParam2Model中判断活动信息是否有交叉,并返回交叉错误信息
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jsonerr"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
@@ -91,11 +92,14 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
||||
}
|
||||
storeIDs := jxutils.IntMap2List(storeIDMap)
|
||||
skuIDs := jxutils.IntMap2List(skuIDMap)
|
||||
// effectActStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, storeIDs, skuIDs, time.Now(), time.Now())
|
||||
// if err != nil {
|
||||
// globals.SugarLogger.Errorf("updateActPrice4StoreSkuNameNew can not get sku promotion info for error:%v", err)
|
||||
// return nil, nil, nil, err
|
||||
// }
|
||||
effectActStoreSkuList, err := dao.GetEffectiveActStoreSkuInfo(db, 0, nil, storeIDs, skuIDs, time.Now(), time.Now())
|
||||
if err != nil {
|
||||
globals.SugarLogger.Errorf("updateActPrice4StoreSkuNameNew can not get sku promotion info for error:%v", err)
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
if len(effectActStoreSkuList) > 0 {
|
||||
return nil, nil, nil, jsonerr.New(effectActStoreSkuList)
|
||||
}
|
||||
|
||||
storeSkuList, err2 := dao.GetStoresSkusInfo(db, storeIDs, skuIDs)
|
||||
if err = err2; err != nil {
|
||||
|
||||
24
business/jxutils/jsonerr/jsonerr.go
Normal file
24
business/jxutils/jsonerr/jsonerr.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package jsonerr
|
||||
|
||||
import "git.rosy.net.cn/baseapi/utils"
|
||||
|
||||
type Error struct {
|
||||
Obj interface{}
|
||||
ObjStr string
|
||||
}
|
||||
|
||||
func New(obj interface{}) (err *Error) {
|
||||
return &Error{
|
||||
Obj: obj,
|
||||
ObjStr: string(utils.MustMarshal(obj)),
|
||||
}
|
||||
}
|
||||
|
||||
func IsJsonErr(err error) bool {
|
||||
_, ok := err.(*Error)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (e *Error) Error() string {
|
||||
return e.ObjStr
|
||||
}
|
||||
@@ -10,6 +10,8 @@ const (
|
||||
ErrCodeTokenIsInvalid = "-2"
|
||||
ErrCodeUserNotExist = "-3"
|
||||
ErrCodeUserAlreadyExist = "-4"
|
||||
|
||||
ErrCodeJsonFormat = "-10" // 这个错误号表示description中的是一个json对象,不是错误文本
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -162,7 +162,7 @@ func (c *ActController) CancelAct() {
|
||||
// @Title 得到活动平台信息
|
||||
// @Description 得到活动平台信息
|
||||
// @Param token header string true "认证token"
|
||||
// @Param actID query int false "活动id"
|
||||
// @Param actID query int true "活动id"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
// @router /GetActVendorInfo [get]
|
||||
|
||||
Reference in New Issue
Block a user