@ -92,7 +92,7 @@ func UpdateUserInfo(user db.User) error {
if err != nil {
return err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
err = dbConn . Table ( "users" ) . Where ( "user_id=?" , user . UserID ) . Update ( & user ) . Error
return err
}
@ -112,7 +112,7 @@ func SelectAllUserID() ([]string, error) {
func SelectSomeUserID ( userIDList [ ] string ) ( [ ] string , error ) {
dbConn , err := db . DB . MysqlDB . DefaultGormDB ( )
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
if err != nil {
return nil , err
}
@ -131,7 +131,7 @@ func GetUsers(showNumber, pageNumber int32) ([]db.User, error) {
if err != nil {
return users , err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
err = dbConn . Table ( "users" ) . Limit ( showNumber ) . Offset ( showNumber * ( pageNumber - 1 ) ) . Find ( & users ) . Error
if err != nil {
return users , err
@ -204,7 +204,7 @@ func UnBlockUser(userId string) error {
if err != nil {
return err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
result := dbConn . Where ( "uid=?" , userId ) . Delete ( & db . BlackList { } )
return result . Error
}
@ -248,7 +248,7 @@ func GetBlockUsers(showNumber, pageNumber int32) ([]BlockUserInfo, error) {
if err != nil {
return blockUserInfos , err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
if err = dbConn . Limit ( showNumber ) . Offset ( showNumber * ( pageNumber - 1 ) ) . Find ( & blockUsers ) . Error ; err != nil {
return blockUserInfos , err
}
@ -275,7 +275,7 @@ func GetUserByName(userName string, showNumber, pageNumber int32) ([]db.User, er
if err != nil {
return users , err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
err = dbConn . Table ( "users" ) . Where ( fmt . Sprintf ( " name like '%%%s%%' " , userName ) ) . Limit ( showNumber ) . Offset ( showNumber * ( pageNumber - 1 ) ) . Find ( & users ) . Error
return users , err
}
@ -285,7 +285,7 @@ func GetUsersCount(user db.User) (int32, error) {
if err != nil {
return 0 , err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
var count int32
if err := dbConn . Table ( "users" ) . Where ( fmt . Sprintf ( " name like '%%%s%%' " , user . Nickname ) ) . Count ( & count ) . Error ; err != nil {
return 0 , err
@ -298,7 +298,7 @@ func GetBlockUsersNumCount() (int32, error) {
if err != nil {
return 0 , err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
var count int32
if err := dbConn . Model ( & db . BlackList { } ) . Count ( & count ) . Error ; err != nil {
return 0 , err
@ -311,7 +311,7 @@ func SetConversation(conversation db.Conversation) error {
if err != nil {
return err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
newConversation := conversation
if dbConn . Model ( & db . Conversation { } ) . Find ( & newConversation ) . RowsAffected == 0 {
log . NewDebug ( "" , utils . GetSelfFuncName ( ) , "conversation" , conversation , "not exist in db, create" )
@ -330,7 +330,7 @@ func PeerUserSetConversation(conversation db.Conversation) error {
if err != nil {
return err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
newConversation := conversation
if dbConn . Model ( & db . Conversation { } ) . Find ( & newConversation ) . RowsAffected == 0 {
log . NewDebug ( "" , utils . GetSelfFuncName ( ) , "conversation" , conversation , "not exist in db, create" )
@ -349,7 +349,7 @@ func SetRecvMsgOpt(conversation db.Conversation) error {
if err != nil {
return err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
newConversation := conversation
if dbConn . Model ( & db . Conversation { } ) . Find ( & newConversation ) . RowsAffected == 0 {
log . NewDebug ( "" , utils . GetSelfFuncName ( ) , "conversation" , conversation , "not exist in db, create" )
@ -369,7 +369,7 @@ func GetUserAllConversations(ownerUserID string) ([]db.Conversation, error) {
if err != nil {
return conversations , err
}
dbConn . LogMode ( tru e)
dbConn . LogMode ( fals e)
err = dbConn . Model ( & db . Conversation { } ) . Where ( "owner_user_id=?" , ownerUserID ) . Find ( & conversations ) . Error
return conversations , err
}