Remove useless field in user. Use default utf8 when installing.
This commit is contained in:
parent
b12cc3f306
commit
bc7c720218
@ -226,8 +226,8 @@ func (this *InstallController) CreateTable(writer http.ResponseWriter, request *
|
|||||||
|
|
||||||
for _, iBase := range this.tableNames {
|
for _, iBase := range this.tableNames {
|
||||||
|
|
||||||
//complete the missing fields or create table.
|
//complete the missing fields or create table. use utf8 charset
|
||||||
db1 := db.AutoMigrate(iBase)
|
db1 := db.Set("gorm:table_options", "CHARSET=utf8").AutoMigrate(iBase)
|
||||||
this.PanicError(db1.Error)
|
this.PanicError(db1.Error)
|
||||||
|
|
||||||
exist, allFields, missingFields := this.getTableMeta(db, iBase)
|
exist, allFields, missingFields := this.getTableMeta(db, iBase)
|
||||||
|
@ -274,8 +274,6 @@ func (this *UserController) Page(writer http.ResponseWriter, request *http.Reque
|
|||||||
orderSort := request.FormValue("orderSort")
|
orderSort := request.FormValue("orderSort")
|
||||||
|
|
||||||
username := request.FormValue("username")
|
username := request.FormValue("username")
|
||||||
email := request.FormValue("email")
|
|
||||||
phone := request.FormValue("phone")
|
|
||||||
status := request.FormValue("status")
|
status := request.FormValue("status")
|
||||||
orderLastTime := request.FormValue("orderLastTime")
|
orderLastTime := request.FormValue("orderLastTime")
|
||||||
|
|
||||||
@ -311,7 +309,7 @@ func (this *UserController) Page(writer http.ResponseWriter, request *http.Reque
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
pager := this.userDao.Page(page, pageSize, username, email, phone, status, sortArray)
|
pager := this.userDao.Page(page, pageSize, username, status, sortArray)
|
||||||
|
|
||||||
return this.Success(pager)
|
return this.Success(pager)
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ func (this *UserDao) FindByUsername(username string) *User {
|
|||||||
return user
|
return user
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *UserDao) Page(page int, pageSize int, username string, email string, phone string, status string, sortArray []builder.OrderPair) *Pager {
|
func (this *UserDao) Page(page int, pageSize int, username string, status string, sortArray []builder.OrderPair) *Pager {
|
||||||
|
|
||||||
var wp = &builder.WherePair{}
|
var wp = &builder.WherePair{}
|
||||||
|
|
||||||
@ -80,14 +80,6 @@ func (this *UserDao) Page(page int, pageSize int, username string, email string,
|
|||||||
wp = wp.And(&builder.WherePair{Query: "username LIKE ?", Args: []interface{}{"%" + username + "%"}})
|
wp = wp.And(&builder.WherePair{Query: "username LIKE ?", Args: []interface{}{"%" + username + "%"}})
|
||||||
}
|
}
|
||||||
|
|
||||||
if email != "" {
|
|
||||||
wp = wp.And(&builder.WherePair{Query: "email LIKE ?", Args: []interface{}{"%" + email + "%"}})
|
|
||||||
}
|
|
||||||
|
|
||||||
if phone != "" {
|
|
||||||
wp = wp.And(&builder.WherePair{Query: "phone = ?", Args: []interface{}{phone}})
|
|
||||||
}
|
|
||||||
|
|
||||||
if status != "" {
|
if status != "" {
|
||||||
wp = wp.And(&builder.WherePair{Query: "status = ?", Args: []interface{}{status}})
|
wp = wp.And(&builder.WherePair{Query: "status = ?", Args: []interface{}{status}})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user