2023-07-25 09:10:50 +00:00
|
|
|
package handler
|
|
|
|
|
|
|
|
import (
|
2023-07-26 03:53:06 +00:00
|
|
|
"fusenapi/server/websocket/internal/logic"
|
2023-07-25 09:10:50 +00:00
|
|
|
"fusenapi/server/websocket/internal/svc"
|
|
|
|
"fusenapi/server/websocket/internal/types"
|
2023-07-26 03:53:06 +00:00
|
|
|
"fusenapi/utils/basic"
|
|
|
|
"net/http"
|
|
|
|
"reflect"
|
2023-07-25 09:10:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func RenderNotifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
|
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
var req types.RenderNotifyReq
|
2023-07-27 08:54:57 +00:00
|
|
|
_, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
|
2023-07-25 09:10:50 +00:00
|
|
|
if err != nil {
|
2023-07-25 09:41:38 +00:00
|
|
|
return
|
|
|
|
}
|
2023-07-26 03:53:06 +00:00
|
|
|
// 创建一个业务逻辑层实例
|
|
|
|
l := logic.NewRenderNotifyLogic(r.Context(), svcCtx)
|
|
|
|
|
|
|
|
rl := reflect.ValueOf(l)
|
|
|
|
basic.BeforeLogic(w, r, rl)
|
|
|
|
|
|
|
|
resp := l.RenderNotify(&req)
|
|
|
|
|
|
|
|
if !basic.AfterLogic(w, r, rl, resp) {
|
|
|
|
basic.NormalAfterLogic(w, r, resp)
|
2023-07-25 09:41:38 +00:00
|
|
|
}
|
2023-07-25 09:10:50 +00:00
|
|
|
}
|
|
|
|
}
|