- SkuCategory下添加调价比例:JdPricePercentage,EbaiPricePercentage,MtwmPricePercentage

This commit is contained in:
gazebo
2019-05-15 16:02:23 +08:00
parent 5c436326bf
commit a3aabcf8a8
8 changed files with 55 additions and 18 deletions

View File

@@ -17,9 +17,10 @@ import (
type tStoreSkuBindExt struct {
model.StoreSkuBind
PricePercentage int
VendorStoreID string `orm:"column(vendor_store_id)"`
JdID int64 `orm:"column(jd_id)"`
PricePercentage int
CatPricePercentage int
VendorStoreID string `orm:"column(vendor_store_id)"`
JdID int64 `orm:"column(jd_id)"`
}
// 京东到家,以有库存表示关注(认领)
@@ -39,10 +40,12 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
}
sql := `
SELECT t3.jd_id, t1.*, t2.price_percentage, t2.vendor_store_id
SELECT t3.jd_id, t1.*, t2.price_percentage, t2.vendor_store_id, t5.jd_price_percentage cat_price_percentage
FROM store_sku_bind t1
JOIN store_map t2 ON t1.store_id = t2.store_id AND t2.vendor_id = ? AND t2.deleted_at = ?
JOIN sku t3 ON t1.sku_id = t3.id AND t3.deleted_at = ?
JOIN sku_name t4 ON t4.id = t3.name_id
JOIN sku_category t5 ON t5.id = t4.category_id
` + sqlWhere + " ORDER BY t1.updated_at"
var storeSkus []*tStoreSkuBindExt
sqlParams := []interface{}{
@@ -83,7 +86,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
if storeSku.JdSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
OutSkuId: utils.Int2Str(storeSku.SkuID),
Price: constrainPrice(jxutils.CaculateSkuVendorPrice(storeSku.Price, storeSku.PricePercentage)),
Price: constrainPrice(jxutils.CaculateSkuVendorPrice(storeSku.Price, storeSku.PricePercentage, storeSku.CatPricePercentage)),
})
}
if storeSku.JdSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 {
@@ -215,7 +218,7 @@ func (p *PurchaseHandler) syncStoreSkus(ctx *jxcontext.Context, parentTask tasks
if storeSku.SkuSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
OutSkuId: utils.Int2Str(storeSku.ID),
Price: constrainPrice(jxutils.CaculateSkuVendorPrice(int(storeSku.Price), int(storeDetail.PricePercentage))),
Price: constrainPrice(jxutils.CaculateSkuVendorPrice(int(storeSku.Price), int(storeDetail.PricePercentage), storeSku.CatPricePercentage)),
})
}
if storeSku.SkuSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 {