重新初始化项目

This commit is contained in:
2023-04-27 15:56:12 +08:00
parent 10546eb629
commit d6e256ef9e
50 changed files with 1255 additions and 308 deletions

38
model/vo/user.go Normal file
View File

@@ -0,0 +1,38 @@
package vo
import (
"Lee-WineList/common/constant"
"Lee-WineList/common/types"
"Lee-WineList/model/entity"
"Lee-WineList/utils"
)
// UserVO 管理员信息
type UserVO struct {
Id int `json:"id"`
Nickname string `json:"nickname"`
Username string `json:"username"`
Phone string `json:"phone"`
Status constant.UserStatus `json:"status"`
Sex constant.UserSex `json:"sex"`
Avatar string `json:"avatar"`
CreatedAt types.DateTime `json:"createdAt"`
}
// ParseOrdinary 转换为VO
func (auv *UserVO) ParseOrdinary(u entity.User) {
auv.Id = u.Id
auv.Phone = utils.Desensitization().Phone(u.Phone)
auv.Nickname = u.Nickname
auv.Status = u.Status
auv.Sex = u.Sex
auv.Avatar = u.Avatar
auv.CreatedAt = u.CreatedAt
}
// UserMiniVO 简要信息
type UserMiniVO struct {
Id string `json:"id"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
}

19
model/vo/wine.go Normal file
View File

@@ -0,0 +1,19 @@
package vo
import "Lee-WineList/common/types"
type Wine struct {
types.BaseDbModel
Name string `gorm:"column:name;type:varchar(255);comment:酒名;NOT NULL" json:"name"`
ChineseName string `gorm:"column:chinese_name;type:varchar(255);comment:中文酒名;NOT NULL" json:"chinese_name"`
Ingredients []Ingredients `json:"ingredients"`
Quote string `gorm:"column:quote;type:varchar(255);comment:引用;NOT NULL" json:"quote"`
CategoryId uint `gorm:"column:category_id;type:int(11) unsigned;comment:分类ID;NOT NULL" json:"category_id"`
Steps []string `gorm:"column:steps;type:varchar(255);comment:步骤;NOT NULL" json:"steps"`
Context string `gorm:"column:context;type:varchar(255);comment:酒文;NOT NULL" json:"context"`
}
type Ingredients struct {
Name string `gorm:"column:name;type:varchar(255);comment:酒名;NOT NULL" json:"name"`
Dose string `gorm:"column:dose;type:varchar(255);comment:剂量;NOT NULL" json:"dose"`
}