- 商品支持图片详情
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -164,6 +164,12 @@ func (p *PurchaseHandler) cuSku(db *dao.DaoDB, sku *model.Sku, handler func(skuE
|
||||
if addParams["sellCities"] == nil {
|
||||
addParams["sellCities"] = []int{0}
|
||||
}
|
||||
if skuInfoExt.DescImg != "" {
|
||||
addParams[jdapi.KeyProductDesc] = skuInfoExt.DescImg
|
||||
addParams[jdapi.KeyIfViewDesc] = 0
|
||||
} else {
|
||||
addParams[jdapi.KeyIfViewDesc] = 1
|
||||
}
|
||||
if err == nil {
|
||||
skuName := jxutils.ComposeSkuName(skuInfoExt.Prefix, skuInfoExt.Name, sku.Comment, skuInfoExt.Unit, sku.SpecQuality, sku.SpecUnit, 0)
|
||||
skuPrice := jxutils.CaculateSkuPrice(skuInfoExt.Price, sku.SpecQuality, sku.SpecUnit, skuInfoExt.Unit)
|
||||
|
||||
@@ -281,6 +281,9 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
foodData["category_name"] = skuItem.VendorCatID
|
||||
foodData["is_sold_out"] = skuStatusJX2Mtwm(jxutils.MergeSkuStatus(skuItem.Status, skuItem.StoreSkuStatus))
|
||||
foodData["picture"] = skuItem.Img
|
||||
if skuItem.DescImg != "" {
|
||||
foodData["picture_contents"] = skuItem.DescImg
|
||||
}
|
||||
foodData["sequence"] = skuItem.Seq
|
||||
if skuItem.VendorVendorCatID != 0 {
|
||||
foodData["tag_id"] = utils.Int64ToStr(skuItem.VendorVendorCatID)
|
||||
|
||||
Reference in New Issue
Block a user