mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-01-23 02:40:23 +08:00
commit
4ffe54b6ac
@ -8,6 +8,8 @@ package com
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/axgle/mahonia"
|
"github.com/axgle/mahonia"
|
||||||
"github.com/bufanyun/hotgo/app/model/entity"
|
"github.com/bufanyun/hotgo/app/model/entity"
|
||||||
"github.com/bufanyun/hotgo/app/utils"
|
"github.com/bufanyun/hotgo/app/utils"
|
||||||
@ -16,7 +18,6 @@ import (
|
|||||||
"github.com/gogf/gf/v2/text/gstr"
|
"github.com/gogf/gf/v2/text/gstr"
|
||||||
"github.com/gogf/gf/v2/util/gconv"
|
"github.com/gogf/gf/v2/util/gconv"
|
||||||
"github.com/kayon/iploc"
|
"github.com/kayon/iploc"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// IP归属地
|
// IP归属地
|
||||||
@ -151,7 +152,7 @@ func (component *ip) Cz88Find(ctx context.Context, ip string) IpLocationData {
|
|||||||
areaModel *entity.SysProvinces
|
areaModel *entity.SysProvinces
|
||||||
)
|
)
|
||||||
|
|
||||||
err = g.DB().Model("hg_common_provinces").
|
err = g.DB().Model("hg_sys_provinces").
|
||||||
Where("level", 1).
|
Where("level", 1).
|
||||||
WhereLike("title", "%"+locationData.Province+"%").
|
WhereLike("title", "%"+locationData.Province+"%").
|
||||||
Scan(&provinceModel)
|
Scan(&provinceModel)
|
||||||
@ -178,7 +179,7 @@ func (component *ip) Cz88Find(ctx context.Context, ip string) IpLocationData {
|
|||||||
//替换掉
|
//替换掉
|
||||||
locationData.City = gstr.Replace(locationData.City, "地区", "")
|
locationData.City = gstr.Replace(locationData.City, "地区", "")
|
||||||
|
|
||||||
err = g.DB().Model("hg_common_provinces").
|
err = g.DB().Model("hg_sys_provinces").
|
||||||
Where("level", 2).
|
Where("level", 2).
|
||||||
Where("pid", locationData.ProvinceCode).
|
Where("pid", locationData.ProvinceCode).
|
||||||
WhereLike("title", "%"+locationData.City+"%").
|
WhereLike("title", "%"+locationData.City+"%").
|
||||||
@ -199,7 +200,7 @@ func (component *ip) Cz88Find(ctx context.Context, ip string) IpLocationData {
|
|||||||
return locationData
|
return locationData
|
||||||
}
|
}
|
||||||
|
|
||||||
err = g.DB().Model("hg_common_provinces").
|
err = g.DB().Model("hg_sys_provinces").
|
||||||
Where("level", 3).
|
Where("level", 3).
|
||||||
Where("pid", locationData.CityCode).
|
Where("pid", locationData.CityCode).
|
||||||
WhereLike("title", "%"+locationData.Area+"%").
|
WhereLike("title", "%"+locationData.Area+"%").
|
||||||
|
Loading…
Reference in New Issue
Block a user