实现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

@@ -15,7 +15,7 @@ type RegionCountryService struct {
// 查找所有的国家列表
func (this *RegionCountryService) FindAllEnabledRegionCountries(ctx context.Context, req *pb.FindAllEnabledRegionCountriesRequest) (*pb.FindAllEnabledRegionCountriesResponse, error) {
// 校验请求
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin)
_, _, err := rpcutils.ValidateRequest(ctx, rpcutils.UserTypeAdmin, rpcutils.UserTypeNode)
if err != nil {
return nil, err
}
@@ -39,6 +39,7 @@ func (this *RegionCountryService) FindAllEnabledRegionCountries(ctx context.Cont
result = append(result, &pb.RegionCountry{
Id: int64(country.Id),
Name: country.Name,
Codes: country.DecodeCodes(),
Pinyin: pinyinStrings,
})
}