go_dreamfactory/modules/notify/api_getlist.go
2022-07-13 16:50:35 +08:00

39 lines
987 B
Go

package notify
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.NotifyGetListReq) (code pb.ErrorCode) {
return
}
///获取系统公告
func (this *apiComp) GetList(session comm.IUserSession, req *pb.NotifyGetListReq) (code pb.ErrorCode, data proto.Message) {
var (
err error
userexpand *pb.DBUserExpand
notify []*pb.DBSystemNotify
)
defer func() {
session.SendMsg(string(this.module.GetType()), "getlist", &pb.NotifyGetListResp{LastReadTime: userexpand.Lastreadnotiftime, SysNotify: notify})
}()
if notify, err = this.module.modelNotify.GetFullNotify(); err != nil {
code = pb.ErrorCode_DBError
return
}
if session.GetUserId() != "" {
if userexpand, err = this.module.modelNotify.GetUserExpand(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError
}
} else {
userexpand = &pb.DBUserExpand{}
}
return
}