DengBiao pirms 2 gadiem
vecāks
revīzija
2958958b00
2 mainītis faili ar 21 papildinājumiem un 11 dzēšanām
  1. +19
    -9
      internal/logic/domain/friend/friend_service.go
  2. +2
    -2
      test/tcp_conn/main.go

+ 19
- 9
internal/logic/domain/friend/friend_service.go Parādīt failu

@@ -122,15 +122,25 @@ func (*friendService) AgreeAddFriend(ctx context.Context, userId, friendId int64
return err
}

now := time.Now()
err = FriendRepo.Save(&Friend{
UserId: userId,
FriendId: friendId,
Remarks: remarks,
Status: FriendStatusAgree,
CreateTime: now,
UpdateTime: now,
})
newFriend, err := FriendRepo.Get(friendId, userId)
if newFriend != nil && newFriend.Status != FriendStatusAgree {
newFriend.Status = FriendStatusAgree
err = FriendRepo.Save(newFriend)
if err != nil {
return err
}
} else {
now := time.Now()
err = FriendRepo.Save(&Friend{
UserId: userId,
FriendId: friendId,
Remarks: remarks,
Status: FriendStatusAgree,
CreateTime: now,
UpdateTime: now,
})
}

if err != nil {
return err
}


+ 2
- 2
test/tcp_conn/main.go Parādīt failu

@@ -67,7 +67,7 @@ func (c *TcpClient) Output(pt pb.PackageType, requestId int64, message proto.Mes
func (c *TcpClient) Start() {

//connect, err := net.Dial("tcp", "111.229.238.28:8080")
connect, err := net.Dial("tcp", "im-tcp-connect.izhyin.com:8001")
connect, err := net.Dial("tcp", "im-tcp-connect.zhiyingos.com:8001")
if err != nil {
log.Println(err)
return
@@ -87,7 +87,7 @@ func (c *TcpClient) SignIn() {
signIn := pb.SignInInput{
UserId: c.UserId,
DeviceId: c.DeviceId,
Token: "JNSTQKMVVIEBWQWEILZXIZJILHBUWHUUNWPLZYDF",
Token: "KGDPGQAQDEXXFXFLPMHDWHJEDYTOVCSGIZNILPRP",
}
c.Output(pb.PackageType_PT_SIGN_IN, time.Now().UnixNano(), &signIn)
}


Notiek ielāde…
Atcelt
Saglabāt