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

pull/131/head
wenxu12345 3 years ago
commit 9409d6e05e

@ -148,8 +148,8 @@ func (s *userServer) DeleteUsers(_ context.Context, req *pbUser.DeleteUsersReq)
var common pbUser.CommonResp
resp := pbUser.DeleteUsersResp{CommonResp: &common}
for _, userID := range req.DeleteUserIDList {
err := imdb.DeleteUser(userID)
if err != nil {
i := imdb.DeleteUser(userID)
if i == 0 {
log.NewError(req.OperationID, "delete user error", userID)
common.ErrCode = 201
common.ErrMsg = "some uid deleted failed"

@ -62,13 +62,13 @@ func UserRegister(user User) error {
// CreateTime time.Time `gorm:"column:create_time"`
//}
func DeleteUser(userID string) error {
func DeleteUser(userID string) (i int64) {
dbConn, err := db.DB.MysqlDB.DefaultGormDB()
if err != nil {
return err
return 0
}
err = dbConn.Table("user").Where("user_id=?", userID).Delete(User{}).Error
return err
i = dbConn.Table("user").Where("user_id=?", userID).Delete(User{}).RowsAffected
return i
}
func GetUserByUserID(userID string) (*User, error) {

Loading…
Cancel
Save