- 高德API的KEY改为公司认证的KEY,可访问量更大
- 拉取门店信息时要获取坐标及区信息 - 饿百订单买家的坐标转换为高德坐标
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ditu"
|
||||
@@ -81,6 +82,9 @@ func getStoreListByCoordinates(ctx *jxcontext.Context, parentTask tasksch.ITask,
|
||||
storeID := batchItemList[0].(string)
|
||||
storePageInfo, err := handler.GetStorePageInfo(ctx, cityInfo, storeID)
|
||||
if err == nil && storePageInfo != nil {
|
||||
if storePageInfo.DistrictCode == 0 && (storePageInfo.Lng != 0 && storePageInfo.Lat != 0) {
|
||||
storePageInfo.DistrictCode = api.AutonaviAPI.GetCoordinateDistrictCode(storePageInfo.Lng, storePageInfo.Lat)
|
||||
}
|
||||
return []interface{}{storePageInfo}, nil
|
||||
}
|
||||
return nil, err
|
||||
@@ -122,9 +126,9 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
|
||||
gridWith = DefGridWith
|
||||
}
|
||||
|
||||
task := tasksch.NewSeqTask("GetAndStoreCitiesShops", ctx,
|
||||
func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
cityCode := cityCodeList[step]
|
||||
task := tasksch.NewParallelTask("GetAndStoreCitiesShops", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(true), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
cityCode := batchItemList[0].(int)
|
||||
globals.SugarLogger.Debugf("process city:%d", cityCode)
|
||||
shopList, err := GetCityShops(ctx, task, vendorIDs, cityCode, radius, gridWith)
|
||||
if err == nil {
|
||||
@@ -150,8 +154,8 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("process city:%d, len(shopList):%d, err:%v", cityCode, len(shopList), err)
|
||||
return nil, nil // 强制继续
|
||||
}, len(cityCodeList))
|
||||
return nil, err
|
||||
}, cityCodeList)
|
||||
tasksch.ManageTask(task).Run()
|
||||
if !isAsync {
|
||||
_, err = task.GetResult(0)
|
||||
|
||||
Reference in New Issue
Block a user