142 lines
10 KiB
Go
142 lines
10 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护理人员
|
|
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP;not null" json:"createTime"` //创建时间
|
|
}
|
|
|
|
// 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"` //宠物描述
|
|
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未知
|
|
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"` //创建时间
|
|
}
|
|
|
|
// 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小
|
|
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"-"` //创建时间
|
|
}
|
|
|
|
// 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 float64 `gorm:"not null" json:"distantGapMeters"` //服务最远距离 单位/米
|
|
}
|
|
|
|
// 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 `gorm:"not null" json:"areaId"` //服务区域ID
|
|
Addr string `gorm:"not null" json:"addr"` //详细地址
|
|
Longitude string `json:"longitude"` //经度
|
|
Latitude string `json:"latitude"` //纬度
|
|
Area string `gorm:"-" json:"area"` //服务区域
|
|
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP;not null" json:"-"` //创建时间
|
|
}
|
|
|
|
// 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 int32 `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:"-"` //创建时间
|
|
}
|
|
|
|
// 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小
|
|
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:"-"` //创建时间
|
|
}
|
|
|
|
// SystemConfig 系统配置
|
|
type SystemConfig struct {
|
|
id int `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
|
Name string `json:"name"` //名称
|
|
Desc string `json:"desc"` //描述
|
|
ConfigType string `json:"configType"` //类型 1关于我们 2在线客服 3拨打电话
|
|
DescType int `json:"descType"` //1文本 2链接
|
|
}
|
|
|
|
// 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
|
|
Status int `json:"status"` //主订单状态 1待服务 2服务中 3已完成
|
|
ServiceTime string `json:"serviceTime"` //服务时间
|
|
ServiceAddrId int64 `json:"serviceAddrId"` //服务地址信息
|
|
ServiceRemark string `json:"serviceRemark"` //服务备注
|
|
CreateTime time.Time `gorm:"type:timestamp;default:CURRENT_TIMESTAMP" json:"createTime"` //创建时间
|
|
}
|
|
|
|
// 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
|
|
Status 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线上
|
|
Discount int `json:"discount"` //折扣
|
|
TotalAmount int32 `gorm:"not null" json:"totalAmount"` //总金额
|
|
PayAmount int32 `json:"payAmount"` //实际支付金额
|
|
PayTime time.Time `gorm:"type:timestamp;" json:"payTime"` //支付时间
|
|
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:"-"` //更新时间
|
|
}
|
|
|
|
// OrderDetail 订单明细
|
|
type OrderDetail struct {
|
|
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
|
SubOrderId string `gorm:"index;not null" json:"subOrderId"` //子订单ID
|
|
GoodsId int64 `gorm:"index;not null" json:"goodsId"` //商品ID
|
|
Amount int32 `gorm:"not null" json:"amount"` //价格
|
|
}
|