- 商品支持图片详情
This commit is contained in:
@@ -54,6 +54,7 @@ type StoreSkuSyncInfo struct {
|
||||
Img string
|
||||
Upc string
|
||||
Seq int
|
||||
DescImg string
|
||||
|
||||
VendorVendorCatID int64 `orm:"column(vendor_vendor_cat_id)"`
|
||||
|
||||
@@ -143,7 +144,7 @@ func GetStoreSkus(db *DaoDB, vendorID, storeID int, skuIDs []int) (skus []*Store
|
||||
sql := `
|
||||
SELECT t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status, %s.%s_id vendor_sku_id, t1.%s_sync_status sku_sync_status, %s vendor_name_id,
|
||||
t2.*,
|
||||
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.%s img, t3.upc,
|
||||
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.%s img, t3.upc, t3.desc_img,
|
||||
t4.%s_category_id vendor_vendor_cat_id, t4.%s_price_percentage cat_price_percentage,
|
||||
t5.%s_sync_status cat_sync_status, t5.%s_id vendor_cat_id,
|
||||
t5sku.%s_sync_status sku_cat_sync_status, t5sku.%s_id sku_vendor_cat_id
|
||||
|
||||
@@ -182,6 +182,8 @@ type SkuName struct {
|
||||
Status int `orm:"default(1)" json:"status"` // skuname状态,取值同sku.Status
|
||||
IsSpu int8 `orm:"column(is_spu)" json:"isSpu"` // 用于指明是否SKUNAME当成SPU
|
||||
|
||||
DescImg string `orm:"size(255)" json:"descImg"` // 商品详情图片描述
|
||||
|
||||
JdID int64 `orm:"column(jd_id);null;index" json:"jdID"`
|
||||
JdSyncStatus int8 `orm:"default(2)" json:"jdSyncStatus"`
|
||||
|
||||
|
||||
@@ -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