From 3a7c01313f9c33f3da412a26d02c404cdd495ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 20 Mar 2020 15:38:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=93=B6=E8=B1=B9partner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 5 ++++- business/partner/purchase/yb/store_sku.go | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index cc4a19da8..1f90f8e38 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -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, diff --git a/business/partner/purchase/yb/store_sku.go b/business/partner/purchase/yb/store_sku.go index 1334d3aa9..bc5647bef 100644 --- a/business/partner/purchase/yb/store_sku.go +++ b/business/partner/purchase/yb/store_sku.go @@ -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 +}