352 lines
29 KiB
Go
352 lines
29 KiB
Go
package models
|
||
|
||
import "time"
|
||
|
||
/**
|
||
数据模型
|
||
*/
|
||
|
||
// User 用户
|
||
type User struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //用户ID
|
||
NickName string `json:"nickName"` //昵称
|
||
HeadImgUrl string `json:"headImgUrl"` //用户头像URL
|
||
Amount int `json:"amount"` //用户余额
|
||
OpenId string `gorm:"index;unique;not null" json:"openId"` //三方openid
|
||
UnionId string `gorm:"index;unique;not null" json:"unionId"` //三方unionid
|
||
UserType int `json:"userType"` //用户类型 0微信 1手机号
|
||
Mobile string `json:"mobile"` //手机号
|
||
Role int `json:"role"` //用户角色 0普通用户 1护理人员
|
||
Discount int `json:"discount"` //折扣
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP;not null" json:"createTime"` //创建时间
|
||
Status int `json:"status"` //信息状态
|
||
InviteUserId int64 `json:"inviteUserId"` //邀请用户
|
||
}
|
||
|
||
// Pet 宠物信息
|
||
type Pet struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Uid int64 `gorm:"index;not null" json:"uid"` //用户id
|
||
NickName string `gorm:"not null" json:"nickName"` //宠物昵称
|
||
HeadImgType int `json:"headImgType"` //用户头像类型 0远程头像 1本地头像
|
||
HeadImgUrl string `json:"headImgUrl"` //宠物头像
|
||
Desc string `json:"desc"` //宠物描述
|
||
Weight int `json:"weight"` //宠物体重
|
||
Precaution string `json:"precaution"` //注意事项
|
||
Gender int `json:"gender"` //性别 0男 1女
|
||
Birthday string `json:"birthday"` //生日
|
||
PetId int `json:"petId"` //宠物类型
|
||
Eunuch int `json:"eunuch"` //是否绝育 0否 1是 2未知
|
||
Vaccine int `gorm:"default:0" json:"vaccine"` //是否打疫苗 0否 1是
|
||
LastServiceProj string `gorm:"default:'-'" json:"lastServiceProj"` //上次服务项目
|
||
LastServiceDate string `gorm:"default:'-'" json:"lastServiceDate"` //上次服务时间
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP;not null" json:"createTime"` //创建时间
|
||
Status int `json:"status"` //信息状态
|
||
}
|
||
|
||
// PetBaseInfo 宠物基础信息
|
||
type PetBaseInfo struct {
|
||
Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
PetType int `gorm:"not null" json:"petType"` //类型 1猫 2狗
|
||
Assortment string `gorm:"not null" json:"assortment"` //品种
|
||
Size int `gorm:"not null" json:"size"` //大小 1大 2中 3小
|
||
Hair int `gorm:"not null" json:"hair"` //毛发 0未知 1长毛 2短毛
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
Status int `json:"status"` //信息状态
|
||
}
|
||
|
||
// ServiceAddr 服务地址
|
||
type ServiceAddr struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //ID
|
||
Longitude string `json:"longitude"` //经度
|
||
Latitude string `json:"latitude"` //纬度
|
||
Addr string `gorm:"not null" json:"addr"` //详细地址
|
||
DistantGapMeters int64 `gorm:"not null" json:"distantGapMeters"` //服务最远距离 单位/米
|
||
ServiceArea string `json:"serviceArea"` //服务区域
|
||
Status int `json:"status"` //信息状态
|
||
}
|
||
|
||
// UserServiceAddr 用户服务地址
|
||
type UserServiceAddr struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Uid int64 `gorm:"index;not null" json:"uid"` //用户ID
|
||
Name string `gorm:"not null" json:"name"` //名称
|
||
Mobile string `gorm:"not null" json:"mobile"` //手机号
|
||
AreaId int64 `json:"areaId"` //服务区域ID
|
||
Addr string `gorm:"not null" json:"addr"` //详细地址
|
||
Longitude string `json:"longitude"` //经度
|
||
Latitude string `json:"latitude"` //纬度
|
||
Area string `gorm:"-" json:"area"` //服务区域
|
||
AddrArea string `json:"addrArea"` //地址区域
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP;not null" json:"-"` //创建时间
|
||
Status int `json:"status"` //信息状态
|
||
}
|
||
|
||
// Goods 商品信息
|
||
type Goods struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //商品ID
|
||
Name string `gorm:"not null" json:"name"` //商品名称
|
||
GoodsType int `gorm:"not null" json:"goodsType"` //商品类型 1基础服务 2附加产品 3附加服务
|
||
Time string `json:"time"` //时间
|
||
Price int `gorm:"not null" json:"price"` //价格
|
||
ParentId int64 `gorm:"not null" json:"parentId"` //商品父ID
|
||
BuyMany int `gorm:"not null" json:"buyMany"` //同类型是否可购买多个 0否 1是
|
||
GoodsDetail string `gorm:"not null" json:"goodsDetail"` //商品详情 图片URL
|
||
GoodsIcon string `json:"goodsIcon"` //iconUrl
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
Status int `json:"status"` //信息状态
|
||
GoodsSubType int `gorm:"not null" json:"goodsSubType"` //商品子类型
|
||
}
|
||
|
||
// PetGoods 宠物商品
|
||
type PetGoods struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Assortment int `gorm:"not null" json:"assortment"` //品种Id 优先用品种查询 如不存在 则用类型及大小查询
|
||
PetType int `gorm:"not null" json:"petType"` //类型 1猫 2狗
|
||
Size int `gorm:"not null" json:"size"` //大小 1大 2中 3小
|
||
Weight int `gorm:"not null" json:"weight"` //体重
|
||
Hair int `gorm:"not null" json:"hair"` //毛发 0未知 1长毛 2短毛
|
||
GoodsId int64 `gorm:"not null" json:"goodsId"` //商品ID
|
||
Sort int `gorm:"not null" json:"sort"` //排序
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
Status int `json:"status"` //信息状态
|
||
}
|
||
|
||
// SystemConfig 系统配置
|
||
type SystemConfig struct {
|
||
Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Name string `json:"name"` //名称
|
||
Content string `json:"content"` //内容
|
||
ConfigType string `json:"configType"` //类型 0banner 1关于我们 2客服电话 3分享信息
|
||
ContentType int `json:"contentType"` //1文本 2链接
|
||
Sort int `json:"sort"` //排序位
|
||
JumpType int `gorm:"default:0" json:"JumpType"` //跳转类型 0无法跳转 1跳转外部 2跳转内部
|
||
JumpUrl string `json:"jumpUrl"` //跳转url
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
}
|
||
|
||
// OrderMain 主订单
|
||
type OrderMain struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
OrderId string `gorm:"index;unique;not null" json:"orderId"` //主订单号
|
||
Uid int64 `gorm:"index;not null" json:"uid"` //用户id
|
||
OrderStatus int `json:"status"` //主订单状态 1待服务 2服务中 3已完成 4已取消
|
||
ServiceTime string `json:"serviceTime"` //服务时间
|
||
ProjectionServiceTime int `json:"projectionServiceTime"` //服务预估时长
|
||
ServiceAddrId int64 `json:"serviceAddrId"` //服务地址信息
|
||
ServiceRemark string `json:"serviceRemark"` //服务备注
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createTime"` //创建时间
|
||
PayStatus int `gorm:"default:0" json:"payStatus"` //支付状态 0未支付 1已支付
|
||
DispatchStatus int `gorm:"default:0" json:"dispatchStatus"` //派单状态 0未派单 1已派单
|
||
PayTotalAmount int `json:"payTotalAmount"` //支付总金额
|
||
TotalAmount int `json:"totalAmount"` //总金额
|
||
PayDiscount int `gorm:"default:0" json:"payDiscount"` //支付折扣
|
||
PayType int `json:"payType"` //支付方式 1线下 2线上 3会员余额
|
||
Status int `json:"status1"` //信息状态
|
||
PayOrderId string `json:"payOrderId"` //支付订单号
|
||
MarkStatus int `gorm:"default:0" json:"markStatus"` //评价状态
|
||
}
|
||
|
||
// OrderSub 子订单
|
||
type OrderSub struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
OrderId string `gorm:"index" json:"orderId"` //子订单ID
|
||
MainOrderId string `gorm:"index" json:"mainOrderId"` //主订单ID
|
||
OrderStatus int `gorm:"not null" json:"status"` //子订单状态 1待服务 2服务中 3已完成 4已取消
|
||
PetId int64 `gorm:"index" json:"petId"` //宠物ID
|
||
PayType int `gorm:"not null" json:"payType"` //支付方式 1线下 2线上 3会员余额
|
||
Discount int `json:"discount"` //折扣
|
||
TotalAmount int `gorm:"not null" json:"totalAmount"` //总金额 - 原价
|
||
ProjectionServiceTime int `json:"projectionServiceTime"` //服务预估时长
|
||
PayStatus int `gorm:"default:0" json:"payStatus"` //支付状态 0未支付 1已支付
|
||
PayAmount int `json:"payAmount"` //实际支付金额 - 折扣金额
|
||
GoodsDiscountAmount int `json:"-"` //商品折扣金额
|
||
GoodsOriginAmount int `json:"-"` //商品原价 除去折扣价的金额
|
||
PayTime time.Time `gorm:"type:timestamp;" json:"payTime"` //支付时间
|
||
PayRemark string `json:"payRemark"` //支付备注
|
||
PetInfo string `json:"petInfo"` //宠物快照信息
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createTime"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
Status int `json:"status1"`
|
||
Cid int `gorm:"not null" json:"cid"` //优惠券ID
|
||
Ucid int `gorm:"not null" json:"ucid"` //优惠券ID - user
|
||
}
|
||
|
||
// OrderDetail 订单明细
|
||
type OrderDetail struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Cid int `json:"cid"` //子订单ID
|
||
Discount int `json:"discount"` //折扣
|
||
SubOrderId string `gorm:"index;not null" json:"subOrderId"` //子订单ID
|
||
GoodsId int64 `gorm:"index;not null" json:"goodsId"` //商品ID
|
||
Amount int `gorm:"not null" json:"amount"` //价格
|
||
DiscountAmount int `json:"-"` //折扣价格
|
||
}
|
||
|
||
// OrderServiceRecord 订单服务记录
|
||
type OrderServiceRecord struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
OrderId string `gorm:"index:not null" json:"orderId"` //订单ID
|
||
FilePath string `json:"filePath"` //照片路径
|
||
Type int `gorm:"not null" json:"type"` //服务类型
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createTime"` //创建时间
|
||
}
|
||
|
||
type UserAmountRecord struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
UserId int64 `gorm:"index:not null" json:"userId"` //用户ID
|
||
Type int `gorm:"not null" json:"type"` //操作类型 1加 2扣
|
||
OriginAmount int `gorm:"not null" json:"originAmount"` //原始余额
|
||
ProAmount int `gorm:"not null" json:"proAmount"` //操作余额
|
||
CurrAmount int `gorm:"not null" json:"currAmount"` //剩余余额
|
||
ProScene string `gorm:"not null" json:"proScene"` //操作场景
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createTime"` //创建时间
|
||
CreateDate time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createDate"` //创建时间
|
||
Status int `json:"status"` //信息状态
|
||
OrderId string `json:"orderId"` //订单ID
|
||
}
|
||
|
||
// ServiceCar 服务车辆
|
||
type ServiceCar struct {
|
||
Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
CarNo string `gorm:"index;not null" json:"carNo"` //车牌号
|
||
CarModel string `json:"carModel"` //车辆型号
|
||
ServiceAddrId int64 `gorm:"not null" json:"serviceAddrId"` //服务地址ID
|
||
ServiceStatus int `gorm:"not null" json:"serviceStatus"` //当前服务状态 0空闲中 1排单中 2服务中
|
||
NowServiceAddr string `json:"nowServiceAddr"` //当前服务地址 开始服务记录位置
|
||
NowLongitude string `json:"nowLongitude"` //当前服务位置经度
|
||
NowLatitude string `json:"nowLatitude"` //当前服务位置维度
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
ServiceAddr ServiceAddr `gorm:"-" json:"serviceAddr"` //当前服务区域
|
||
CarStatus int `gorm:"not null"` //车辆状态 1在线 2下线
|
||
}
|
||
|
||
// CarOrder 车辆订单
|
||
type CarOrder struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
CarId int `gorm:"index;not null" json:"carId"` //车辆ID
|
||
OrderId string `gorm:"index;not null" json:"orderId"` //订单ID
|
||
Remark string `json:"remark"` //备注
|
||
PredictionServiceTime int `json:"predictionServiceTime"` //预计服务时间
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
}
|
||
|
||
// ServiceCarUser 随车人员
|
||
type ServiceCarUser struct {
|
||
Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
CarId int `gorm:"index;not null" json:"carId"` //车ID
|
||
Uid int64 `gorm:"index;unique;not null" json:"uid"` //用户ID
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
}
|
||
|
||
// ServiceUserMark 服务人员评分
|
||
type ServiceUserMark struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
ServiceStar int `gorm:"default:5" json:"serviceStar"` //服务星级
|
||
ServiceLabels string `json:"serviceLabels"` //服务标签
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
}
|
||
|
||
// ServiceUserMarkRecord 服务人员评分记录
|
||
type ServiceUserMarkRecord struct {
|
||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Uid int64 `gorm:"index;not null" json:"uid"` //评价用户
|
||
OrderId string `gorm:"not null" json:"orderId"` //订单ID
|
||
ServiceStar int `gorm:"default:5" json:"serviceStar"` //服务星级
|
||
ServiceLabels string `json:"serviceLabels"` //服务标签
|
||
MarkContext string `json:"markContext"` //评价内容
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
Status int `json:"status"` //信息状态
|
||
}
|
||
|
||
// ReserveTimeFilter 服务过滤时间
|
||
type ReserveTimeFilter struct {
|
||
Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Type int `gorm:"not null" json:"type"` //类型 1日期 2小时
|
||
Content string `gorm:"not null" json:"content"` //类型 具体内容 比如:2024-04-08 12
|
||
}
|
||
|
||
// AddrServiceTime 服务地址时间排期
|
||
type AddrServiceTime struct {
|
||
Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
ServiceAddrId int64 `gorm:"not null" json:"ServiceAddrId"` //服务地址ID
|
||
Times string `gorm:"not null" json:"times"` //时间列表
|
||
}
|
||
|
||
// Coupons 优惠券
|
||
type Coupons struct {
|
||
Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Name string `gorm:"not null" json:"name"`
|
||
GoodsSubType int `gorm:"not null" json:"goodsSubType"` //商品子类型 1:洗护 2:美容 3:SPA 4:驱虫 5:洁牙
|
||
Discount int `gorm:"not null" json:"discount"` //折扣
|
||
Source string `gorm:"not null" json:"source"` //来源
|
||
PeriodType int `gorm:"not null" json:"periodType"` //使用类型 0、无 1、星期 2、截至时间 3、指定日期可用
|
||
Period string `json:"-"` //使用信息 具体时间 星期类型:1,2,3截止日期:2024-09-01 23:59:59指定日期:2024-08-10
|
||
PeriodInfo []string `gorm:"-" json:"periodInfo"`
|
||
ExpireTime int64 `json:"expireTime"` //优惠券过期时间
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createTime"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
Status int `gorm:"default:1" json:"-"` //数据状态
|
||
SendStatus int `gorm:"not null" json:"-"` //下发类型 1领取 2新用户注册赠送 3邀请新用户赠送
|
||
ReceiverStatus int `gorm:"-" json:"receiverStatus"` //领取状态 0未领取 1已领取
|
||
DrawDay int `gorm:"not null" json:"drawDay"` //优惠券领取后过期天数
|
||
LastExpireTime string `gorm:"-" json:"lastExpireTime"` //优惠券最后过期时间
|
||
}
|
||
|
||
// UserCoupons 用户优惠券
|
||
type UserCoupons struct {
|
||
Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Uid int64 `gorm:"not null" json:"uid"` //用户id
|
||
Cid int `gorm:"not null" json:"cid"` //优惠券ID
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createTime"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
Status int `gorm:"default:1" json:"-"`
|
||
CouponsStatus int `gorm:"default:1" json:"status"` //状态 1未使用 2已使用 3已过期
|
||
LastExpireTime time.Time `gorm:"not null" json:"lastExpireTime"` //优惠券最后过期时间
|
||
}
|
||
|
||
// RechargeInfo 充值挡位信息
|
||
type RechargeInfo struct {
|
||
Id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||
Name string `gorm:"not null" json:"name"` //挡位名称
|
||
Desc string `json:"desc"` //挡位描述
|
||
Price string `gorm:"not null" json:"price"` //价格
|
||
RechargePrice string `gorm:"not null;default:0" json:"rechargePrice"` //实际充值
|
||
Give string `gorm:"default:无" json:"give"` //赠送
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
Status int `gorm:"default:1" json:"-" json:"-"` //状态
|
||
Type int `gorm:"default:1" json:"type" json:"type"` //类型 1充值挡位 2押金
|
||
}
|
||
|
||
// PayOrder 支付订单
|
||
type PayOrder struct {
|
||
Id int `gorm:"primaryKey;autoIncrement"` //id
|
||
Uid int64 `gorm:"not null;default:0" json:"uid"` //uid
|
||
OrderId string `gorm:"not null"` //订单ID
|
||
OrderName string `gorm:"not null"` //订单名称
|
||
OrderPrice string `gorm:"not null"` //订单金额
|
||
OrderStatus int `gorm:"not null;default:0"` //订单状态 0:未支付 1:已支付 2:已退款
|
||
PayId string //三方交易号
|
||
RechargeId int `gorm:"not null;default:0"` //充值ID
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createTime"` //创建时间
|
||
UpdateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP" json:"-"` //更新时间
|
||
Status int `gorm:"default:1" json:"-"` //状态
|
||
}
|
||
|
||
// ServiceCarLocation 服务车辆定位
|
||
type ServiceCarLocation struct {
|
||
Id int `gorm:"primaryKey;autoIncrement"` //id
|
||
Uid int64 `gorm:"not null" json:"uid"` //用户ID
|
||
CarId int `gorm:"not null" json:"carId"` //车辆ID
|
||
Longitude string `json:"longitude"` //经度
|
||
Latitude string `json:"latitude"` //纬度
|
||
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createTime"` //创建时间
|
||
Status int `gorm:"default:1" json:"-"` //状态
|
||
}
|