获取文档评论列表 @param did 文档ID @param p 页码 @param listRows 每页记录数 @return params 返回的数据 @return rows 返回的数据记录数 @return err 返回错误
(did, p, listRows int)
| 36 | //@return rows 返回的数据记录数 |
| 37 | //@return err 返回错误 |
| 38 | func (this *DocumentComment) GetCommentList(did, p, listRows int) (params []orm.Params, rows int64, err error) { |
| 39 | tables := []string{GetTableDocumentComment() + " c", GetTableUser() + " u"} |
| 40 | on := []map[string]string{ |
| 41 | {"c.Uid": "u.Id"}, |
| 42 | } |
| 43 | fields := map[string][]string{ |
| 44 | "c": GetFields(NewDocumentComment()), |
| 45 | "u": {"Username", "Avatar"}, |
| 46 | } |
| 47 | if sql, err := LeftJoinSqlBuild(tables, on, fields, p, listRows, []string{"c.Id desc"}, nil, "c.Did=?"); err == nil { |
| 48 | rows, err = orm.NewOrm().Raw(sql, did).Values(¶ms) |
| 49 | } |
| 50 | return params, rows, err |
| 51 | } |
| 52 | |
| 53 | //根据文档ID删除文档评论 |
| 54 | //@param ids 文档id |
no test coverage detected