From 4e52916066f580ebf55d2739c3b1e7fa217a878c Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 11 Sep 2019 16:24:42 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E6=8B=89=E5=8F=96=E9=A5=BF=E7=99=BE?= =?UTF-8?q?=E9=97=A8=E5=BA=97=E8=90=A5=E4=B8=9A=E6=89=A7=E7=85=A7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/net_spider.go | 3 ++ business/partner/purchase/ebai/net_spider.go | 29 +++++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/business/model/net_spider.go b/business/model/net_spider.go index bf9e909b2..90612f38e 100644 --- a/business/model/net_spider.go +++ b/business/model/net_spider.go @@ -23,6 +23,9 @@ type PageShop struct { RecentOrderNum int `orm:"size(48)" json:"recentOrderNum"` // 月订单量 SkuCount int `orm:"size(48)" json:"skuCount"` // 商品总量 BusinessType string `orm:"size(48)" json:"businessType"` // 经营范围 + + LicenceCode string `orm:"size(32)" json:"licenceCode"` // 营业执照 + LicenceImg string `orm:"size(255)" json:"licenceImg"` // 营业执照图片 } func (*PageShop) TableUnique() [][]string { diff --git a/business/partner/purchase/ebai/net_spider.go b/business/partner/purchase/ebai/net_spider.go index 90bc3e873..37fd010c3 100644 --- a/business/partner/purchase/ebai/net_spider.go +++ b/business/partner/purchase/ebai/net_spider.go @@ -1,7 +1,7 @@ package ebai import ( - "git.rosy.net.cn/baseapi/platformapi/autonavi" + "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" @@ -25,8 +25,9 @@ func (c *PurchaseHandler) GetStoreIDListByCoordinates(ctx *jxcontext.Context, co 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) - return &model.PageShop{ + // 饿百扒下来的坐标是加了密的,不能用 + // lng, lat, _ := api.AutonaviAPI.CoordinateConvert(shopInfo.Longitude/100000, shopInfo.Latitude/100000, autonavi.CoordSysBaidu) + storePageInfo = &model.PageShop{ Name: shopInfo.Name, VendorID: model.VendorIDEBAI, VendorStoreID: storeID, @@ -34,8 +35,8 @@ func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, storeID strin VendorStatus: utils.Int2Str(shopInfo.BusinessStatus), Address: shopInfo.Address, - Lng: lng, - Lat: lat, + Lng: 0, + Lat: 0, DistrictCode: 0, Tel1: shopInfo.Phone, @@ -44,7 +45,21 @@ func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, storeID strin SkuCount: shopInfo.SkuCount, BusinessType: shopInfo.Category, ShopScore: float64(shopInfo.ShopScore), - }, nil + } + storePageInfo.LicenceCode, storePageInfo.LicenceImg = getLicenceInfoFromShopInfo(shopInfo) } - return nil, err + 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 }