From 0f048e15accc3893cacc4ed89a97fa752778016d Mon Sep 17 00:00:00 2001 From: Zed Date: Sun, 5 Apr 2020 22:01:57 +0800 Subject: [PATCH] feat: add application creating filter (cannot apply my quotation) --- backend/routers/application.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/routers/application.go b/backend/routers/application.go index a154ef7..0dbee70 100644 --- a/backend/routers/application.go +++ b/backend/routers/application.go @@ -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 = "" @@ -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 }