shan
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
package partner
|
||||
|
||||
import (
|
||||
"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"
|
||||
)
|
||||
|
||||
type IPurchasePlatformNetSpiderHandler interface {
|
||||
GetStoreIDListByCoordinates(ctx *jxcontext.Context, coord *ditu.Coordinate) (storeIDList []string, err error)
|
||||
GetStorePageInfo(ctx *jxcontext.Context, storeID string) (storePageInfo *model.PageShop, err error)
|
||||
|
||||
// GetStoreListByCoordinates(ctx *jxcontext.Context, parentTask tasksch.ITask, cityInfo string, coordList []*ditu.Coordinate) (storeList []*model.PageShop, err error)
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package ebai
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/ebaiapi"
|
||||
"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, 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)
|
||||
storePageInfo = &model.PageShop{
|
||||
Name: shopInfo.Name,
|
||||
VendorID: model.VendorIDEBAI,
|
||||
VendorStoreID: storeID,
|
||||
OrgCode: shopInfo.Brand,
|
||||
VendorStatus: utils.Int2Str(shopInfo.BusinessStatus),
|
||||
|
||||
Address: shopInfo.Address,
|
||||
Lng: 0,
|
||||
Lat: 0,
|
||||
DistrictCode: 0,
|
||||
|
||||
Tel1: shopInfo.Phone,
|
||||
|
||||
RecentOrderNum: shopInfo.RecentOrderNum,
|
||||
SkuCount: shopInfo.SkuCount,
|
||||
BusinessType: shopInfo.Category,
|
||||
ShopScore: float64(shopInfo.ShopScore),
|
||||
}
|
||||
storePageInfo.LicenceCode, storePageInfo.LicenceImg = getLicenceInfoFromShopInfo(shopInfo)
|
||||
}
|
||||
return storePageInfo, err
|
||||
}
|
||||
|
||||
func getLicenceInfoFromShopInfo(storeInfo *ebaiapi.PageShopInfo) (licenceCode, licenceImg string) {
|
||||
for _, v := range storeInfo.MedicineQualification {
|
||||
if v.AptitudeType == "101" { // 营业执照
|
||||
licenceCode = v.LicenseNumber
|
||||
if len(v.AptitudePhoto) > 0 {
|
||||
licenceImg = v.AptitudePhoto[0]
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
return licenceCode, licenceImg
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package jd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"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.JdPageAPI.GetStoreList(fmt.Sprintf("%.6f", coord.Lng), fmt.Sprintf("%.6f", coord.Lat))
|
||||
if err != nil {
|
||||
// time.Sleep(5 * time.Second)
|
||||
return nil, err
|
||||
}
|
||||
if shopListInfo != nil {
|
||||
shopDataList, _ := shopListInfo["data"].(map[string]interface{})["data"].([]interface{})
|
||||
for _, v := range shopDataList {
|
||||
floorCellData := v.(map[string]interface{})["floorCellData"].(map[string]interface{})
|
||||
storeIDList = append(storeIDList, utils.Interface2String(floorCellData["storeId"]))
|
||||
}
|
||||
}
|
||||
return storeIDList, nil
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, storeID string) (storePageInfo *model.PageShop, err error) {
|
||||
shopInfo, err2 := api.JdPageAPI.GetStoreInfo2(storeID)
|
||||
if err = err2; err == nil && shopInfo != nil {
|
||||
return &model.PageShop{
|
||||
Name: shopInfo.StoreInfo.StoreName,
|
||||
VendorID: model.VendorIDJD,
|
||||
VendorStoreID: storeID,
|
||||
OrgCode: shopInfo.StoreInfo.OrgCode,
|
||||
VendorStatus: utils.Int2Str(shopInfo.StoreInfo.StationStatus),
|
||||
|
||||
Address: shopInfo.StoreInfo.StoreAddress,
|
||||
Lng: 0,
|
||||
Lat: 0,
|
||||
DistrictCode: 0,
|
||||
|
||||
Tel1: shopInfo.StoreInfo.StoreTel,
|
||||
|
||||
RecentOrderNum: jdapi.MonthSaleNum2Int(shopInfo.StoreInfo.MonthSaleNum),
|
||||
SkuCount: int(utils.Str2Int64WithDefault(shopInfo.StoreInfo.InSaleNum, 0)),
|
||||
BusinessType: shopInfo.StoreInfo.Industry,
|
||||
ShopScore: float64(shopInfo.StoreCommentVO.ScoreAvg),
|
||||
}, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
Reference in New Issue
Block a user