Unify the user's status. fix #9.
This commit is contained in:
@ -64,7 +64,7 @@ func (this *UserDao) FindByEmail(email string) *User {
|
||||
}
|
||||
|
||||
//显示用户列表。
|
||||
func (this *UserDao) Page(page int, pageSize int, username string, email string, phone string, sortArray []OrderPair) *Pager {
|
||||
func (this *UserDao) Page(page int, pageSize int, username string, email string, phone string, status string, sortArray []OrderPair) *Pager {
|
||||
|
||||
var wp = &WherePair{}
|
||||
|
||||
@ -80,6 +80,10 @@ func (this *UserDao) Page(page int, pageSize int, username string, email string,
|
||||
wp = wp.And(&WherePair{Query: "phone = ?", Args: []interface{}{phone}})
|
||||
}
|
||||
|
||||
if status != "" {
|
||||
wp = wp.And(&WherePair{Query: "status = ?", Args: []interface{}{status}})
|
||||
}
|
||||
|
||||
count := 0
|
||||
db := this.context.DB.Model(&User{}).Where(wp.Query, wp.Args...).Count(&count)
|
||||
this.PanicError(db.Error)
|
||||
|
Reference in New Issue
Block a user