- GetStores中转换至百度坐标OK
This commit is contained in:
@@ -13,6 +13,8 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/auth2"
|
||||
"git.rosy.net.cn/jx-callback/business/authz"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/autonavi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/baidunavi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -406,29 +408,29 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
retVal.Stores = retVal.Stores[offset : offset+pageSize]
|
||||
}
|
||||
if needConver2Baidu {
|
||||
// task := tasksch.NewParallelTask("坐标转换", tasksch.NewParallelConfig().SetParallelCount(4).SetBatchSize(autonavi.MaxConvertCount), ctx,
|
||||
// func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
// var coords []*autonavi.Coordinate
|
||||
// for _, v := range batchItemList {
|
||||
// store := v.(*StoreExt)
|
||||
// coords = append(coords, &autonavi.Coordinate{
|
||||
// Lng: store.FloatLng,
|
||||
// Lat: store.FloatLat,
|
||||
// })
|
||||
// }
|
||||
// coords, err = api.AutonaviAPI.BatchCoordinateConvert(coords, autonavi.CoordSysBaidu)
|
||||
// if err == nil {
|
||||
// for k, v := range batchItemList {
|
||||
// store := v.(*StoreExt)
|
||||
// coord := coords[k]
|
||||
// store.FloatLng = coord.Lng
|
||||
// store.FloatLat = coord.Lat
|
||||
// }
|
||||
// }
|
||||
// return retVal, err
|
||||
// }, retVal.Stores)
|
||||
// task.Run()
|
||||
// task.GetResult(0)
|
||||
task := tasksch.NewParallelTask("坐标转换", tasksch.NewParallelConfig().SetParallelCount(4).SetBatchSize(autonavi.MaxConvertCount), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
var coords []*baidunavi.Coordinate
|
||||
for _, v := range batchItemList {
|
||||
store := v.(*StoreExt)
|
||||
coords = append(coords, &baidunavi.Coordinate{
|
||||
Lng: store.FloatLng,
|
||||
Lat: store.FloatLat,
|
||||
})
|
||||
}
|
||||
coords, err = api.BaiDuNaviAPI.BatchCoordinateConvert(coords, baidunavi.CoordSysGCJ02, baidunavi.CoordSysBaiDu)
|
||||
if err == nil {
|
||||
for k, v := range batchItemList {
|
||||
store := v.(*StoreExt)
|
||||
coord := coords[k]
|
||||
store.FloatLng = coord.Lng
|
||||
store.FloatLat = coord.Lat
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
}, retVal.Stores)
|
||||
task.Run()
|
||||
task.GetResult(0)
|
||||
}
|
||||
// if mapLimit {
|
||||
// retVal.TotalCount = len(retVal.Stores)
|
||||
|
||||
@@ -34,7 +34,7 @@ func GetStoreUsers(ctx *jxcontext.Context, storeID int) (storeUserInfos []*dao.S
|
||||
WHERE t1.parentid = -1 AND t1.jxstoreid = ?
|
||||
GROUP BY 1,2,3,4,5,6,7;
|
||||
`
|
||||
globals.SugarLogger.Debug(sql)
|
||||
// globals.SugarLogger.Debug(sql)
|
||||
if err = dao.GetRows(nil, &storeUserInfos, sql, storeID); err == nil {
|
||||
for _, storeUserInfo := range storeUserInfos {
|
||||
if storeUserInfo.MembersStr != "" {
|
||||
@@ -111,7 +111,7 @@ func BindMobile2Store(ctx *jxcontext.Context, mobile string, storeID int) (num i
|
||||
dao.Commit(db)
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Debug(utils.Format4Output(user, false))
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(user, false))
|
||||
dao.WrapAddIDCULEntity(user, ctx.GetUserName())
|
||||
user.ParentID = -1
|
||||
if err = dao.CreateWeiXins(db, user); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user