- 修复菜谱BUG
This commit is contained in:
@@ -266,7 +266,7 @@ func VoteFoodRecipe(ctx *jxcontext.Context, recipeID, voteType int) (err error)
|
|||||||
RecipeID: recipeID,
|
RecipeID: recipeID,
|
||||||
UserID: userID,
|
UserID: userID,
|
||||||
}
|
}
|
||||||
if err = dao.GetEntity(db, recipeUser); err != nil {
|
if err = dao.GetEntity(db, recipeUser, "RecipeID", "UserID"); err != nil {
|
||||||
if !dao.IsNoRowsError(err) {
|
if !dao.IsNoRowsError(err) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -290,7 +290,7 @@ func VoteFoodRecipe(ctx *jxcontext.Context, recipeID, voteType int) (err error)
|
|||||||
return fmt.Errorf("已经做过此操作了")
|
return fmt.Errorf("已经做过此操作了")
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeUser.ActionType &= actionMask | ^(model.RecipeActionUpvote | model.RecipeActionDownvote)
|
recipeUser.ActionType = (recipeUser.ActionType & ^(model.RecipeActionUpvote | model.RecipeActionDownvote)) | actionMask
|
||||||
if recipeUser.ID == 0 {
|
if recipeUser.ID == 0 {
|
||||||
dao.WrapAddIDCULDEntity(recipeUser, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(recipeUser, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(db, recipeUser)
|
err = dao.CreateEntity(db, recipeUser)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ type FoodRecipeController struct {
|
|||||||
// @Param name formData string true "菜谱名"
|
// @Param name formData string true "菜谱名"
|
||||||
// @Param description formData string true "菜谱描述"
|
// @Param description formData string true "菜谱描述"
|
||||||
// @Param img formData string true "图片""
|
// @Param img formData string true "图片""
|
||||||
// @Param timeInMinute formData string true "大约需要时间(分钟)"
|
// @Param timeInMinute formData int true "大约需要时间(分钟)"
|
||||||
// @Param recipeItems formData string true "菜谱配料"
|
// @Param recipeItems formData string true "菜谱配料"
|
||||||
// @Param recipeSteps formData string true "菜谱步骤"
|
// @Param recipeSteps formData string true "菜谱步骤"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
@@ -32,9 +32,10 @@ func (c *FoodRecipeController) CreateFoodRecipe() {
|
|||||||
)
|
)
|
||||||
if err = jxutils.Strings2Objs(params.RecipeItems, &itemList, params.RecipeSteps, &stepList); err == nil {
|
if err = jxutils.Strings2Objs(params.RecipeItems, &itemList, params.RecipeSteps, &stepList); err == nil {
|
||||||
foodRecipe = &model.FoodRecipe{
|
foodRecipe = &model.FoodRecipe{
|
||||||
Name: params.Name,
|
Name: params.Name,
|
||||||
Description: params.Description,
|
Description: params.Description,
|
||||||
Img: params.Img,
|
Img: params.Img,
|
||||||
|
TimeInMinute: params.TimeInMinute,
|
||||||
}
|
}
|
||||||
err = userstore.CreateFoodRecipe(params.Ctx, foodRecipe, itemList, stepList)
|
err = userstore.CreateFoodRecipe(params.Ctx, foodRecipe, itemList, stepList)
|
||||||
}
|
}
|
||||||
@@ -49,7 +50,7 @@ func (c *FoodRecipeController) CreateFoodRecipe() {
|
|||||||
// @Param name formData string false "菜谱名"
|
// @Param name formData string false "菜谱名"
|
||||||
// @Param description formData string false "菜谱描述"
|
// @Param description formData string false "菜谱描述"
|
||||||
// @Param img formData string false "图片""
|
// @Param img formData string false "图片""
|
||||||
// @Param timeInMinute formData string false "大约需要时间(分钟)"
|
// @Param timeInMinute formData int false "大约需要时间(分钟)"
|
||||||
// @Param recipeItems formData string false "菜谱配料"
|
// @Param recipeItems formData string false "菜谱配料"
|
||||||
// @Param recipeSteps formData string false "菜谱步骤"
|
// @Param recipeSteps formData string false "菜谱步骤"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
|||||||
Reference in New Issue
Block a user