正在显示
4 个修改的文件
包含
49 行增加
和
14 行删除
| @@ -95,3 +95,24 @@ func (this *MessageController) MsgInteractive() { | @@ -95,3 +95,24 @@ func (this *MessageController) MsgInteractive() { | ||
| 95 | header := controllers.GetRequestHeader(this.Ctx) | 95 | header := controllers.GetRequestHeader(this.Ctx) |
| 96 | msg = protocol.NewReturnResponse(message.MsgInteractive(header, request)) | 96 | msg = protocol.NewReturnResponse(message.MsgInteractive(header, request)) |
| 97 | } | 97 | } |
| 98 | + | ||
| 99 | +//Announcements | ||
| 100 | +//@router /announcements [post] | ||
| 101 | +func (this *MessageController) Announcements() { | ||
| 102 | + var msg *protocol.ResponseMessage | ||
| 103 | + defer func() { | ||
| 104 | + this.Resp(msg) | ||
| 105 | + }() | ||
| 106 | + var request *protocol.AnnouncementsRequest | ||
| 107 | + if err := json.Unmarshal(this.ByteBody, &request); err != nil { | ||
| 108 | + log.Error(err) | ||
| 109 | + msg = protocol.BadRequestParam(1) | ||
| 110 | + return | ||
| 111 | + } | ||
| 112 | + if b, m := this.Valid(request); !b { | ||
| 113 | + msg = m | ||
| 114 | + return | ||
| 115 | + } | ||
| 116 | + header := controllers.GetRequestHeader(this.Ctx) | ||
| 117 | + msg = protocol.NewReturnResponse(message.Announcements(header, request)) | ||
| 118 | +} |
| @@ -21,6 +21,10 @@ type UserMsg struct { | @@ -21,6 +21,10 @@ type UserMsg struct { | ||
| 21 | CreateAt time.Time `orm:"column(create_at);type(timestamp);auto_now" description:"创建时间"` | 21 | CreateAt time.Time `orm:"column(create_at);type(timestamp);auto_now" description:"创建时间"` |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | +const ( | ||
| 25 | + SqlUserMsgUnRead = "select * from user_msg where company_id=? and receive_user_id=? and msg_type=? and is_read=0" | ||
| 26 | +) | ||
| 27 | + | ||
| 24 | func (t *UserMsg) TableName() string { | 28 | func (t *UserMsg) TableName() string { |
| 25 | return "user_msg" | 29 | return "user_msg" |
| 26 | } | 30 | } |
| @@ -125,23 +125,23 @@ type BulletinItem struct { | @@ -125,23 +125,23 @@ type BulletinItem struct { | ||
| 125 | CreateAt string `json:"time"` | 125 | CreateAt string `json:"time"` |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | -/*GetBulletin */ | ||
| 129 | -type GetBulletinRequest struct { | 128 | +type Receiver struct { |
| 129 | + Id int64 `json:"id"` | ||
| 130 | + NickName string `json:"name"` | ||
| 130 | } | 131 | } |
| 131 | -type GetBulletinResponse struct { | 132 | + |
| 133 | +/*请求公告列表 Announcements */ | ||
| 134 | +type AnnouncementsRequest struct { | ||
| 135 | +} | ||
| 136 | +type AnnouncementsResponse struct { | ||
| 137 | + Lists []Announcement `json:"lists"` | ||
| 138 | +} | ||
| 139 | + | ||
| 140 | +type Announcement struct { | ||
| 132 | Id int `json:"id"` | 141 | Id int `json:"id"` |
| 133 | Type int `json:"type" valid:"Required"` | 142 | Type int `json:"type" valid:"Required"` |
| 134 | Title string `json:"title" valid:"Required"` | 143 | Title string `json:"title" valid:"Required"` |
| 135 | - Content string `json:"content" valid:"Required"` | ||
| 136 | - AllowClose int `json:"allow_close"` | ||
| 137 | - //AllowCondition int `json:"allow_condition"` | ||
| 138 | - QuestionSwitch int `json:"question_switch"` | ||
| 139 | - Receiver []Receiver `json:"receiver" valid:"Required"` | ||
| 140 | - Question Question `json:"question"` | ||
| 141 | Cover Cover `json:"cover" valid:"Required"` | 144 | Cover Cover `json:"cover" valid:"Required"` |
| 142 | -} | ||
| 143 | - | ||
| 144 | -type Receiver struct { | ||
| 145 | - Id int64 `json:"id"` | ||
| 146 | - NickName string `json:"name"` | 145 | + Link string `json:"link"` |
| 146 | + Control int `json:"Control"` | ||
| 147 | } | 147 | } |
| @@ -67,3 +67,13 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac | @@ -67,3 +67,13 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac | ||
| 67 | } | 67 | } |
| 68 | return | 68 | return |
| 69 | } | 69 | } |
| 70 | + | ||
| 71 | +//未读公告列表 | ||
| 72 | +func Announcements(header *protocol.RequestHeader, request *protocol.AnnouncementsRequest) (rsp *protocol.AnnouncementsResponse, err error) { | ||
| 73 | + var ( | ||
| 74 | + //userMsg []*models.UserMsg | ||
| 75 | + ) | ||
| 76 | + //if err = utils.ExecuteQueryAll(&userMsg,models.SqlUserMsgUnRead,header.CompanyId,header.) | ||
| 77 | + rsp = &protocol.AnnouncementsResponse{} | ||
| 78 | + return | ||
| 79 | +} |
-
请 注册 或 登录 后发表评论