- 添加调试输出
This commit is contained in:
@@ -142,7 +142,7 @@ func (p *PurchaseHandler) createCatByStoreSkus(ctx *jxcontext.Context, parentTas
|
||||
|
||||
func (p *PurchaseHandler) FullSyncStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
userName := ctx.GetUserName()
|
||||
globals.SugarLogger.Debugf("FullSyncStoreSkus storeID:%d, isContinueWhenError:%t, userName:%s", storeID, isContinueWhenError, userName)
|
||||
globals.SugarLogger.Debugf("ebai FullSyncStoreSkus storeID:%d, isContinueWhenError:%t, userName:%s", storeID, isContinueWhenError, userName)
|
||||
|
||||
db := dao.GetDB()
|
||||
rootTask := tasksch.NewSeqTask("FullSyncStoreSkus", ctx,
|
||||
@@ -178,7 +178,7 @@ func (p *PurchaseHandler) FullSyncStoreSkus(ctx *jxcontext.Context, parentTask t
|
||||
|
||||
func (p *PurchaseHandler) DeleteRemoteStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
userName := ctx.GetUserName()
|
||||
globals.SugarLogger.Debugf("DeleteRemoteStoreSkus storeID:%d, isContinueWhenError:%t, userName:%s", storeID, isContinueWhenError, userName)
|
||||
globals.SugarLogger.Debugf("ebai DeleteRemoteStoreSkus storeID:%d, isContinueWhenError:%t, userName:%s", storeID, isContinueWhenError, userName)
|
||||
|
||||
db := dao.GetDB()
|
||||
var errDeleteSku error
|
||||
@@ -213,7 +213,7 @@ func (p *PurchaseHandler) DeleteRemoteStoreSkus(ctx *jxcontext.Context, parentTa
|
||||
|
||||
func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
userName := ctx.GetUserName()
|
||||
globals.SugarLogger.Debugf("SyncStoreSkus storeID:%d, skuIDs:%v, isContinueWhenError:%t, userName:%s", storeID, skuIDs, isContinueWhenError, userName)
|
||||
globals.SugarLogger.Debugf("ebai SyncStoreSkus storeID:%d, skuIDs:%v, isContinueWhenError:%t, userName:%s", storeID, skuIDs, isContinueWhenError, userName)
|
||||
|
||||
var storeSkuInfoList []*tStoreSkuFullInfo
|
||||
var num int64
|
||||
@@ -282,6 +282,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetAllRemoteSkus(ctx *jxcontext.Context, storeID int, parentTask tasksch.ITask) (skus []map[string]interface{}, err error) {
|
||||
globals.SugarLogger.Debugf("ebai GetAllRemoteSkus storeID:%d, userName:%s", storeID, ctx.GetUserName())
|
||||
page1, err := api.EbaiAPI.SkuList(utils.Int2Str(storeID), utils.Params2Map("pagesize", MaxPageSize))
|
||||
if err == nil {
|
||||
skus = append(skus, page1.List...)
|
||||
@@ -316,7 +317,7 @@ func (p *PurchaseHandler) GetAllRemoteSkus(ctx *jxcontext.Context, storeID int,
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) DeleteRemoteSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorSkuIDs []string) (err error) {
|
||||
globals.SugarLogger.Debugf("DeleteRemoteSkus饿百 storeID:%d", storeID)
|
||||
globals.SugarLogger.Debugf("ebai DeleteRemoteSkus storeID:%d, userName:%s", storeID, ctx.GetUserName())
|
||||
|
||||
if vendorSkuIDs == nil {
|
||||
result, err2 := p.GetAllRemoteSkus(ctx, storeID, parentTask)
|
||||
@@ -344,7 +345,7 @@ func (p *PurchaseHandler) DeleteRemoteSkus(ctx *jxcontext.Context, parentTask ta
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) DeleteRemoteCategories(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, vendorCatIDs []int64) (err error) {
|
||||
globals.SugarLogger.Debugf("DeleteRemoteCategories饿百 storeID:%d", storeID)
|
||||
globals.SugarLogger.Debugf("ebai DeleteRemoteCategories storeID:%d, userName:%s", storeID, ctx.GetUserName())
|
||||
|
||||
strStoreID := utils.Int2Str(storeID)
|
||||
if vendorCatIDs == nil {
|
||||
@@ -420,7 +421,7 @@ func getEbaiCat(catID int64, level int) int64 {
|
||||
// 远程没有本地有的条目会标记新增
|
||||
// 远程有本地没有的条目不做处理
|
||||
func (p *PurchaseHandler) SyncLocalStoreCategory(db *dao.DaoDB, storeID int, userName string) (err error) {
|
||||
globals.SugarLogger.Debugf("SyncLocalStoreCategory storeID:%d, userName:%s", storeID, userName)
|
||||
globals.SugarLogger.Debugf("ebai SyncLocalStoreCategory storeID:%d, userName:%s", storeID, userName)
|
||||
|
||||
sql := `
|
||||
SELECT t2.*, t1.id cat_id, t1.name, t1.parent_id, t1.level, t1.type, t1.seq
|
||||
@@ -472,7 +473,7 @@ func (p *PurchaseHandler) SyncLocalStoreCategory(db *dao.DaoDB, storeID int, use
|
||||
// 测试过程中出现过,父分类创建成功后马上创建子分类会报没有父分类错
|
||||
func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, isAsync bool) (hint string, err error) {
|
||||
userName := ctx.GetUserName()
|
||||
globals.SugarLogger.Debugf("SyncOneStoreCategories storeID:%d, userName:%s", storeID, userName)
|
||||
globals.SugarLogger.Debugf("ebai SyncStoreCategory storeID:%d, userName:%s", storeID, userName)
|
||||
|
||||
db := dao.GetDB()
|
||||
rootTask := tasksch.NewSeqTask("ebai SyncStoreCategory", ctx,
|
||||
@@ -587,7 +588,7 @@ func (p *PurchaseHandler) updateLocalCatAsNew(db *dao.DaoDB, localCatMap map[str
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) setStoreSkuSyncStatus(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, skuIDs []int, syncStatus int) (num int64, err error) {
|
||||
globals.SugarLogger.Debugf("setStoreSkuSyncStatus饿百 storeID:%d", storeID)
|
||||
globals.SugarLogger.Debugf("ebai setStoreSkuSyncStatus storeID:%d, userName:%s", storeID, ctx.GetUserName())
|
||||
return dao.SetStoreSkuSyncStatus(db, model.VendorIDEBAI, storeID, skuIDs, syncStatus)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
|
||||
// hint,如果是异步,返回的是任务ID,如果是同步,返回是本次需要同步的目录数
|
||||
func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, isAsync bool) (hint string, err error) {
|
||||
globals.SugarLogger.Debugf("mtwm SyncStoreCategory storeID:%d, userName:%s", storeID, ctx.GetUserName())
|
||||
num := 0
|
||||
db := dao.GetDB()
|
||||
storeDetail, err := dao.GetStoreDetail(db, storeID, model.VendorIDMTWM)
|
||||
@@ -97,6 +98,7 @@ func (p *PurchaseHandler) SyncStoreCategory(ctx *jxcontext.Context, parentTask t
|
||||
// 远程无,本地有,映射有, --> 同步标记改为新增
|
||||
// hint,如果是异步,返回的是任务ID,如果是同步,返回是本次需要同步的目录数
|
||||
func (p *PurchaseHandler) SyncLocalStoreCategory(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, isCheckRemote bool) (hint string, err error) {
|
||||
globals.SugarLogger.Debugf("mtwm SyncLocalStoreCategory storeID:%d, userName:%s", storeID, ctx.GetUserName())
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
@@ -211,6 +213,7 @@ func TranverseRemoteCatList(parentCatName string, remoteCats []*mtwmapi.RetailCa
|
||||
|
||||
// hint,如果是异步,返回的是任务ID,如果是同步,返回是本次需要同步的目录数
|
||||
func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, skuIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
globals.SugarLogger.Debugf("mtwm SyncStoreSkus storeID:%d, skuIDs:%v, isContinueWhenError:%t, userName:%s", storeID, skuIDs, isContinueWhenError, ctx.GetUserName())
|
||||
db := dao.GetDB()
|
||||
for i := 0; i < 3; i++ { // 最多重试三次
|
||||
if hint, err = p.SyncLocalStoreCategory(ctx, db, storeID, false); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user