- 拉取饿百门店营业执照信息

This commit is contained in:
gazebo
2019-09-11 16:24:42 +08:00
parent adbaf4ff13
commit 4e52916066
2 changed files with 25 additions and 7 deletions

View File

@@ -23,6 +23,9 @@ type PageShop struct {
RecentOrderNum int `orm:"size(48)" json:"recentOrderNum"` // 月订单量 RecentOrderNum int `orm:"size(48)" json:"recentOrderNum"` // 月订单量
SkuCount int `orm:"size(48)" json:"skuCount"` // 商品总量 SkuCount int `orm:"size(48)" json:"skuCount"` // 商品总量
BusinessType string `orm:"size(48)" json:"businessType"` // 经营范围 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 { func (*PageShop) TableUnique() [][]string {

View File

@@ -1,7 +1,7 @@
package ebai package ebai
import ( 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/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/ditu" "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/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) { func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, storeID string) (storePageInfo *model.PageShop, err error) {
shopInfo, err2 := api.EbaiAPI.GetStoreInfo2(storeID) shopInfo, err2 := api.EbaiAPI.GetStoreInfo2(storeID)
if err = err2; err == nil && shopInfo != nil { 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, Name: shopInfo.Name,
VendorID: model.VendorIDEBAI, VendorID: model.VendorIDEBAI,
VendorStoreID: storeID, VendorStoreID: storeID,
@@ -34,8 +35,8 @@ func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, storeID strin
VendorStatus: utils.Int2Str(shopInfo.BusinessStatus), VendorStatus: utils.Int2Str(shopInfo.BusinessStatus),
Address: shopInfo.Address, Address: shopInfo.Address,
Lng: lng, Lng: 0,
Lat: lat, Lat: 0,
DistrictCode: 0, DistrictCode: 0,
Tel1: shopInfo.Phone, Tel1: shopInfo.Phone,
@@ -44,7 +45,21 @@ func (c *PurchaseHandler) GetStorePageInfo(ctx *jxcontext.Context, storeID strin
SkuCount: shopInfo.SkuCount, SkuCount: shopInfo.SkuCount,
BusinessType: shopInfo.Category, BusinessType: shopInfo.Category,
ShopScore: float64(shopInfo.ShopScore), 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
} }