Merge remote-tracking branch 'origin/tuoyun' into tuoyun

pull/131/head
wenxu12345 3 years ago
commit 9eaa180c10

@ -141,7 +141,7 @@ func (s *userServer) GetAllConversationMsgOpt(ctx context.Context, req *pbUser.G
}
func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq) (*pbUser.DeleteUsersResp, error) {
log.NewInfo(req.OperationID, "DeleteUsers args ", req.String())
if token_verify.IsMangerUserID(req.OpUserID) {
if !token_verify.IsMangerUserID(req.OpUserID) {
log.NewError(req.OperationID, "IsMangerUserID false ", req.OpUserID)
return &pbUser.DeleteUsersResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}, FailedUserIDList: req.DeleteUserIDList}, nil
}
@ -161,7 +161,7 @@ func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq)
func (s *userServer) GetAllUserID(_ context.Context, req *pbUser.GetAllUserIDReq) (*pbUser.GetAllUserIDResp, error) {
log.NewInfo(req.OperationID, "GetAllUserID args ", req.String())
if token_verify.IsMangerUserID(req.OpUserID) {
if !token_verify.IsMangerUserID(req.OpUserID) {
log.NewError(req.OperationID, "IsMangerUserID false ", req.OpUserID)
return &pbUser.GetAllUserIDResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil
}
@ -177,11 +177,12 @@ func (s *userServer) GetAllUserID(_ context.Context, req *pbUser.GetAllUserIDReq
func (s *userServer) AccountCheck(_ context.Context, req *pbUser.AccountCheckReq) (*pbUser.AccountCheckResp, error) {
log.NewInfo(req.OperationID, "AccountCheck args ", req.String())
if token_verify.IsMangerUserID(req.OpUserID) {
if !token_verify.IsMangerUserID(req.OpUserID) {
log.NewError(req.OperationID, "IsMangerUserID false ", req.OpUserID)
return &pbUser.AccountCheckResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil
}
uidList, err := imdb.SelectSomeUserID(req.CheckUserIDList)
log.NewDebug(req.OperationID, "from db uid list is:", uidList)
if err != nil {
log.NewError(req.OperationID, "SelectSomeUserID failed ", err.Error(), req.CheckUserIDList)
return &pbUser.AccountCheckResp{CommonResp: &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil

@ -112,10 +112,10 @@ func SelectSomeUserID(userIDList []string) ([]string, error) {
if err != nil {
return nil, err
}
var userList []User
err = dbConn.Table("user").Where("(user_id) IN ? ", userIDList).Find(&userList).Error
var resultArr []string
err = dbConn.Table("user").Where("(user_id) IN ? ", userIDList).Pluck("user_id", &resultArr).Error
if err != nil {
return nil, err
}
return userIDList, nil
return resultArr, nil
}

Loading…
Cancel
Save