- GetUsers接口改变
This commit is contained in:
@@ -51,7 +51,7 @@ func TransferLegacyWeixins() (err error) {
|
||||
if user.Name == "" {
|
||||
user.Name = user.Mobile
|
||||
}
|
||||
userList, err2 := dao.GetUsers(db, 0, "", "", v.Tel, "")
|
||||
userList, err2 := dao.GetUsers(db, 0, "", nil, "", v.Tel)
|
||||
if err = err2; err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -153,6 +153,6 @@ func OnDingDingMsg(msg map[string]interface{}) (callbackResponse *dingdingapi.Ca
|
||||
return api.DingDingAPI.Err2CallbackResponse(nil)
|
||||
}
|
||||
|
||||
func GetUsers(ctx *jxcontext.Context, userType int, userID, userID2, mobile, userName string) (userList []*model.User, err error) {
|
||||
return dao.GetUsers(dao.GetDB(), userType, userID, userID2, mobile, userName)
|
||||
func GetUsers(ctx *jxcontext.Context, userType int, keyword string, userIDs []string, userID2, mobile string) (userList []*model.User, err error) {
|
||||
return dao.GetUsers(dao.GetDB(), userType, keyword, userIDs, userID2, mobile)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ func GetUserByID(db *DaoDB, fieldName, fieldValue string) (user *model.User, err
|
||||
return user, err
|
||||
}
|
||||
|
||||
func GetUsers(db *DaoDB, userType int, userID, userID2, mobile, userName string) (userList []*model.User, err error) {
|
||||
func GetUsers(db *DaoDB, userType int, keyword string, userIDs []string, userID2, mobile string) (userList []*model.User, err error) {
|
||||
if userType == 0 {
|
||||
userType = 255
|
||||
}
|
||||
@@ -35,9 +35,9 @@ func GetUsers(db *DaoDB, userType int, userID, userID2, mobile, userName string)
|
||||
utils.DefaultTimeValue,
|
||||
userType,
|
||||
}
|
||||
if userID != "" {
|
||||
sql += " AND t1.user_id = ?"
|
||||
sqlParams = append(sqlParams, userID)
|
||||
if len(userIDs) > 0 {
|
||||
sql += " AND t1.user_id IN (" + GenQuestionMarks(len(userIDs)) + ")"
|
||||
sqlParams = append(sqlParams, userIDs)
|
||||
}
|
||||
if userID2 != "" {
|
||||
sql += " AND t1.user_id2 = ?"
|
||||
@@ -47,9 +47,10 @@ func GetUsers(db *DaoDB, userType int, userID, userID2, mobile, userName string)
|
||||
sql += " AND t1.mobile = ?"
|
||||
sqlParams = append(sqlParams, mobile)
|
||||
}
|
||||
if userName != "" {
|
||||
sql += " AND t1.name LIKE ?"
|
||||
sqlParams = append(sqlParams, "%"+userName+"%")
|
||||
if keyword != "" {
|
||||
keywordLike := "%" + keyword + "%"
|
||||
sql += " AND (t1.user_id2 LIKE % OR t1.mobile LIKE % OR t1.email LIKE ? OR t1.name LIKE ?)"
|
||||
sqlParams = append(sqlParams, keywordLike, keywordLike, keywordLike, keywordLike)
|
||||
}
|
||||
err = GetRows(db, &userList, sql, sqlParams...)
|
||||
return userList, err
|
||||
|
||||
Reference in New Issue
Block a user