From 424c8be42031b59d237876d58c3a2820d31fecd4 Mon Sep 17 00:00:00 2001 From: lmw00 Date: Tue, 20 Feb 2024 11:23:27 +0900 Subject: [PATCH] =?UTF-8?q?[=EC=9D=B4=EB=AF=BC=EC=9A=B0]=20=EC=9A=B4?= =?UTF-8?q?=EC=98=81=ED=88=B4=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 쿠폰 사용 시 accid 변수타입 잘못 받는 이슈 수정 --- core/api_coupon.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/api_coupon.go b/core/api_coupon.go index 18bda65..f475a02 100644 --- a/core/api_coupon.go +++ b/core/api_coupon.go @@ -261,8 +261,8 @@ func listAllCouponNames(mongoClient gocommon.MongoClient, w http.ResponseWriter, } func useCoupon(mongoClient gocommon.MongoClient, w http.ResponseWriter, r *http.Request) { - acc, ok := gocommon.ReadObjectIDFormValue(r.Form, "accid") - if !ok || acc.IsZero() { + acc, _ := gocommon.ReadStringFormValue(r.Form, "accid") + if len(acc) == 0 { w.WriteHeader(http.StatusBadRequest) return } @@ -285,7 +285,7 @@ func useCoupon(mongoClient gocommon.MongoClient, w http.ResponseWriter, r *http. // 무한 쿠폰일 수 있으므로 존재하는지 확인 if err := mongoClient.FindOneAs(CollectionCoupon, bson.M{ "_id": roundObj, - }, &coupon, options.FindOne().SetProjection(bson.M{"_id": 0, "effect": 1, "name": 1, "reason": 1, "total": 1, "expire": 1})); err != nil { + }, &coupon, options.FindOne().SetProjection(bson.M{"_id": 0, "effect": 1, "name": 1, "total": 1, "expire": 1})); err != nil { logger.Println(err) w.WriteHeader(http.StatusInternalServerError) return