36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
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
|
|
}
|