message.api 3.5 KB
syntax = "v1"

info(
    title: "消息中心"
    desc: "消息中心"
    author: "zz"
    email: "email"
    version: "v1"
)

@server(
    prefix: v1
    group: message
    jwt: MiniAuth
)
service Core {
    @doc "系统消息"
    @handler miniSystem
    post /mini/message/system (MessageSystemRequest) returns (MessageSystemResponse)

    @doc "业务消息"
    @handler miniBusiness
    post /mini/message/business (MessageBusinessRequest) returns (MessageBusinessResponse)
}

type (
    MessageSystemRequest  {
        Page int `json:"page"`
        Size int `json:"size"`
    }
    MessageSystemResponse {
        List []MessageSystemItem `json:"list"`
        Total int64 `json:"total"`
    }
    MessageSystemItem  {
        Id             int64   `json:"id"`              // ID
        Type           int     `json:"type"`            // 系统分类
        Title          string  `json:"title"`           // 标题
        Content        string  `json:"content"`         // 内容
        CreatedAt      int64   `json:"createdAt"`       // 创建时间
    }

    MessageBusinessRequest  {
        Type int `json:"type"`
        Page int `json:"page"`
        Size int `json:"size"`
    }
    MessageBusinessResponse {
        List []MessageBusinessItem `json:"list"`
        Total int64 `json:"total"`
    }
    MessageBusinessItem  {
        Id                  int64                 `json:"id"`
        Type                int                   `json:"type"`                // 分类   (1回复 2点赞 3被采纳)
        OptType             int                   `json:"optType"`             // 操作类型(1针对文章、1针对评论、2针对圆桌)
        CompanyId           int64                 `json:"companyId"`           // 操作人公司ID
        UserId              int64                 `json:"userId"`              // 操作人用户ID
        RecipientId         int64                 `json:"recipientId"`         // 接收者ID
        ArticleId           int64                 `json:"articleId"`           // 文章ID
        CommentId           int64                 `json:"commentId"`           // 评论ID
        DiscussionId        int64                 `json:"discussionId"`        // 圆桌ID
        DiscussionOpinionId int64                 `json:"discussionOpinionId"` // 观点ID
        Content             string                `json:"content"`             // 消息内容
        CreatedAt           int64                 `json:"createdAt"`           // 创建时间
        User                *User                 `json:"user"`                // 操作人
        Article             *SimpleArticle        `json:"article"`             // 文章
        Comment             *Comment              `json:"comment"`             // 评论(不一定是自己,可能是被人@到)
    }

    User  {
        Id           int64   `json:"id"`
        CompanyId    int64   `json:"companyId,omitempty"`    // 公司ID
        CompanyName  string  `json:"companyName,omitempty"`  // 公司名称
        Name         string  `json:"name,omitempty"`         // 名称
        Avatar       string  `json:"avatar,omitempty"`       // 头像
        Position     string  `json:"position,omitempty"`     // 职位
    }


    SimpleArticle  {
        Id           int64   `json:"id"`
        Title        string  `json:"title"`                  // 文章标题
        CountLove    int     `json:"countLove"`              // 点赞数量
        CountComment int     `json:"countComment"`           // 评论数量
    }
)