go-common/app/interface/main/web/service/ip.go

19 lines
425 B
Go
Raw Normal View History

2019-04-22 10:49:16 +00:00
package service
import (
"context"
"go-common/app/service/main/location/model"
"go-common/library/log"
"go-common/library/net/metadata"
)
// IPZone get ip zone info by ip
func (s *Service) IPZone(c context.Context) (res *model.Info, err error) {
ip := metadata.String(c, metadata.RemoteIP)
if res, err = s.loc.Info(c, &model.ArgIP{IP: ip}); err != nil {
log.Error("s.loc.Info(%s) error(%v)", ip, err)
}
return
}