- 修复菜谱BUG
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user