This commit is contained in:
gazebo
2019-09-11 11:13:59 +08:00
parent 86fc32cf2e
commit 85c8354873

View File

@@ -23,7 +23,7 @@ const (
func GetCityShops(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, cityCode, radius, gridWith int) (pageStoreList []*model.PageShop, err error) { func GetCityShops(ctx *jxcontext.Context, parentTask tasksch.ITask, vendorIDs []int, cityCode, radius, gridWith int) (pageStoreList []*model.PageShop, err error) {
coordList := ditu.GetCityCoordinateList(cityCode, radius, gridWith) coordList := ditu.GetCityCoordinateList(cityCode, radius, gridWith)
if len(coordList) > 0 { if len(coordList) > 0 {
task := tasksch.NewParallelTask("GetCityShops", tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx, task := tasksch.NewParallelTask(fmt.Sprintf("GetCityShops:%d", cityCode), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
vendorID := batchItemList[0].(int) vendorID := batchItemList[0].(int)
storeList, err2 := getStoreListByCoordinates(ctx, task, vendorID, utils.Int2Str(cityCode), coordList) storeList, err2 := getStoreListByCoordinates(ctx, task, vendorID, utils.Int2Str(cityCode), coordList)
@@ -126,7 +126,7 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
gridWith = DefGridWith gridWith = DefGridWith
} }
task := tasksch.NewParallelTask("GetAndStoreCitiesShops", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx, task := tasksch.NewParallelTask(fmt.Sprintf("GetAndStoreCitiesShops:%v", vendorIDs), tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
cityCode := batchItemList[0].(int) cityCode := batchItemList[0].(int)
globals.SugarLogger.Debugf("process city:%d", cityCode) globals.SugarLogger.Debugf("process city:%d", cityCode)