mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 23:30:26 +08:00
优化代码
This commit is contained in:
@@ -352,6 +352,10 @@ func (this *RPCClient) RegionProvinceRPC() pb.RegionProvinceServiceClient {
|
|||||||
return pb.NewRegionProvinceServiceClient(this.pickConn())
|
return pb.NewRegionProvinceServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RPCClient) RegionProviderRPC() pb.RegionProviderServiceClient {
|
||||||
|
return pb.NewRegionProviderServiceClient(this.pickConn())
|
||||||
|
}
|
||||||
|
|
||||||
func (this *RPCClient) LogRPC() pb.LogServiceClient {
|
func (this *RPCClient) LogRPC() pb.LogServiceClient {
|
||||||
return pb.NewLogServiceClient(this.pickConn())
|
return pb.NewLogServiceClient(this.pickConn())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ func (this *SelectCountriesPopupAction) Init() {
|
|||||||
func (this *SelectCountriesPopupAction) RunGet(params struct {
|
func (this *SelectCountriesPopupAction) RunGet(params struct {
|
||||||
CountryIds string
|
CountryIds string
|
||||||
}) {
|
}) {
|
||||||
selectedCountryIds := utils.SplitNumbers(params.CountryIds)
|
var selectedCountryIds = utils.SplitNumbers(params.CountryIds)
|
||||||
|
|
||||||
countriesResp, err := this.RPC().RegionCountryRPC().FindAllEnabledRegionCountries(this.AdminContext(), &pb.FindAllEnabledRegionCountriesRequest{})
|
countriesResp, err := this.RPC().RegionCountryRPC().FindAllEnabledRegionCountries(this.AdminContext(), &pb.FindAllEnabledRegionCountriesRequest{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
countryMaps := []maps.Map{}
|
var countryMaps = []maps.Map{}
|
||||||
for _, country := range countriesResp.RegionCountries {
|
for _, country := range countriesResp.RegionCountries {
|
||||||
countryMaps = append(countryMaps, maps.Map{
|
countryMaps = append(countryMaps, maps.Map{
|
||||||
"id": country.Id,
|
"id": country.Id,
|
||||||
@@ -48,7 +48,7 @@ func (this *SelectCountriesPopupAction) RunPost(params struct {
|
|||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
CSRF *actionutils.CSRF
|
CSRF *actionutils.CSRF
|
||||||
}) {
|
}) {
|
||||||
countryMaps := []maps.Map{}
|
var countryMaps = []maps.Map{}
|
||||||
for _, countryId := range params.CountryIds {
|
for _, countryId := range params.CountryIds {
|
||||||
countryResp, err := this.RPC().RegionCountryRPC().FindEnabledRegionCountry(this.AdminContext(), &pb.FindEnabledRegionCountryRequest{RegionCountryId: countryId})
|
countryResp, err := this.RPC().RegionCountryRPC().FindEnabledRegionCountry(this.AdminContext(), &pb.FindEnabledRegionCountryRequest{RegionCountryId: countryId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ func (this *SelectProvincesPopupAction) Init() {
|
|||||||
func (this *SelectProvincesPopupAction) RunGet(params struct {
|
func (this *SelectProvincesPopupAction) RunGet(params struct {
|
||||||
ProvinceIds string
|
ProvinceIds string
|
||||||
}) {
|
}) {
|
||||||
selectedProvinceIds := utils.SplitNumbers(params.ProvinceIds)
|
var selectedProvinceIds = utils.SplitNumbers(params.ProvinceIds)
|
||||||
|
|
||||||
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllEnabledRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllEnabledRegionProvincesWithCountryIdRequest{RegionCountryId: ChinaCountryId})
|
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllEnabledRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllEnabledRegionProvincesWithCountryIdRequest{RegionCountryId: ChinaCountryId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.ErrorPage(err)
|
this.ErrorPage(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
provinceMaps := []maps.Map{}
|
var provinceMaps = []maps.Map{}
|
||||||
for _, province := range provincesResp.RegionProvinces {
|
for _, province := range provincesResp.RegionProvinces {
|
||||||
provinceMaps = append(provinceMaps, maps.Map{
|
provinceMaps = append(provinceMaps, maps.Map{
|
||||||
"id": province.Id,
|
"id": province.Id,
|
||||||
@@ -48,7 +48,7 @@ func (this *SelectProvincesPopupAction) RunPost(params struct {
|
|||||||
Must *actions.Must
|
Must *actions.Must
|
||||||
CSRF *actionutils.CSRF
|
CSRF *actionutils.CSRF
|
||||||
}) {
|
}) {
|
||||||
provinceMaps := []maps.Map{}
|
var provinceMaps = []maps.Map{}
|
||||||
for _, provinceId := range params.ProvinceIds {
|
for _, provinceId := range params.ProvinceIds {
|
||||||
provinceResp, err := this.RPC().RegionProvinceRPC().FindEnabledRegionProvince(this.AdminContext(), &pb.FindEnabledRegionProvinceRequest{RegionProvinceId: provinceId})
|
provinceResp, err := this.RPC().RegionProvinceRPC().FindEnabledRegionProvince(this.AdminContext(), &pb.FindEnabledRegionProvinceRequest{RegionProvinceId: provinceId})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ Vue.component("http-cond-url-eq", {
|
|||||||
template: `<div>
|
template: `<div>
|
||||||
<input type="hidden" name="condJSON" :value="JSON.stringify(cond)"/>
|
<input type="hidden" name="condJSON" :value="JSON.stringify(cond)"/>
|
||||||
<input type="text" v-model="cond.value"/>
|
<input type="text" v-model="cond.value"/>
|
||||||
<p class="comment">完整的URL路径,通常以<code-label>/</code-label>开头,比如<code-label>/static/ui.js</code-label>。</p>
|
<p class="comment">完整的URL路径,通常以<code-label>/</code-label>开头,比如<code-label>/static/ui.js</code-label>,并不包含域名部分。</p>
|
||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ Vue.component("http-cond-url-not-eq", {
|
|||||||
template: `<div>
|
template: `<div>
|
||||||
<input type="hidden" name="condJSON" :value="JSON.stringify(cond)"/>
|
<input type="hidden" name="condJSON" :value="JSON.stringify(cond)"/>
|
||||||
<input type="text" v-model="cond.value"/>
|
<input type="text" v-model="cond.value"/>
|
||||||
<p class="comment">要排除的完整的URL路径,通常以<code-label>/</code-label>开头,比如<code-label>/static/ui.js</code-label>。</p>
|
<p class="comment">要排除的完整的URL路径,通常以<code-label>/</code-label>开头,比如<code-label>/static/ui.js</code-label>,并不包含域名部分。</p>
|
||||||
</div>`
|
</div>`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user