Files
zmkgC/api/v1/system/notifications.go
2025-07-07 20:11:59 +08:00

219 lines
8.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ==========================================================================
// GFast自动生成api操作代码。
// 生成日期2024-04-11 16:56:36
// 生成路径: api/v1/system/notifications.go
// 生成人gfast
// desc:通知信息相关参数
// company:云南奇讯科技有限公司
// ==========================================================================
package system
import (
"github.com/gogf/gf/v2/frame/g"
commonApi "github.com/tiger1103/gfast/v3/api/v1/common"
comModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
"github.com/tiger1103/gfast/v3/internal/app/system/model"
)
// NotificationsSearchReq 分页请求参数
type NotificationsSearchReq struct {
g.Meta `path:"/list" tags:"通知信息" method:"get" summary:"通知信息列表"`
Id string `p:"id"` //
CreatedAt string `p:"createdAt" v:"createdAt@datetime#需为YYYY-MM-DD hh:mm:ss格式"` //
NotificationText string `p:"notificationText"` // 通知正文
Route string `p:"route"` // 跳转的路由
NotificationTime string `p:"notificationTime"` // 通知时间
Initiator string `p:"initiator" v:"initiator@integer#发起人需为整数"` // 发起人
ProjectId string `p:"projectId" v:"projectId@integer#项目ID需为整数"` // 项目ID
Type string `p:"type"` // 0 未读 | 1 已读
Title string `p:"title"` // 标题
IsApp string `p:"isApp"` // 0 PC | 1 App 公告通知 | 2 公告新闻
commonApi.PageReq
commonApi.Author
}
// NotificationsSearchRes 列表返回结果
type NotificationsSearchRes struct {
g.Meta `mime:"application/json"`
commonApi.ListRes
List []*model.NotificationsListRes `json:"list"`
}
// NotificationsAddReq 添加操作请求参数
type NotificationsAddReq struct {
g.Meta `path:"/add" tags:"通知信息" method:"post" summary:"通知信息添加"`
commonApi.Author
NotificationText string `p:"notificationText" `
Route string `p:"route" `
NotificationTime string `p:"notificationTime" `
Initiator int `p:"initiator" `
ProjectId int `p:"projectId" `
}
// NotificationsAddRes 添加操作返回结果
type NotificationsAddRes struct {
commonApi.EmptyRes
}
// NotificationsEditReq 修改操作请求参数
type NotificationsEditReq struct {
g.Meta `path:"/edit" tags:"通知信息" method:"put" summary:"通知信息修改"`
commonApi.Author
Id uint `p:"id" v:"required#主键ID不能为空"`
Title string `p:"title"`
NotificationText string `p:"text" `
Route string `p:"route" `
NotificationTime string `p:"notificationTime" `
Initiator int `p:"initiator" `
ProjectId int `p:"projectId" `
}
// NotificationsEditRes 修改操作返回结果
type NotificationsEditRes struct {
commonApi.EmptyRes
}
// NotificationsGetReq 获取一条数据请求
type NotificationsGetReq struct {
g.Meta `path:"/get" tags:"通知信息" method:"get" summary:"获取通知信息信息"`
commonApi.Author
Id uint `p:"id" v:"required#主键必须"` // 通过主键获取
}
// NotificationsGetRes 获取一条数据结果
type NotificationsGetRes struct {
g.Meta `mime:"application/json"`
*model.NotificationsInfoRes
}
// NotificationsDeleteReq 删除数据请求
type NotificationsDeleteReq struct {
g.Meta `path:"/delete" tags:"通知信息" method:"delete" summary:"删除通知信息"`
commonApi.Author
Ids []uint `p:"ids" v:"required#主键必须"` // 通过主键删除
}
// NotificationsDeleteRes 删除数据返回
type NotificationsDeleteRes struct {
commonApi.EmptyRes
}
// NotificationsPublishReq 发布一条通知
type NotificationsPublishReq struct {
g.Meta `path:"/publish" tags:"通知信息" method:"post" summary:"发布通知"`
commonApi.Author
// 通知标题
NotificationTitle string `p:"title" v:"required#通知标题不能为空|max-length:50#最大输入字数为50" dc:"通知标题"`
// 消息正文
NotificationText string `p:"text" v:"required#消息正文不能为空|max-length:300#最大输入字数为255" dc:"通知正文"`
// 跳转路由
Route string `p:"route" dc:"消息需要跳转的路由"`
// 通知人员
Users []int `p:"users" dc:"消息接收人员"`
// 通知岗位下的人员
Positions []int `p:"positions" dc:"通知该岗位下的人员"`
// 附件
Files []*comModel.UpFile `p:"files" dc:"消息附件"` // 需事先通过 pload/singleFile 上传
// 通知类型
IsApp int `p:"isApp" dc:" 0 PC | 1 App 公告通知 | 2 公告新闻"`
// 关联的 PC 端项目新闻ID
ProjectNewsId int64 `p:"projectNewsId" dc:"关联的 PC 端项目新闻ID"`
// 项目ID
ProjectId int `p:"projectId" v:"required#项目ID不能为空" dc:"项目ID"`
}
// NotificationsPublishRes 发布一条通知返回
type NotificationsPublishRes struct {
commonApi.EmptyRes
}
// NotificationsGetUserReq 获取当前用户的通知信息
type NotificationsGetUserReq struct {
g.Meta `path:"/getNotify" tags:"App" method:"get" summary:"获取当前用户的通知信息"`
commonApi.Author
commonApi.PageReq
ProjectId int `p:"projectId" v:"required#项目ID不能为空" dc:"项目ID"` // 项目ID
IsApp int `p:"isApp" d:"0" dc:"App 获取通知公告时为 1 | App 获取新闻时为 2"` // 是否是 App
}
// NotificationsGetUserRes 获取当前用户的通知信息返回
type NotificationsGetUserRes struct {
g.Meta `mime:"application/json"`
commonApi.ListRes
List []Notifications
}
type Notifications struct {
Id string `p:"id" orm:"id" dc:"通知ID"` // 消息ID
NotificationTitle string `p:"title" orm:"title" dc:"公告标题"` // 标题
NotificationText string `p:"notificationText" orm:"notification_text" dc:"公告正文"` // 通知正文
NotificationTime string `p:"notificationTime" orm:"notification_time" dc:"通知时间"` // 通知时间
NotificationStatus string `p:"notification_status" orm:"notification_status" dc:"0 未读 | 1 已读"` // 通知状态
Initiator string `p:"initiator" orm:"initiator" dc:"发起人"` // 发起人
}
// NotificationsReadReq 标记消息为已读
type NotificationsReadReq struct {
g.Meta `path:"/read" tags:"通知信息" method:"post" summary:"标记消息为已读"`
commonApi.Author
// 项目ID
ProjectId int `p:"projectId" v:"required#项目ID不能为空" dc:"项目ID"`
}
// NotificationsReadRes 标记消息为已读返回
type NotificationsReadRes struct {
commonApi.EmptyRes
}
// NotificationsDetailReq 查看通知公告详情
type NotificationsDetailReq struct {
g.Meta `path:"/detail" tags:"App" method:"get" summary:"查看一个通知公告详情"`
commonApi.Author
Id int `p:"id" v:"required#消息ID不能为空" dc:"通知公告的ID"` // 消息ID
}
// NotificationsDetailRes 查看通知公告详情返回
type NotificationsDetailRes struct {
g.Meta `mime:"application/json"`
List NotificationsDetail
}
// 查看通知公告的详细数据
type NotificationsDetail struct {
NotificationTitle string `json:"title" dc:"标题"` // 标题
NotificationText string `json:"text" dc:"通知正文"` // 通知正文
NotificationTime string `json:"time" dc:"发布时间"` // 发布时间
ReadNum int `json:"readNum" dc:"总阅读数"` // 总阅读数
ReadPeople int `json:"readPeople" dc:"已读人数"` // 已读人数
UnreadPeople int `json:"unreadPeople" dc:"未读人数"` // 未读人数
Files []model.FileInfo `json:"files" dc:"附件"` // 附件
}
// NotificationsGetPeopleReq 获取通知公告的未读人员或已读人员
type NotificationsGetPeopleReq struct {
g.Meta `path:"/getPeople" tags:"App" method:"get" summary:"获取通知公告的未读人员或已读人员"`
commonApi.Author
commonApi.PageReq
Id int `p:"id" v:"required#消息ID不能为空" dc:"通知公告的ID"` // 消息ID
Status int `p:"status" v:"required#状态不能为空" dc:"0 未读 | 1 已读"` // 0 未读 | 1 已读
}
// NotificationsGetPeopleRes 获取通知公告的未读人员或已读人员返回
type NotificationsGetPeopleRes struct {
g.Meta `mime:"application/json"`
commonApi.ListRes
List []AppUserInfo
}
// 用户详情
type AppUserInfo struct {
Id uint `json:"id" dc:"用户ID"` // 用户ID
// 头像
Avatars string `json:"avatar" dc:"头像"`
// 用户名
Username string `json:"username" dc:"用户名"`
// 已读时间
ReadTime string `json:"readTime" dc:"已读时间"`
}