Files
jx-callback/business/model/store.go

887 lines
36 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package model
import (
"time"
"git.rosy.net.cn/baseapi/utils"
)
const (
StoreStatusAll = -9
StoreStatusDisabled = -2
StoreStatusClosed = -1
StoreStatusHaveRest = 0
StoreStatusOpened = 1
StoreIsSyncAll = -1
StoreIsSyncNo = 0
StoreIsSyncYes = 1
)
const (
StoreAuditStatusCreated = 1
StoreAuditStatusOnline = 0
StoreAuditStatusRejected = -1
StoreAuditStatusUpdated = 2
StoreAuditStatusAll = -9
)
const (
StoreSkuAuditTypePrice = 1 //改价
StoreSkuAuditTypeFocus = 2 //关注
)
const (
MainSubStoreName = "本店"
MainSubStoreAddress = "本店"
)
// 配送范围类型,此定义与京东到家相同,除非特殊说明,本系统中的坐标都是火星坐标
const (
DeliveryRangeTypePolygon = 2
DeliveryRangeTypeRadius = 3
)
const (
StoreDeliveryTypeCrowdSourcing = 0 //缺省,平台众包配送,可转自送
StoreDeliveryTypeByPlatform = 1 //平台专送
StoreDeliveryTypeByStore = 2 //完全门店自送
)
const (
StoreChangePriceTypeDirect = 0 // 普通门店
StoreChangePriceTypeNeedApprove = 1 // 改价需要审核,暂时没用
StoreChangePriceTypeBossDisabled = 2 // 完全禁止改价
StoreChangePriceTypeManagedStore = 3 // 直营门店,禁止改价
)
const (
AutoReplyAll = 0 // 全部自动回复
AutoReplyGoodComment = 1 // 禁止差评自动回复
AutoReplyDisabled = 2 // 禁止自动回复
)
const (
ExdStoreName = "饿鲜达"
MatterStoreID = 666666
JdShopMainVendorStoreID = "999999"
JdShopMainVendorStoreID2 = "9999999"
JdShopMainStoreID = 102919
JdShopMainStoreID2 = 100000
VendorStoreTel = "18011597879"
)
var (
StoreStatusName = map[int]string{
StoreStatusDisabled: "禁用",
StoreStatusClosed: "休息",
StoreStatusHaveRest: "临时休息",
StoreStatusOpened: "营业中",
}
DeliveryRangeTypeName = map[int]string{
DeliveryRangeTypePolygon: "多边形",
DeliveryRangeTypeRadius: "圆",
}
DeliveryTypeName = map[int]string{
StoreDeliveryTypeCrowdSourcing: "平台众包",
StoreDeliveryTypeByPlatform: "平台专送",
StoreDeliveryTypeByStore: "门店自送",
}
BankName = map[string]string{
"CDB": "国家开发银行",
"ICBC": "中国工商银行",
"ABC": "中国农业银行",
"BOC": "中国银行",
"CCB": "中国建设银行",
"PSBC": "中国邮政储蓄银行",
"COMM": "交通银行",
"CMB": "招商银行",
"SPDB": "上海浦东发展银行",
"CIB": "兴业银行",
"HXBANK": "华夏银行",
"GDB": "广发银行", //0724
"CMBC": "民生银行",
"CITIC": "中信银行",
"CEB": "光大银行", //0724
"EGBANK": "恒丰银行",
"CZBANK": "浙商银行",
"BOHAIB": "渤海银行",
"SPABANK": "平安银行",
"SHRCB": "上海农村商业银行",
"YXCCB": "玉溪市商业银行",
"YDRCB": "尧都农商行",
"BJBANK": "北京银行",
"SHBANK": "上海银行",
"JSBANK": "江苏银行",
"HZCB": "杭州银行",
"NJCB": "南京银行",
"NBBANK": "宁波银行",
"HSBANK": "徽商银行",
"CSCB": "长沙银行",
"CDCB": "成都银行",
"CQBANK": "重庆银行",
"DLB": "大连银行",
"NCB": "南昌银行",
"FJHXBC": "福建海峡银行",
"HKB": "汉口银行",
"WZCB": "温州银行",
"QDCCB": "青岛银行",
"TZCB": "台州银行",
"JXBANK": "嘉兴银行",
"CSRCB": "常熟农村商业银行",
"NHB": "南海农村信用联社",
"CZRCB": "常州农村信用联社",
"H3CB": "内蒙古银行",
"SXCB": "绍兴银行",
"SDEB": "顺德农商银行",
"WJRCB": "吴江农商银行",
"ZBCB": "齐商银行",
"GYCB": "贵阳市商业银行",
"ZYCBANK": "遵义市商业银行",
"HZCCB": "湖州市商业银行",
"DAQINGB": "龙江银行",
"JINCHB": "晋城银行JCBANK",
"ZJTLCB": "浙江泰隆商业银行",
"GDRCC": "广东省农村信用社联合社",
"DRCBCL": "东莞农村商业银行",
"MTBANK": "浙江民泰商业银行",
"GCB": "广州银行",
"LYCB": "辽阳市商业银行",
"JSRCU": "江苏省农村信用联合社",
"LANGFB": "廊坊银行",
"CZCB": "浙江稠州商业银行",
"DYCB": "德阳商业银行",
"JZBANK": "晋中市商业银行",
"BOSZ": "苏州银行",
"GLBANK": "桂林银行",
"URMQCCB": "乌鲁木齐市商业银行",
"CDRCB": "成都农商银行",
"ZRCBANK": "张家港农村商业银行",
"BOD": "东莞银行",
"LSBANK": "莱商银行",
"BJRCB": "北京农村商业银行",
"TRCB": "天津农商银行",
"SRBANK": "上饶银行",
"FDB": "富滇银行",
"CRCBANK": "重庆农村商业银行",
"ASCB": "鞍山银行",
"NXBANK": "宁夏银行",
"BHB": "河北银行",
"HRXJB": "华融湘江银行",
"ZGCCB": "自贡市商业银行",
"YNRCC": "云南省农村信用社",
"JLBANK": "吉林银行",
"DYCCB": "东营市商业银行",
"KLB": "昆仑银行",
"ORBANK": "鄂尔多斯银行",
"XTB": "邢台银行",
"JSB": "晋商银行",
"TCCB": "天津银行",
"BOYK": "营口银行",
"JLRCU": "吉林农信",
"SDRCU": "山东农信",
"XABANK": "西安银行",
"HBRCU": "河北省农村信用社",
"NXRCU": "宁夏黄河农村商业银行",
"GZRCU": "贵州省农村信用社",
"FXCB": "阜新银行",
"HBHSBANK": "湖北银行黄石分行",
"ZJNX": "浙江省农村信用社联合社",
"XXBANK": "新乡银行",
"HBYCBANK": "湖北银行宜昌分行",
"LSCCB": "乐山市商业银行",
"TCRCB": "江苏太仓农村商业银行",
"BZMD": "驻马店银行",
"GZB": "赣州银行",
"WRCB": "无锡农村商业银行",
"BGB": "广西北部湾银行",
"GRCB": "广州农商银行",
"JRCB": "江苏江阴农村商业银行",
"BOP": "平顶山银行",
"TACCB": "泰安市商业银行",
"CGNB": "南充市商业银行",
"CCQTGB": "重庆三峡银行",
"XLBANK": "中山小榄村镇银行",
"HDBANK": "邯郸银行",
"KORLABANK": "库尔勒市商业银行",
"BOJZ": "锦州银行",
"QLBANK": "齐鲁银行",
"BOQH": "青海银行",
"YQCCB": "阳泉银行",
"SJBANK": "盛京银行",
"FSCB": "抚顺银行",
"ZZBANK": "郑州银行",
"SRCB": "深圳农村商业银行",
"BANKWF": "潍坊银行",
"JJBANK": "九江银行",
"JXRCU": "江西省农村信用",
"HNRCU": "河南省农村信用",
"GSRCU": "甘肃省农村信用",
"SCRCU": "四川省农村信用",
"GXRCU": "广西省农村信用",
"SXRCCU": "陕西信合",
"WHRCB": "武汉农村商业银行",
"YBCCB": "宜宾市商业银行",
"KSRB": "昆山农村商业银行",
"SZSBK": "石嘴山银行",
"HSBK": "衡水银行",
"XYBANK": "信阳银行",
"NBYZ": "鄞州银行",
"ZJKCCB": "张家口市商业银行",
"XCYH": "许昌银行",
"JNBANK": "济宁银行",
"CBKF": "开封市商业银行",
"WHCCB": "威海市商业银行",
"HBC": "湖北银行",
"BOCD": "承德银行",
"BODD": "丹东银行",
"JHBANK": "金华银行",
"BOCY": "朝阳银行",
"LSBC": "临商银行",
"BSB": "包商银行",
"LZYH": "兰州银行",
"BOZK": "周口银行",
"DZBANK": "德州银行",
"SCCB": "三门峡银行",
"AYCB": "安阳银行",
"ARCU": "安徽省农村信用社",
"HURCB": "湖北省农村信用社",
"HNRCC": "湖南省农村信用社",
"NYNB": "广东南粤银行",
"LYBANK": "洛阳银行",
"NHQS": "农信银清算中心",
"CBBQS": "城市商业银行资金清算中心",
}
StoreAuditStatusName = map[int]string{
StoreAuditStatusCreated: "待审核",
StoreAuditStatusOnline: "上线",
StoreAuditStatusRejected: "拒绝",
}
StorePriceTypeName = map[int]string{
StoreChangePriceTypeDirect: "普通门店",
// StoreChangePriceTypeBossDisabled: "普通门店禁止改价",
// StoreChangePriceTypeManagedStore: "直营门店禁止改价",
}
AutoReplyTypeName = map[int]string{
AutoReplyAll: "全部自动回复",
AutoReplyGoodComment: "禁止差评自动回复",
AutoReplyDisabled: "禁止自动回复",
}
)
type Store struct {
ModelIDCULD
OriginalName string `orm:"-" json:"originalName"`
Name string `orm:"size(255)" json:"name"`
CityCode int `orm:"default(0);null" json:"cityCode"` // todo ?
DistrictCode int `orm:"default(0);null" json:"districtCode"` // todo ?
Address string `orm:"size(255)" json:"address"`
Tel1 string `orm:"size(32);index" json:"tel1"`
Tel2 string `orm:"size(32);index" json:"tel2"`
OpenTime1 int16 `json:"openTime1" validate:"max=2359,min=1,ltfield=CloseTime1"` // 930就表示9点半用两个的原因是为了支持中午休息1与2的时间段不能交叉为0表示没有
CloseTime1 int16 `json:"closeTime1" validate:"max=2359,min=1` // 格式同上
OpenTime2 int16 `json:"openTime2" validate:"max=2359,min=1,ltfield=CloseTime2"` // 格式同上
CloseTime2 int16 `json:"closeTime2" validate:"max=2359,min=1` // 格式同上
Lng int `json:"-"` // 乘了10的6次方
Lat int `json:"-"` // 乘了10的6次方
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon则为逗号分隔坐标分号分隔的坐标点坐标与Lng和Lat一样都是整数比如 121361504,31189308;121420555,31150238。否则为半径单位为米
Status int `json:"status"`
AutoEnableAt *time.Time `orm:"type(datetime);null" json:"autoEnableAt"` // 自动营业时间(临时休息用)
ChangePriceType int8 `json:"changePriceType"` // 修改价格类型,即是否需要审核
SMSNotify int8 `orm:"column(sms_notify);" json:"smsNotify"` // 是否通过短信接收订单消息(每天只推一条)
SMSNotifyMark int8 `orm:"column(sms_notify_mark);" json:"smsNotifyMark"` //今天是否已经推送过订单消息
AutoReplyType int8 `json:"autoReplyType"` // 订单评价自动回复类型
LinkStoreID int `orm:"column(link_store_id);default(0);index" json:"linkStoreID"` // 关联门店ID
StoreLevel string `orm:"default(C);size(32)" json:"storeLevel"` // 门店等级(筛选用,京西的)
Comment string `orm:"size(255)" json:"comment"` //门店备注
PrinterDisabled int8 `orm:"default(0)" json:"printerDisabled"` // 是否禁用网络打印机
PrinterFontSize int8 `orm:"default(0)" json:"printerFontSize"` // 打印字体-10正常1
PrinterVendorID int `orm:"column(printer_vendor_id);" json:"printerVendorID"`
PrinterSN string `orm:"size(32);column(printer_sn);index" json:"printerSN"`
PrinterKey string `orm:"size(64)" json:"printerKey"`
PrinterBindInfo string `orm:"size(1024)" json:"-"`
IDCardFront string `orm:"size(255);column(id_card_front)" json:"idCardFront"`
IDCardBack string `orm:"size(255);column(id_card_back)" json:"idCardBack"`
IDCardHand string `orm:"size(255);column(id_card_hand)" json:"idCardHand"`
Licence string `orm:"size(255)" json:"licence"` // 营业执照图片
LicenceCode string `orm:"size(32)" json:"licenceCode"`
LicenceType int8 `json:"licenceType"` // 营业执照类型0个人1公司
LicenceCorpName string `orm:"size(64)" json:"licenceCorpName"` // 营业执照公司名称
LicenceOwnerName string `orm:"size(8)" json:"licenceOwnerName"` // 法人姓名
LicenceAddress string `orm:"size(255)" json:"licenceAddress"` // 地址
LicenceValid string `orm:"size(32)" json:"licenceValid"` // 有效期开始
LicenceExpire string `orm:"size(32)" json:"licenceExpire"` // 有效期结束
IDName string `orm:"size(8);column(id_name)" json:"idName"` // 身份证姓名
IDCode string `orm:"size(32);column(id_code)" json:"idCode"` // 身份证号
IDValid string `orm:"column(id_valid);size(32)" json:"idValid"` // 有效期开始
IDExpire string `orm:"column(id_expire);size(32)" json:"idExpire"` // 有效期结束
Licence2Image string `orm:"size(255)" json:"licence2Image"` // 食品经营许可证
Licence2Code string `orm:"size(32)" json:"licence2Code"` // 食品经营许可证编号
Licence2Valid string `orm:"size(32)" json:"licence2Valid"` // 有效期开始
Licence2Expire string `orm:"size(32)" json:"licence2Expire"` // 有效期结束
// MarketManName string `orm:"size(8)" json:"marketManName"` // 市场负责人姓名
MarketManPhone string `orm:"size(16)" json:"marketManPhone"` // 市场负责人电话
MarketManRole string `orm:"size(32)" json:"marketManRole"` // 市场负责人组(角色,单人)
JxBrandFeeFactor int `json:"jxBrandFeeFactor"` // 京西品牌费因子
MarketAddFeeFactor int `json:"marketAddFeeFactor"` // 市场附加费因子
PayeeName string `orm:"size(8)" json:"payeeName"` // 收款人姓名
PayeeAccountNo string `orm:"size(255)" json:"payeeAccountNo"` // 收款账号
PayeeBankBranchName string `orm:"size(255)" json:"payeeBankBranchName"` // 开户支行
PayeeBankCode string `orm:"size(8)" json:"payeeBankCode"` // 开户行代码
PayPercentage int `json:"payPercentage"`
OldPayPercentage int `json:"oldPayPercentage"`
StoreFrontPic string `orm:"size(255)" json:"storeFrontPic"` //门面照
StoreInPic string `orm:"size(255)" json:"storeInPic"` //门店内照片
// OperatorName string `orm:"size(8)" json:"operatorName"` // 运营人姓名
OperatorPhone string `orm:"size(16)" json:"operatorPhone"` // 京东运营人电话
OperatorRole string `orm:"size(32)" json:"operatorRole"` // 京东运营人组(角色)
OperatorPhone2 string `orm:"size(16)" json:"operatorPhone2"` // 美团运营人电话
OperatorRole2 string `orm:"size(32)" json:"operatorRole2"` // 美团运营人组(角色)
OperatorPhone3 string `orm:"size(16)" json:"operatorPhone3"` // 饿百运营人电话
OperatorRole3 string `orm:"size(32)" json:"operatorRole3"` // 饿百运营人组(角色)
PromoteInfo string `orm:"size(255)" json:"promoteInfo"` //门店公告(所有平台统一的公告)
IsBoughtMatter int `json:"isBoughtMatter"` //这周是否申请过物料
SoundPercentage int `json:"soundPercentage"` //打印机声音大小比例
Banner string `orm:"size(9999)" json:"banner"` //门店商城bannar图
BrandID int `orm:"column(brand_id)" json:"brandID"` //品牌ID
}
func (*Store) TableUnique() [][]string {
return [][]string{
[]string{"Name", "DeletedAt"},
}
}
func (*Store) TableIndex() [][]string {
return [][]string{
[]string{"Lng", "Lat"},
}
}
func (s *Store) IsPrinterDisabled() bool {
return s.PrinterDisabled == 1
}
func (s *Store) GetOpTimeList() (opTimeList []int16) {
opTimeList = []int16{s.OpenTime1, s.CloseTime1}
if s.OpenTime2 != 0 {
opTimeList = append(opTimeList, s.OpenTime2, s.CloseTime2)
}
return opTimeList
}
func (s *Store) SetOpTime(opTimeList []int16) {
if len(opTimeList) >= 2 {
s.OpenTime1, s.CloseTime1 = opTimeList[0], opTimeList[1]
if len(opTimeList) >= 4 {
s.OpenTime2, s.CloseTime2 = opTimeList[2], opTimeList[3]
}
}
}
type StoreSub struct {
ModelIDCULD
StoreID int `orm:"column(store_id)"`
Index int // 子店序号为0表示主店
Name string `orm:"size(255);index"`
Address string `orm:"size(255)"`
Status int // 取值同Store.Status
Mobile1 string `orm:"size(32)"`
Mobile2 string `orm:"size(32)"`
Mobile3 string `orm:"size(32)"`
}
func (*StoreSub) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "Index", "DeletedAt"},
}
}
type StoreMap struct {
ModelIDCULD
StoreID int `orm:"column(store_id)" json:"storeID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
Status int `json:"status"` // 取值同Store.Status
StoreName string `orm:"size(255)" json:"storeName"` // 平台门店的名字,由平台到京西
VendorStoreName string `orm:"size(255)" json:"vendorStoreName"` //平台门店名,由京西到平台
VendorPayPercentage int `json:"vendorPayPercentage"` //平台结算比例
PricePercentage int16 `orm:"default(100)" json:"pricePercentage"` // todo 厂商价格相对于本地价格的百分比,这个字段的修改会比较特殊,因为可能需要刷新厂商价格
PricePercentagePack string `orm:"size(32)" json:"pricePercentagePack"` //
FreightDeductionPack string `orm:"size(32)" json:"freightDeductionPack"` //
AutoPickup int8 `orm:"default(1)" json:"autoPickup"` // 是否自动拣货
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
DeliveryFeeDeductionSill int `json:"deliveryFeeDeductionSill"`
DeliveryFeeDeductionFee int `json:"deliveryFeeDeductionFee"`
DeliveryCompetition int8 `orm:"default(1)" json:"deliveryCompetition"` // 是否支持配送竞争
CreateDeliveryType int `orm:"default(0)" json:"createDeliveryType"` //默认0系统发单1为门店发单
SyncStatus int8 `orm:"default(2)" json:"syncStatus"`
IsSync int8 `orm:"default(1)" json:"isSync"` // 是否同步
SyncRule int8 `orm:"default(0)" json:"syncRule"` //目前用于京东商城晚上的同步规则0表示关闭1表示小同步2表示大同步
FakeOpenStart int16 `orm:"default(0)" json:"fakeOpenStart"` // 假开店开始
FakeOpenStop int16 `orm:"default(0)" json:"fakeOpenStop"` // 假开店结束
JdStoreLevel string `orm:"size(32)" json:"jdStoreLevel"` //京东门店等级
JdsStreetCode int `orm:"default(0)" json:"jdsStreetCode"` //京东商城直辖市街道code
JdsStreetName string `orm:"size(32)" json:"jdsStreetName"` //京东商城直辖市街道
IsOrder int `orm:"default(0)" json:"isOrder"` //是否是下预订单门店
IsSysCat int `orm:"default(0)" json:"isSysCat"` //是否使用京西分类
IsSupplyGoods int `orm:"default(0)" json:"isSupplyGoods"` // 是否是货源门店
YbAppID string `orm:"column(yb_app_id);size(255)" json:"ybAppID"`
YbAppKey string `orm:"size(255)" json:"ybAppKey"`
YbStorePrefix string `orm:"size(255)" json:"ybStorePrefix"`
MtwmToken string `orm:"size(255)" json:"mtwmToken"` //美团外卖商超token有效期30天每20天刷一次
MtwmRefreshToken string `orm:"size(255)" json:"mtwmRefreshToken"` //美团外卖商超refreshToken
EbaiSupplierID string `orm:"column(ebai_supplier_id)" json:"ebaiSupplierID"` //饿百供应商ID
}
func (*StoreMap) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "VendorID", "DeletedAt", "VendorOrgCode"},
[]string{"VendorStoreID", "VendorID", "DeletedAt", "VendorOrgCode"},
}
}
type StoreCourierMap struct {
ModelIDCULD
StoreID int `orm:"column(store_id)" json:"storeID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
Status int `json:"status"`
AuditStatus int `json:"auditStatus"`
VendorStatus int `json:"vendorStatus"`
VendorStoreName string `orm:"size(255)" json:"vendorStoreName"` //平台门店名,由京西到平台
Comment string `orm:"size(255)" json:"comment"`
// 以下数据仅用于同步使用
Lng int `json:"-"` // 乘了10的6次方
Lat int `json:"-"` // 乘了10的6次方
Remark string `orm:"size(255)" json:"-"`
}
func (*StoreCourierMap) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "VendorID", "DeletedAt"},
}
}
func (*StoreCourierMap) TableIndex() [][]string {
return [][]string{
[]string{"VendorStoreID", "VendorID", "DeletedAt"},
}
}
type PriceReferSnapshot struct {
ModelIDCULD
SnapshotAt time.Time `orm:"type(datetime)" json:"snapshotAt"` // 这个不同于CreatedAtSnapshotAt是逻辑上的时间CreatedAt是实际存储的时间
CityCode int `json:"cityCode"`
SkuID int `orm:"column(sku_id)" json:"skuId"`
NameID int `orm:"column(name_id)" json:"nameID"`
MaxPrice int `json:"maxPrice"`
MinPrice int `json:"minPrice"`
AvgPrice int `json:"avgPrice"`
MidPrice int `json:"midPrice"`
MaxUnitPrice int `json:"maxUnitPrice"`
MinUnitPrice int `json:"minUnitPrice"`
AvgUnitPrice int `json:"avgUnitPrice"`
MidUnitPrice int `json:"midUnitPrice"`
MaxJdPrice int `json:"maxJdPrice"`
MinJdPrice int `json:"minJdPrice"`
AvgJdPrice int `json:"avgJdPrice"`
MidJdPrice int `json:"midJdPrice"`
MaxEbaiPrice int `json:"maxEbaiPrice"`
MinEbaiPrice int `json:"minEbaiPrice"`
AvgEbaiPrice int `json:"avgEbaiPrice"`
MidEbaiPrice int `json:"midEbaiPrice"`
MaxMtwmPrice int `json:"maxMtwmPrice"`
MinMtwmPrice int `json:"minMtwmPrice"`
AvgMtwmPrice int `json:"avgMtwmPrice"`
MidMtwmPrice int `json:"midMtwmPrice"`
MaxSalePrice int `json:"maxSalePrice"`
MinSalePrice int `json:"minSalePrice"`
AvgSalePrice int `json:"avgSalePrice"`
MaxVendorPrice int `json:"maxVendorPrice"`
MinVendorPrice int `json:"minVendorPrice"`
AvgVendorPrice int `json:"avgVendorPrice"`
JdDirectPrice int `json:"jdDirectPrice"`
}
func (*PriceReferSnapshot) TableUnique() [][]string {
return [][]string{
[]string{"CityCode", "NameID", "SkuID", "SnapshotAt"},
}
}
func (*PriceReferSnapshot) TableIndex() [][]string {
return [][]string{
[]string{"CityCode", "SnapshotAt", "SkuID"},
}
}
type StorePriceScoreSnapshot struct {
ModelIDCULD
SnapshotAt time.Time `orm:"type(datetime)" json:"snapshotAt"` // 这个不同于CreatedAtSnapshotAt是逻辑上的时间CreatedAt是实际存储的时间
StoreID int `orm:"column(store_id)" json:"storeID"`
Score float64 `json:"score"`
}
func (*StorePriceScoreSnapshot) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "Score", "SnapshotAt"},
}
}
func (*StorePriceScoreSnapshot) TableIndex() [][]string {
return [][]string{
[]string{"SnapshotAt"},
}
}
type StoreSkuNamePrice struct {
ModelIDCULD
OutSkuID string `orm:"column(out_sku_id)" json:"outSkuID"`
Name string `json:"name"`
Price int `json:"price"`
Unit string `json:"unit"`
NameIDGroup string `orm:"column(name_id_group)" json:"nameIDGroup"`
}
func (*StoreSkuNamePrice) TableUnique() [][]string {
return [][]string{
[]string{"OutSkuID", "Price", "NameIDGroup"},
}
}
func (*StoreSkuNamePrice) TableIndex() [][]string {
return [][]string{
[]string{"OutSkuID"},
}
}
type VendorStoreSnapshot struct {
ModelIDCULD
VendorOrgCode string `orm:"size(32)" json:"vendorOrgCode"` // 同一平台下不同的商户代码,如果只有一个,可以为空
StoreID int `orm:"column(store_id)" json:"storeID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
VendorStoreID string `orm:"column(vendor_store_id);size(48)" json:"vendorStoreID"`
SnapshotAt time.Time `orm:"type(datetime)" json:"snapshotAt"` // 这个不同于CreatedAtSnapshotAt是逻辑上的时间CreatedAt是实际存储的时间
Status int `json:"status"` // 取值同Store.Status
OpenTime1 int16 `json:"openTime1"` // 930就表示9点半用两个的原因是为了支持中午休息1与2的时间段不能交叉为0表示没有
CloseTime1 int16 `json:"closeTime1"` // 格式同上
OpenTime2 int16 `json:"openTime2"` // 格式同上
CloseTime2 int16 `json:"closeTime2"` // 格式同上
DeliveryType int8 `orm:"default(0)" json:"deliveryType"` // 配送类型
StoreName string `orm:"size(255)" json:"storeName"` // 平台门店的名字
IsAutoOrder int8 `json:"isAutoOrder"` // 平台是否自动接单,-10未知1
JdStoreLevel string `orm:"size(32)" json:"jdStoreLevel"` //京东门店等级
}
func (*VendorStoreSnapshot) TableUnique() [][]string {
return [][]string{
[]string{"VendorStoreID", "VendorID", "SnapshotAt"},
}
}
func (*VendorStoreSnapshot) TableIndex() [][]string {
return [][]string{
[]string{"SnapshotAt"},
}
}
func (v *VendorStoreSnapshot) GenMapKey() string {
return v.VendorStoreID + utils.Int2Str(v.VendorID)
}
func (v *VendorStoreSnapshot) CompareOperationTime(s2 *VendorStoreSnapshot) int {
if s2 == nil {
return 1
}
if v.OpenTime1 == s2.OpenTime1 && v.CloseTime1 == s2.CloseTime1 &&
v.OpenTime2 == s2.OpenTime2 && v.CloseTime2 == s2.CloseTime2 {
return 0
} else if v.OpenTime1 > s2.OpenTime1 || v.CloseTime1 < s2.CloseTime2 {
return -1
}
return 1
}
type PricePercentageItem struct {
BeginPrice int `json:"beginPrice"` // 起始价格区间(包括)
PricePercentage int `json:"pricePercentage"` // 调价比例
PriceAdd int `json:"priceAdd"` // 调价额定值
}
type PricePercentagePack []*PricePercentageItem
func (l PricePercentagePack) Len() int {
return len(l)
}
// Less reports whether the element with
// index i should sort before the element with index j.
func (l PricePercentagePack) Less(i, j int) bool {
return l[i].BeginPrice < l[j].BeginPrice
}
// Swap swaps the elements with indexes i and j.
func (l PricePercentagePack) Swap(i, j int) {
tmp := l[i]
l[i] = l[j]
l[j] = tmp
}
type FreightDeductionItem struct {
BeginPrice int `json:"beginPrice"` // 起始价格区间(包括)
DeductFreight int `json:"deductFreight"` // 减免运费
}
type FreightDeductionPack struct {
StartPrice int `json:"startPrice"` // 起送价
FreightDeductionList []*FreightDeductionItem `json:"freightDeductionList"`
}
func (l *FreightDeductionPack) Len() int {
return len(l.FreightDeductionList)
}
// Less reports whether the element with
// index i should sort before the element with index j.
func (l *FreightDeductionPack) Less(i, j int) bool {
return l.FreightDeductionList[i].BeginPrice < l.FreightDeductionList[j].BeginPrice
}
// Swap swaps the elements with indexes i and j.
func (l *FreightDeductionPack) Swap(i, j int) {
l2 := l.FreightDeductionList
tmp := l2[i]
l2[i] = l2[j]
l2[j] = tmp
}
type StoreCategoryMap struct {
ModelIDCULD
StoreID int `orm:"column(store_id)" json:"storeID"`
CategoryID int `orm:"column(category_id)" json:"categoryID"` // 这个是指对应的sku_category
StoreCategoryName string `orm:"size(255)" json:"name"` // 门店类别单独的名字
StoreCategorySeq int `orm:"default(0)" json:"storeCategorySeq"` // 门店类别单独的序号
Level int `json:"level"` // 门店类别单独的等级
ParentID int `orm:"column(parent_id)" json:"parentID"` //门店类别父ID和sku_category一致
}
func (*StoreCategoryMap) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "CategoryID", "DeletedAt"},
}
}
type StorePushClient struct {
ModelIDCULD
StoreID int `orm:"column(store_id)" json:"storeID"`
ClientID string `orm:"column(client_id);size(255)" json:"clientID"`
}
func (*StorePushClient) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "ClientID"},
}
}
type StoreAudit struct {
ModelIDCULD
Name string `orm:"size(255)" json:"name"`
CityCode int `orm:"default(0);null" json:"cityCode"` // todo ?
DistrictCode int `orm:"default(0);null" json:"districtCode"` // todo ?
Address string `orm:"size(255)" json:"address"`
Tel1 string `orm:"size(32);index" json:"tel1"`
Tel2 string `orm:"size(32);index" json:"tel2"`
OpenTime1 int16 `json:"openTime1" validate:"max=2359,min=1,ltfield=CloseTime1"` // 930就表示9点半用两个的原因是为了支持中午休息1与2的时间段不能交叉为0表示没有
CloseTime1 int16 `json:"closeTime1" validate:"max=2359,min=1` // 格式同上
OpenTime2 int16 `json:"openTime2" validate:"max=2359,min=1,ltfield=CloseTime2"` // 格式同上
CloseTime2 int16 `json:"closeTime2" validate:"max=2359,min=1` // 格式同上
Lng int `json:"lng"` // 乘了10的6次方
Lat int `json:"lat"` // 乘了10的6次方
DeliveryRangeType int8 `json:"deliveryRangeType"` // 参见相关常量定义
DeliveryRange string `orm:"type(text)" json:"deliveryRange"` // 如果DeliveryRangeType为DeliveryRangeTypePolygon则为逗号分隔坐标分号分隔的坐标点坐标与Lng和Lat一样都是整数比如 121361504,31189308;121420555,31150238。否则为半径单位为米
Status int `json:"status"`
SMSNotify int8 `orm:"column(sms_notify);" json:"smsNotify"` // 是否通过短信接收订单消息(每天只推一条)
IDCardFront string `orm:"size(255);column(id_card_front)" json:"idCardFront"`
IDCardBack string `orm:"size(255);column(id_card_back)" json:"idCardBack"`
IDCardHand string `orm:"size(255);column(id_card_hand)" json:"idCardHand"`
Licence string `orm:"size(255)" json:"licence"` // 营业执照图片
LicenceCode string `orm:"size(32)" json:"licenceCode"`
LicenceType int8 `json:"licenceType"` // 营业执照类型0个人1公司
LicenceCorpName string `orm:"size(64)" json:"licenceCorpName"` // 营业执照公司名称
LicenceOwnerName string `orm:"size(8)" json:"licenceOwnerName"` // 法人姓名
LicenceAddress string `orm:"size(255)" json:"licenceAddress"` // 地址
LicenceValid string `orm:"size(32)" json:"licenceValid"` // 有效期开始
LicenceExpire string `orm:"size(32)" json:"licenceExpire"` // 有效期结束
IDName string `orm:"size(8);column(id_name)" json:"idName"` // 身份证姓名
IDCode string `orm:"size(32);column(id_code)" json:"idCode"` // 身份证号
IDValid string `orm:"column(id_valid);size(32)" json:"idValid"` // 有效期开始
IDExpire string `orm:"column(id_expire);size(32)" json:"idExpire"` // 有效期结束
Licence2Image string `orm:"size(255)" json:"licence2Image"` // 食品经营许可证
Licence2Code string `orm:"size(32)" json:"licence2Code"` // 食品经营许可证编号
Licence2Valid string `orm:"size(32)" json:"licence2Valid"` // 有效期开始
Licence2Expire string `orm:"size(32)" json:"licence2Expire"` // 有效期结束
UserID string `orm:"column(user_id);size(32)" json:"userID"` //谁发起的审核就把谁添加到这个门店里
AuditStatus int `json:"auditStatus"` //0是待审核1是通过-1是不通过
Remark string `orm:"size(255)" json:"remark"` //不通过原因
}
func (*StoreAudit) TableUnique() [][]string {
return [][]string{
[]string{"Name"},
}
}
func (*StoreAudit) TableIndex() [][]string {
return [][]string{
[]string{"UserID"},
}
}
type Brand struct {
ModelIDCULD
Name string `orm:"size(255)" json:"name"` //品牌名
Logo string `orm:"size(255)" json:"logo"` //品牌logo
BrandType int `json:"brandType"` //品牌类型
IsOpen int `json:"isOpen"` //主要三方配送用是否配送默认0表示打开1表示关
IsPrint int `json:"isPrint"` //是否打印小票中的标题默认0表示打1表示不打
}
func (*Brand) TableUnique() [][]string {
return [][]string{
[]string{"Name"},
}
}
type BrandStore struct {
ModelIDCULD
Name string `orm:"size(255)" json:"name"` //门店名
}
func (*BrandStore) TableUnique() [][]string {
return [][]string{
[]string{"Name"},
}
}
//门店账户收入
type StoreAcctIncome struct {
ModelIDCUL
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
UserID string `orm:"column(user_id)" json:"userID"` //用户ID (谁消费的)
ExpID int `orm:"column(exp_id)" json:"expID"` //用于关联多退少补的金额是对应哪一笔收入(支出)
Type int `json:"type"` //收入类型
IncomePrice int `json:"incomePrice"` //收入金额
}
func (v *StoreAcctIncome) TableIndex() [][]string {
return [][]string{
[]string{"StoreID"},
[]string{"CreatedAt"},
}
}
//门店账户支出
type StoreAcctExpend struct {
ModelIDCUL
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
UserID string `orm:"column(user_id)" json:"userID"` //用户ID (谁消费的)
ExpID int `orm:"column(exp_id)" json:"expID"` //用于关联多退少补的金额是对应哪一笔收入(支出)
Type int `json:"type"` //支出类型
ExpendPrice int `json:"expendPrice"` //支出金额
}
func (v *StoreAcctExpend) TableIndex() [][]string {
return [][]string{
[]string{"StoreID"},
[]string{"CreatedAt"},
}
}
//门店账单表
type StoreAcct struct {
ModelIDCULD
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
AccountBalance int `json:"accountBalance"` //账户余额
}
func (v *StoreAcct) TableUnique() [][]string {
return [][]string{
[]string{"StoreID"},
}
}
func (v *StoreAcct) TableIndex() [][]string {
return [][]string{
[]string{"CreatedAt"},
[]string{"AccountBalance"},
}
}
type StoreManageState struct {
ModelIDCUL
StoreID int `orm:"column(store_id)" json:"storeID"`
VendorID int `orm:"column(vendor_id)" json:"vendorID"`
CoverArea float64 `json:"coverArea"`
OpenTime float64 `json:"openTime"` //营业时长
SkuCount int `json:"skuCount"` //商品数
HighSkuCount int `json:"highSkuCount"` //虚高商品数
ActAmple int `json:"actAmple"` //活动丰富的
NullOrderCount int `json:"nullOrderCount"` //无效订单数
RefuseOrderCount int `json:"refuseOrderCount"` //拒绝订单数
StoreScore float64 `json:"storeScore"` //门店评分
RepurchaseRate int `json:"repurchaseRate"` //复购率(转化率)
VendorStatus int `json:"vendorStatus"` //平台营业状态
}
func (v *StoreManageState) TableUnique() [][]string {
return [][]string{
[]string{"StoreID", "VendorID"},
}
}