mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			36 lines
		
	
	
		
			994 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			994 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
						|
 | 
						|
package ui
 | 
						|
 | 
						|
import (
 | 
						|
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
						|
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
						|
	"github.com/iwind/TeaGo/maps"
 | 
						|
)
 | 
						|
 | 
						|
type ProvinceOptionsAction struct {
 | 
						|
	actionutils.ParentAction
 | 
						|
}
 | 
						|
 | 
						|
func (this *ProvinceOptionsAction) RunPost(params struct{}) {
 | 
						|
	provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{RegionCountryId: ChinaCountryId})
 | 
						|
	if err != nil {
 | 
						|
		this.ErrorPage(err)
 | 
						|
		return
 | 
						|
	}
 | 
						|
	var provinceMaps = []maps.Map{}
 | 
						|
	for _, province := range provincesResp.RegionProvinces {
 | 
						|
		if province.Codes == nil {
 | 
						|
			province.Codes = []string{}
 | 
						|
		}
 | 
						|
		provinceMaps = append(provinceMaps, maps.Map{
 | 
						|
			"id":    province.Id,
 | 
						|
			"name":  province.Name,
 | 
						|
			"codes": province.Codes,
 | 
						|
		})
 | 
						|
	}
 | 
						|
	this.Data["provinces"] = provinceMaps
 | 
						|
 | 
						|
	this.Success()
 | 
						|
}
 |