Files
jx-callback/business/model/food_recipe.go
2019-09-20 16:57:26 +08:00

106 lines
2.8 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
const (
RecipeActionCollect = 1 // 收藏
RecipeActionUpvote = 2 // 顶
RecipeActionDownvote = 4 // 踩
)
type FoodRecipe struct {
ModelIDCULD
Name string `orm:"size(48)" json:"name"`
AuthorID string `orm:"size(48);column(author_id);index" json:"authorID"`
Description string `orm:"size(4096)" json:"description"`
Img string `orm:"size(512)" json:"img"`
TimeInMinute int `json:"timeInMinute"` // 大约时间(分钟)
UpvoteCount int `json:"upvoteCount"`
DownvoteCount int `json:"downvoteCount"`
Score int `json:"score"` // 分数
TagCategory string `orm:"size(48)" json:"tagCategory"` // 菜系(川,粤,鲁等等)
TagCookType string `orm:"size(48)" json:"tagCookType"` // 制作工艺(煮,炒,蒸等等)
TagTaste string `orm:"size(48)" json:"tagTaste"` // 口味(辣,麻,甜)
}
func (*FoodRecipe) TableUnique() [][]string {
return [][]string{
[]string{"Name", "AuthorID", "DeletedAt"},
}
}
// 菜谱步骤
type FoodRecipeStep struct {
ModelIDCULD
RecipeID int `orm:"column(recipe_id)" json:"recipeID"`
Index int8 `json:"index"` // 步骤序号从1开始
Name string `orm:"size(48)" json:"name"`
Description string `orm:"size(4096)" json:"description"`
Img string `orm:"size(512)" json:"img"`
}
func (*FoodRecipeStep) TableUnique() [][]string {
return [][]string{
[]string{"RecipeID", "Index", "DeletedAt"},
}
}
// 菜谱配料
type FoodRecipeItem struct {
ModelIDCULD
RecipeID int `orm:"column(recipe_id)" json:"recipeID"`
Index int8 `json:"index"` // 配料序号从1开始
Name string `orm:"size(48)" json:"name"`
// SpecQuality float32 `json:"specQuality"`
// SpecUnit string `orm:"size(8)" json:"specUnit"` // 质量或容量
}
func (*FoodRecipeItem) TableUnique() [][]string {
return [][]string{
[]string{"RecipeID", "Index", "DeletedAt"},
}
}
// 菜谱配料选择
type FoodRecipeItemChoice struct {
ModelIDCULD
RecipeID int `orm:"column(recipe_id)" json:"recipeID"`
Index int8 `json:"index"` // 配料序号从1开始
SkuID int `orm:"column(sku_id)" json:"skuID"`
ChoiceIndex int8 `json:"choiceIndex"` // 选择序号从1开始
}
func (*FoodRecipeItemChoice) TableUnique() [][]string {
return [][]string{
[]string{"RecipeID", "Index", "SkuID", "DeletedAt"},
}
}
type FoodRecipeUser struct {
ModelIDCULD
RecipeID int `orm:"column(recipe_id)" json:"recipeID"`
UserID string `orm:"size(48);column(user_id)" json:"userID" compact:"userID"`
ActionType int8 `json:"actionType"`
}
func (*FoodRecipeUser) TableUnique() [][]string {
return [][]string{
[]string{"RecipeID", "UserID", "DeletedAt"},
}
}
func (*FoodRecipeUser) TableIndex() [][]string {
return [][]string{
[]string{"UserID", "RecipeID", "DeletedAt"},
}
}