From ae8b6a32c1ed7eb979fdb07d6bb1a518de3822eb Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 8 Nov 2019 09:39:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=88=B0=E5=AE=B6=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=B6=88=E6=81=AF=E5=9B=9E=E8=B0=83=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E5=88=9B=E5=BB=BA=E9=87=8D=E5=A4=8D=E7=9A=84?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/act/act.go | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/business/jxstore/act/act.go b/business/jxstore/act/act.go index 9b6907fb2..7f62439dd 100644 --- a/business/jxstore/act/act.go +++ b/business/jxstore/act/act.go @@ -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,