bson을 json으로 통일(일단은)

This commit is contained in:
2023-09-08 15:29:01 +09:00
parent 1d14fb659d
commit 3dde7ccaf5
5 changed files with 29 additions and 79 deletions

View File

@ -315,8 +315,8 @@ func (gc *groupChat) FetchChattingChannels(w http.ResponseWriter, r *http.Reques
var data struct {
Prefix string `bson:"prefix"`
}
if err := gocommon.ReadBsonDocumentFromBody(r.Body, &data); err != nil {
logger.Println("FetchChattingChannels failed. ReadBsonDocumentFromBody returns err :", err)
if err := gocommon.ReadJsonDocumentFromBody(r.Body, &data); err != nil {
logger.Println("FetchChattingChannels failed. ReadJsonDocumentFromBody returns err :", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
@ -371,9 +371,9 @@ func (gc *groupChat) QueryPlayerChattingChannel(w http.ResponseWriter, r *http.R
Accid string `bson:"accid"`
Typename string `bson:"typename"`
}
err := gocommon.ReadBsonDocumentFromBody(r.Body, &data)
err := gocommon.ReadJsonDocumentFromBody(r.Body, &data)
if err != nil {
logger.Println("QueryPlayerChattingChannel failed. ReadBsonDocumentFromBody returns err :", err)
logger.Println("QueryPlayerChattingChannel failed. ReadJsonDocumentFromBody returns err :", err)
w.WriteHeader(http.StatusInternalServerError)
return
}
@ -392,8 +392,8 @@ func (gc *groupChat) QueryPlayerChattingChannel(w http.ResponseWriter, r *http.R
func (gc *groupChat) SendMessageOnChannel(w http.ResponseWriter, r *http.Request) {
var msg wshandler.UpstreamMessage
if err := gocommon.ReadBsonDocumentFromBody(r.Body, &msg); err != nil {
logger.Println("SendMessageOnChannel failed. ReadBsonDocumentFromBody return err :", err)
if err := gocommon.ReadJsonDocumentFromBody(r.Body, &msg); err != nil {
logger.Println("SendMessageOnChannel failed. ReadJsonDocumentFromBody return err :", err)
w.WriteHeader(http.StatusBadRequest)
return
}