aa
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
beego "github.com/astaxie/beego/adapter"
|
||||
beego "github.com/astaxie/beego/server/web"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/aliupcapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -169,7 +169,7 @@ func AddCategory(ctx *jxcontext.Context, cat *model.SkuCategory, userName string
|
||||
}
|
||||
cat.Seq = maxSeq.MaxSeq + 1
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -230,7 +230,7 @@ func UpdateCategory(ctx *jxcontext.Context, categoryID int, payload map[string]i
|
||||
}
|
||||
}
|
||||
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -326,7 +326,7 @@ func ReorderCategories(ctx *jxcontext.Context, parentID int, categoryIDs []int,
|
||||
catsMap[cat.ID] = cat
|
||||
}
|
||||
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -390,7 +390,7 @@ func DeleteCategory(ctx *jxcontext.Context, categoryID int, userName string) (nu
|
||||
} else if countInfos[2].Ct != 0 {
|
||||
return 0, errors.New("还有商品类别使用此类别,不能删除")
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -636,7 +636,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku, isQueryMidPric
|
||||
offset = jxutils.FormalizePageOffset(offset)
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
skuNamesInfo = &SkuNamesInfo{}
|
||||
txDB , _ := dao.Begin(db) // todo 这里用事务的原因是,SQL_CALC_FOUND_ROWS会出错
|
||||
txDB, _ := dao.Begin(db) // todo 这里用事务的原因是,SQL_CALC_FOUND_ROWS会出错
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -857,7 +857,7 @@ func AddSkuName(ctx *jxcontext.Context, skuNameExt *model.SkuNameExt, userName s
|
||||
}
|
||||
}
|
||||
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -978,7 +978,7 @@ func UpdateSkuName(ctx *jxcontext.Context, nameID int, payload map[string]interf
|
||||
if payload["eclpID"] != nil {
|
||||
eclpID = payload["eclpID"].(string)
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1144,7 +1144,7 @@ func SetStoreSkuSyncStatus2(db *dao.DaoDB, storeIDs []int, vendorIDs, skuIDs []i
|
||||
|
||||
func DeleteSkuName(ctx *jxcontext.Context, nameID int, userName string) (num int64, err error) {
|
||||
db := dao.GetDB()
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1223,7 +1223,7 @@ func AddSku(ctx *jxcontext.Context, nameID int, sku *model.Sku, userName string)
|
||||
sku.LadderBoxPrice = 10
|
||||
}
|
||||
sku.LadderBoxNum = 1
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1292,7 +1292,7 @@ func UpdateSku(ctx *jxcontext.Context, skuID int, payload map[string]interface{}
|
||||
valid := dao.StrictMakeMapByStructObject(payload, sku, userName)
|
||||
if len(valid) > 0 {
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(valid, false))
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1372,7 +1372,7 @@ func refreshStoreSkuPrice(ctx *jxcontext.Context, db *dao.DaoDB, skuID int) (err
|
||||
storeSku.JxPrice = jxutils.CaculatePriceByPricePack(storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage), int(storeSku.Price))
|
||||
storeSku.LastOperator = ctx.GetUserName()
|
||||
storeSku.UpdatedAt = time.Now()
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil || err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1392,7 +1392,7 @@ func refreshStoreSkuPrice(ctx *jxcontext.Context, db *dao.DaoDB, skuID int) (err
|
||||
|
||||
func DeleteSku(ctx *jxcontext.Context, skuID int, userName string) (num int64, err error) {
|
||||
db := dao.GetDB()
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1474,7 +1474,7 @@ func AddSkuNamePlace(ctx *jxcontext.Context, nameID, placeCode int, userName str
|
||||
}
|
||||
dao.WrapAddIDCULEntity(placeBind, userName)
|
||||
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1501,7 +1501,7 @@ func DeleteSkuNamePlace(ctx *jxcontext.Context, nameID, placeCode int, userName
|
||||
placeBind.NameID = nameID
|
||||
placeBind.PlaceCode = placeCode
|
||||
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1550,7 +1550,7 @@ func SortCategorySkus(ctx *jxcontext.Context, catID int, skuIDList []int) (err e
|
||||
}
|
||||
}
|
||||
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -1718,7 +1718,7 @@ func UpdateSkuNamesExPrefix(ctx *jxcontext.Context, nameIDs []int, imgWaterMark
|
||||
skuName.ID = nameID
|
||||
skuName.LastOperator = ctx.GetLoginID()
|
||||
skuName.UpdatedAt = time.Now()
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -2689,7 +2689,7 @@ func AddVendorCategoryMap(ctx *jxcontext.Context, vendorCategoryMap *model.Vendo
|
||||
vendorOrgCodes, _ := dao.GetVendorOrgCode(db, vendorCategoryMap.VendorID, vendorCategoryMap.VendorOrgCode, model.VendorOrgTypePlatform)
|
||||
vendorCategoryMap.VendorCategoryName = strings.Trim(vendorCategoryMap.VendorCategoryName, " ")
|
||||
dao.WrapAddIDCULDEntity(vendorCategoryMap, ctx.GetUserName())
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -2800,7 +2800,7 @@ func UpdateVendorCategoryMap(ctx *jxcontext.Context, ID int, vendorCategoryMap *
|
||||
}
|
||||
}
|
||||
vendorOrgCodes, err := dao.GetVendorOrgCode(db, vendorCategoryMap2.VendorID, vendorCategoryMap2.VendorOrgCode, model.VendorOrgTypePlatform)
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -2834,7 +2834,7 @@ func ReorderVendorCategories(ctx *jxcontext.Context, parentID, vendorID int, ven
|
||||
for _, cat := range vendorCatsMap {
|
||||
catsMap[cat.CategoryID] = cat
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -2871,7 +2871,7 @@ func LoadStoreVendorCategories(ctx *jxcontext.Context, vendorOrgCode string, ven
|
||||
if vendorCatMap, _ := dao.GetVendorCategoryMap(db, -1, 0, vendorID, vendorOrgCode, 0); len(vendorCatMap) > 0 {
|
||||
return fmt.Errorf("该账号下已有分类,请在这里修改!")
|
||||
}
|
||||
txDB , _ := dao.Begin(db)
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
|
||||
Reference in New Issue
Block a user