package yb import ( "git.rosy.net.cn/baseapi/platformapi/yinbaoapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" "git.rosy.net.cn/jx-callback/business/partner" "git.rosy.net.cn/jx-callback/business/partner/putils" "git.rosy.net.cn/jx-callback/globals/api" ) var ( stock float64 = 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) result, err := api.YinBaoAPI.AddProductInfo(buildProductInfoParam(storeSku)) if err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDYB], "εˆ›ε»Ίε•†ε“") } else { storeSku.VendorSkuID = utils.Int64ToStr(result.UID) } 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) { var ( buyPrice float64 = utils.Str2Float64(utils.Int64ToStr(storeSku.Price)) / 100 sellPrice float64 = utils.Str2Float64(utils.Int64ToStr(storeSku.VendorPrice)) / 100 ) productInfoParam = &yinbaoapi.ProductInfoParam{} productInfo := &yinbaoapi.ProductInfo{ Stock: &stock, Name: storeSku.SkuName, Barcode: utils.Int2Str(storeSku.SkuID), BuyPrice: &buyPrice, SellPrice: &sellPrice, } productInfoParam.ProductInfo = productInfo return productInfoParam } func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) { return err } func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) { return err } func (p *PurchaseHandler) DeleteStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID, vendorCatID string, level int) (err error) { return err }