|
@@ -64,7 +64,7 @@ func DouShenUserRegisterConsumeForMyFans(queue md.MqQueue) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func handleDouShenUserRegisterConsumeForMyFans(msgData []byte) error { |
|
|
func handleDouShenUserRegisterConsumeForMyFans(msgData []byte) error { |
|
|
time.Sleep(time.Duration(10) * time.Second) |
|
|
|
|
|
|
|
|
time.Sleep(time.Duration(1) * time.Second) |
|
|
//1、解析mq中queue的数据结构体 |
|
|
//1、解析mq中queue的数据结构体 |
|
|
var msg *md.DouShenUserRegisterMessageStructForMyFans |
|
|
var msg *md.DouShenUserRegisterMessageStructForMyFans |
|
|
err := json.Unmarshal(msgData, &msg) |
|
|
err := json.Unmarshal(msgData, &msg) |
|
@@ -80,44 +80,34 @@ func handleDouShenUserRegisterConsumeForMyFans(msgData []byte) error { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
if gimUser == nil { |
|
|
if gimUser == nil { |
|
|
time.Sleep(time.Duration(1) * time.Second) |
|
|
|
|
|
gimUser, err = db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{ |
|
|
|
|
|
"key": "phone_number", |
|
|
|
|
|
"value": msg.Phone, |
|
|
|
|
|
|
|
|
user, err := db.UserFindByMobile(db.DBs[msg.MasterId], strconv.FormatInt(msg.Phone, 10)) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
userProfile, err := db.UserProfileFindByID(db.DBs[msg.MasterId], user.Uid) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
gimUserId, err := db2.UserInsert(db.ImDb, &model2.User{ |
|
|
|
|
|
PhoneNumber: strconv.FormatInt(msg.Phone, 10), |
|
|
|
|
|
Nickname: user.Nickname, |
|
|
|
|
|
AvatarUrl: userProfile.AvatarUrl, |
|
|
|
|
|
Sex: userProfile.Gender, |
|
|
|
|
|
CreateTime: time.Now().Format("2006-01-02 15:04:05"), |
|
|
|
|
|
UpdateTime: time.Now().Format("2006-01-02 15:04:05"), |
|
|
|
|
|
MasterId: utils2.StrToInt64(msg.MasterId), |
|
|
|
|
|
IsAutoAddedFriends: 0, |
|
|
}) |
|
|
}) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
|
|
|
gimUser, err = db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{ |
|
|
|
|
|
"key": "id", |
|
|
|
|
|
"value": gimUserId, |
|
|
|
|
|
}) |
|
|
if gimUser == nil { |
|
|
if gimUser == nil { |
|
|
user, err := db.UserFindByMobile(db.DBs[msg.MasterId], strconv.FormatInt(msg.Phone, 10)) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
userProfile, err := db.UserProfileFindByID(db.DBs[msg.MasterId], user.Uid) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
gimUserId, err := db2.UserInsert(db.ImDb, &model2.User{ |
|
|
|
|
|
PhoneNumber: strconv.FormatInt(msg.Phone, 10), |
|
|
|
|
|
Nickname: user.Nickname, |
|
|
|
|
|
AvatarUrl: userProfile.AvatarUrl, |
|
|
|
|
|
Sex: userProfile.Gender, |
|
|
|
|
|
CreateTime: time.Now().Format("2006-01-02 15:04:05"), |
|
|
|
|
|
UpdateTime: time.Now().Format("2006-01-02 15:04:05"), |
|
|
|
|
|
MasterId: utils2.StrToInt64(msg.MasterId), |
|
|
|
|
|
IsAutoAddedFriends: 0, |
|
|
|
|
|
}) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
gimUser, err = db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{ |
|
|
|
|
|
"key": "id", |
|
|
|
|
|
"value": gimUserId, |
|
|
|
|
|
}) |
|
|
|
|
|
if gimUser == nil { |
|
|
|
|
|
return errors.New("用户暂未注册im系统") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return errors.New("用户暂未注册im系统") |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|