增加银豹beta修改限制
This commit is contained in:
@@ -36,35 +36,6 @@ func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, v
|
|||||||
return failedList, err
|
return failedList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildYbConfigs(storeID int) (err error) {
|
|
||||||
if storeID == 0 {
|
|
||||||
return fmt.Errorf("门店ID不能为空!平台:[%v]", model.VendorIDYB)
|
|
||||||
}
|
|
||||||
store, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDYB)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
api.YinBaoAPI = yinbaoapi.New(store.YbAppKey, store.YbAppID)
|
|
||||||
return 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) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (skuNameList []*partner.SkuNameInfo, err error) {
|
func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (skuNameList []*partner.SkuNameInfo, err error) {
|
||||||
buildYbConfigs(storeID)
|
buildYbConfigs(storeID)
|
||||||
if storeSkuList != nil {
|
if storeSkuList != nil {
|
||||||
@@ -121,32 +92,58 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas
|
|||||||
return skuNameList, err
|
return skuNameList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func loopPages(parameterType, parameterValue string, skuNameList []*partner.SkuNameInfo) (err error) {
|
func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo, status int) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||||
var postBackParameter = &yinbaoapi.PostBackParameter{
|
if globals.EnableYbStoreWrite {
|
||||||
ParameterType: parameterType,
|
|
||||||
ParameterValue: parameterValue,
|
|
||||||
}
|
}
|
||||||
resultPages, err := api.YinBaoAPI.QueryProductPages(postBackParameter)
|
return failedList, err
|
||||||
if err != nil {
|
}
|
||||||
return err
|
|
||||||
|
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||||
|
if globals.EnableYbStoreWrite {
|
||||||
|
|
||||||
}
|
}
|
||||||
for _, v := range resultPages.Result {
|
return failedList, err
|
||||||
resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(v.Barcode)
|
}
|
||||||
if err != nil {
|
|
||||||
return err
|
func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||||
}
|
if globals.EnableYbStoreWrite {
|
||||||
vv := &yinbaoapi.QueryProductByBarcodeResult{}
|
|
||||||
err = utils.Map2StructByJson(utils.Struct2MapByJson(v), vv, false)
|
|
||||||
if skuName := vendorSku2Jx(vv, resultp); skuName != nil {
|
|
||||||
skuNameList = append(skuNameList, skuName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if resultPages.PostBackParameter.ParameterType != yinbaoapi.PageMaxID {
|
|
||||||
err = loopPages(resultPages.PostBackParameter.ParameterType, resultPages.PostBackParameter.ParameterValue, skuNameList)
|
|
||||||
}
|
}
|
||||||
|
return failedList, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
||||||
return err
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PurchaseHandler) IsErrSkuExist(err error) (isExist bool) {
|
||||||
|
return yinbaoapi.IsErrSkuExist(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
func vendorSku2Jx(result *yinbaoapi.QueryProductByBarcodeResult, resultp []*yinbaoapi.QueryProductImagesByBarcodeResult) (skuName *partner.SkuNameInfo) {
|
||||||
var picList []string
|
var picList []string
|
||||||
if result == nil {
|
if result == nil {
|
||||||
@@ -185,33 +182,57 @@ func vendorSku2Jx(result *yinbaoapi.QueryProductByBarcodeResult, resultp []*yinb
|
|||||||
return skuName
|
return skuName
|
||||||
}
|
}
|
||||||
|
|
||||||
func ybSkuStatus2Jx(ybStatus int) (jxSkuStatus int) {
|
func loopPages(parameterType, parameterValue string, skuNameList []*partner.SkuNameInfo) (err error) {
|
||||||
if ybStatus == yinbaoapi.SkuStatusEnable {
|
var postBackParameter = &yinbaoapi.PostBackParameter{
|
||||||
jxSkuStatus = model.SkuStatusNormal
|
ParameterType: parameterType,
|
||||||
} else if ybStatus == yinbaoapi.SkuStatusDisabled {
|
ParameterValue: parameterValue,
|
||||||
jxSkuStatus = model.SkuStatusDontSale
|
}
|
||||||
} else if ybStatus == yinbaoapi.SkuStatusDeleted {
|
resultPages, err := api.YinBaoAPI.QueryProductPages(postBackParameter)
|
||||||
jxSkuStatus = model.SkuStatusDeleted
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, v := range resultPages.Result {
|
||||||
|
resultp, err := api.YinBaoAPI.QueryProductImagesByBarcode(v.Barcode)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
vv := &yinbaoapi.QueryProductByBarcodeResult{}
|
||||||
|
err = utils.Map2StructByJson(utils.Struct2MapByJson(v), vv, false)
|
||||||
|
if skuName := vendorSku2Jx(vv, resultp); skuName != nil {
|
||||||
|
skuNameList = append(skuNameList, skuName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if resultPages.PostBackParameter.ParameterType != yinbaoapi.PageMaxID {
|
||||||
|
err = loopPages(resultPages.PostBackParameter.ParameterType, resultPages.PostBackParameter.ParameterValue, skuNameList)
|
||||||
}
|
}
|
||||||
return jxSkuStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
|
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 buildYbConfigs(storeID int) (err error) {
|
||||||
|
if storeID == 0 {
|
||||||
|
return fmt.Errorf("门店ID不能为空!平台:[%v]", model.VendorIDYB)
|
||||||
|
}
|
||||||
|
store, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDYB)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
api.YinBaoAPI = yinbaoapi.New(store.YbAppKey, store.YbAppID)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PurchaseHandler) DeleteStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID, vendorCatID string, level int) (err error) {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PurchaseHandler) IsErrSkuExist(err error) (isExist bool) {
|
|
||||||
return yinbaoapi.IsErrSkuExist(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PurchaseHandler) GetStoreSkusBatchSize(funcID int) (batchSize int) {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ enableEbaiStoreWrite = false
|
|||||||
enableElmStoreWrite = false
|
enableElmStoreWrite = false
|
||||||
enableMtwmStoreWrite = false
|
enableMtwmStoreWrite = false
|
||||||
enableWscStoreWrite = false
|
enableWscStoreWrite = false
|
||||||
|
enableEbaiStoreWrite = false
|
||||||
|
|
||||||
aliKey = "LTAI4FwZN7pp4dACQHoapkZQ"
|
aliKey = "LTAI4FwZN7pp4dACQHoapkZQ"
|
||||||
aliSecret = "NTegceUFX0FdfMovqCDzqcIKmhcoOu"
|
aliSecret = "NTegceUFX0FdfMovqCDzqcIKmhcoOu"
|
||||||
@@ -211,6 +212,7 @@ enableJdStoreWrite = true
|
|||||||
enableEbaiStoreWrite = true
|
enableEbaiStoreWrite = true
|
||||||
enableMtwmStoreWrite = true
|
enableMtwmStoreWrite = true
|
||||||
enableWscStoreWrite = true
|
enableWscStoreWrite = true
|
||||||
|
enableEbaiStoreWrite = true
|
||||||
|
|
||||||
disableWeimob = false
|
disableWeimob = false
|
||||||
weimobCallbackURL = "http://callback.jxc4.com/weimob"
|
weimobCallbackURL = "http://callback.jxc4.com/weimob"
|
||||||
@@ -247,6 +249,7 @@ enableStoreWrite = true
|
|||||||
enableJdStoreWrite = true
|
enableJdStoreWrite = true
|
||||||
enableEbaiStoreWrite = true
|
enableEbaiStoreWrite = true
|
||||||
enableMtwmStoreWrite = true
|
enableMtwmStoreWrite = true
|
||||||
|
enableEbaiStoreWrite = true
|
||||||
|
|
||||||
mtpsAppKey = "3c0a05d464c247c19d7ec13accc78605"
|
mtpsAppKey = "3c0a05d464c247c19d7ec13accc78605"
|
||||||
mtpsSecret = "b1M}9?:sTbsB[OF2gNORnN(|(iy9rB8(`7]|[wGLnbmt`evfM>E:A90DjHAW:UPE"
|
mtpsSecret = "b1M}9?:sTbsB[OF2gNORnN(|(iy9rB8(`7]|[wGLnbmt`evfM>E:A90DjHAW:UPE"
|
||||||
@@ -366,6 +369,7 @@ enableEbaiStoreWrite = false
|
|||||||
enableElmStoreWrite = false
|
enableElmStoreWrite = false
|
||||||
enableMtwmStoreWrite = false
|
enableMtwmStoreWrite = false
|
||||||
enableWscStoreWrite = false
|
enableWscStoreWrite = false
|
||||||
|
enableEbaiStoreWrite = true
|
||||||
|
|
||||||
jdOrgCode = "320406"
|
jdOrgCode = "320406"
|
||||||
jdToken = "77e703b7-7997-441b-a12a-2e522efb117a"
|
jdToken = "77e703b7-7997-441b-a12a-2e522efb117a"
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ var (
|
|||||||
EnableMtwmStoreWrite bool
|
EnableMtwmStoreWrite bool
|
||||||
EnableWscStoreWrite bool
|
EnableWscStoreWrite bool
|
||||||
EnablePendingChange bool
|
EnablePendingChange bool
|
||||||
|
EnableYbStoreWrite bool
|
||||||
|
|
||||||
QiniuBucket string
|
QiniuBucket string
|
||||||
WeimobCallbackURL string
|
WeimobCallbackURL string
|
||||||
@@ -91,6 +92,7 @@ func Init() {
|
|||||||
EnableMtwmStoreWrite = EnableStoreWrite && beego.AppConfig.DefaultBool("enableMtwmStoreWrite", false)
|
EnableMtwmStoreWrite = EnableStoreWrite && beego.AppConfig.DefaultBool("enableMtwmStoreWrite", false)
|
||||||
EnableWscStoreWrite = EnableStoreWrite && beego.AppConfig.DefaultBool("enableWscStoreWrite", false)
|
EnableWscStoreWrite = EnableStoreWrite && beego.AppConfig.DefaultBool("enableWscStoreWrite", false)
|
||||||
// EnablePendingChange = beego.AppConfig.DefaultBool("enablePendingChange", false)
|
// EnablePendingChange = beego.AppConfig.DefaultBool("enablePendingChange", false)
|
||||||
|
EnableYbStoreWrite = EnableStoreWrite && beego.AppConfig.DefaultBool("enableYbStoreWrite", false)
|
||||||
|
|
||||||
QiniuBucket = beego.AppConfig.String("qiniuBucket")
|
QiniuBucket = beego.AppConfig.String("qiniuBucket")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user