1
This commit is contained in:
@@ -670,7 +670,6 @@ func CreateAct(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOr
|
||||
}
|
||||
|
||||
func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []int, vendorOrgCode string, actStoreSku []*ActStoreSkuParam) (err error) {
|
||||
globals.SugarLogger.Debugf("================actStoreSku := %s", utils.Format4Output(actStoreSku, false))
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
actStoreSkuMap = make(map[int][]*model.StoreSkuBind)
|
||||
@@ -722,6 +721,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(1111, false))
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -730,6 +730,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
}
|
||||
}()
|
||||
dao.WrapAddIDCULDEntity(act, ctx.GetUserName())
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(2222, false))
|
||||
err = dao.CreateEntityTx(txDB, act)
|
||||
if err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -740,12 +741,14 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
VendorID: vendorID,
|
||||
VendorOrgCode: vendorOrgCode,
|
||||
}
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(3333, false))
|
||||
dao.WrapAddIDCULDEntity(actMap, ctx.GetUserName())
|
||||
err = dao.CreateEntityTx(txDB, actMap)
|
||||
if err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
return err
|
||||
}
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(444, false))
|
||||
for storeID, storeSkus := range actStoreSkuMap {
|
||||
for _, storeSku := range storeSkus {
|
||||
actStoreSkuModel := &model.ActStoreSku{
|
||||
@@ -757,6 +760,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
ActPrice: int64(storeSku.JdsPrice),
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(actStoreSkuModel, ctx.GetUserName())
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(555, false))
|
||||
err = dao.CreateEntityTx(txDB, actStoreSkuModel)
|
||||
if err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -772,6 +776,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
ActualActPrice: int64(storeSku.JdsPrice),
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(actStoreSkuMapModel, ctx.GetUserName())
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(666, false))
|
||||
err = dao.CreateEntityTx(txDB, actStoreSkuMapModel)
|
||||
if err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -779,6 +784,7 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
}
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(1111, false))
|
||||
dao.Commit(db, txDB)
|
||||
if !globals.IsProductEnv() {
|
||||
return err
|
||||
|
||||
@@ -2,6 +2,7 @@ package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/business/partner/purchase/mtwm"
|
||||
|
||||
@@ -160,6 +161,7 @@ func (c *ActController) CreateActForMtByOrder() {
|
||||
}
|
||||
//retVal, err = act.CreateAct(params.Ctx, actObj, vendorIDs, params.VendorOrgCode, nil, actStoreSkuList, params.IsAsync)
|
||||
err = act.CreateActForMtByOrder(params.Ctx, actObj, vendorIDs, params.VendorOrgCode, actStoreSkuList)
|
||||
globals.SugarLogger.Debugf("================CreateActForMtByOrder := %v", err)
|
||||
}
|
||||
}
|
||||
return "success", "", err
|
||||
|
||||
Reference in New Issue
Block a user