- SkuCategory下添加调价比例:JdPricePercentage,EbaiPricePercentage,MtwmPricePercentage
This commit is contained in:
@@ -54,7 +54,8 @@ type tStoreSkuFullInfo struct {
|
||||
EbaiCat2ID int64 `orm:"column(ebai_cat2_id)"`
|
||||
EbaiCat3ID int64 `orm:"column(ebai_cat3_id)"`
|
||||
|
||||
PricePercentage int
|
||||
PricePercentage int
|
||||
CatPricePercentage int
|
||||
}
|
||||
|
||||
type tStoreCatInfo struct {
|
||||
@@ -82,7 +83,7 @@ func (p *PurchaseHandler) getDirtyStoreSkus(db *dao.DaoDB, storeID int, skuIDs [
|
||||
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,
|
||||
t4.name cat_name,
|
||||
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,
|
||||
cat1.vendor_category_id ebai_cat3_id, cat2.vendor_category_id ebai_cat2_id, cat2.parent_id ebai_cat1_id
|
||||
@@ -385,7 +386,7 @@ func (p *PurchaseHandler) RefreshStoresAllSkusID(ctx *jxcontext.Context, parentT
|
||||
|
||||
///////////
|
||||
func genSkuParamsFromStoreSkuInfo(storeSku *tStoreSkuFullInfo) (params map[string]interface{}) {
|
||||
price := jxutils.CaculateSkuVendorPrice(storeSku.Price, storeSku.PricePercentage)
|
||||
price := jxutils.CaculateSkuVendorPrice(storeSku.Price, storeSku.PricePercentage, storeSku.CatPricePercentage)
|
||||
params = map[string]interface{}{
|
||||
"name": jxutils.ComposeSkuName(storeSku.Prefix, storeSku.Name, storeSku.Comment, storeSku.Unit, storeSku.SpecQuality, storeSku.SpecUnit, 0),
|
||||
"left_num": model.MaxStoreSkuStockQty,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -273,7 +273,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
globals.SugarLogger.Debugf("mtwm SyncStoreSkus3 skuID:%d, SkuSyncStatus:%d", skuItem.ID, skuItem.SkuSyncStatus)
|
||||
foodData["name"] = jxutils.ComposeSkuName(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, 30)
|
||||
foodData["description"] = skuItem.Comment
|
||||
foodData["price"] = jxutils.IntPrice2Standard(int64(jxutils.CaculateSkuVendorPrice(int(skuItem.Price), int(storeDetail.PricePercentage))))
|
||||
foodData["price"] = jxutils.IntPrice2Standard(int64(jxutils.CaculateSkuVendorPrice(int(skuItem.Price), int(storeDetail.PricePercentage), skuItem.CatPricePercentage)))
|
||||
foodData["min_order_count"] = 1
|
||||
foodData["unit"] = skuItem.Unit
|
||||
foodData["box_num"] = 0
|
||||
|
||||
@@ -208,7 +208,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
DeliveryTypeIdList: []int64{DefDeliveryTypeId},
|
||||
B2cGoodsType: weimobapi.GoodsTypeNormal,
|
||||
}
|
||||
salePrice := int64(jxutils.CaculateSkuVendorPrice(int(skuItem.Price), int(storeDetail.PricePercentage)))
|
||||
salePrice := int64(jxutils.CaculateSkuVendorPrice(int(skuItem.Price), int(storeDetail.PricePercentage), skuItem.CatPricePercentage))
|
||||
skuList := []map[string]interface{}{
|
||||
map[string]interface{}{
|
||||
weimobapi.KeyOuterSkuCode: utils.Int2Str(skuItem.ID),
|
||||
|
||||
Reference in New Issue
Block a user