- 处理饿百商品富文本详情

This commit is contained in:
gazebo
2019-05-16 17:44:38 +08:00
parent 17936dc0eb
commit 098616686e
3 changed files with 64 additions and 27 deletions

View File

@@ -31,15 +31,15 @@ type tStoreSkuFullInfo struct {
Weight int `json:"weight"` // 重量/质量单位为克当相应的SkuName的SpecUnit为g或kg时必须等于SpecQuality
SkuStatus int
Prefix string `orm:"size(255)" json:"prefix"`
Name string `orm:"size(255);index" json:"name"`
Comment string `orm:"size(255)" json:"comment"`
IsGlobal int8 `orm:"default(1)" json:"isGlobal"` // 是否是全部全国可见如果否的话可见性由SkuPlace决定
Unit string `orm:"size(8)" json:"unit"`
Img string `orm:"size(255)" json:"img"`
PlaceStr string
Upc string
DescImg string
Prefix string `orm:"size(255)" json:"prefix"`
Name string `orm:"size(255);index" json:"name"`
Comment string `orm:"size(255)" json:"comment"`
IsGlobal int8 `orm:"default(1)" json:"isGlobal"` // 是否是全部全国可见如果否的话可见性由SkuPlace决定
Unit string `orm:"size(8)" json:"unit"`
Img string `orm:"size(255)" json:"img"`
PlaceStr string
Upc string
DescImgEbai string
CatName string `orm:"size(255)"`
@@ -83,7 +83,7 @@ var (
func (p *PurchaseHandler) getDirtyStoreSkus(db *dao.DaoDB, storeID int, skuIDs []int) (storeSkuInfoList []*tStoreSkuFullInfo, err error) {
sql := `
SELECT t8.price_percentage, t1.*, t2.id sku_id, t2.spec_quality, t2.spec_unit, t2.weight, t2.status sku_status,
t3.id name_id, t3.prefix, t3.name, t2.comment, t3.is_global, t3.unit, IF(t3.img_ebai <> '', t3.img_ebai, t3.img) img, t3.upc, t3.desc_img,
t3.id name_id, t3.prefix, t3.name, t2.comment, t3.is_global, t3.unit, IF(t3.img_ebai <> '', t3.img_ebai, t3.img) img, t3.upc, t3.desc_img_ebai,
t4.name cat_name, t4.ebai_price_percentage cat_price_percentage,
t4.id cat_id, t4.level cat_level, t5.ebai_id cat_ebai_id,
t4p.id parent_cat_id, t5p.ebai_id parent_cat_ebai_id, t5p.ebai_sync_status parent_cat_ebai_sync_status,
@@ -388,18 +388,6 @@ func (p *PurchaseHandler) RefreshStoresAllSkusID(ctx *jxcontext.Context, parentT
///////////
func genSkuParamsFromStoreSkuInfo(storeSku *tStoreSkuFullInfo) (params map[string]interface{}) {
price := jxutils.CaculateSkuVendorPrice(storeSku.Price, storeSku.PricePercentage, storeSku.CatPricePercentage)
photos := []map[string]interface{}{
map[string]interface{}{
"is_master": true,
"url": storeSku.Img,
},
}
if storeSku.DescImg != "" {
// photos = append(photos, map[string]interface{}{
// "is_master": false,
// "url": storeSku.DescImg,
// })
}
params = map[string]interface{}{
"name": jxutils.ComposeSkuName(storeSku.Prefix, storeSku.Name, storeSku.Comment, storeSku.Unit, storeSku.SpecQuality, storeSku.SpecUnit, 0),
"left_num": model.MaxStoreSkuStockQty,
@@ -408,7 +396,15 @@ func genSkuParamsFromStoreSkuInfo(storeSku *tStoreSkuFullInfo) (params map[strin
"cat2_id": getEbaiCat(storeSku.EbaiCat2ID, 2),
"cat3_id": getEbaiCat(storeSku.EbaiCat3ID, 3),
"weight": storeSku.Weight,
"photos": photos,
"photos": []map[string]interface{}{
map[string]interface{}{
"is_master": true,
"url": storeSku.Img,
},
},
}
if storeSku.DescImgEbai != "" {
params["rtf"] = storeSku.DescImgEbai
}
if storeSku.EbaiSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
params["sale_price"] = price