mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-20 08:49:01 +08:00
add birthStr field
This commit is contained in:
@@ -17,6 +17,7 @@ type ApiUserInfo struct {
|
||||
CreateTime int64 `json:"createTime"`
|
||||
LoginLimit int32 `json:"loginLimit" binding:"omitempty"`
|
||||
Ex string `json:"ex" binding:"omitempty,max=1024"`
|
||||
BirthStr string `json:"birthStr" binding:"omitempty"`
|
||||
}
|
||||
|
||||
//type Conversation struct {
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"Open_IM/pkg/utils"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -116,10 +115,10 @@ func GetUsers(showNumber, pageNumber int32) ([]db.User, error) {
|
||||
return users, err
|
||||
}
|
||||
|
||||
func AddUser(userID string, phoneNumber string, name string, email string, gender int32, faceURL string, birth uint32) error {
|
||||
_birth, _err := time.ParseInLocation("2006-01-02", strconv.Itoa(int(birth)), time.Local)
|
||||
if _err != nil {
|
||||
_birth = time.Now()
|
||||
func AddUser(userID string, phoneNumber string, name string, email string, gender int32, faceURL string, birth string) error {
|
||||
_birth, err := utils.TimeStringToTime(birth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
user := db.User{
|
||||
UserID: userID,
|
||||
|
||||
@@ -146,14 +146,15 @@ func GroupRequestDBCopyOpenIM(dst *open_im_sdk.GroupRequest, src *db.GroupReques
|
||||
|
||||
func UserOpenIMCopyDB(dst *db.User, src *open_im_sdk.UserInfo) {
|
||||
utils.CopyStructFields(dst, src)
|
||||
dst.Birth = utils.UnixSecondToTime(int64(src.Birth))
|
||||
dst.Birth, _ = utils.TimeStringToTime(src.BirthStr)
|
||||
dst.CreateTime = utils.UnixSecondToTime(int64(src.CreateTime))
|
||||
}
|
||||
|
||||
func UserDBCopyOpenIM(dst *open_im_sdk.UserInfo, src *db.User) {
|
||||
utils.CopyStructFields(dst, src)
|
||||
dst.CreateTime = uint32(src.CreateTime.Unix())
|
||||
dst.Birth = uint32(src.Birth.Unix())
|
||||
//dst.Birth = uint32(src.Birth.Unix())
|
||||
dst.BirthStr = utils.TimeToString(src.Birth)
|
||||
}
|
||||
|
||||
func UserDBCopyOpenIMPublicUser(dst *open_im_sdk.PublicUserInfo, src *db.User) {
|
||||
|
||||
+335
-318
File diff suppressed because it is too large
Load Diff
@@ -75,6 +75,7 @@ message UserInfo{
|
||||
uint32 createTime = 9;
|
||||
int32 appMangerLevel = 10;
|
||||
int32 globalRecvMsgOpt = 11;
|
||||
string birthStr = 12;
|
||||
}
|
||||
|
||||
message FriendInfo{
|
||||
@@ -157,6 +158,7 @@ message OrganizationUser {
|
||||
string email = 9;
|
||||
uint32 createTime = 10;
|
||||
string ex = 11;
|
||||
string birthStr = 12;
|
||||
}
|
||||
|
||||
message DepartmentMember {
|
||||
|
||||
@@ -83,3 +83,7 @@ func TimeStringToTime(timeString string) (time.Time, error) {
|
||||
t, err := time.Parse("2006-01-02", timeString)
|
||||
return t, err
|
||||
}
|
||||
|
||||
func TimeToString(t time.Time) string {
|
||||
return t.Format("2006-01-02")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user