新增平台京东商城
This commit is contained in:
165
business/partner/purchase/jdshop/store_sku.go
Normal file
165
business/partner/purchase/jdshop/store_sku.go
Normal file
@@ -0,0 +1,165 @@
|
||||
package jdshop
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/yinbaoapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/tasksch"
|
||||
"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/globals"
|
||||
)
|
||||
|
||||
var (
|
||||
sensitiveWordRegexp = regexp.MustCompile(`商品名称中含有敏感词(\[.*\])`)
|
||||
)
|
||||
|
||||
func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
|
||||
}
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
|
||||
}
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) DeleteStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
|
||||
}
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (skuNameList []*partner.SkuNameInfo, err error) {
|
||||
|
||||
return skuNameList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo, status int) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
|
||||
}
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
|
||||
}
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
|
||||
}
|
||||
return failedList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetStoreAllCategories(ctx *jxcontext.Context, storeID int, vendorStoreID string) (cats []*partner.BareCategoryInfo, err error) {
|
||||
return cats, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) DeleteStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID, vendorCatID string, level int) (err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) IsErrSkuExist(err error) (isExist bool) {
|
||||
return yinbaoapi.IsErrSkuExist(err)
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) IsErrCategoryExist(err error) (isExist bool) {
|
||||
return yinbaoapi.IsErrCategoryExist(err)
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) IsErrCategoryNotExist(err error) (isNotExist bool) {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) {
|
||||
return 1
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetSensitiveWordRegexp() *regexp.Regexp {
|
||||
return sensitiveWordRegexp
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) IsErrSkuNotExist(err error) (isNotExist bool) {
|
||||
return yinbaoapi.IsErrSkuNotExist(err)
|
||||
}
|
||||
|
||||
func ybSkuStatus2Jx(ybStatus int) (jxSkuStatus int) {
|
||||
if ybStatus == yinbaoapi.SkuStatusEnable {
|
||||
jxSkuStatus = model.SkuStatusNormal
|
||||
} else if ybStatus == yinbaoapi.SkuStatusDisabled {
|
||||
jxSkuStatus = model.SkuStatusDontSale
|
||||
} else if ybStatus == yinbaoapi.SkuStatusDeleted {
|
||||
jxSkuStatus = model.SkuStatusDeleted
|
||||
}
|
||||
return jxSkuStatus
|
||||
}
|
||||
|
||||
func vendorSku2Jx(result *yinbaoapi.QueryProductByBarcodeResult, resultp []*yinbaoapi.QueryProductImagesByBarcodeResult) (skuName *partner.SkuNameInfo) {
|
||||
var picList []string
|
||||
if result == nil {
|
||||
globals.SugarLogger.Warnf("vendorSku2Jx, strange result:%s", utils.Format4Output(result, true))
|
||||
return nil
|
||||
}
|
||||
if len(resultp) > 0 {
|
||||
if resultp[0].ImageURL != "" {
|
||||
// for _, v := range resultp.Productimages {
|
||||
picList = append(picList, resultp[0].ImageURL)
|
||||
// }
|
||||
}
|
||||
}
|
||||
prefix, name, comment, specUnit, unit, specQuality := jxutils.SplitSkuName(result.Name)
|
||||
skuName = &partner.SkuNameInfo{
|
||||
Prefix: prefix,
|
||||
Name: name,
|
||||
Unit: unit,
|
||||
YbBarCode: result.Barcode,
|
||||
SkuList: []*partner.SkuInfo{
|
||||
&partner.SkuInfo{
|
||||
StoreSkuInfo: partner.StoreSkuInfo{
|
||||
VendorSkuID: utils.Int64ToStr(result.UID),
|
||||
Stock: int(utils.Float64TwoInt64(result.Stock)),
|
||||
VendorPrice: jxutils.StandardPrice2Int(result.SellPrice),
|
||||
Status: ybSkuStatus2Jx(result.Enable),
|
||||
},
|
||||
SkuName: result.Name,
|
||||
Comment: comment,
|
||||
SpecQuality: float64(specQuality),
|
||||
SpecUnit: specUnit,
|
||||
Weight: int(utils.Float64TwoInt64(float64(specQuality))),
|
||||
},
|
||||
},
|
||||
PictureList: picList,
|
||||
}
|
||||
return skuName
|
||||
}
|
||||
Reference in New Issue
Block a user