优化代码

This commit is contained in:
刘祥超
2022-06-12 20:59:55 +08:00
parent c8e826014b
commit c82fa4709d
4 changed files with 12 additions and 8 deletions

View File

@@ -352,6 +352,10 @@ func (this *RPCClient) RegionProvinceRPC() pb.RegionProvinceServiceClient {
return pb.NewRegionProvinceServiceClient(this.pickConn())
}
func (this *RPCClient) RegionProviderRPC() pb.RegionProviderServiceClient {
return pb.NewRegionProviderServiceClient(this.pickConn())
}
func (this *RPCClient) LogRPC() pb.LogServiceClient {
return pb.NewLogServiceClient(this.pickConn())
}

View File

@@ -21,14 +21,14 @@ func (this *SelectCountriesPopupAction) Init() {
func (this *SelectCountriesPopupAction) RunGet(params struct {
CountryIds string
}) {
selectedCountryIds := utils.SplitNumbers(params.CountryIds)
var selectedCountryIds = utils.SplitNumbers(params.CountryIds)
countriesResp, err := this.RPC().RegionCountryRPC().FindAllEnabledRegionCountries(this.AdminContext(), &pb.FindAllEnabledRegionCountriesRequest{})
if err != nil {
this.ErrorPage(err)
return
}
countryMaps := []maps.Map{}
var countryMaps = []maps.Map{}
for _, country := range countriesResp.RegionCountries {
countryMaps = append(countryMaps, maps.Map{
"id": country.Id,
@@ -48,7 +48,7 @@ func (this *SelectCountriesPopupAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
countryMaps := []maps.Map{}
var countryMaps = []maps.Map{}
for _, countryId := range params.CountryIds {
countryResp, err := this.RPC().RegionCountryRPC().FindEnabledRegionCountry(this.AdminContext(), &pb.FindEnabledRegionCountryRequest{RegionCountryId: countryId})
if err != nil {

View File

@@ -22,14 +22,14 @@ func (this *SelectProvincesPopupAction) Init() {
func (this *SelectProvincesPopupAction) RunGet(params struct {
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})
if err != nil {
this.ErrorPage(err)
return
}
provinceMaps := []maps.Map{}
var provinceMaps = []maps.Map{}
for _, province := range provincesResp.RegionProvinces {
provinceMaps = append(provinceMaps, maps.Map{
"id": province.Id,
@@ -48,7 +48,7 @@ func (this *SelectProvincesPopupAction) RunPost(params struct {
Must *actions.Must
CSRF *actionutils.CSRF
}) {
provinceMaps := []maps.Map{}
var provinceMaps = []maps.Map{}
for _, provinceId := range params.ProvinceIds {
provinceResp, err := this.RPC().RegionProvinceRPC().FindEnabledRegionProvince(this.AdminContext(), &pb.FindEnabledRegionProvinceRequest{RegionProvinceId: provinceId})
if err != nil {

View File

@@ -266,7 +266,7 @@ Vue.component("http-cond-url-eq", {
template: `<div>
<input type="hidden" name="condJSON" :value="JSON.stringify(cond)"/>
<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>`
})
@@ -296,7 +296,7 @@ Vue.component("http-cond-url-not-eq", {
template: `<div>
<input type="hidden" name="condJSON" :value="JSON.stringify(cond)"/>
<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>`
})