- 商品支持图片详情

This commit is contained in:
gazebo
2019-05-16 10:21:31 +08:00
parent 30869da889
commit b1b90b5317
5 changed files with 28 additions and 8 deletions

View File

@@ -39,6 +39,7 @@ type tStoreSkuFullInfo struct {
Img string `orm:"size(255)" json:"img"`
PlaceStr string
Upc string
DescImg string
CatName string `orm:"size(255)"`
@@ -82,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.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,
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,
@@ -387,6 +388,18 @@ 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,
@@ -395,12 +408,7 @@ func genSkuParamsFromStoreSkuInfo(storeSku *tStoreSkuFullInfo) (params map[strin
"cat2_id": getEbaiCat(storeSku.EbaiCat2ID, 2),
"cat3_id": getEbaiCat(storeSku.EbaiCat3ID, 3),
"weight": storeSku.Weight,
"photos": []map[string]interface{}{
map[string]interface{}{
"is_master": true,
"url": storeSku.Img,
},
},
"photos": photos,
}
if storeSku.EbaiSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
params["sale_price"] = price