增加ip获取

This commit is contained in:
ayflying
2025-02-28 14:53:05 +08:00
parent 6765eff93f
commit 45ffdc37fb
11 changed files with 212 additions and 1 deletions

15
api/callback/callback.go Normal file
View File

@@ -0,0 +1,15 @@
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package callback
import (
"context"
"github.com/ayflying/utility_go/api/callback/v1"
)
type ICallbackV1 interface {
Ip(ctx context.Context, req *v1.IpReq) (res *v1.IpRes, err error)
}

20
api/callback/v1/ip.go Normal file
View File

@@ -0,0 +1,20 @@
package v1
import "github.com/gogf/gf/v2/frame/g"
type IpReq struct {
g.Meta `path:"/callback/ip/{ip}" tags:"回调响应" method:"get" summary:"获取ip"`
Ip string `json:"ip" dc:"ip"`
}
type IpRes struct {
g.Meta `mime:"application/json" example:"string"`
Address []string `json:"address" dc:"地区名"`
}
type Ip struct {
Country string `json:"country" dc:"国家"` //国家
Region string `json:"region" dc:"地区"` //地区
Province string `json:"province" dc:"省份"` //省份
City string `json:"city" dc:"城市"` //城市
District string `json:"district" dc:"区县"` //区县
}