- 修复菜谱BUG

This commit is contained in:
gazebo
2019-09-17 17:46:56 +08:00
parent 8dbb872f4c
commit c4c5afb6f9
2 changed files with 8 additions and 7 deletions

View File

@@ -266,7 +266,7 @@ func VoteFoodRecipe(ctx *jxcontext.Context, recipeID, voteType int) (err error)
RecipeID: recipeID,
UserID: userID,
}
if err = dao.GetEntity(db, recipeUser); err != nil {
if err = dao.GetEntity(db, recipeUser, "RecipeID", "UserID"); err != nil {
if !dao.IsNoRowsError(err) {
return err
}
@@ -290,7 +290,7 @@ func VoteFoodRecipe(ctx *jxcontext.Context, recipeID, voteType int) (err error)
return fmt.Errorf("已经做过此操作了")
}
recipeUser.ActionType &= actionMask | ^(model.RecipeActionUpvote | model.RecipeActionDownvote)
recipeUser.ActionType = (recipeUser.ActionType & ^(model.RecipeActionUpvote | model.RecipeActionDownvote)) | actionMask
if recipeUser.ID == 0 {
dao.WrapAddIDCULDEntity(recipeUser, ctx.GetUserName())
err = dao.CreateEntity(db, recipeUser)