- GetUsers接口改变
This commit is contained in:
@@ -51,7 +51,7 @@ func TransferLegacyWeixins() (err error) {
|
|||||||
if user.Name == "" {
|
if user.Name == "" {
|
||||||
user.Name = user.Mobile
|
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 {
|
if err = err2; err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,6 @@ func OnDingDingMsg(msg map[string]interface{}) (callbackResponse *dingdingapi.Ca
|
|||||||
return api.DingDingAPI.Err2CallbackResponse(nil)
|
return api.DingDingAPI.Err2CallbackResponse(nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUsers(ctx *jxcontext.Context, userType int, userID, userID2, mobile, userName string) (userList []*model.User, err error) {
|
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, userID, userID2, mobile, userName)
|
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
|
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 {
|
if userType == 0 {
|
||||||
userType = 255
|
userType = 255
|
||||||
}
|
}
|
||||||
@@ -35,9 +35,9 @@ func GetUsers(db *DaoDB, userType int, userID, userID2, mobile, userName string)
|
|||||||
utils.DefaultTimeValue,
|
utils.DefaultTimeValue,
|
||||||
userType,
|
userType,
|
||||||
}
|
}
|
||||||
if userID != "" {
|
if len(userIDs) > 0 {
|
||||||
sql += " AND t1.user_id = ?"
|
sql += " AND t1.user_id IN (" + GenQuestionMarks(len(userIDs)) + ")"
|
||||||
sqlParams = append(sqlParams, userID)
|
sqlParams = append(sqlParams, userIDs)
|
||||||
}
|
}
|
||||||
if userID2 != "" {
|
if userID2 != "" {
|
||||||
sql += " AND t1.user_id2 = ?"
|
sql += " AND t1.user_id2 = ?"
|
||||||
@@ -47,9 +47,10 @@ func GetUsers(db *DaoDB, userType int, userID, userID2, mobile, userName string)
|
|||||||
sql += " AND t1.mobile = ?"
|
sql += " AND t1.mobile = ?"
|
||||||
sqlParams = append(sqlParams, mobile)
|
sqlParams = append(sqlParams, mobile)
|
||||||
}
|
}
|
||||||
if userName != "" {
|
if keyword != "" {
|
||||||
sql += " AND t1.name LIKE ?"
|
keywordLike := "%" + keyword + "%"
|
||||||
sqlParams = append(sqlParams, "%"+userName+"%")
|
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...)
|
err = GetRows(db, &userList, sql, sqlParams...)
|
||||||
return userList, err
|
return userList, err
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ func (c *Auth2Controller) Login() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Title 钉钉认证回调接口
|
// @Title 得到自己登录token的信息
|
||||||
// @Description 钉钉认证回调接口,自己不能直接调用
|
// @Description 得到自己登录token的信息
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /GetTokenInfo [get]
|
// @router /GetTokenInfo [get]
|
||||||
|
|||||||
@@ -55,16 +55,19 @@ func (c *User2Controller) GetBindAuthInfo() {
|
|||||||
// @Description 得到用户列表
|
// @Description 得到用户列表
|
||||||
// @Param token header string true "认证token"
|
// @Param token header string true "认证token"
|
||||||
// @Param userType query int true "用户类型(0表示全部)"
|
// @Param userType query int true "用户类型(0表示全部)"
|
||||||
// @Param userID query string faslse "用户id,必须全匹配(内部唯一标识)"
|
// @Param keyword query string faslse "关键字,可以部分匹配"
|
||||||
|
// @Param userIDs query string faslse "用户id列表"
|
||||||
// @Param userID2 query string faslse "用户id2,必须全匹配(外部唯一标识)"
|
// @Param userID2 query string faslse "用户id2,必须全匹配(外部唯一标识)"
|
||||||
// @Param mobile query string faslse "用户手机,必须全匹配"
|
// @Param mobile query string faslse "用户手机,必须全匹配"
|
||||||
// @Param userName query string faslse "用户名,可以部分匹配"
|
|
||||||
// @Success 200 {object} controllers.CallResult
|
// @Success 200 {object} controllers.CallResult
|
||||||
// @Failure 200 {object} controllers.CallResult
|
// @Failure 200 {object} controllers.CallResult
|
||||||
// @router /GetUsers [get]
|
// @router /GetUsers [get]
|
||||||
func (c *User2Controller) GetUsers() {
|
func (c *User2Controller) GetUsers() {
|
||||||
c.callGetUsers(func(params *tUser2GetUsersParams) (retVal interface{}, errCode string, err error) {
|
c.callGetUsers(func(params *tUser2GetUsersParams) (retVal interface{}, errCode string, err error) {
|
||||||
retVal, err = cms.GetUsers(params.Ctx, params.UserType, params.UserID, params.UserID2, params.Mobile, params.UserName)
|
var userIDs []string
|
||||||
|
if err := jxutils.Strings2Objs(params.UserIDs, &userIDs); err == nil {
|
||||||
|
retVal, err = cms.GetUsers(params.Ctx, params.UserType, params.Keyword, userIDs, params.UserID2, params.Mobile)
|
||||||
|
}
|
||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user