From 4ebf50d0769fd4ce77820d05fcc46abc6806c402 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 4 Jan 2019 14:51:43 +0800 Subject: [PATCH] - rename sku.index to sku.sku_index to avoid key word index --- business/jxstore/cms/sync.go | 6 +++--- business/model/sku.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/sync.go b/business/jxstore/cms/sync.go index d2082e7fc..e549d70d9 100644 --- a/business/jxstore/cms/sync.go +++ b/business/jxstore/cms/sync.go @@ -260,9 +260,9 @@ func (v *VendorSync) SyncSku(ctx *jxcontext.Context, db *dao.DaoDB, nameID, skuI MaxIndex int } // todo hard code 得到京东spu中sku的顺序(以方便以后修改销售属性) - if dao.GetRow(db, &tmpStruct, "SELECT MAX(index) max_index FROM sku WHERE name_id = ? AND jd_id > 0 AND jd_id < 4024012631406 ", sku.NameID) == nil { - sku.Index = tmpStruct.MaxIndex + 1 - updateFields = append(updateFields, "Index") + if dao.GetRow(db, &tmpStruct, "SELECT MAX(sku_index) max_index FROM sku WHERE name_id = ? AND jd_id > 0 AND jd_id < 4024012631406 ", sku.NameID) == nil { + sku.SkuIndex = tmpStruct.MaxIndex + 1 + updateFields = append(updateFields, "SkuIndex") } updateFields = append(updateFields, dao.GetVendorThingIDStructField(model.VendorNames[multiStoresHandler.GetVendorID()])) } diff --git a/business/model/sku.go b/business/model/sku.go index 4af48838d..5613322f6 100644 --- a/business/model/sku.go +++ b/business/model/sku.go @@ -184,7 +184,7 @@ type Sku struct { CategoryID int `orm:"column(category_id)" json:"categoryID"` // 特殊类别,一般用于秒杀,特价之类的特殊类别 NameID int `orm:"column(name_id)" json:"nameID"` // todo 这个索引应该要求唯一 - Index int `json:"-"` + SkuIndex int `json:"-"` Comment string `orm:"size(255)" json:"comment"` SpecQuality float32 `json:"specQuality"` SpecUnit string `orm:"size(8)" json:"specUnit"` // 质量或容量