银豹partner

This commit is contained in:
苏尹岚
2020-03-20 15:38:01 +08:00
parent ace4d0ef7c
commit 3a7c01313f
2 changed files with 24 additions and 2 deletions

View File

@@ -109,6 +109,9 @@ type StoreSkuSyncInfo struct {
ActPercentage int `json:"actPercentage"` // 直降活动百分比
ActSyncStatus int8 `orm:"default(2)" json:"actSyncStatus"`
VendorActPrice int64 `json:"vendorActPrice"` // 保存数据用,实际的活动价
YbAppID string `orm:"column(yb_app_id)" json:"ybAppID"` //银豹对应门店的appID
YbAppKey string //银豹对应门店的appkey
}
type MissingStoreSkuInfo struct {
@@ -509,7 +512,7 @@ func GetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSyncInf
// 对于多门店平台商品库删除后不需要操作门店商品所以sku_name用JOIN, sku与sku_name也可以直接排除下架的
sql := `
SELECT
sm.vendor_id, sm.vendor_org_code,
sm.vendor_id, sm.vendor_org_code, sm.yb_app_id, sm.yb_app_key,
t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status,
t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time,
t1.store_id, t1.deleted_at bind_deleted_at,

View File

@@ -1,16 +1,35 @@
package yb
import (
"git.rosy.net.cn/baseapi/platformapi/yinbaoapi"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model/dao"
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/globals/api"
)
const (
stock = 100
)
func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
storeSku := storeSkuList[0]
api.YinBaoAPI = yinbaoapi.New(storeSku.YbAppKey, storeSku.YbAppID)
api.YinBaoAPI.AddProductInfo(buildProductInfoParam(storeSku))
return failedList, err
}
func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
return failedList, err
}
func buildProductInfoParam(storeSku *dao.StoreSkuSyncInfo) (productInfoParam *yinbaoapi.ProductInfoParam) {
productInfoParam = &yinbaoapi.ProductInfoParam{}
productInfo := &yinbaoapi.ProductInfo{
Stock: stock,
Name: storeSku.SkuName,
Barcode: storeSku.SkuID,
BuyPrice: storeSku.pr
}
return productInfoParam
}