Skip to content

Commit

Permalink
fix(webclient): share fail when expire is 0
Browse files Browse the repository at this point in the history
Closes: #88
  • Loading branch information
lejianwen committed Dec 25, 2024
1 parent 512f3f9 commit 0dbab18
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions http/controller/api/webClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ func (i *WebClient) SharedPeer(c *gin.Context) {
response.Fail(c, 101, "share not found")
return
}
//判断是否过期,created_at + expire > now
ca := time.Time(sr.CreatedAt)
if ca.Add(time.Second * time.Duration(sr.Expire)).Before(time.Now()) {
response.Fail(c, 101, "share expired")
return
if sr.Expire != 0 {
//判断是否过期,created_at + expire > now
ca := time.Time(sr.CreatedAt)
if ca.Add(time.Second * time.Duration(sr.Expire)).Before(time.Now()) {
response.Fail(c, 101, "share expired")
return
}
}

ab := service.AllService.AddressBookService.InfoByUserIdAndId(sr.UserId, sr.PeerId)
if ab.RowId == 0 {
response.Fail(c, 101, "peer not found")
Expand Down

0 comments on commit 0dbab18

Please sign in to comment.