1
This commit is contained in:
@@ -1751,6 +1751,25 @@ func GetStoreSkuBindByNameID(db *DaoDB, storeID, nameID, status int) (storeSkuBi
|
|||||||
return storeSkuBind, err
|
return storeSkuBind, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetStoreSkuByVendorSkuId(storeId int, vendorID int, vendorSkuId string) (storeSkuBind *model.StoreSkuBind, err error) {
|
||||||
|
sql := `
|
||||||
|
SELECT * FROM store_sku_bind s WHERE s.store_id = ?
|
||||||
|
`
|
||||||
|
param := []interface{}{
|
||||||
|
storeId,
|
||||||
|
}
|
||||||
|
switch vendorID {
|
||||||
|
case model.VendorIDEBAI:
|
||||||
|
sql += ` AND s.ebai_id = ?`
|
||||||
|
param = append(param, vendorSkuId)
|
||||||
|
}
|
||||||
|
sql += ` AND s.deleted_at = ? `
|
||||||
|
param = append(param, utils.DefaultTimeValue)
|
||||||
|
|
||||||
|
err = GetRow(GetDB(), &storeSkuBind, sql, param...)
|
||||||
|
return storeSkuBind, err
|
||||||
|
}
|
||||||
|
|
||||||
func GetPriceReferPrice(db *DaoDB, cityCode int, skuID int, snapDate time.Time) (result *PriceReferSnapshotExt, err error) {
|
func GetPriceReferPrice(db *DaoDB, cityCode int, skuID int, snapDate time.Time) (result *PriceReferSnapshotExt, err error) {
|
||||||
var (
|
var (
|
||||||
pRefer *PriceReferSnapshotExt
|
pRefer *PriceReferSnapshotExt
|
||||||
|
|||||||
@@ -319,6 +319,16 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo
|
|||||||
if shelfPosition, ok := product["shelf_position"]; ok {
|
if shelfPosition, ok := product["shelf_position"]; ok {
|
||||||
sku.LocationCode = shelfPosition.(string)
|
sku.LocationCode = shelfPosition.(string)
|
||||||
}
|
}
|
||||||
|
if sku.SkuID == 0 {
|
||||||
|
if product["upc"] != nil {
|
||||||
|
sku.SkuID = utils.Str2Int(strings.Split(product["upc"].(string), "-")[1])
|
||||||
|
} else if product["baidu_product_id"] != nil {
|
||||||
|
skuBind, err := dao.GetStoreSkuByVendorSkuId(order.StoreID, model.VendorIDEBAI, product["baidu_product_id"].(string))
|
||||||
|
if err == nil && skuBind != nil {
|
||||||
|
sku.SkuID = skuBind.SkuID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
var baiduRate int64
|
var baiduRate int64
|
||||||
sku.SalePrice, baiduRate, sku.StoreSubName = getSkuSalePrice(product)
|
sku.SalePrice, baiduRate, sku.StoreSubName = getSkuSalePrice(product)
|
||||||
order.PmSubsidyMoney += baiduRate
|
order.PmSubsidyMoney += baiduRate
|
||||||
|
|||||||
Reference in New Issue
Block a user