作者 yangfu

log/opp 打印日志

... ... @@ -95,3 +95,24 @@ func (this *MessageController) MsgInteractive() {
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(message.MsgInteractive(header, request))
}
//Announcements
//@router /announcements [post]
func (this *MessageController) Announcements() {
var msg *protocol.ResponseMessage
defer func() {
this.Resp(msg)
}()
var request *protocol.AnnouncementsRequest
if err := json.Unmarshal(this.ByteBody, &request); err != nil {
log.Error(err)
msg = protocol.BadRequestParam(1)
return
}
if b, m := this.Valid(request); !b {
msg = m
return
}
header := controllers.GetRequestHeader(this.Ctx)
msg = protocol.NewReturnResponse(message.Announcements(header, request))
}
... ...
... ... @@ -21,6 +21,10 @@ type UserMsg struct {
CreateAt time.Time `orm:"column(create_at);type(timestamp);auto_now" description:"创建时间"`
}
const (
SqlUserMsgUnRead = "select * from user_msg where company_id=? and receive_user_id=? and msg_type=? and is_read=0"
)
func (t *UserMsg) TableName() string {
return "user_msg"
}
... ...
... ... @@ -125,23 +125,23 @@ type BulletinItem struct {
CreateAt string `json:"time"`
}
/*GetBulletin */
type GetBulletinRequest struct {
}
type GetBulletinResponse struct {
Id int `json:"id"`
Type int `json:"type" valid:"Required"`
Title string `json:"title" valid:"Required"`
Content string `json:"content" valid:"Required"`
AllowClose int `json:"allow_close"`
//AllowCondition int `json:"allow_condition"`
QuestionSwitch int `json:"question_switch"`
Receiver []Receiver `json:"receiver" valid:"Required"`
Question Question `json:"question"`
Cover Cover `json:"cover" valid:"Required"`
}
type Receiver struct {
Id int64 `json:"id"`
NickName string `json:"name"`
}
/*请求公告列表 Announcements */
type AnnouncementsRequest struct {
}
type AnnouncementsResponse struct {
Lists []Announcement `json:"lists"`
}
type Announcement struct {
Id int `json:"id"`
Type int `json:"type" valid:"Required"`
Title string `json:"title" valid:"Required"`
Cover Cover `json:"cover" valid:"Required"`
Link string `json:"link"`
Control int `json:"Control"`
}
... ...
... ... @@ -67,3 +67,13 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac
}
return
}
//未读公告列表
func Announcements(header *protocol.RequestHeader, request *protocol.AnnouncementsRequest) (rsp *protocol.AnnouncementsResponse, err error) {
var (
//userMsg []*models.UserMsg
)
//if err = utils.ExecuteQueryAll(&userMsg,models.SqlUserMsgUnRead,header.CompanyId,header.)
rsp = &protocol.AnnouncementsResponse{}
return
}
... ...