|
...
|
...
|
@@ -5,7 +5,6 @@ import ( |
|
|
|
"oppmg/common/log"
|
|
|
|
"oppmg/protocol"
|
|
|
|
"oppmg/services/bulletin"
|
|
|
|
"strconv"
|
|
|
|
)
|
|
|
|
|
|
|
|
type BulletinController struct {
|
|
...
|
...
|
@@ -74,33 +73,28 @@ func (this *BulletinController) BulletinList() { |
|
|
|
}
|
|
|
|
|
|
|
|
//GetBulletin
|
|
|
|
//@router /get [post]
|
|
|
|
func (this *BulletinController) GetBulletin() {
|
|
|
|
var msg *protocol.ResponseMessage
|
|
|
|
defer func() {
|
|
|
|
this.ResposeJson(msg)
|
|
|
|
}()
|
|
|
|
var request *protocol.GetBulletinRequest
|
|
|
|
//if err := json.Unmarshal(this.Ctx.Input.RequestBody, &request); err != nil {
|
|
|
|
// log.Error("json 解析失败", err)
|
|
|
|
// msg = protocol.BadRequestParam("1")
|
|
|
|
// return
|
|
|
|
//}
|
|
|
|
//if b, m := this.Valid(request); !b {
|
|
|
|
// msg = m
|
|
|
|
// return
|
|
|
|
//}
|
|
|
|
param := this.Ctx.Input.Param(":id")
|
|
|
|
id, _ := strconv.ParseInt(param, 10, 64)
|
|
|
|
if id == 0 {
|
|
|
|
if err := json.Unmarshal(this.Ctx.Input.RequestBody, &request); err != nil {
|
|
|
|
log.Error("json 解析失败", err)
|
|
|
|
msg = protocol.BadRequestParam("1")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
if b, m := this.Valid(request); !b {
|
|
|
|
msg = m
|
|
|
|
return
|
|
|
|
}
|
|
|
|
companyId := this.GetCompanyId()
|
|
|
|
if companyId <= 0 {
|
|
|
|
msg = protocol.BadRequestParam("1")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
rsp, err := bulletin.GetBulletin(int(id), companyId, request)
|
|
|
|
rsp, err := bulletin.GetBulletin(request.Id, companyId, request)
|
|
|
|
msg = protocol.NewReturnResponse(rsp, err)
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|