Documentation ¶
Overview ¶
*
- Copyright 2015 @ 56x.net.
- name : shop
- author : jarryliu
- date : 2016-05-29 11:12
- description :
- history :
*
- Copyright 2015 @ 56x.net.
- name : shop_repo.go
- author : jarryliu
- date : 2016-05-28 13:10
- description :
- history :
Index ¶
Constants ¶
View Source
const ( // TypeOnlineShop 线上商店 TypeOnlineShop int32 = 1 // TypeOfflineShop 线下实体店 TypeOfflineShop int32 = 2 )
View Source
const ( // StateAwaitInitial 待初始化 StateAwaitInitial = 0 // StateNormal 正常状态 StateNormal int32 = 1 // StateStopped 停用状态 StateStopped int32 = 2 // OStateNormal 营业状态-正常 OStateNormal int32 = 1 // OStatePause 营业状态-暂停营业 OStatePause int32 = 2 )
View Source
const ( // FlagSelfSale 自营 FlagSelfSale = 1 << iota )
Variables ¶
View Source
var ( ErrNoSuchShop = domain.NewError( "err_shop_no_such_shop", "未指定店铺") ErrShopNoLogo = domain.NewError( "err_shop_no_logo", "请上传店铺Logo") ErrShopAliasFormat = domain.NewError( "err_shop_alias_format", "域名前缀为3-11位的字母数字的组合") ErrShopAliasIncorrect = domain.NewError( "err_shop_alias_incorrect", "域名前缀不允许使用") ErrShopAliasUsed = domain.NewError( "err_shop_alias_used", "域名已被占用") ErrSupportSingleOnlineShop = domain.NewError( "err_shop_support_only_online_shop", "当前商户仅支持1个店铺") )
View Source
var ( ErrSameNameShopExists = domain.NewError( "err_same_name_shop_exists", "商店已经存在") // 商店状态字典 StateTextMap = map[int32]string{ StateNormal: "正常", StateStopped: "已关闭", } // 状态顺序 StateIndex = []int32{ StateNormal, StateStopped, } // 商店类型字电 TypeTextMap = map[int32]string{ TypeOnlineShop: "商店", TypeOfflineShop: "门店", } StateTextStrMap = map[string]string{ strconv.Itoa(int(StateNormal)): StateTextMap[StateNormal], strconv.Itoa(int(StateStopped)): StateTextMap[StateStopped], } TypeTextStrMap = map[string]string{ strconv.Itoa(int(TypeOnlineShop)): TypeTextMap[TypeOnlineShop], strconv.Itoa(int(TypeOfflineShop)): TypeTextMap[TypeOfflineShop], } DefaultOnlineShop = OnlineShop{ Addr: "", Telephone: "", Alias: "", Host: "", Logo: "assets/init/no_pic.png", ShopTitle: "", ShopNotice: "", } DefaultOfflineShop = OfflineShop{ Tel: "", Address: "", Lng: 0, Lat: 0, CoverRadius: 0, } )
Functions ¶
This section is empty.
Types ¶
type ComplexShop ¶
type ComplexShop struct { ID int64 VendorId int64 ShopType int32 Name string State int32 // 线上/线下商店的数据 Data map[string]string }
ComplexShop 商店数据传输对象
type IOfflineShop ¶
type IOfflineShop interface { // SetShopValue 设置值 SetShopValue(*OfflineShop) error // GetShopValue 获取值 GetShopValue() OfflineShop // GetLngLat 获取经维度 GetLngLat() (float64, float64) // CanDeliver 是否可以配送 // 返回是否可以配送,以及距离(米) CanDeliver(lng, lat float64) (bool, int) // CanDeliverTo 是否可以配送 // 返回是否可以配送,以及距离(米) CanDeliverTo(address string) (bool, int) }
IOfflineShop 线下商店
type IOnlineShop ¶
type IOnlineShop interface { // SetShopValue 设置值 SetShopValue(*OnlineShop) error // GetShopValue 获取值 GetShopValue() OnlineShop // GetLocateDomain 获取分配的域名 GetLocateDomain() string // BindDomain 绑定自定义域名 BindDomain(domain string) error }
IOnlineShop 线上商城
type IShopManager ¶
type IShopManager interface { // CreateOnlineShop 创建线上店铺 CreateOnlineShop(o *OnlineShop) (IShop, error) //todo: will be removed // 新建商店 CreateShop(*Shop) IShop // 获取店铺 GetOnlineShop() IShop // 获取门店 GetStore(id int) IShop // 获取所有商店 GetShops() []IShop // 获取营业中的商店 GetBusinessInShops() []IShop // 根据名称获取商店 GetShopByName(name string) IShop // 删除门店 DeleteShop(shopId int32) error }
type IShopRepo ¶
type IShopRepo interface { // 创建电子商城 CreateShop(shop *OnlineShop) IShop // 获取商店 GetShop(shopId int64) IShop // 获取门店 GetStore(storeId int64) IShop SaveShop(*Shop) (int64, error) // 检查商户商城是否存在(创建) CheckShopExists(vendorId int64) bool // 获取店铺数量 ShopCount(vendorId int64, shopType int32) int // 商店别名是否存在 ShopAliasExists(alias string, shopId int) bool // 获取商店值 GetValueShop(shopId int64) *Shop // 获取线下商店 GetOfflineShop(shopId int) *OfflineShop // 获取商户的店铺 GetOnlineShopOfMerchant(vendorId int) *OnlineShop // 获取商户所有商店 GetShopId(mchId int64) []Shop // 删除线上商店 DeleteOnlineShop(mchId, shopId int64) error // 删除线下门店 DeleteOfflineShop(mchId, shopId int64) error // 保存线上商店 SaveOnlineShop(v *OnlineShop) (int64, error) // 保存线下商店 SaveOfflineShop(v *OfflineShop, create bool) error // GetShopIdByAlias 根据alias获取店铺编号 GetShopIdByAlias(alias string) int64 }
type OfflineShop ¶
type OfflineShop struct { // 商店编号 ShopId int `db:"shop_id" pk:"yes" auto:"no"` // 联系电话 Tel string `db:"tel"` // 省 Province int32 `db:"province"` // 市 City int32 `db:"city"` // 区 District int32 `db:"district"` // 通讯地址 Address string `db:"addr"` // 经度 Lng float32 `db:"lng"` // 纬度 Lat float32 `db:"lat"` // 配送最大半径(公里) CoverRadius int `db:"deliver_radius"` }
门店
type OnlineShop ¶
type OnlineShop struct { // 店铺编号 Id int64 `db:"id" pk:"yes" auto:"yes"` // 商户编号 VendorId int64 `db:"vendor_id"` // 店铺名称 ShopName string `db:"shop_name"` // 店铺标志 Logo string `db:"logo"` // 自定义 域名 Host string `db:"host"` // 个性化域名 Alias string `db:"alias"` // 电话 Telephone string `db:"tel"` // 地址 Addr string `db:"addr"` // 店铺标题 ShopTitle string `db:"shop_title"` // 店铺公告 ShopNotice string `db:"shop_notice"` // 标志 Flag int `db:"flag"` // 状态 State int16 `db:"state"` // 创建时间 CreateTime int64 `db:"create_time"` }
商城
type Shop ¶
type Shop struct { //商店编号 Id int64 `db:"id" pk:"yes" auto:"yes"` //运营商编号 VendorId int64 `db:"vendor_id"` //商店类型 ShopType int32 `db:"shop_type"` //商店名称 Name string `db:"name"` //商店状态 State int32 `db:"state"` //营业状态 OpeningState int32 `db:"opening_state"` //排序 SortNum int32 `db:"sort_num"` //创建时间 CreateTime int64 `db:"create_time"` }
Shop 商店
Click to show internal directories.
Click to hide internal directories.