正在显示
4 个修改的文件
包含
15 行增加
和
4 行删除
| @@ -41,6 +41,10 @@ func (this *BulletinController) BulletinRelease() { | @@ -41,6 +41,10 @@ func (this *BulletinController) BulletinRelease() { | ||
| 41 | msg = m | 41 | msg = m |
| 42 | return | 42 | return |
| 43 | } | 43 | } |
| 44 | + if len([]rune(request.Title)) > 30 { | ||
| 45 | + msg = protocol.BadRequestParam("10278") | ||
| 46 | + return | ||
| 47 | + } | ||
| 44 | rsp, err := bulletin.BulletinRelease(uid, companyId, request) | 48 | rsp, err := bulletin.BulletinRelease(uid, companyId, request) |
| 45 | msg = protocol.NewReturnResponse(rsp, err) | 49 | msg = protocol.NewReturnResponse(rsp, err) |
| 46 | return | 50 | return |
| @@ -205,7 +209,7 @@ func (this *BulletinController) ExportFeedBacks() { | @@ -205,7 +209,7 @@ func (this *BulletinController) ExportFeedBacks() { | ||
| 205 | msg = protocol.BadRequestParam("1") | 209 | msg = protocol.BadRequestParam("1") |
| 206 | return | 210 | return |
| 207 | } | 211 | } |
| 208 | - //excel.FileName = fmt.Sprintf("商品列表%v.xlsx","") | 212 | + //excel.FileName = fmt.Sprintf("商品列表%v.xlsx",time.Now().Format("2006-1-2 15:04:05")) |
| 209 | if err = this.ResponseExcelByFile(this.Ctx, excel); err != nil { | 213 | if err = this.ResponseExcelByFile(this.Ctx, excel); err != nil { |
| 210 | log.Error(err.Error()) | 214 | log.Error(err.Error()) |
| 211 | msg = protocol.BadRequestParam("1") | 215 | msg = protocol.BadRequestParam("1") |
| @@ -2,6 +2,7 @@ package models | @@ -2,6 +2,7 @@ package models | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | + "oppmg/utils" | ||
| 5 | "time" | 6 | "time" |
| 6 | 7 | ||
| 7 | "github.com/astaxie/beego/orm" | 8 | "github.com/astaxie/beego/orm" |
| @@ -82,10 +83,10 @@ func DeleteBulletin(id int) (err error) { | @@ -82,10 +83,10 @@ func DeleteBulletin(id int) (err error) { | ||
| 82 | return | 83 | return |
| 83 | } | 84 | } |
| 84 | 85 | ||
| 85 | -func GetBulletins(companyId int64, status int8, page, pageSize int) (v []*Bulletin, total int, err error) { | 86 | +func GetBulletins(companyId int64, status int8, offset, pageSize int) (v []*Bulletin, total int, err error) { |
| 86 | sql := "select * from bulletin where (status=? or ?=0) and company_id =? order by create_at desc limit ?,?" | 87 | sql := "select * from bulletin where (status=? or ?=0) and company_id =? order by create_at desc limit ?,?" |
| 87 | o := orm.NewOrm() | 88 | o := orm.NewOrm() |
| 88 | - if _, err = o.Raw(sql, status, status, companyId, page-1, pageSize).QueryRows(&v); err != nil { | 89 | + if err = utils.ExecuteQueryAllWithOrmer(o, &v, sql, status, status, companyId, offset, pageSize); err != nil { |
| 89 | return | 90 | return |
| 90 | } | 91 | } |
| 91 | 92 |
| @@ -75,6 +75,7 @@ var errmessge ErrorMap = map[string]string{ | @@ -75,6 +75,7 @@ var errmessge ErrorMap = map[string]string{ | ||
| 75 | "10275": "最多添加1个节点", | 75 | "10275": "最多添加1个节点", |
| 76 | "10276": "最多选择1个角色", | 76 | "10276": "最多选择1个角色", |
| 77 | "10277": "最多一个小数", | 77 | "10277": "最多一个小数", |
| 78 | + "10278": "公告标题大于30个字符", | ||
| 78 | 79 | ||
| 79 | "10170": "请选择指定成员", | 80 | "10170": "请选择指定成员", |
| 80 | "10171": "请选择审批人类别", | 81 | "10171": "请选择审批人类别", |
| @@ -171,7 +171,7 @@ func BulletinList(uid, companyId int64, request *protocol.BulletinListRequest) ( | @@ -171,7 +171,7 @@ func BulletinList(uid, companyId int64, request *protocol.BulletinListRequest) ( | ||
| 171 | request.PageSize = 20 | 171 | request.PageSize = 20 |
| 172 | } | 172 | } |
| 173 | rsp = &protocol.BulletinListResponse{} | 173 | rsp = &protocol.BulletinListResponse{} |
| 174 | - if list, total, err = models.GetBulletins(companyId, request.Status, request.PageIndex, request.PageSize); err != nil { | 174 | + if list, total, err = models.GetBulletins(companyId, request.Status, (request.PageIndex-1)*request.PageIndex, request.PageSize); err != nil { |
| 175 | log.Error(err.Error()) | 175 | log.Error(err.Error()) |
| 176 | return | 176 | return |
| 177 | } | 177 | } |
| @@ -277,6 +277,11 @@ func GetBulletin(id int, companyId int64, request *protocol.GetBulletinRequest) | @@ -277,6 +277,11 @@ func GetBulletin(id int, companyId int64, request *protocol.GetBulletinRequest) | ||
| 277 | log.Error(err.Error()) | 277 | log.Error(err.Error()) |
| 278 | return | 278 | return |
| 279 | } | 279 | } |
| 280 | + for i := range rsp.Question.Content { | ||
| 281 | + if rsp.Question.Content[i].Id == -1 && len(rsp.Question.Content[i].Content) == 0 { | ||
| 282 | + rsp.Question.Content[i].Content = "其他" | ||
| 283 | + } | ||
| 284 | + } | ||
| 280 | } | 285 | } |
| 281 | if e := json.Unmarshal([]byte(bulletin.Receiver), &rsp.Receiver); e != nil { | 286 | if e := json.Unmarshal([]byte(bulletin.Receiver), &rsp.Receiver); e != nil { |
| 282 | log.Error(e.Error()) | 287 | log.Error(e.Error()) |
-
请 注册 或 登录 后发表评论