(limit int, orderField string)
| 137 | } |
| 138 | |
| 139 | func (m *Book) Sorted(limit int, orderField string) (books []Book) { |
| 140 | o := orm.NewOrm() |
| 141 | fields := []string{"book_id", "book_name", "identify", "cover", "vcnt", "star", "cnt_comment"} |
| 142 | o.QueryTable(m).Filter("order_index__gte", 0).Filter("privately_owned", 0).OrderBy("-"+orderField).Limit(limit).All(&books, fields...) |
| 143 | return |
| 144 | } |
| 145 | |
| 146 | func (m *Book) Insert() (err error) { |
| 147 | o := orm.NewOrm() |