From 834a011a1f3ba837d86390dbcfbfad1f594e579d Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 23 Jul 2019 16:38:39 +0800 Subject: [PATCH] - TestIt --- controllers/temp_op.go | 46 ++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/controllers/temp_op.go b/controllers/temp_op.go index 4c0ca5a67..be3960f43 100644 --- a/controllers/temp_op.go +++ b/controllers/temp_op.go @@ -1,9 +1,11 @@ package controllers import ( - "git.rosy.net.cn/jx-callback/business/jxstore/cms" + "git.rosy.net.cn/baseapi/platformapi/ebaiapi" "git.rosy.net.cn/jx-callback/business/jxstore/tempop" "git.rosy.net.cn/jx-callback/business/jxutils" + "git.rosy.net.cn/jx-callback/business/jxutils/tasksch" + "git.rosy.net.cn/jx-callback/globals/api" "github.com/astaxie/beego" ) @@ -240,27 +242,27 @@ func (c *TempOpController) RefreshMtpsWaybillFee() { // @router /TestIt [get] func (c *TempOpController) TestIt() { c.callTestIt(func(params *tTempopTestItParams) (retVal interface{}, errCode string, err error) { - retVal, err = cms.OpenRemoteStoreByJxStatus(params.Ctx, nil, nil, false, true, true) - // shopList, err := api.EbaiAPI.ShopList(ebaiapi.SysStatusAll) - // task := tasksch.NewParallelTask("tttt", nil, params.Ctx, - // func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { - // shop := batchItemList[0].(*ebaiapi.ShopInfo) - // skuInfo, err := api.EbaiAPI.SkuList(shop.ShopID, &ebaiapi.SkuListParams{}) - // if err == nil && skuInfo.Total > 500 { - // errSkuCount := 0 - // for _, sku := range skuInfo.List { - // if sku.CustomCatIDs == "" { - // errSkuCount++ - // } - // } - // if errSkuCount > len(skuInfo.List)/3 { - // retVal = []string{shop.ShopID} - // } - // } - // return retVal, err - // }, shopList) - // task.Run() - // retVal, err = task.GetResult(0) + // retVal, err = cms.OpenRemoteStoreByJxStatus(params.Ctx, nil, nil, false, true, true) + shopList, err := api.EbaiAPI.ShopList(ebaiapi.SysStatusAll) + task := tasksch.NewParallelTask("TestIt", nil, params.Ctx, + func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { + shop := batchItemList[0].(*ebaiapi.ShopInfo) + skuInfo, err := api.EbaiAPI.SkuList(shop.ShopID, &ebaiapi.SkuListParams{}) + if err == nil && skuInfo.Total > 500 { + errSkuCount := 0 + for _, sku := range skuInfo.List { + if sku.CustomCatIDs == "" { + errSkuCount++ + } + } + if errSkuCount > len(skuInfo.List)/3 { + retVal = []string{shop.ShopID} + } + } + return retVal, err + }, shopList) + task.Run() + retVal, err = task.GetResult(0) return retVal, "", err }) }