Example #1
0
// 是否可以配送
// 返回是否可以配送,以及距离(米)
func (this *CoverageArea) CanDeliverTo(address string) (bool, int) {
	lng, lat, err := lbs.GetLocation(address)
	if err != nil {
		return false, -1
	}
	return this.CanDeliver(lng, lat)
}
Example #2
0
// 智能选择门店
func (this *Shopping) SmartChoiceShop(address string) (partner.IShop, error) {
	dly := this._deliveryRep.GetDelivery(this.GetAggregateRootId())
	lng, lat, err := lbs.GetLocation(address)
	if err != nil {
		return nil, errors.New("无法识别的地址:" + address)
	}
	var cov delivery.ICoverageArea = dly.GetNearestCoverage(lng, lat)
	if cov == nil {
		return nil, delivery.ErrNotCoveragedArea
	}
	shopId, _, err := dly.GetDeliveryInfo(cov.GetDomainId())
	return this._partner.GetShop(shopId), err
}