38 lines
914 B
Go
38 lines
914 B
Go
![]() |
package handler
|
||
|
|
||
|
import (
|
||
|
"ecs/proto"
|
||
|
"github.com/oylshe1314/framework/http"
|
||
|
"github.com/oylshe1314/framework/util"
|
||
|
)
|
||
|
|
||
|
func (this *RequestHandler) Notice(msg *http.Message) {
|
||
|
if this.Logger().IsDebugEnabled() {
|
||
|
this.Logger().Debugf("[%s] <- Notice, req: %s", msg.R.RemoteAddr, util.ToJsonString(nil))
|
||
|
}
|
||
|
|
||
|
var ack = &proto.MsgGateNoticeAck{}
|
||
|
notices, err := this.gateManager.GetNotice()
|
||
|
if err != nil {
|
||
|
this.Logger().Error("GetNotice error, ", err)
|
||
|
_ = msg.Reply(proto.ErrInternalError)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
for _, notice := range notices {
|
||
|
ack.NoticeList = append(ack.NoticeList, &proto.Notice{
|
||
|
Type: notice.Type,
|
||
|
Title: notice.Title,
|
||
|
Content: notice.Content,
|
||
|
BeginTime: notice.BeginTime,
|
||
|
EndTime: notice.EndTime,
|
||
|
})
|
||
|
}
|
||
|
|
||
|
if this.Logger().IsDebugEnabled() {
|
||
|
this.Logger().Debugf("[%s] -> Notice, ack: %s", msg.R.RemoteAddr, util.ToJsonString(ack))
|
||
|
}
|
||
|
|
||
|
_ = msg.Reply(ack)
|
||
|
}
|