Files
jx-callback/business/partner/purchase/ebai/net_spider.go
gazebo f1fbcf6366 - 高德API的KEY改为公司认证的KEY,可访问量更大
- 拉取门店信息时要获取坐标及区信息
- 饿百订单买家的坐标转换为高德坐标
2019-09-11 10:14:40 +08:00

51 lines
1.6 KiB
Go

package ebai
import (
"git.rosy.net.cn/baseapi/platformapi/autonavi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/ditu"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals/api"
)
func (c *PurchaseHandler) GetStoreIDListByCoordinates(ctx *jxcontext.Context, coord *ditu.Coordinate) (storeIDList []string, err error) {
shopListInfo, err := api.EbaiAPI.GetStoreList2(coord.Lng, coord.Lat)
if err != nil {
return nil, err
}
if shopListInfo != nil {
for _, v := range shopListInfo.ShopList {
storeIDList = append(storeIDList, v.ShopInfo.Wid)
}
}
return storeIDList, nil
}
func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, cityInfo, storeID string) (storePageInfo *model.PageShop, err error) {
shopInfo, err2 := api.EbaiAPI.GetStoreInfo2(storeID)
if err = err2; err == nil && shopInfo != nil {
lng, lat, _ := api.AutonaviAPI.CoordinateConvert(shopInfo.Longitude/100000, shopInfo.Latitude/100000, autonavi.CoordSysBaidu)
return &model.PageShop{
Name: shopInfo.Name,
VendorID: model.VendorIDEBAI,
VendorStoreID: storeID,
OrgCode: shopInfo.Brand,
VendorStatus: utils.Int2Str(shopInfo.BusinessStatus),
Address: shopInfo.Address,
Lng: lng,
Lat: lat,
DistrictCode: 0,
Tel1: shopInfo.Phone,
RecentOrderNum: shopInfo.RecentOrderNum,
SkuCount: shopInfo.SkuCount,
BusinessType: shopInfo.Category,
ShopScore: float64(shopInfo.ShopScore),
}, nil
}
return nil, err
}