实现IP黑白名单、国家|地区封禁、省份封禁

This commit is contained in:
刘祥超
2020-11-09 10:44:00 +08:00
parent 725ff1d9ef
commit e8e1d3a4bd
14 changed files with 187 additions and 22 deletions

View File

@@ -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()