- refactor sync.
This commit is contained in:
@@ -6,10 +6,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/basesch"
|
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
"git.rosy.net.cn/jx-callback/globals/api"
|
"git.rosy.net.cn/jx-callback/globals/api"
|
||||||
"github.com/qiniu/api.v7/storage"
|
"github.com/qiniu/api.v7/storage"
|
||||||
@@ -46,10 +44,6 @@ func InitServiceInfo(version, buildDate, gitCommit string) {
|
|||||||
Init()
|
Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPurchaseHandler(vendorID int) partner.IPurchasePlatformHandler {
|
|
||||||
return basesch.FixedBaseScheduler.GetPurchasePlatformFromVendorID(vendorID)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetServiceInfo() interface{} {
|
func GetServiceInfo() interface{} {
|
||||||
return serviceInfo
|
return serviceInfo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/model"
|
"git.rosy.net.cn/jx-callback/business/model"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SkuNamesInfo struct {
|
type SkuNamesInfo struct {
|
||||||
@@ -528,8 +527,8 @@ func DeleteSkuNamePlace(nameID, placeCode int, userName string) (num int64, err
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetVendorSku(vendorID int, vendorSkuID string) (skuNameInfo *model.SkuNameExt, err error) {
|
func GetVendorSku(vendorID int, vendorSkuID string) (skuNameInfo *model.SkuNameExt, err error) {
|
||||||
if handler := GetPurchaseHandler(vendorID); handler != nil {
|
if handler := CurVendorSync.GetMultiStoreHandler(vendorID); handler != nil {
|
||||||
return handler.(partner.IMultipleStoresHandler).ReadSku(vendorSkuID)
|
return handler.ReadSku(vendorSkuID)
|
||||||
}
|
}
|
||||||
return nil, ErrCanNotFindVendor
|
return nil, ErrCanNotFindVendor
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ func GetStores(keyword string, params map[string]interface{}, offset, pageSize i
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetVendorStore(vendorStoreID string, vendorID int) (retVal *StoreExt, err error) {
|
func GetVendorStore(vendorStoreID string, vendorID int) (retVal *StoreExt, err error) {
|
||||||
if handler := GetPurchaseHandler(vendorID); handler != nil {
|
if handler := CurVendorSync.GetMultiStoreHandler(vendorID); handler != nil {
|
||||||
result, err2 := handler.ReadStore(vendorStoreID)
|
result, err2 := handler.ReadStore(vendorStoreID)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
retVal = &StoreExt{
|
retVal = &StoreExt{
|
||||||
@@ -235,7 +235,7 @@ func GetStoreVendorMaps(db *dao.DaoDB, storeID int, vendorID int) (storeMaps []*
|
|||||||
}
|
}
|
||||||
|
|
||||||
func AddStoreVendorMap(db *dao.DaoDB, storeID, vendorID int, storeMap *model.StoreMap, userName string) (outStoreMap *model.StoreMap, err error) {
|
func AddStoreVendorMap(db *dao.DaoDB, storeID, vendorID int, storeMap *model.StoreMap, userName string) (outStoreMap *model.StoreMap, err error) {
|
||||||
if handler := GetPurchaseHandler(vendorID); handler != nil {
|
if handler := CurVendorSync.GetMultiStoreHandler(vendorID); handler != nil {
|
||||||
store, err2 := handler.ReadStore(storeMap.VendorStoreID)
|
store, err2 := handler.ReadStore(storeMap.VendorStoreID)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
dao.WrapAddIDCULDEntity(storeMap, userName)
|
dao.WrapAddIDCULDEntity(storeMap, userName)
|
||||||
@@ -291,7 +291,7 @@ func UpdateStoreVendorMap(db *dao.DaoDB, storeID, vendorID int, payload map[stri
|
|||||||
db = dao.GetDB()
|
db = dao.GetDB()
|
||||||
}
|
}
|
||||||
if vendorStoreID := utils.Interface2String(payload["vendorStoreID"]); vendorStoreID != "" {
|
if vendorStoreID := utils.Interface2String(payload["vendorStoreID"]); vendorStoreID != "" {
|
||||||
if handler := GetPurchaseHandler(vendorID); handler != nil {
|
if handler := CurVendorSync.GetMultiStoreHandler(vendorID); handler != nil {
|
||||||
jdStore, err2 := handler.ReadStore(vendorStoreID)
|
jdStore, err2 := handler.ReadStore(vendorStoreID)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
payload["deliveryType"] = jdStore.DeliveryType
|
payload["deliveryType"] = jdStore.DeliveryType
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package controllers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler/basesch"
|
|
||||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"github.com/astaxie/beego"
|
"github.com/astaxie/beego"
|
||||||
@@ -95,7 +94,7 @@ func (c *StoreSkuController) SyncStoresSkus() {
|
|||||||
err = utils.UnmarshalUseNumber([]byte(params.SkuIDs), &skuIDs)
|
err = utils.UnmarshalUseNumber([]byte(params.SkuIDs), &skuIDs)
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = basesch.FixedBaseScheduler.GetPurchasePlatformFromVendorID(params.VendorID).SyncStoresSkus(db, storeIDs, skuIDs, params.IsSync, GetUserNameFromToken(params.Token))
|
err = cms.CurVendorSync.GetStoreHandler(params.VendorID).SyncStoresSkus(db, storeIDs, skuIDs, params.IsSync, GetUserNameFromToken(params.Token))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
|
|||||||
Reference in New Issue
Block a user