- rename sku.index to sku.sku_index to avoid key word index

This commit is contained in:
gazebo
2019-01-04 14:51:43 +08:00
parent 010e5a5c0c
commit 4ebf50d076
2 changed files with 4 additions and 4 deletions

View File

@@ -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()]))
}

View File

@@ -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"` // 质量或容量