Bladeren bron

update

three
DengBiao 1 jaar geleden
bovenliggende
commit
aee6f8680b
1 gewijzigde bestanden met toevoegingen van 24 en 34 verwijderingen
  1. +24
    -34
      consume/dou_shen_user_register_for_my_my_fans.go

+ 24
- 34
consume/dou_shen_user_register_for_my_my_fans.go Bestand weergeven

@@ -64,7 +64,7 @@ func DouShenUserRegisterConsumeForMyFans(queue md.MqQueue) {
}

func handleDouShenUserRegisterConsumeForMyFans(msgData []byte) error {
time.Sleep(time.Duration(10) * time.Second)
time.Sleep(time.Duration(1) * time.Second)
//1、解析mq中queue的数据结构体
var msg *md.DouShenUserRegisterMessageStructForMyFans
err := json.Unmarshal(msgData, &msg)
@@ -80,44 +80,34 @@ func handleDouShenUserRegisterConsumeForMyFans(msgData []byte) error {
return err
}
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 {
return err
}
gimUser, err = db2.UserGetOneByParams(db.ImDb, msg.MasterId, map[string]interface{}{
"key": "id",
"value": gimUserId,
})
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系统")
}
}



Laden…
Annuleren
Opslaan