delivery

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2022 License: GPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

*

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

*

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

*

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

*

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

*

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

*

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

*

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

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type AreaValue

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

中国省市行政规划

type CoverageValue

type CoverageValue struct {
	Id      int32   `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  int32   `db:"area_id"`
}

覆盖区域

type ICoverageArea

type ICoverageArea interface {
	GetDomainId() int32

	GetValue() CoverageValue

	SetValue(*CoverageValue) error

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

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

	Save() (int32, error)
}

type IDelivery

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

	// 等同于GetAggregateRootId()
	GetMerchantId() int32

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

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

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

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

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

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

type IDeliveryRepo

type IDeliveryRepo interface {
	// 获取配送
	GetDelivery(id int32) IDelivery

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

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

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

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

	// 获取配送绑定
	GetDeliveryBind(mchId, coverageId int32) *MerchantDeliverBind
}

type MerchantDeliverBind

type MerchantDeliverBind struct {
	Id           int32 `db:"id" auto:"yes" pk:"yes"`
	MerchantId   int32 `db:"merchant_id"`
	CoverageId   int32 `db:"coverage_id"`
	ShopId       int32 `db:"shop_id"`
	DeliverUsrId int32 `db:"delivery_user_id"`
	Enabled      int   `db:"enabled"`
}

Jump to

Keyboard shortcuts

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