15 Star 61 Fork 10

e9ab98e991ab/GoBooks

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
dashboard.go 900 Bytes
Copy Edit Raw Blame History
高鑫 authored 2018-11-20 21:09 +08:00 . commit
package models
import "github.com/astaxie/beego/orm"
type Dashboard struct {
BookNumber int64 `json:"book_number"`
DocumentNumber int64 `json:"document_number"`
MemberNumber int64 `json:"member_number"`
CommentNumber int64 `json:"comment_number"`
AttachmentNumber int64 `json:"attachment_number"`
}
func NewDashboard() *Dashboard {
return &Dashboard{}
}
func (m *Dashboard) Query() *Dashboard {
o := orm.NewOrm()
bookNumber, _ := o.QueryTable(NewBook().TableNameWithPrefix()).Count()
m.BookNumber = bookNumber
m.DocumentNumber, _ = o.QueryTable(NewDocument().TableNameWithPrefix()).Count()
m.MemberNumber, _ = o.QueryTable(NewMember().TableNameWithPrefix()).Count()
//comment_number,_ := o.QueryTable(NewComment().TableNameWithPrefix()).Count()
m.CommentNumber = 0
m.AttachmentNumber, _ = o.QueryTable(NewAttachment().TableNameWithPrefix()).Count()
return m
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/Godfeer/GoBooks.git
git@gitee.com:Godfeer/GoBooks.git
Godfeer
GoBooks
GoBooks
cbd8ecaa8838

Search