mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-01-06 15:35:47 +08:00
实现IP黑白名单、国家|地区封禁、省份封禁
This commit is contained in:
@@ -80,6 +80,15 @@ func (this *RegionProvinceDAO) FindProvinceIdWithDataId(dataId string) (int64, e
|
||||
FindInt64Col(0)
|
||||
}
|
||||
|
||||
// 根据省份名查找省份ID
|
||||
func (this *RegionProvinceDAO) FindProvinceIdWithProvinceName(provinceName string) (int64, error) {
|
||||
return this.Query().
|
||||
Where("JSON_CONTAINS(codes, :provinceName)").
|
||||
Param("provinceName", "\""+provinceName+"\""). // 查询的需要是个JSON字符串,所以这里加双引号
|
||||
ResultPk().
|
||||
FindInt64Col(0)
|
||||
}
|
||||
|
||||
// 创建省份
|
||||
func (this *RegionProvinceDAO) CreateProvince(countryId int64, name string, dataId string) (int64, error) {
|
||||
op := NewRegionProvinceOperator()
|
||||
|
||||
Reference in New Issue
Block a user