京东到家活动消息回调时,避免创建重复的活动
This commit is contained in:
@@ -518,6 +518,21 @@ func (a *ActManager) CreateActFromVendor(ctx *jxcontext.Context, act2 *model.Act
|
||||
}
|
||||
|
||||
func createActFromVendor(ctx *jxcontext.Context, db *dao.DaoDB, act2 *model.Act2, actStoreSku []*model.ActStoreSku2) (actID int, err error) {
|
||||
actMap := &model.ActMap{
|
||||
VendorID: act2.VendorID,
|
||||
VendorActID: act2.VendorActID,
|
||||
SyncStatus: 0,
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(actMap, ctx.GetUserName())
|
||||
if actMap.VendorActID != "" {
|
||||
if err = dao.GetEntity(db, actMap, model.FieldVendorActID, model.FieldVendorID, model.FieldDeletedAt); err == nil {
|
||||
return actMap.ActID, nil
|
||||
} else if !dao.IsNoRowsError(err) {
|
||||
return 0, err
|
||||
}
|
||||
err = nil
|
||||
}
|
||||
|
||||
dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -534,13 +549,7 @@ func createActFromVendor(ctx *jxcontext.Context, db *dao.DaoDB, act2 *model.Act2
|
||||
return 0, err
|
||||
}
|
||||
|
||||
actMap := &model.ActMap{
|
||||
ActID: act.ID,
|
||||
VendorID: act2.VendorID,
|
||||
VendorActID: act2.VendorActID,
|
||||
SyncStatus: 0,
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(actMap, ctx.GetUserName())
|
||||
actMap.ActID = act.ID
|
||||
err = dao.CreateEntity(db, actMap)
|
||||
if err != nil {
|
||||
dao.Rollback(db)
|
||||
@@ -702,7 +711,7 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act
|
||||
}
|
||||
}
|
||||
|
||||
if isNeedCancelAct {
|
||||
if isNeedCancelAct && act.Type != model.ActSkuFake {
|
||||
act := &model.Act{}
|
||||
act.ID = actID
|
||||
if _, err = dao.UpdateEntityLogically(db, act,
|
||||
|
||||
Reference in New Issue
Block a user