Skip to content

Commit

Permalink
feat: add application creating filter (cannot apply my quotation)
Browse files Browse the repository at this point in the history
  • Loading branch information
kastnerorz committed Apr 5, 2020
1 parent 1e39fd9 commit 0f048e1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/routers/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func CreateApplication(c *gin.Context) {
log.Println(err)
return
}
if quotation.Author.ID.Hex() == user.ID.Hex() {
c.JSON(http.StatusBadRequest, gin.H{"code": -6, "msg": "不用申请自己的报价哦!"})
return
}

mongoCtx, collection = pkg.GetMongoContext("applications")
user.Password = ""
Expand All @@ -72,7 +76,7 @@ func CreateApplication(c *gin.Context) {
"switchFriendNumber": "",
})
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"code": -6, "msg": "(-3)内部错误"})
c.JSON(http.StatusInternalServerError, gin.H{"code": -7, "msg": "(-3)内部错误"})
log.Println(err)
return
}
Expand Down

0 comments on commit 0f048e1

Please sign in to comment.