Skip to content

Commit

Permalink
完善功能: 判断 interface{} 是否为空
Browse files Browse the repository at this point in the history
  • Loading branch information
royalrick committed Sep 10, 2021
1 parent 786af82 commit 61f78c5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,11 @@ func (srv *Server) handleRequest(w http.ResponseWriter, r *http.Request, isEncrp

// 判断 interface{} 是否为空
func isNil(i interface{}) bool {
defer func() {
recover()
}()
if i == nil {
return false
}

vi := reflect.ValueOf(i)
return vi.IsNil()
return reflect.ValueOf(i).IsZero()
}

// Serve 接收并处理微信通知服务
Expand Down

0 comments on commit 61f78c5

Please sign in to comment.