[이민우] 운영툴 개선

- 쿠폰 사용 시 accid 변수타입 잘못 받는 이슈 수정
This commit is contained in:
2024-02-20 11:23:27 +09:00
parent ce39e8d878
commit 424c8be420

View File

@ -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