delivery

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2016 License: GPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

*

  • Copyright 2014 @ z3q.net.
  • name :
  • author : jarryliu
  • date : 2014-02-14 15:18
  • description :
  • history :

*

  • Copyright 2014 @ z3q.net.
  • name :
  • author : jarryliu
  • date : 2014-02-12 16:38
  • description :
  • history :

*

  • Copyright 2014 @ z3q.net.
  • name :
  • author : jarryliu
  • date : 2014-02-12 17:08
  • description :
  • history :

*

  • Copyright 2014 @ z3q.net.
  • name :
  • author : jarryliu
  • date : 2014-02-12 16:21
  • description :
  • history :

*

  • Copyright 2014 @ z3q.net.
  • name :
  • author : jarryliu
  • date : 2014-02-14 15:37
  • description :
  • history :

*

  • Copyright 2014 @ z3q.net.
  • name :
  • author : jarryliu
  • date : 2014-02-12 21:09
  • description :
  • history :

*

  • Copyright 2014 @ z3q.net.
  • name :
  • author : jarryliu
  • date : 2013-12-12 16:53
  • description :
  • history :

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotCoveragedArea *domain.DomainError = domain.NewDomainError(
		"not_coveraged_area", "未覆盖的配送区域")
)

Functions

This section is empty.

Types

type AreaValue

type AreaValue struct {
	Id   int    `db:"id" pk:"yes" auto:"no"`
	Pid  int    `db:"pid"`
	Name string `db:"name"`
}

中国省市行政规划

type CoverageValue

type CoverageValue struct {
	Id      int     `db:"id" auto:"yes" pk:"true"`
	Name    string  `db:"name"`
	Lng     float64 `db:"lng"`
	Lat     float64 `db:"lat"`
	Radius  int     `db:"radius"`
	Address string  `db:"address"`
	AreaId  int     `db:"area_id"`
}

覆盖区域

type ICoverageArea

type ICoverageArea interface {
	GetDomainId() int

	GetValue() CoverageValue

	SetValue(*CoverageValue) error

	// 是否可以配送
	// 返回是否可以配送,以及距离(米)
	CanDeliver(lng, lat float64) (bool, int)

	// 是否可以配送
	// 返回是否可以配送,以及距离(米)
	CanDeliverTo(address string) (bool, int)

	Save() (int, error)
}

type IDelivery

type IDelivery interface {
	// 返回聚合编号
	GetAggregateRootId() int

	// 等同于GetAggregateRootId()
	GetPartnerId() int

	// 获取最近的配送区域
	GetNearestCoverage(lng, lat float64) ICoverageArea

	// 根据地址获取地区(可能会有重复的区名)
	GetArea(addr string) ([]*AreaValue, error)

	// 获取覆盖区域
	GetCoverageArea(id int) ICoverageArea

	// 查看单个所在的区域
	FindSingleCoverageArea(lng, lat float64) ICoverageArea

	// 查找所有所在的区域
	FindCoverageAreas(lng, lat float64) []ICoverageArea

	// 获取配送信息
	GetDeliveryInfo(coverageId int) (shopId, deliverUsrId int, err error)
}

type IDeliveryRep

type IDeliveryRep interface {
	// 获取配送
	GetDelivery(int) IDelivery

	// 根据区名获取区域
	GetAreaByArea(name string) []*AreaValue

	// 保存覆盖区域
	SaveCoverageArea(*CoverageValue) (int, error)

	// 获取覆盖区域
	GetCoverageArea(areaId, id int) *CoverageValue

	// 获取所有的覆盖区域
	GetAllCoverageAreas(areaId int) []*CoverageValue

	// 获取配送绑定
	GetDeliveryBind(partnerId, coverageId int) *PartnerDeliverBind
}

type PartnerDeliverBind

type PartnerDeliverBind struct {
	Id           int `db:"id" auto:"yes" pk:"yes"`
	PartnerId    int `db:"partner_id"`
	CoverageId   int `db:"coverage_id"`
	ShopId       int `db:"shop_id"`
	DeliverUsrId int `db:"delivery_usr_id"`
	Enabled      int `db:"enabled"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL