- make SkuNameExt.Skus as real object (not string).
This commit is contained in:
@@ -12,7 +12,8 @@ import (
|
||||
|
||||
type SkuNameExt struct {
|
||||
model.SkuName
|
||||
Skus string `orm:"size(2000)" json:"skus"`
|
||||
Skus []*model.Sku `orm:"-" json:"skus"`
|
||||
SkusStr string `orm:"size(2000)" json:"-"`
|
||||
}
|
||||
|
||||
type SkuNamesInfo struct {
|
||||
@@ -233,7 +234,8 @@ func GetSkuNames(keyword string, params map[string]interface{}, offset, pageSize
|
||||
t1.unit,
|
||||
t1.price,
|
||||
t1.img,
|
||||
t1.elm_img_hash_code, CONCAT("[", GROUP_CONCAT(CONCAT('{"id":', t2.id, ',"specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit, '","weight":', t2.weight, ',"jdID":', t2.jd_id, "}")), "]") skus
|
||||
t1.elm_img_hash_code,
|
||||
CONCAT("[", GROUP_CONCAT(CONCAT('{"id":', t2.id, ',"createdAt":"', CONCAT(REPLACE(t2.created_at," ","T"),"+08:00"), '","updatedAt":"', CONCAT(REPLACE(t2.updated_at," ","T"),"+08:00"), '","lastOperator":"', t2.last_operator, '","specQuality":', t2.spec_quality, ',"specUnit":"', t2.spec_unit, '","weight":', t2.weight, ',"jdID":', t2.jd_id, ',"categoryID":', t2.category_id, ',"nameID":', t2.name_id, "}")), "]") skus_str
|
||||
` + sql + `
|
||||
ORDER BY t1.id
|
||||
LIMIT ? OFFSET ?`
|
||||
@@ -250,7 +252,20 @@ func GetSkuNames(keyword string, params map[string]interface{}, offset, pageSize
|
||||
countInfo := &struct{ Ct int }{}
|
||||
if err = dao.GetRow(db, countInfo, "SELECT FOUND_ROWS() ct"); err == nil {
|
||||
skuNamesInfo.TotalCount = countInfo.Ct
|
||||
for _, skuName := range skuNamesInfo.SkuNames {
|
||||
if err = utils.UnmarshalUseNumber([]byte(skuName.SkusStr), &skuName.Skus); err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return skuNamesInfo, err
|
||||
}
|
||||
|
||||
func AddSkuName(skuNameID int, payload map[string]interface{}) (num int64, err error) {
|
||||
return num, err
|
||||
}
|
||||
|
||||
func UpdateSkuName(skuNameID int, payload map[string]interface{}) (num int64, err error) {
|
||||
return num, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user