mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-30 18:16:36 +08:00
国家/地区、省份等相关表增加真实ID字段,防止数据表被用户修改时无法对应
This commit is contained in:
@@ -309,7 +309,7 @@ func (this *IPLibraryFileService) CheckCountriesWithIPLibraryFileId(ctx context.
|
||||
}
|
||||
for _, similarCountry := range similarCountries {
|
||||
pbMissingCountry.SimilarCountries = append(pbMissingCountry.SimilarCountries, &pb.RegionCountry{
|
||||
Id: int64(similarCountry.Id),
|
||||
Id: int64(similarCountry.ValueId),
|
||||
Name: similarCountry.Name,
|
||||
DisplayName: similarCountry.DisplayName(),
|
||||
})
|
||||
@@ -391,7 +391,7 @@ func (this *IPLibraryFileService) CheckProvincesWithIPLibraryFileId(ctx context.
|
||||
|
||||
for _, similarProvince := range similarProvinces {
|
||||
pbMissingProvince.SimilarProvinces = append(pbMissingProvince.SimilarProvinces, &pb.RegionProvince{
|
||||
Id: int64(similarProvince.Id),
|
||||
Id: int64(similarProvince.ValueId),
|
||||
Name: similarProvince.Name,
|
||||
DisplayName: similarProvince.DisplayName(),
|
||||
})
|
||||
@@ -482,7 +482,7 @@ func (this *IPLibraryFileService) CheckCitiesWithIPLibraryFileId(ctx context.Con
|
||||
|
||||
for _, similarCity := range similarCities {
|
||||
pbMissingCity.SimilarCities = append(pbMissingCity.SimilarCities, &pb.RegionCity{
|
||||
Id: int64(similarCity.Id),
|
||||
Id: int64(similarCity.ValueId),
|
||||
Name: similarCity.Name,
|
||||
DisplayName: similarCity.DisplayName(),
|
||||
})
|
||||
@@ -597,7 +597,7 @@ func (this *IPLibraryFileService) CheckTownsWithIPLibraryFileId(ctx context.Cont
|
||||
|
||||
for _, similarTown := range similarTowns {
|
||||
pbMissingTown.SimilarTowns = append(pbMissingTown.SimilarTowns, &pb.RegionTown{
|
||||
Id: int64(similarTown.Id),
|
||||
Id: int64(similarTown.ValueId),
|
||||
Name: similarTown.Name,
|
||||
DisplayName: similarTown.DisplayName(),
|
||||
})
|
||||
@@ -654,7 +654,7 @@ func (this *IPLibraryFileService) CheckProvidersWithIPLibraryFileId(ctx context.
|
||||
}
|
||||
for _, similarProvider := range similarProviders {
|
||||
pbMissingProvider.SimilarProviders = append(pbMissingProvider.SimilarProviders, &pb.RegionProvider{
|
||||
Id: int64(similarProvider.Id),
|
||||
Id: int64(similarProvider.ValueId),
|
||||
Name: similarProvider.Name,
|
||||
DisplayName: similarProvider.DisplayName(),
|
||||
})
|
||||
|
||||
@@ -49,7 +49,7 @@ func (this *RegionCityService) FindAllEnabledRegionCities(ctx context.Context, r
|
||||
}
|
||||
|
||||
pbProvince = &pb.RegionProvince{
|
||||
Id: int64(province.Id),
|
||||
Id: int64(province.ValueId),
|
||||
Name: province.Name,
|
||||
Codes: province.DecodeCodes(),
|
||||
DisplayName: province.DisplayName(),
|
||||
@@ -57,7 +57,7 @@ func (this *RegionCityService) FindAllEnabledRegionCities(ctx context.Context, r
|
||||
}
|
||||
|
||||
pbCities = append(pbCities, &pb.RegionCity{
|
||||
Id: int64(city.Id),
|
||||
Id: int64(city.ValueId),
|
||||
Name: city.Name,
|
||||
Codes: city.DecodeCodes(),
|
||||
RegionProvinceId: int64(city.ProvinceId),
|
||||
@@ -108,7 +108,7 @@ func (this *RegionCityService) FindAllRegionCities(ctx context.Context, req *pb.
|
||||
}
|
||||
|
||||
pbProvince = &pb.RegionProvince{
|
||||
Id: int64(province.Id),
|
||||
Id: int64(province.ValueId),
|
||||
Name: province.Name,
|
||||
Codes: province.DecodeCodes(),
|
||||
CustomName: province.CustomName,
|
||||
@@ -118,7 +118,7 @@ func (this *RegionCityService) FindAllRegionCities(ctx context.Context, req *pb.
|
||||
}
|
||||
|
||||
pbCities = append(pbCities, &pb.RegionCity{
|
||||
Id: int64(city.Id),
|
||||
Id: int64(city.ValueId),
|
||||
Name: city.Name,
|
||||
Codes: city.DecodeCodes(),
|
||||
RegionProvinceId: int64(city.ProvinceId),
|
||||
@@ -155,7 +155,7 @@ func (this *RegionCityService) FindAllRegionCitiesWithRegionProvinceId(ctx conte
|
||||
var pbProvince = &pb.RegionProvince{Id: provinceId}
|
||||
|
||||
pbCities = append(pbCities, &pb.RegionCity{
|
||||
Id: int64(city.Id),
|
||||
Id: int64(city.ValueId),
|
||||
Name: city.Name,
|
||||
Codes: city.DecodeCodes(),
|
||||
RegionProvinceId: int64(city.ProvinceId),
|
||||
@@ -192,7 +192,7 @@ func (this *RegionCityService) FindEnabledRegionCity(ctx context.Context, req *p
|
||||
|
||||
return &pb.FindEnabledRegionCityResponse{
|
||||
RegionCity: &pb.RegionCity{
|
||||
Id: int64(city.Id),
|
||||
Id: int64(city.ValueId),
|
||||
Name: city.Name,
|
||||
Codes: city.DecodeCodes(),
|
||||
RegionProvinceId: int64(city.ProvinceId),
|
||||
@@ -223,7 +223,7 @@ func (this *RegionCityService) FindRegionCity(ctx context.Context, req *pb.FindR
|
||||
|
||||
return &pb.FindRegionCityResponse{
|
||||
RegionCity: &pb.RegionCity{
|
||||
Id: int64(city.Id),
|
||||
Id: int64(city.ValueId),
|
||||
Name: city.Name,
|
||||
Codes: city.DecodeCodes(),
|
||||
RegionProvinceId: int64(city.ProvinceId),
|
||||
|
||||
@@ -40,13 +40,14 @@ func (this *RegionCountryService) FindAllEnabledRegionCountries(ctx context.Cont
|
||||
}
|
||||
|
||||
result = append(result, &pb.RegionCountry{
|
||||
Id: int64(country.Id),
|
||||
Id: int64(country.ValueId),
|
||||
Name: country.Name,
|
||||
Codes: country.DecodeCodes(),
|
||||
Pinyin: pinyinStrings,
|
||||
CustomName: country.CustomName,
|
||||
CustomCodes: country.DecodeCustomCodes(),
|
||||
DisplayName: country.DisplayName(),
|
||||
IsCommon: country.IsCommon,
|
||||
})
|
||||
}
|
||||
return &pb.FindAllEnabledRegionCountriesResponse{
|
||||
@@ -74,7 +75,7 @@ func (this *RegionCountryService) FindEnabledRegionCountry(ctx context.Context,
|
||||
}
|
||||
|
||||
return &pb.FindEnabledRegionCountryResponse{RegionCountry: &pb.RegionCountry{
|
||||
Id: int64(country.Id),
|
||||
Id: int64(country.ValueId),
|
||||
Name: country.Name,
|
||||
Codes: country.DecodeCodes(),
|
||||
CustomName: country.CustomName,
|
||||
@@ -110,13 +111,14 @@ func (this *RegionCountryService) FindAllRegionCountries(ctx context.Context, re
|
||||
}
|
||||
|
||||
result = append(result, &pb.RegionCountry{
|
||||
Id: int64(country.Id),
|
||||
Id: int64(country.ValueId),
|
||||
Name: country.Name,
|
||||
Codes: country.DecodeCodes(),
|
||||
Pinyin: pinyinStrings,
|
||||
CustomName: country.CustomName,
|
||||
CustomCodes: country.DecodeCustomCodes(),
|
||||
DisplayName: country.DisplayName(),
|
||||
IsCommon: country.IsCommon,
|
||||
})
|
||||
}
|
||||
return &pb.FindAllRegionCountriesResponse{
|
||||
@@ -143,12 +145,13 @@ func (this *RegionCountryService) FindRegionCountry(ctx context.Context, req *pb
|
||||
}
|
||||
|
||||
return &pb.FindRegionCountryResponse{RegionCountry: &pb.RegionCountry{
|
||||
Id: int64(country.Id),
|
||||
Id: int64(country.ValueId),
|
||||
Name: country.Name,
|
||||
Codes: country.DecodeCodes(),
|
||||
CustomName: country.CustomName,
|
||||
CustomCodes: country.DecodeCustomCodes(),
|
||||
DisplayName: country.DisplayName(),
|
||||
IsCommon: country.IsCommon,
|
||||
}}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ func (this *RegionProviderService) FindAllEnabledRegionProviders(ctx context.Con
|
||||
var pbProviders = []*pb.RegionProvider{}
|
||||
for _, provider := range providers {
|
||||
pbProviders = append(pbProviders, &pb.RegionProvider{
|
||||
Id: int64(provider.Id),
|
||||
Id: int64(provider.ValueId),
|
||||
Name: provider.Name,
|
||||
Codes: provider.DecodeCodes(),
|
||||
CustomName: provider.CustomName,
|
||||
@@ -65,7 +65,7 @@ func (this *RegionProviderService) FindEnabledRegionProvider(ctx context.Context
|
||||
|
||||
return &pb.FindEnabledRegionProviderResponse{
|
||||
RegionProvider: &pb.RegionProvider{
|
||||
Id: int64(provider.Id),
|
||||
Id: int64(provider.ValueId),
|
||||
Name: provider.Name,
|
||||
Codes: provider.DecodeCodes(),
|
||||
CustomName: provider.CustomName,
|
||||
@@ -91,7 +91,7 @@ func (this *RegionProviderService) FindAllRegionProviders(ctx context.Context, r
|
||||
var pbProviders = []*pb.RegionProvider{}
|
||||
for _, provider := range providers {
|
||||
pbProviders = append(pbProviders, &pb.RegionProvider{
|
||||
Id: int64(provider.Id),
|
||||
Id: int64(provider.ValueId),
|
||||
Name: provider.Name,
|
||||
Codes: provider.DecodeCodes(),
|
||||
CustomName: provider.CustomName,
|
||||
@@ -125,7 +125,7 @@ func (this *RegionProviderService) FindRegionProvider(ctx context.Context, req *
|
||||
|
||||
return &pb.FindRegionProviderResponse{
|
||||
RegionProvider: &pb.RegionProvider{
|
||||
Id: int64(provider.Id),
|
||||
Id: int64(provider.ValueId),
|
||||
Name: provider.Name,
|
||||
Codes: provider.DecodeCodes(),
|
||||
CustomName: provider.CustomName,
|
||||
|
||||
@@ -29,7 +29,7 @@ func (this *RegionProvinceService) FindAllEnabledRegionProvincesWithCountryId(ct
|
||||
result := []*pb.RegionProvince{}
|
||||
for _, province := range provinces {
|
||||
result = append(result, &pb.RegionProvince{
|
||||
Id: int64(province.Id),
|
||||
Id: int64(province.ValueId),
|
||||
Name: province.Name,
|
||||
Codes: province.DecodeCodes(),
|
||||
CustomName: province.CustomName,
|
||||
@@ -64,7 +64,7 @@ func (this *RegionProvinceService) FindEnabledRegionProvince(ctx context.Context
|
||||
|
||||
return &pb.FindEnabledRegionProvinceResponse{
|
||||
RegionProvince: &pb.RegionProvince{
|
||||
Id: int64(province.Id),
|
||||
Id: int64(province.ValueId),
|
||||
Name: province.Name,
|
||||
Codes: province.DecodeCodes(),
|
||||
CustomName: province.CustomName,
|
||||
@@ -91,7 +91,7 @@ func (this *RegionProvinceService) FindAllRegionProvincesWithRegionCountryId(ctx
|
||||
var result = []*pb.RegionProvince{}
|
||||
for _, province := range provinces {
|
||||
result = append(result, &pb.RegionProvince{
|
||||
Id: int64(province.Id),
|
||||
Id: int64(province.ValueId),
|
||||
Name: province.Name,
|
||||
Codes: province.DecodeCodes(),
|
||||
CustomName: province.CustomName,
|
||||
@@ -125,7 +125,7 @@ func (this *RegionProvinceService) FindRegionProvince(ctx context.Context, req *
|
||||
|
||||
return &pb.FindRegionProvinceResponse{
|
||||
RegionProvince: &pb.RegionProvince{
|
||||
Id: int64(province.Id),
|
||||
Id: int64(province.ValueId),
|
||||
Name: province.Name,
|
||||
Codes: province.DecodeCodes(),
|
||||
CustomName: province.CustomName,
|
||||
|
||||
@@ -48,7 +48,7 @@ func (this *RegionTownService) FindAllRegionTowns(ctx context.Context, req *pb.F
|
||||
}
|
||||
|
||||
pbCity = &pb.RegionCity{
|
||||
Id: int64(city.Id),
|
||||
Id: int64(city.ValueId),
|
||||
Name: city.Name,
|
||||
Codes: city.DecodeCodes(),
|
||||
CustomName: city.CustomName,
|
||||
@@ -58,7 +58,7 @@ func (this *RegionTownService) FindAllRegionTowns(ctx context.Context, req *pb.F
|
||||
}
|
||||
|
||||
pbTowns = append(pbTowns, &pb.RegionTown{
|
||||
Id: int64(town.Id),
|
||||
Id: int64(town.ValueId),
|
||||
Name: town.Name,
|
||||
Codes: town.DecodeCodes(),
|
||||
RegionCityId: int64(town.CityId),
|
||||
@@ -95,7 +95,7 @@ func (this *RegionTownService) FindAllRegionTownsWithRegionCityId(ctx context.Co
|
||||
var pbCity = &pb.RegionCity{Id: cityId}
|
||||
|
||||
pbTowns = append(pbTowns, &pb.RegionTown{
|
||||
Id: int64(town.Id),
|
||||
Id: int64(town.ValueId),
|
||||
Name: town.Name,
|
||||
Codes: town.DecodeCodes(),
|
||||
RegionCityId: int64(town.CityId),
|
||||
@@ -131,7 +131,7 @@ func (this *RegionTownService) FindRegionTown(ctx context.Context, req *pb.FindR
|
||||
|
||||
return &pb.FindRegionTownResponse{
|
||||
RegionTown: &pb.RegionTown{
|
||||
Id: int64(town.Id),
|
||||
Id: int64(town.ValueId),
|
||||
Name: town.Name,
|
||||
Codes: town.DecodeCodes(),
|
||||
RegionCityId: int64(town.CityId),
|
||||
|
||||
@@ -62,15 +62,15 @@ func (this *ServerRegionCityMonthlyStatService) FindTopServerRegionCityMonthlySt
|
||||
continue
|
||||
}
|
||||
pbStat.RegionCountry = &pb.RegionCountry{
|
||||
Id: int64(country.Id),
|
||||
Id: int64(country.ValueId),
|
||||
Name: country.DisplayName(),
|
||||
}
|
||||
pbStat.RegionProvince = &pb.RegionProvince{
|
||||
Id: int64(province.Id),
|
||||
Id: int64(province.ValueId),
|
||||
Name: province.DisplayName(),
|
||||
}
|
||||
pbStat.RegionCity = &pb.RegionCity{
|
||||
Id: int64(city.Id),
|
||||
Id: int64(city.ValueId),
|
||||
Name: city.DisplayName(),
|
||||
}
|
||||
pbStats = append(pbStats, pbStat)
|
||||
|
||||
@@ -46,7 +46,7 @@ func (this *ServerRegionCountryMonthlyStatService) FindTopServerRegionCountryMon
|
||||
continue
|
||||
}
|
||||
pbStat.RegionCountry = &pb.RegionCountry{
|
||||
Id: int64(country.Id),
|
||||
Id: int64(country.ValueId),
|
||||
Name: country.DisplayName(),
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ func (this *ServerRegionProviderMonthlyStatService) FindTopServerRegionProviderM
|
||||
continue
|
||||
}
|
||||
pbStat.RegionProvider = &pb.RegionProvider{
|
||||
Id: int64(provider.Id),
|
||||
Id: int64(provider.ValueId),
|
||||
Name: provider.DisplayName(),
|
||||
}
|
||||
pbStats = append(pbStats, pbStat)
|
||||
|
||||
@@ -52,11 +52,11 @@ func (this *ServerRegionProvinceMonthlyStatService) FindTopServerRegionProvinceM
|
||||
continue
|
||||
}
|
||||
pbStat.RegionCountry = &pb.RegionCountry{
|
||||
Id: int64(country.Id),
|
||||
Id: int64(country.ValueId),
|
||||
Name: country.DisplayName(),
|
||||
}
|
||||
pbStat.RegionProvince = &pb.RegionProvince{
|
||||
Id: int64(province.Id),
|
||||
Id: int64(province.ValueId),
|
||||
Name: province.DisplayName(),
|
||||
}
|
||||
pbStats = append(pbStats, pbStat)
|
||||
|
||||
Reference in New Issue
Block a user