作者 yangfu

企业修改、省市列表获取

@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 "github.com/linmadan/egglib-go/log/logrus" 6 "github.com/linmadan/egglib-go/log/logrus"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
8 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant" 8 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/area"
9 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg" 10 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg"
10 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/redis" 11 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/redis"
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log"
@@ -30,6 +31,7 @@ func main() { @@ -30,6 +31,7 @@ func main() {
30 log.Logger.AddHook(bw) 31 log.Logger.AddHook(bw)
31 32
32 goqueue.SetUp() 33 goqueue.SetUp()
  34 + area.SetUp()
33 35
34 log.Logger.Info("server start!") 36 log.Logger.Info("server start!")
35 web.Run() 37 web.Run()
@@ -2,6 +2,7 @@ package command @@ -2,6 +2,7 @@ package command
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
5 "reflect" 6 "reflect"
6 "strings" 7 "strings"
7 8
@@ -21,6 +22,15 @@ type CompanySignUpCommand struct { @@ -21,6 +22,15 @@ type CompanySignUpCommand struct {
21 IndustryCategory string `cname:"所属行业" json:"industryCategory" valid:"Required"` 22 IndustryCategory string `cname:"所属行业" json:"industryCategory" valid:"Required"`
22 // 密码 23 // 密码
23 Password string `cname:"密码" json:"password" valid:"Required"` 24 Password string `cname:"密码" json:"password" valid:"Required"`
  25 +
  26 + // 法人
  27 + LegalPerson string `cname:"法人" json:"legalPerson" valid:"Required"`
  28 + // 社会信用代码
  29 + SocialCreditCode string `cname:"社会信用代码" json:"socialCreditCode" valid:"Required"`
  30 + // 营业执照所在地
  31 + BusinessLicenseAddress domain.BusinessLicenseAddress `cname:"营业执照所在地" json:"businessLicenseAddress" valid:"Required"`
  32 + // 营业执照-附件
  33 + BusinessLicenseAttachments []domain.Attachment `cname:"营业执照-附件" json:"businessLicenseAttachments" valid:"Required"`
24 } 34 }
25 35
26 func (companySignUpCommand *CompanySignUpCommand) Valid(validation *validation.Validation) { 36 func (companySignUpCommand *CompanySignUpCommand) Valid(validation *validation.Validation) {
@@ -45,6 +45,12 @@ func (authService *AuthService) CompanySignUp(companySignUpCommand *command.Comp @@ -45,6 +45,12 @@ func (authService *AuthService) CompanySignUp(companySignUpCommand *command.Comp
45 Address: "", 45 Address: "",
46 IndustryCategory: companySignUpCommand.IndustryCategory, 46 IndustryCategory: companySignUpCommand.IndustryCategory,
47 RegisteredTime: time.Now(), 47 RegisteredTime: time.Now(),
  48 + Legal: domain.Legal{
  49 + LegalPerson: companySignUpCommand.LegalPerson,
  50 + SocialCreditCode: companySignUpCommand.SocialCreditCode,
  51 + BusinessLicenseAddress: companySignUpCommand.BusinessLicenseAddress,
  52 + BusinessLicenseAttachments: companySignUpCommand.BusinessLicenseAttachments,
  53 + },
48 } 54 }
49 userInfo := &domain.UserInfo{ 55 userInfo := &domain.UserInfo{
50 UserName: companySignUpCommand.Contacts, 56 UserName: companySignUpCommand.Contacts,
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 + "reflect"
  6 + "strings"
  7 +
  8 + "github.com/beego/beego/v2/core/validation"
  9 +)
  10 +
  11 +type AuditCompanyCommand struct {
  12 + // 企业id
  13 + CompanyId int64 `cname:"企业id" json:"companyId,string" valid:"Required"`
  14 + // 审核状态
  15 + Status int `cname:"审核状态" json:"status" valid:"Required"`
  16 + // 备注
  17 + Remark string `cname:"备注" json:"remark" valid:"Required"`
  18 +}
  19 +
  20 +func (updateCompanyCommand *AuditCompanyCommand) Valid(validation *validation.Validation) {
  21 + //validation.SetError("CustomValid", "未实现的自定义认证")
  22 +}
  23 +
  24 +func (updateCompanyCommand *AuditCompanyCommand) ValidateCommand() error {
  25 + valid := validation.Validation{}
  26 + b, err := valid.Valid(updateCompanyCommand)
  27 + if err != nil {
  28 + return err
  29 + }
  30 + if !b {
  31 + elem := reflect.TypeOf(updateCompanyCommand).Elem()
  32 + for _, validErr := range valid.Errors {
  33 + field, isExist := elem.FieldByName(validErr.Field)
  34 + if isExist {
  35 + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
  36 + } else {
  37 + return fmt.Errorf(validErr.Message)
  38 + }
  39 + }
  40 + }
  41 + return nil
  42 +}
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 + "reflect"
  6 + "strings"
  7 +
  8 + "github.com/beego/beego/v2/core/validation"
  9 +)
  10 +
  11 +type EnableCompanyCommand struct {
  12 + // 企业id
  13 + CompanyId int64 `cname:"企业id" json:"companyId,string" valid:"Required"`
  14 + // 审核状态
  15 + Status int `cname:"审核状态" json:"status" valid:"Required"`
  16 +}
  17 +
  18 +func (updateCompanyCommand *EnableCompanyCommand) Valid(validation *validation.Validation) {
  19 + //validation.SetError("CustomValid", "未实现的自定义认证")
  20 +}
  21 +
  22 +func (updateCompanyCommand *EnableCompanyCommand) ValidateCommand() error {
  23 + valid := validation.Validation{}
  24 + b, err := valid.Valid(updateCompanyCommand)
  25 + if err != nil {
  26 + return err
  27 + }
  28 + if !b {
  29 + elem := reflect.TypeOf(updateCompanyCommand).Elem()
  30 + for _, validErr := range valid.Errors {
  31 + field, isExist := elem.FieldByName(validErr.Field)
  32 + if isExist {
  33 + return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, field.Tag.Get("cname"), -1))
  34 + } else {
  35 + return fmt.Errorf(validErr.Message)
  36 + }
  37 + }
  38 + }
  39 + return nil
  40 +}
@@ -10,9 +10,13 @@ import ( @@ -10,9 +10,13 @@ import (
10 10
11 type ListCompanyQuery struct { 11 type ListCompanyQuery struct {
12 // 查询偏离量 12 // 查询偏离量
13 - Offset int `cname:"查询偏离量" json:"offset" valid:"Required"` 13 + Offset int `cname:"查询偏离量" json:"offset,omitempty"`
14 // 查询限制 14 // 查询限制
15 - Limit int `cname:"查询限制" json:"limit" valid:"Required"` 15 + Limit int `cname:"查询限制" json:"limit,omitempty"`
  16 + // 状态
  17 + Status int `cname:"状态" json:"status,omitempty"`
  18 + // 企业名称
  19 + CompanyName string `cname:"企业名称" json:"companyName,omitempty"`
16 } 20 }
17 21
18 func (listCompanyQuery *ListCompanyQuery) Valid(validation *validation.Validation) { 22 func (listCompanyQuery *ListCompanyQuery) Valid(validation *validation.Validation) {
@@ -10,6 +10,7 @@ import ( @@ -10,6 +10,7 @@ import (
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/factory" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/application/factory"
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/common" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/common"
  13 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/utils"
13 "strconv" 14 "strconv"
14 ) 15 )
15 16
@@ -113,7 +114,7 @@ func (companyService *CompanyService) ListCompany(listCompanyQuery *query.ListCo @@ -113,7 +114,7 @@ func (companyService *CompanyService) ListCompany(listCompanyQuery *query.ListCo
113 } else { 114 } else {
114 companyRepository = value 115 companyRepository = value
115 } 116 }
116 - if count, companys, err := companyRepository.Find(tool_funs.SimpleStructToMap(listCompanyQuery)); err != nil { 117 + if count, companys, err := companyRepository.Find(utils.ObjectToMap(listCompanyQuery)); err != nil {
117 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) 118 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
118 } else { 119 } else {
119 if err := transactionContext.CommitTransaction(); err != nil { 120 if err := transactionContext.CommitTransaction(); err != nil {
@@ -279,6 +280,92 @@ func (companyService *CompanyService) UpdateCompany(updateCompanyCommand *comman @@ -279,6 +280,92 @@ func (companyService *CompanyService) UpdateCompany(updateCompanyCommand *comman
279 } 280 }
280 } 281 }
281 282
  283 +// 审核企业
  284 +func (companyService *CompanyService) AuditCompany(cmd *command.AuditCompanyCommand) (interface{}, error) {
  285 + if err := cmd.ValidateCommand(); err != nil {
  286 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  287 + }
  288 + transactionContext, err := factory.CreateTransactionContext(nil)
  289 + if err != nil {
  290 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  291 + }
  292 + if err := transactionContext.StartTransaction(); err != nil {
  293 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  294 + }
  295 + defer func() {
  296 + transactionContext.RollbackTransaction()
  297 + }()
  298 + var companyRepository domain.CompanyRepository
  299 + if value, err := factory.CreateCompanyRepository(map[string]interface{}{
  300 + "transactionContext": transactionContext,
  301 + }); err != nil {
  302 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  303 + } else {
  304 + companyRepository = value
  305 + }
  306 + company, err := companyRepository.FindOne(map[string]interface{}{"companyId": cmd.CompanyId})
  307 + if err != nil {
  308 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  309 + }
  310 + if company == nil {
  311 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(cmd.CompanyId)))
  312 + }
  313 + if err := company.Audit(cmd.Status, cmd.Remark); err != nil {
  314 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  315 + }
  316 + if company, err := companyRepository.Save(company); err != nil {
  317 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  318 + } else {
  319 + if err := transactionContext.CommitTransaction(); err != nil {
  320 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  321 + }
  322 + return company, nil
  323 + }
  324 +}
  325 +
  326 +// 禁用启用企业
  327 +func (companyService *CompanyService) EnableCompany(cmd *command.EnableCompanyCommand) (interface{}, error) {
  328 + if err := cmd.ValidateCommand(); err != nil {
  329 + return nil, application.ThrowError(application.ARG_ERROR, err.Error())
  330 + }
  331 + transactionContext, err := factory.CreateTransactionContext(nil)
  332 + if err != nil {
  333 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  334 + }
  335 + if err := transactionContext.StartTransaction(); err != nil {
  336 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  337 + }
  338 + defer func() {
  339 + transactionContext.RollbackTransaction()
  340 + }()
  341 + var companyRepository domain.CompanyRepository
  342 + if value, err := factory.CreateCompanyRepository(map[string]interface{}{
  343 + "transactionContext": transactionContext,
  344 + }); err != nil {
  345 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  346 + } else {
  347 + companyRepository = value
  348 + }
  349 + company, err := companyRepository.FindOne(map[string]interface{}{"companyId": cmd.CompanyId})
  350 + if err != nil {
  351 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  352 + }
  353 + if company == nil {
  354 + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(cmd.CompanyId)))
  355 + }
  356 + if err := company.Enable(cmd.Status); err != nil {
  357 + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
  358 + }
  359 + if company, err := companyRepository.Save(company); err != nil {
  360 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  361 + } else {
  362 + if err := transactionContext.CommitTransaction(); err != nil {
  363 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  364 + }
  365 + return company, nil
  366 + }
  367 +}
  368 +
282 // 更新自定义菜单 369 // 更新自定义菜单
283 func (companyService *CompanyService) UpdateCompanyCustomizeMenus(updateCompanyCustomizeMenusCommand *command.UpdateCompanyCustomizeMenusCommand) (interface{}, error) { 370 func (companyService *CompanyService) UpdateCompanyCustomizeMenus(updateCompanyCustomizeMenusCommand *command.UpdateCompanyCustomizeMenusCommand) (interface{}, error) {
284 if err := updateCompanyCustomizeMenusCommand.ValidateCommand(); err != nil { 371 if err := updateCompanyCustomizeMenusCommand.ValidateCommand(); err != nil {
@@ -41,6 +41,8 @@ type ListUserQuery struct { @@ -41,6 +41,8 @@ type ListUserQuery struct {
41 EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"` 41 EnableStatus int `cname:"状态(1:启用 2:禁用 3:注销)" json:"enableStatus,omitempty"`
42 // 状态(1:启用 2:禁用 3:注销) 42 // 状态(1:启用 2:禁用 3:注销)
43 InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"` 43 InEnableStatus []int `cname:"状态(1:启用 2:禁用 3:注销)" json:"inEnableStatus,omitempty"`
  44 + // 在企业范围内
  45 + InCompanyIds []int64 `cname:"在企业范围内" json:"inCompanyIds,omitempty"`
44 } 46 }
45 47
46 func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) { 48 func (listUserQuery *ListUserQuery) Valid(validation *validation.Validation) {
  1 +package domain
  2 +
  3 +// Attachment 附件对象
  4 +type Attachment struct {
  5 + // 附件文件类型,jpg,pdf
  6 + FileType string `json:"fileType"`
  7 + // 附件名称
  8 + Name string `json:"name"`
  9 + // 附件地址
  10 + Url string `json:"url"`
  11 + // 附件文件大小,保存KB单位
  12 + FileSize int64 `json:"fileSize"`
  13 +}
@@ -6,11 +6,12 @@ import ( @@ -6,11 +6,12 @@ import (
6 "time" 6 "time"
7 ) 7 )
8 8
9 -// 公司状态状态 1:已注册 2:待认证 3:已认证 9 +// 公司状态状态 1:已注册 2:已通过 3:已拒绝 4:禁用
10 const ( 10 const (
11 CompanyRegistered = iota + 1 11 CompanyRegistered = iota + 1
12 - CompanyUnauthenticated  
13 CompanyAuthenticated 12 CompanyAuthenticated
  13 + CompanyUnauthenticated
  14 + CompanyUnAvailable
14 ) 15 )
15 16
16 // 企业信息 (base) 17 // 企业信息 (base)
@@ -21,7 +22,7 @@ type Company struct { @@ -21,7 +22,7 @@ type Company struct {
21 CompanyConfig *CompanyConfig `json:"companyConfig"` 22 CompanyConfig *CompanyConfig `json:"companyConfig"`
22 // 企业基本信息 23 // 企业基本信息
23 CompanyInfo *CompanyInfo `json:"companyInfo"` 24 CompanyInfo *CompanyInfo `json:"companyInfo"`
24 - // 公司状态 1:已注册 2:待认证 3:已认证 25 + // 公司状态 1:已注册(待审核) 2:已通过 3:已拒绝
25 Status int `json:"status"` 26 Status int `json:"status"`
26 // 创建时间 27 // 创建时间
27 CreatedAt time.Time `json:"createdAt"` 28 CreatedAt time.Time `json:"createdAt"`
@@ -102,6 +103,36 @@ func (company *Company) ToCompanyVisible() *CompanyVisible { @@ -102,6 +103,36 @@ func (company *Company) ToCompanyVisible() *CompanyVisible {
102 } 103 }
103 } 104 }
104 105
  106 +// 公司审核
  107 +func (company *Company) Audit(status int, remark string) error {
  108 + if company.Status != CompanyRegistered {
  109 + return fmt.Errorf("公司已审核")
  110 + }
  111 + if !(status == CompanyAuthenticated || status == CompanyUnauthenticated) {
  112 + return fmt.Errorf("审核状态有误")
  113 + }
  114 + company.Status = status
  115 + company.CompanyInfo.Remark = remark
  116 + company.Update(map[string]interface{}{})
  117 + return nil
  118 +}
  119 +
  120 +// 公司启用禁用
  121 +func (company *Company) Enable(status int) error {
  122 + if company.Status == CompanyRegistered {
  123 + return fmt.Errorf("公司待审核")
  124 + }
  125 + if company.Status == status {
  126 + return nil
  127 + }
  128 + if !(status == CompanyAuthenticated || status == CompanyUnAvailable) {
  129 + return fmt.Errorf("状态有误 2:启用 4:禁用")
  130 + }
  131 + company.Status = status
  132 + company.Update(map[string]interface{}{})
  133 + return nil
  134 +}
  135 +
105 /***** 2.缓存模块 *****/ 136 /***** 2.缓存模块 *****/
106 137
107 func (company *Company) CacheKeyFunc() string { 138 func (company *Company) CacheKeyFunc() string {
@@ -14,10 +14,29 @@ type CompanyInfo struct { @@ -14,10 +14,29 @@ type CompanyInfo struct {
14 Address string `json:"address,omitempty"` 14 Address string `json:"address,omitempty"`
15 // 所属行业 15 // 所属行业
16 IndustryCategory string `json:"industryCategory,omitempty"` 16 IndustryCategory string `json:"industryCategory,omitempty"`
17 - // 联系人  
18 - //Contacts string `json:"contacts"`  
19 // 注册时间 17 // 注册时间
20 RegisteredTime time.Time `json:"registeredTime,omitempty"` 18 RegisteredTime time.Time `json:"registeredTime,omitempty"`
21 - // 状态 1:已注册 2:待认证 3:已认证  
22 - //Status int `json:"status"` 19 + // 法律相关
  20 + Legal Legal `json:"legal"`
  21 + // 备注信息(审核时使用)
  22 + Remark string `json:"备注"`
  23 +}
  24 +
  25 +// 法律相关
  26 +type Legal struct {
  27 + // 法人
  28 + LegalPerson string `json:"legalPerson"`
  29 + // 社会信用代码
  30 + SocialCreditCode string `json:"socialCreditCode"`
  31 + // 营业执照所在地
  32 + BusinessLicenseAddress BusinessLicenseAddress `json:"businessLicenseAddress"`
  33 + // 营业执照-附件
  34 + BusinessLicenseAttachments []Attachment `json:"businessLicenseAttachments"`
  35 +}
  36 +
  37 +// 营业执照所在地
  38 +type BusinessLicenseAddress struct {
  39 + Province string `json:"province"`
  40 + City string `json:"city"`
  41 + Address string `json:"address"`
23 } 42 }
@@ -45,6 +45,7 @@ type UserBase struct { @@ -45,6 +45,7 @@ type UserBase struct {
45 type Favorite struct { 45 type Favorite struct {
46 OrgItems []int64 `json:"orgItems"` 46 OrgItems []int64 `json:"orgItems"`
47 Referer string `json:"referer"` 47 Referer string `json:"referer"`
  48 + LastLogInAt int64 `json:"lastLogInAt"`
48 } 49 }
49 50
50 type UserBaseRepository interface { 51 type UserBaseRepository interface {
@@ -263,6 +264,17 @@ func (userBase *UserBase) removeFavorite(items []int64, code int64) ([]int64, er @@ -263,6 +264,17 @@ func (userBase *UserBase) removeFavorite(items []int64, code int64) ([]int64, er
263 return newItems, nil 264 return newItems, nil
264 } 265 }
265 266
  267 +// LastLogIn 更新最后一次登录时间
  268 +//
  269 +// t 时间
  270 +func (userBase *UserBase) LastLogIn(t time.Time) error {
  271 + if userBase.Favorite == nil {
  272 + userBase.Favorite = NewFavorite()
  273 + }
  274 + userBase.Favorite.LastLogInAt = t.Unix()
  275 + return nil
  276 +}
  277 +
266 /***** 2.缓存模块 *****/ 278 /***** 2.缓存模块 *****/
267 279
268 func (m *UserBase) CacheKeyFunc() string { 280 func (m *UserBase) CacheKeyFunc() string {
  1 +package area
  2 +
  3 +import (
  4 + _ "embed"
  5 + "encoding/json"
  6 +)
  7 +
  8 +type ProvinceCity struct {
  9 + Provinces []*Province
  10 + Cities []*City
  11 + ProvincesCity map[string][]*City
  12 +}
  13 +
  14 +func (p *ProvinceCity) LoadProvincesCity(provinces []*Province, cities []*City) {
  15 + p.Provinces = provinces
  16 + p.Cities = cities
  17 + for i := range provinces {
  18 + p.ProvincesCity[provinces[i].Province] = make([]*City, 0)
  19 + }
  20 + for i := range cities {
  21 + if _, ok := p.ProvincesCity[cities[i].Province]; ok {
  22 + p.ProvincesCity[cities[i].Province] = append(p.ProvincesCity[cities[i].Province], cities[i])
  23 + }
  24 + }
  25 +}
  26 +
  27 +var DefaultProvinceCity *ProvinceCity
  28 +
  29 +// data source :https://github.com/uiwjs/province-city-china/tree/gh-pages
  30 +
  31 +//go:embed city.json
  32 +var city []byte
  33 +
  34 +//go:embed province.json
  35 +var province []byte
  36 +
  37 +func SetUp() {
  38 + DefaultProvinceCity = &ProvinceCity{
  39 + Provinces: make([]*Province, 0),
  40 + Cities: make([]*City, 0),
  41 + ProvincesCity: make(map[string][]*City),
  42 + }
  43 + var cities []*City = make([]*City, 0)
  44 + var provinces []*Province = make([]*Province, 0)
  45 + err := json.Unmarshal(city, &cities)
  46 + if err != nil {
  47 + panic(err)
  48 + }
  49 + err = json.Unmarshal(province, &provinces)
  50 + if err != nil {
  51 + panic(err)
  52 + }
  53 + DefaultProvinceCity.LoadProvincesCity(provinces, cities)
  54 +}
  55 +
  56 +/*
  57 +eg:
  58 +{
  59 + "code": "130100",
  60 + "name": "石家庄市",
  61 + "province": "13",
  62 + "city": "01"
  63 +}
  64 +*/
  65 +type City struct {
  66 + Code string `json:"code"`
  67 + Name string `json:"name"`
  68 + Province string `json:"province"`
  69 + City string `json:"city"`
  70 +}
  71 +
  72 +/*
  73 +eg:
  74 +{
  75 + "code": "110000",
  76 + "name": "北京市",
  77 + "province": "11"
  78 +}
  79 +*/
  80 +type Province struct {
  81 + Code string `json:"code"`
  82 + Name string `json:"name"`
  83 + Province string `json:"province"`
  84 +}
  85 +
  86 +func Provinces() []*Province {
  87 + return DefaultProvinceCity.Provinces
  88 +}
  89 +
  90 +func Cities() []*City {
  91 + return DefaultProvinceCity.Cities
  92 +}
  93 +
  94 +func ProvinceCities(provinceCode string) []*City {
  95 + if v, ok := DefaultProvinceCity.ProvincesCity[provinceCode]; ok {
  96 + return v
  97 + }
  98 + return []*City{}
  99 +}
  1 +[
  2 + {
  3 + "code": "130100",
  4 + "name": "石家庄市",
  5 + "province": "13",
  6 + "city": "01"
  7 + },
  8 + {
  9 + "code": "130200",
  10 + "name": "唐山市",
  11 + "province": "13",
  12 + "city": "02"
  13 + },
  14 + {
  15 + "code": "130300",
  16 + "name": "秦皇岛市",
  17 + "province": "13",
  18 + "city": "03"
  19 + },
  20 + {
  21 + "code": "130400",
  22 + "name": "邯郸市",
  23 + "province": "13",
  24 + "city": "04"
  25 + },
  26 + {
  27 + "code": "130500",
  28 + "name": "邢台市",
  29 + "province": "13",
  30 + "city": "05"
  31 + },
  32 + {
  33 + "code": "130600",
  34 + "name": "保定市",
  35 + "province": "13",
  36 + "city": "06"
  37 + },
  38 + {
  39 + "code": "130700",
  40 + "name": "张家口市",
  41 + "province": "13",
  42 + "city": "07"
  43 + },
  44 + {
  45 + "code": "130800",
  46 + "name": "承德市",
  47 + "province": "13",
  48 + "city": "08"
  49 + },
  50 + {
  51 + "code": "130900",
  52 + "name": "沧州市",
  53 + "province": "13",
  54 + "city": "09"
  55 + },
  56 + {
  57 + "code": "131000",
  58 + "name": "廊坊市",
  59 + "province": "13",
  60 + "city": "10"
  61 + },
  62 + {
  63 + "code": "131100",
  64 + "name": "衡水市",
  65 + "province": "13",
  66 + "city": "11"
  67 + },
  68 + {
  69 + "code": "140100",
  70 + "name": "太原市",
  71 + "province": "14",
  72 + "city": "01"
  73 + },
  74 + {
  75 + "code": "140200",
  76 + "name": "大同市",
  77 + "province": "14",
  78 + "city": "02"
  79 + },
  80 + {
  81 + "code": "140300",
  82 + "name": "阳泉市",
  83 + "province": "14",
  84 + "city": "03"
  85 + },
  86 + {
  87 + "code": "140400",
  88 + "name": "长治市",
  89 + "province": "14",
  90 + "city": "04"
  91 + },
  92 + {
  93 + "code": "140500",
  94 + "name": "晋城市",
  95 + "province": "14",
  96 + "city": "05"
  97 + },
  98 + {
  99 + "code": "140600",
  100 + "name": "朔州市",
  101 + "province": "14",
  102 + "city": "06"
  103 + },
  104 + {
  105 + "code": "140700",
  106 + "name": "晋中市",
  107 + "province": "14",
  108 + "city": "07"
  109 + },
  110 + {
  111 + "code": "140800",
  112 + "name": "运城市",
  113 + "province": "14",
  114 + "city": "08"
  115 + },
  116 + {
  117 + "code": "140900",
  118 + "name": "忻州市",
  119 + "province": "14",
  120 + "city": "09"
  121 + },
  122 + {
  123 + "code": "141000",
  124 + "name": "临汾市",
  125 + "province": "14",
  126 + "city": "10"
  127 + },
  128 + {
  129 + "code": "141100",
  130 + "name": "吕梁市",
  131 + "province": "14",
  132 + "city": "11"
  133 + },
  134 + {
  135 + "code": "150100",
  136 + "name": "呼和浩特市",
  137 + "province": "15",
  138 + "city": "01"
  139 + },
  140 + {
  141 + "code": "150200",
  142 + "name": "包头市",
  143 + "province": "15",
  144 + "city": "02"
  145 + },
  146 + {
  147 + "code": "150300",
  148 + "name": "乌海市",
  149 + "province": "15",
  150 + "city": "03"
  151 + },
  152 + {
  153 + "code": "150400",
  154 + "name": "赤峰市",
  155 + "province": "15",
  156 + "city": "04"
  157 + },
  158 + {
  159 + "code": "150500",
  160 + "name": "通辽市",
  161 + "province": "15",
  162 + "city": "05"
  163 + },
  164 + {
  165 + "code": "150600",
  166 + "name": "鄂尔多斯市",
  167 + "province": "15",
  168 + "city": "06"
  169 + },
  170 + {
  171 + "code": "150700",
  172 + "name": "呼伦贝尔市",
  173 + "province": "15",
  174 + "city": "07"
  175 + },
  176 + {
  177 + "code": "150800",
  178 + "name": "巴彦淖尔市",
  179 + "province": "15",
  180 + "city": "08"
  181 + },
  182 + {
  183 + "code": "150900",
  184 + "name": "乌兰察布市",
  185 + "province": "15",
  186 + "city": "09"
  187 + },
  188 + {
  189 + "code": "152200",
  190 + "name": "兴安盟",
  191 + "province": "15",
  192 + "city": "22"
  193 + },
  194 + {
  195 + "code": "152500",
  196 + "name": "锡林郭勒盟",
  197 + "province": "15",
  198 + "city": "25"
  199 + },
  200 + {
  201 + "code": "152900",
  202 + "name": "阿拉善盟",
  203 + "province": "15",
  204 + "city": "29"
  205 + },
  206 + {
  207 + "code": "210100",
  208 + "name": "沈阳市",
  209 + "province": "21",
  210 + "city": "01"
  211 + },
  212 + {
  213 + "code": "210200",
  214 + "name": "大连市",
  215 + "province": "21",
  216 + "city": "02"
  217 + },
  218 + {
  219 + "code": "210300",
  220 + "name": "鞍山市",
  221 + "province": "21",
  222 + "city": "03"
  223 + },
  224 + {
  225 + "code": "210400",
  226 + "name": "抚顺市",
  227 + "province": "21",
  228 + "city": "04"
  229 + },
  230 + {
  231 + "code": "210500",
  232 + "name": "本溪市",
  233 + "province": "21",
  234 + "city": "05"
  235 + },
  236 + {
  237 + "code": "210600",
  238 + "name": "丹东市",
  239 + "province": "21",
  240 + "city": "06"
  241 + },
  242 + {
  243 + "code": "210700",
  244 + "name": "锦州市",
  245 + "province": "21",
  246 + "city": "07"
  247 + },
  248 + {
  249 + "code": "210800",
  250 + "name": "营口市",
  251 + "province": "21",
  252 + "city": "08"
  253 + },
  254 + {
  255 + "code": "210900",
  256 + "name": "阜新市",
  257 + "province": "21",
  258 + "city": "09"
  259 + },
  260 + {
  261 + "code": "211000",
  262 + "name": "辽阳市",
  263 + "province": "21",
  264 + "city": "10"
  265 + },
  266 + {
  267 + "code": "211100",
  268 + "name": "盘锦市",
  269 + "province": "21",
  270 + "city": "11"
  271 + },
  272 + {
  273 + "code": "211200",
  274 + "name": "铁岭市",
  275 + "province": "21",
  276 + "city": "12"
  277 + },
  278 + {
  279 + "code": "211300",
  280 + "name": "朝阳市",
  281 + "province": "21",
  282 + "city": "13"
  283 + },
  284 + {
  285 + "code": "211400",
  286 + "name": "葫芦岛市",
  287 + "province": "21",
  288 + "city": "14"
  289 + },
  290 + {
  291 + "code": "220100",
  292 + "name": "长春市",
  293 + "province": "22",
  294 + "city": "01"
  295 + },
  296 + {
  297 + "code": "220200",
  298 + "name": "吉林市",
  299 + "province": "22",
  300 + "city": "02"
  301 + },
  302 + {
  303 + "code": "220300",
  304 + "name": "四平市",
  305 + "province": "22",
  306 + "city": "03"
  307 + },
  308 + {
  309 + "code": "220400",
  310 + "name": "辽源市",
  311 + "province": "22",
  312 + "city": "04"
  313 + },
  314 + {
  315 + "code": "220500",
  316 + "name": "通化市",
  317 + "province": "22",
  318 + "city": "05"
  319 + },
  320 + {
  321 + "code": "220600",
  322 + "name": "白山市",
  323 + "province": "22",
  324 + "city": "06"
  325 + },
  326 + {
  327 + "code": "220700",
  328 + "name": "松原市",
  329 + "province": "22",
  330 + "city": "07"
  331 + },
  332 + {
  333 + "code": "220800",
  334 + "name": "白城市",
  335 + "province": "22",
  336 + "city": "08"
  337 + },
  338 + {
  339 + "code": "222400",
  340 + "name": "延边朝鲜族自治州",
  341 + "province": "22",
  342 + "city": "24"
  343 + },
  344 + {
  345 + "code": "230100",
  346 + "name": "哈尔滨市",
  347 + "province": "23",
  348 + "city": "01"
  349 + },
  350 + {
  351 + "code": "230200",
  352 + "name": "齐齐哈尔市",
  353 + "province": "23",
  354 + "city": "02"
  355 + },
  356 + {
  357 + "code": "230300",
  358 + "name": "鸡西市",
  359 + "province": "23",
  360 + "city": "03"
  361 + },
  362 + {
  363 + "code": "230400",
  364 + "name": "鹤岗市",
  365 + "province": "23",
  366 + "city": "04"
  367 + },
  368 + {
  369 + "code": "230500",
  370 + "name": "双鸭山市",
  371 + "province": "23",
  372 + "city": "05"
  373 + },
  374 + {
  375 + "code": "230600",
  376 + "name": "大庆市",
  377 + "province": "23",
  378 + "city": "06"
  379 + },
  380 + {
  381 + "code": "230700",
  382 + "name": "伊春市",
  383 + "province": "23",
  384 + "city": "07"
  385 + },
  386 + {
  387 + "code": "230800",
  388 + "name": "佳木斯市",
  389 + "province": "23",
  390 + "city": "08"
  391 + },
  392 + {
  393 + "code": "230900",
  394 + "name": "七台河市",
  395 + "province": "23",
  396 + "city": "09"
  397 + },
  398 + {
  399 + "code": "231000",
  400 + "name": "牡丹江市",
  401 + "province": "23",
  402 + "city": "10"
  403 + },
  404 + {
  405 + "code": "231100",
  406 + "name": "黑河市",
  407 + "province": "23",
  408 + "city": "11"
  409 + },
  410 + {
  411 + "code": "231200",
  412 + "name": "绥化市",
  413 + "province": "23",
  414 + "city": "12"
  415 + },
  416 + {
  417 + "code": "232700",
  418 + "name": "大兴安岭地区",
  419 + "province": "23",
  420 + "city": "27"
  421 + },
  422 + {
  423 + "code": "320100",
  424 + "name": "南京市",
  425 + "province": "32",
  426 + "city": "01"
  427 + },
  428 + {
  429 + "code": "320200",
  430 + "name": "无锡市",
  431 + "province": "32",
  432 + "city": "02"
  433 + },
  434 + {
  435 + "code": "320300",
  436 + "name": "徐州市",
  437 + "province": "32",
  438 + "city": "03"
  439 + },
  440 + {
  441 + "code": "320400",
  442 + "name": "常州市",
  443 + "province": "32",
  444 + "city": "04"
  445 + },
  446 + {
  447 + "code": "320500",
  448 + "name": "苏州市",
  449 + "province": "32",
  450 + "city": "05"
  451 + },
  452 + {
  453 + "code": "320600",
  454 + "name": "南通市",
  455 + "province": "32",
  456 + "city": "06"
  457 + },
  458 + {
  459 + "code": "320700",
  460 + "name": "连云港市",
  461 + "province": "32",
  462 + "city": "07"
  463 + },
  464 + {
  465 + "code": "320800",
  466 + "name": "淮安市",
  467 + "province": "32",
  468 + "city": "08"
  469 + },
  470 + {
  471 + "code": "320900",
  472 + "name": "盐城市",
  473 + "province": "32",
  474 + "city": "09"
  475 + },
  476 + {
  477 + "code": "321000",
  478 + "name": "扬州市",
  479 + "province": "32",
  480 + "city": "10"
  481 + },
  482 + {
  483 + "code": "321100",
  484 + "name": "镇江市",
  485 + "province": "32",
  486 + "city": "11"
  487 + },
  488 + {
  489 + "code": "321200",
  490 + "name": "泰州市",
  491 + "province": "32",
  492 + "city": "12"
  493 + },
  494 + {
  495 + "code": "321300",
  496 + "name": "宿迁市",
  497 + "province": "32",
  498 + "city": "13"
  499 + },
  500 + {
  501 + "code": "330100",
  502 + "name": "杭州市",
  503 + "province": "33",
  504 + "city": "01"
  505 + },
  506 + {
  507 + "code": "330200",
  508 + "name": "宁波市",
  509 + "province": "33",
  510 + "city": "02"
  511 + },
  512 + {
  513 + "code": "330300",
  514 + "name": "温州市",
  515 + "province": "33",
  516 + "city": "03"
  517 + },
  518 + {
  519 + "code": "330400",
  520 + "name": "嘉兴市",
  521 + "province": "33",
  522 + "city": "04"
  523 + },
  524 + {
  525 + "code": "330500",
  526 + "name": "湖州市",
  527 + "province": "33",
  528 + "city": "05"
  529 + },
  530 + {
  531 + "code": "330600",
  532 + "name": "绍兴市",
  533 + "province": "33",
  534 + "city": "06"
  535 + },
  536 + {
  537 + "code": "330700",
  538 + "name": "金华市",
  539 + "province": "33",
  540 + "city": "07"
  541 + },
  542 + {
  543 + "code": "330800",
  544 + "name": "衢州市",
  545 + "province": "33",
  546 + "city": "08"
  547 + },
  548 + {
  549 + "code": "330900",
  550 + "name": "舟山市",
  551 + "province": "33",
  552 + "city": "09"
  553 + },
  554 + {
  555 + "code": "331000",
  556 + "name": "台州市",
  557 + "province": "33",
  558 + "city": "10"
  559 + },
  560 + {
  561 + "code": "331100",
  562 + "name": "丽水市",
  563 + "province": "33",
  564 + "city": "11"
  565 + },
  566 + {
  567 + "code": "340100",
  568 + "name": "合肥市",
  569 + "province": "34",
  570 + "city": "01"
  571 + },
  572 + {
  573 + "code": "340200",
  574 + "name": "芜湖市",
  575 + "province": "34",
  576 + "city": "02"
  577 + },
  578 + {
  579 + "code": "340300",
  580 + "name": "蚌埠市",
  581 + "province": "34",
  582 + "city": "03"
  583 + },
  584 + {
  585 + "code": "340400",
  586 + "name": "淮南市",
  587 + "province": "34",
  588 + "city": "04"
  589 + },
  590 + {
  591 + "code": "340500",
  592 + "name": "马鞍山市",
  593 + "province": "34",
  594 + "city": "05"
  595 + },
  596 + {
  597 + "code": "340600",
  598 + "name": "淮北市",
  599 + "province": "34",
  600 + "city": "06"
  601 + },
  602 + {
  603 + "code": "340700",
  604 + "name": "铜陵市",
  605 + "province": "34",
  606 + "city": "07"
  607 + },
  608 + {
  609 + "code": "340800",
  610 + "name": "安庆市",
  611 + "province": "34",
  612 + "city": "08"
  613 + },
  614 + {
  615 + "code": "341000",
  616 + "name": "黄山市",
  617 + "province": "34",
  618 + "city": "10"
  619 + },
  620 + {
  621 + "code": "341100",
  622 + "name": "滁州市",
  623 + "province": "34",
  624 + "city": "11"
  625 + },
  626 + {
  627 + "code": "341200",
  628 + "name": "阜阳市",
  629 + "province": "34",
  630 + "city": "12"
  631 + },
  632 + {
  633 + "code": "341300",
  634 + "name": "宿州市",
  635 + "province": "34",
  636 + "city": "13"
  637 + },
  638 + {
  639 + "code": "341500",
  640 + "name": "六安市",
  641 + "province": "34",
  642 + "city": "15"
  643 + },
  644 + {
  645 + "code": "341600",
  646 + "name": "亳州市",
  647 + "province": "34",
  648 + "city": "16"
  649 + },
  650 + {
  651 + "code": "341700",
  652 + "name": "池州市",
  653 + "province": "34",
  654 + "city": "17"
  655 + },
  656 + {
  657 + "code": "341800",
  658 + "name": "宣城市",
  659 + "province": "34",
  660 + "city": "18"
  661 + },
  662 + {
  663 + "code": "350100",
  664 + "name": "福州市",
  665 + "province": "35",
  666 + "city": "01"
  667 + },
  668 + {
  669 + "code": "350200",
  670 + "name": "厦门市",
  671 + "province": "35",
  672 + "city": "02"
  673 + },
  674 + {
  675 + "code": "350300",
  676 + "name": "莆田市",
  677 + "province": "35",
  678 + "city": "03"
  679 + },
  680 + {
  681 + "code": "350400",
  682 + "name": "三明市",
  683 + "province": "35",
  684 + "city": "04"
  685 + },
  686 + {
  687 + "code": "350500",
  688 + "name": "泉州市",
  689 + "province": "35",
  690 + "city": "05"
  691 + },
  692 + {
  693 + "code": "350600",
  694 + "name": "漳州市",
  695 + "province": "35",
  696 + "city": "06"
  697 + },
  698 + {
  699 + "code": "350700",
  700 + "name": "南平市",
  701 + "province": "35",
  702 + "city": "07"
  703 + },
  704 + {
  705 + "code": "350800",
  706 + "name": "龙岩市",
  707 + "province": "35",
  708 + "city": "08"
  709 + },
  710 + {
  711 + "code": "350900",
  712 + "name": "宁德市",
  713 + "province": "35",
  714 + "city": "09"
  715 + },
  716 + {
  717 + "code": "360100",
  718 + "name": "南昌市",
  719 + "province": "36",
  720 + "city": "01"
  721 + },
  722 + {
  723 + "code": "360200",
  724 + "name": "景德镇市",
  725 + "province": "36",
  726 + "city": "02"
  727 + },
  728 + {
  729 + "code": "360300",
  730 + "name": "萍乡市",
  731 + "province": "36",
  732 + "city": "03"
  733 + },
  734 + {
  735 + "code": "360400",
  736 + "name": "九江市",
  737 + "province": "36",
  738 + "city": "04"
  739 + },
  740 + {
  741 + "code": "360500",
  742 + "name": "新余市",
  743 + "province": "36",
  744 + "city": "05"
  745 + },
  746 + {
  747 + "code": "360600",
  748 + "name": "鹰潭市",
  749 + "province": "36",
  750 + "city": "06"
  751 + },
  752 + {
  753 + "code": "360700",
  754 + "name": "赣州市",
  755 + "province": "36",
  756 + "city": "07"
  757 + },
  758 + {
  759 + "code": "360800",
  760 + "name": "吉安市",
  761 + "province": "36",
  762 + "city": "08"
  763 + },
  764 + {
  765 + "code": "360900",
  766 + "name": "宜春市",
  767 + "province": "36",
  768 + "city": "09"
  769 + },
  770 + {
  771 + "code": "361000",
  772 + "name": "抚州市",
  773 + "province": "36",
  774 + "city": "10"
  775 + },
  776 + {
  777 + "code": "361100",
  778 + "name": "上饶市",
  779 + "province": "36",
  780 + "city": "11"
  781 + },
  782 + {
  783 + "code": "370100",
  784 + "name": "济南市",
  785 + "province": "37",
  786 + "city": "01"
  787 + },
  788 + {
  789 + "code": "370200",
  790 + "name": "青岛市",
  791 + "province": "37",
  792 + "city": "02"
  793 + },
  794 + {
  795 + "code": "370300",
  796 + "name": "淄博市",
  797 + "province": "37",
  798 + "city": "03"
  799 + },
  800 + {
  801 + "code": "370400",
  802 + "name": "枣庄市",
  803 + "province": "37",
  804 + "city": "04"
  805 + },
  806 + {
  807 + "code": "370500",
  808 + "name": "东营市",
  809 + "province": "37",
  810 + "city": "05"
  811 + },
  812 + {
  813 + "code": "370600",
  814 + "name": "烟台市",
  815 + "province": "37",
  816 + "city": "06"
  817 + },
  818 + {
  819 + "code": "370700",
  820 + "name": "潍坊市",
  821 + "province": "37",
  822 + "city": "07"
  823 + },
  824 + {
  825 + "code": "370800",
  826 + "name": "济宁市",
  827 + "province": "37",
  828 + "city": "08"
  829 + },
  830 + {
  831 + "code": "370900",
  832 + "name": "泰安市",
  833 + "province": "37",
  834 + "city": "09"
  835 + },
  836 + {
  837 + "code": "371000",
  838 + "name": "威海市",
  839 + "province": "37",
  840 + "city": "10"
  841 + },
  842 + {
  843 + "code": "371100",
  844 + "name": "日照市",
  845 + "province": "37",
  846 + "city": "11"
  847 + },
  848 + {
  849 + "code": "371300",
  850 + "name": "临沂市",
  851 + "province": "37",
  852 + "city": "13"
  853 + },
  854 + {
  855 + "code": "371400",
  856 + "name": "德州市",
  857 + "province": "37",
  858 + "city": "14"
  859 + },
  860 + {
  861 + "code": "371500",
  862 + "name": "聊城市",
  863 + "province": "37",
  864 + "city": "15"
  865 + },
  866 + {
  867 + "code": "371600",
  868 + "name": "滨州市",
  869 + "province": "37",
  870 + "city": "16"
  871 + },
  872 + {
  873 + "code": "371700",
  874 + "name": "菏泽市",
  875 + "province": "37",
  876 + "city": "17"
  877 + },
  878 + {
  879 + "code": "410100",
  880 + "name": "郑州市",
  881 + "province": "41",
  882 + "city": "01"
  883 + },
  884 + {
  885 + "code": "410200",
  886 + "name": "开封市",
  887 + "province": "41",
  888 + "city": "02"
  889 + },
  890 + {
  891 + "code": "410300",
  892 + "name": "洛阳市",
  893 + "province": "41",
  894 + "city": "03"
  895 + },
  896 + {
  897 + "code": "410400",
  898 + "name": "平顶山市",
  899 + "province": "41",
  900 + "city": "04"
  901 + },
  902 + {
  903 + "code": "410500",
  904 + "name": "安阳市",
  905 + "province": "41",
  906 + "city": "05"
  907 + },
  908 + {
  909 + "code": "410600",
  910 + "name": "鹤壁市",
  911 + "province": "41",
  912 + "city": "06"
  913 + },
  914 + {
  915 + "code": "410700",
  916 + "name": "新乡市",
  917 + "province": "41",
  918 + "city": "07"
  919 + },
  920 + {
  921 + "code": "410800",
  922 + "name": "焦作市",
  923 + "province": "41",
  924 + "city": "08"
  925 + },
  926 + {
  927 + "code": "410900",
  928 + "name": "濮阳市",
  929 + "province": "41",
  930 + "city": "09"
  931 + },
  932 + {
  933 + "code": "411000",
  934 + "name": "许昌市",
  935 + "province": "41",
  936 + "city": "10"
  937 + },
  938 + {
  939 + "code": "411100",
  940 + "name": "漯河市",
  941 + "province": "41",
  942 + "city": "11"
  943 + },
  944 + {
  945 + "code": "411200",
  946 + "name": "三门峡市",
  947 + "province": "41",
  948 + "city": "12"
  949 + },
  950 + {
  951 + "code": "411300",
  952 + "name": "南阳市",
  953 + "province": "41",
  954 + "city": "13"
  955 + },
  956 + {
  957 + "code": "411400",
  958 + "name": "商丘市",
  959 + "province": "41",
  960 + "city": "14"
  961 + },
  962 + {
  963 + "code": "411500",
  964 + "name": "信阳市",
  965 + "province": "41",
  966 + "city": "15"
  967 + },
  968 + {
  969 + "code": "411600",
  970 + "name": "周口市",
  971 + "province": "41",
  972 + "city": "16"
  973 + },
  974 + {
  975 + "code": "411700",
  976 + "name": "驻马店市",
  977 + "province": "41",
  978 + "city": "17"
  979 + },
  980 + {
  981 + "code": "420100",
  982 + "name": "武汉市",
  983 + "province": "42",
  984 + "city": "01"
  985 + },
  986 + {
  987 + "code": "420200",
  988 + "name": "黄石市",
  989 + "province": "42",
  990 + "city": "02"
  991 + },
  992 + {
  993 + "code": "420300",
  994 + "name": "十堰市",
  995 + "province": "42",
  996 + "city": "03"
  997 + },
  998 + {
  999 + "code": "420500",
  1000 + "name": "宜昌市",
  1001 + "province": "42",
  1002 + "city": "05"
  1003 + },
  1004 + {
  1005 + "code": "420600",
  1006 + "name": "襄阳市",
  1007 + "province": "42",
  1008 + "city": "06"
  1009 + },
  1010 + {
  1011 + "code": "420700",
  1012 + "name": "鄂州市",
  1013 + "province": "42",
  1014 + "city": "07"
  1015 + },
  1016 + {
  1017 + "code": "420800",
  1018 + "name": "荆门市",
  1019 + "province": "42",
  1020 + "city": "08"
  1021 + },
  1022 + {
  1023 + "code": "420900",
  1024 + "name": "孝感市",
  1025 + "province": "42",
  1026 + "city": "09"
  1027 + },
  1028 + {
  1029 + "code": "421000",
  1030 + "name": "荆州市",
  1031 + "province": "42",
  1032 + "city": "10"
  1033 + },
  1034 + {
  1035 + "code": "421100",
  1036 + "name": "黄冈市",
  1037 + "province": "42",
  1038 + "city": "11"
  1039 + },
  1040 + {
  1041 + "code": "421200",
  1042 + "name": "咸宁市",
  1043 + "province": "42",
  1044 + "city": "12"
  1045 + },
  1046 + {
  1047 + "code": "421300",
  1048 + "name": "随州市",
  1049 + "province": "42",
  1050 + "city": "13"
  1051 + },
  1052 + {
  1053 + "code": "422800",
  1054 + "name": "恩施土家族苗族自治州",
  1055 + "province": "42",
  1056 + "city": "28"
  1057 + },
  1058 + {
  1059 + "code": "430100",
  1060 + "name": "长沙市",
  1061 + "province": "43",
  1062 + "city": "01"
  1063 + },
  1064 + {
  1065 + "code": "430200",
  1066 + "name": "株洲市",
  1067 + "province": "43",
  1068 + "city": "02"
  1069 + },
  1070 + {
  1071 + "code": "430300",
  1072 + "name": "湘潭市",
  1073 + "province": "43",
  1074 + "city": "03"
  1075 + },
  1076 + {
  1077 + "code": "430400",
  1078 + "name": "衡阳市",
  1079 + "province": "43",
  1080 + "city": "04"
  1081 + },
  1082 + {
  1083 + "code": "430500",
  1084 + "name": "邵阳市",
  1085 + "province": "43",
  1086 + "city": "05"
  1087 + },
  1088 + {
  1089 + "code": "430600",
  1090 + "name": "岳阳市",
  1091 + "province": "43",
  1092 + "city": "06"
  1093 + },
  1094 + {
  1095 + "code": "430700",
  1096 + "name": "常德市",
  1097 + "province": "43",
  1098 + "city": "07"
  1099 + },
  1100 + {
  1101 + "code": "430800",
  1102 + "name": "张家界市",
  1103 + "province": "43",
  1104 + "city": "08"
  1105 + },
  1106 + {
  1107 + "code": "430900",
  1108 + "name": "益阳市",
  1109 + "province": "43",
  1110 + "city": "09"
  1111 + },
  1112 + {
  1113 + "code": "431000",
  1114 + "name": "郴州市",
  1115 + "province": "43",
  1116 + "city": "10"
  1117 + },
  1118 + {
  1119 + "code": "431100",
  1120 + "name": "永州市",
  1121 + "province": "43",
  1122 + "city": "11"
  1123 + },
  1124 + {
  1125 + "code": "431200",
  1126 + "name": "怀化市",
  1127 + "province": "43",
  1128 + "city": "12"
  1129 + },
  1130 + {
  1131 + "code": "431300",
  1132 + "name": "娄底市",
  1133 + "province": "43",
  1134 + "city": "13"
  1135 + },
  1136 + {
  1137 + "code": "433100",
  1138 + "name": "湘西土家族苗族自治州",
  1139 + "province": "43",
  1140 + "city": "31"
  1141 + },
  1142 + {
  1143 + "code": "440100",
  1144 + "name": "广州市",
  1145 + "province": "44",
  1146 + "city": "01"
  1147 + },
  1148 + {
  1149 + "code": "440200",
  1150 + "name": "韶关市",
  1151 + "province": "44",
  1152 + "city": "02"
  1153 + },
  1154 + {
  1155 + "code": "440300",
  1156 + "name": "深圳市",
  1157 + "province": "44",
  1158 + "city": "03"
  1159 + },
  1160 + {
  1161 + "code": "440400",
  1162 + "name": "珠海市",
  1163 + "province": "44",
  1164 + "city": "04"
  1165 + },
  1166 + {
  1167 + "code": "440500",
  1168 + "name": "汕头市",
  1169 + "province": "44",
  1170 + "city": "05"
  1171 + },
  1172 + {
  1173 + "code": "440600",
  1174 + "name": "佛山市",
  1175 + "province": "44",
  1176 + "city": "06"
  1177 + },
  1178 + {
  1179 + "code": "440700",
  1180 + "name": "江门市",
  1181 + "province": "44",
  1182 + "city": "07"
  1183 + },
  1184 + {
  1185 + "code": "440800",
  1186 + "name": "湛江市",
  1187 + "province": "44",
  1188 + "city": "08"
  1189 + },
  1190 + {
  1191 + "code": "440900",
  1192 + "name": "茂名市",
  1193 + "province": "44",
  1194 + "city": "09"
  1195 + },
  1196 + {
  1197 + "code": "441200",
  1198 + "name": "肇庆市",
  1199 + "province": "44",
  1200 + "city": "12"
  1201 + },
  1202 + {
  1203 + "code": "441300",
  1204 + "name": "惠州市",
  1205 + "province": "44",
  1206 + "city": "13"
  1207 + },
  1208 + {
  1209 + "code": "441400",
  1210 + "name": "梅州市",
  1211 + "province": "44",
  1212 + "city": "14"
  1213 + },
  1214 + {
  1215 + "code": "441500",
  1216 + "name": "汕尾市",
  1217 + "province": "44",
  1218 + "city": "15"
  1219 + },
  1220 + {
  1221 + "code": "441600",
  1222 + "name": "河源市",
  1223 + "province": "44",
  1224 + "city": "16"
  1225 + },
  1226 + {
  1227 + "code": "441700",
  1228 + "name": "阳江市",
  1229 + "province": "44",
  1230 + "city": "17"
  1231 + },
  1232 + {
  1233 + "code": "441800",
  1234 + "name": "清远市",
  1235 + "province": "44",
  1236 + "city": "18"
  1237 + },
  1238 + {
  1239 + "code": "441900",
  1240 + "name": "东莞市",
  1241 + "province": "44",
  1242 + "city": "19"
  1243 + },
  1244 + {
  1245 + "code": "442000",
  1246 + "name": "中山市",
  1247 + "province": "44",
  1248 + "city": "20"
  1249 + },
  1250 + {
  1251 + "code": "445100",
  1252 + "name": "潮州市",
  1253 + "province": "44",
  1254 + "city": "51"
  1255 + },
  1256 + {
  1257 + "code": "445200",
  1258 + "name": "揭阳市",
  1259 + "province": "44",
  1260 + "city": "52"
  1261 + },
  1262 + {
  1263 + "code": "445300",
  1264 + "name": "云浮市",
  1265 + "province": "44",
  1266 + "city": "53"
  1267 + },
  1268 + {
  1269 + "code": "450100",
  1270 + "name": "南宁市",
  1271 + "province": "45",
  1272 + "city": "01"
  1273 + },
  1274 + {
  1275 + "code": "450200",
  1276 + "name": "柳州市",
  1277 + "province": "45",
  1278 + "city": "02"
  1279 + },
  1280 + {
  1281 + "code": "450300",
  1282 + "name": "桂林市",
  1283 + "province": "45",
  1284 + "city": "03"
  1285 + },
  1286 + {
  1287 + "code": "450400",
  1288 + "name": "梧州市",
  1289 + "province": "45",
  1290 + "city": "04"
  1291 + },
  1292 + {
  1293 + "code": "450500",
  1294 + "name": "北海市",
  1295 + "province": "45",
  1296 + "city": "05"
  1297 + },
  1298 + {
  1299 + "code": "450600",
  1300 + "name": "防城港市",
  1301 + "province": "45",
  1302 + "city": "06"
  1303 + },
  1304 + {
  1305 + "code": "450700",
  1306 + "name": "钦州市",
  1307 + "province": "45",
  1308 + "city": "07"
  1309 + },
  1310 + {
  1311 + "code": "450800",
  1312 + "name": "贵港市",
  1313 + "province": "45",
  1314 + "city": "08"
  1315 + },
  1316 + {
  1317 + "code": "450900",
  1318 + "name": "玉林市",
  1319 + "province": "45",
  1320 + "city": "09"
  1321 + },
  1322 + {
  1323 + "code": "451000",
  1324 + "name": "百色市",
  1325 + "province": "45",
  1326 + "city": "10"
  1327 + },
  1328 + {
  1329 + "code": "451100",
  1330 + "name": "贺州市",
  1331 + "province": "45",
  1332 + "city": "11"
  1333 + },
  1334 + {
  1335 + "code": "451200",
  1336 + "name": "河池市",
  1337 + "province": "45",
  1338 + "city": "12"
  1339 + },
  1340 + {
  1341 + "code": "451300",
  1342 + "name": "来宾市",
  1343 + "province": "45",
  1344 + "city": "13"
  1345 + },
  1346 + {
  1347 + "code": "451400",
  1348 + "name": "崇左市",
  1349 + "province": "45",
  1350 + "city": "14"
  1351 + },
  1352 + {
  1353 + "code": "460100",
  1354 + "name": "海口市",
  1355 + "province": "46",
  1356 + "city": "01"
  1357 + },
  1358 + {
  1359 + "code": "460200",
  1360 + "name": "三亚市",
  1361 + "province": "46",
  1362 + "city": "02"
  1363 + },
  1364 + {
  1365 + "code": "460300",
  1366 + "name": "三沙市",
  1367 + "province": "46",
  1368 + "city": "03"
  1369 + },
  1370 + {
  1371 + "code": "460400",
  1372 + "name": "儋州市",
  1373 + "province": "46",
  1374 + "city": "04"
  1375 + },
  1376 + {
  1377 + "code": "510100",
  1378 + "name": "成都市",
  1379 + "province": "51",
  1380 + "city": "01"
  1381 + },
  1382 + {
  1383 + "code": "510300",
  1384 + "name": "自贡市",
  1385 + "province": "51",
  1386 + "city": "03"
  1387 + },
  1388 + {
  1389 + "code": "510400",
  1390 + "name": "攀枝花市",
  1391 + "province": "51",
  1392 + "city": "04"
  1393 + },
  1394 + {
  1395 + "code": "510500",
  1396 + "name": "泸州市",
  1397 + "province": "51",
  1398 + "city": "05"
  1399 + },
  1400 + {
  1401 + "code": "510600",
  1402 + "name": "德阳市",
  1403 + "province": "51",
  1404 + "city": "06"
  1405 + },
  1406 + {
  1407 + "code": "510700",
  1408 + "name": "绵阳市",
  1409 + "province": "51",
  1410 + "city": "07"
  1411 + },
  1412 + {
  1413 + "code": "510800",
  1414 + "name": "广元市",
  1415 + "province": "51",
  1416 + "city": "08"
  1417 + },
  1418 + {
  1419 + "code": "510900",
  1420 + "name": "遂宁市",
  1421 + "province": "51",
  1422 + "city": "09"
  1423 + },
  1424 + {
  1425 + "code": "511000",
  1426 + "name": "内江市",
  1427 + "province": "51",
  1428 + "city": "10"
  1429 + },
  1430 + {
  1431 + "code": "511100",
  1432 + "name": "乐山市",
  1433 + "province": "51",
  1434 + "city": "11"
  1435 + },
  1436 + {
  1437 + "code": "511300",
  1438 + "name": "南充市",
  1439 + "province": "51",
  1440 + "city": "13"
  1441 + },
  1442 + {
  1443 + "code": "511400",
  1444 + "name": "眉山市",
  1445 + "province": "51",
  1446 + "city": "14"
  1447 + },
  1448 + {
  1449 + "code": "511500",
  1450 + "name": "宜宾市",
  1451 + "province": "51",
  1452 + "city": "15"
  1453 + },
  1454 + {
  1455 + "code": "511600",
  1456 + "name": "广安市",
  1457 + "province": "51",
  1458 + "city": "16"
  1459 + },
  1460 + {
  1461 + "code": "511700",
  1462 + "name": "达州市",
  1463 + "province": "51",
  1464 + "city": "17"
  1465 + },
  1466 + {
  1467 + "code": "511800",
  1468 + "name": "雅安市",
  1469 + "province": "51",
  1470 + "city": "18"
  1471 + },
  1472 + {
  1473 + "code": "511900",
  1474 + "name": "巴中市",
  1475 + "province": "51",
  1476 + "city": "19"
  1477 + },
  1478 + {
  1479 + "code": "512000",
  1480 + "name": "资阳市",
  1481 + "province": "51",
  1482 + "city": "20"
  1483 + },
  1484 + {
  1485 + "code": "513200",
  1486 + "name": "阿坝藏族羌族自治州",
  1487 + "province": "51",
  1488 + "city": "32"
  1489 + },
  1490 + {
  1491 + "code": "513300",
  1492 + "name": "甘孜藏族自治州",
  1493 + "province": "51",
  1494 + "city": "33"
  1495 + },
  1496 + {
  1497 + "code": "513400",
  1498 + "name": "凉山彝族自治州",
  1499 + "province": "51",
  1500 + "city": "34"
  1501 + },
  1502 + {
  1503 + "code": "520100",
  1504 + "name": "贵阳市",
  1505 + "province": "52",
  1506 + "city": "01"
  1507 + },
  1508 + {
  1509 + "code": "520200",
  1510 + "name": "六盘水市",
  1511 + "province": "52",
  1512 + "city": "02"
  1513 + },
  1514 + {
  1515 + "code": "520300",
  1516 + "name": "遵义市",
  1517 + "province": "52",
  1518 + "city": "03"
  1519 + },
  1520 + {
  1521 + "code": "520400",
  1522 + "name": "安顺市",
  1523 + "province": "52",
  1524 + "city": "04"
  1525 + },
  1526 + {
  1527 + "code": "520500",
  1528 + "name": "毕节市",
  1529 + "province": "52",
  1530 + "city": "05"
  1531 + },
  1532 + {
  1533 + "code": "520600",
  1534 + "name": "铜仁市",
  1535 + "province": "52",
  1536 + "city": "06"
  1537 + },
  1538 + {
  1539 + "code": "522300",
  1540 + "name": "黔西南布依族苗族自治州",
  1541 + "province": "52",
  1542 + "city": "23"
  1543 + },
  1544 + {
  1545 + "code": "522600",
  1546 + "name": "黔东南苗族侗族自治州",
  1547 + "province": "52",
  1548 + "city": "26"
  1549 + },
  1550 + {
  1551 + "code": "522700",
  1552 + "name": "黔南布依族苗族自治州",
  1553 + "province": "52",
  1554 + "city": "27"
  1555 + },
  1556 + {
  1557 + "code": "530100",
  1558 + "name": "昆明市",
  1559 + "province": "53",
  1560 + "city": "01"
  1561 + },
  1562 + {
  1563 + "code": "530300",
  1564 + "name": "曲靖市",
  1565 + "province": "53",
  1566 + "city": "03"
  1567 + },
  1568 + {
  1569 + "code": "530400",
  1570 + "name": "玉溪市",
  1571 + "province": "53",
  1572 + "city": "04"
  1573 + },
  1574 + {
  1575 + "code": "530500",
  1576 + "name": "保山市",
  1577 + "province": "53",
  1578 + "city": "05"
  1579 + },
  1580 + {
  1581 + "code": "530600",
  1582 + "name": "昭通市",
  1583 + "province": "53",
  1584 + "city": "06"
  1585 + },
  1586 + {
  1587 + "code": "530700",
  1588 + "name": "丽江市",
  1589 + "province": "53",
  1590 + "city": "07"
  1591 + },
  1592 + {
  1593 + "code": "530800",
  1594 + "name": "普洱市",
  1595 + "province": "53",
  1596 + "city": "08"
  1597 + },
  1598 + {
  1599 + "code": "530900",
  1600 + "name": "临沧市",
  1601 + "province": "53",
  1602 + "city": "09"
  1603 + },
  1604 + {
  1605 + "code": "532300",
  1606 + "name": "楚雄彝族自治州",
  1607 + "province": "53",
  1608 + "city": "23"
  1609 + },
  1610 + {
  1611 + "code": "532500",
  1612 + "name": "红河哈尼族彝族自治州",
  1613 + "province": "53",
  1614 + "city": "25"
  1615 + },
  1616 + {
  1617 + "code": "532600",
  1618 + "name": "文山壮族苗族自治州",
  1619 + "province": "53",
  1620 + "city": "26"
  1621 + },
  1622 + {
  1623 + "code": "532800",
  1624 + "name": "西双版纳傣族自治州",
  1625 + "province": "53",
  1626 + "city": "28"
  1627 + },
  1628 + {
  1629 + "code": "532900",
  1630 + "name": "大理白族自治州",
  1631 + "province": "53",
  1632 + "city": "29"
  1633 + },
  1634 + {
  1635 + "code": "533100",
  1636 + "name": "德宏傣族景颇族自治州",
  1637 + "province": "53",
  1638 + "city": "31"
  1639 + },
  1640 + {
  1641 + "code": "533300",
  1642 + "name": "怒江傈僳族自治州",
  1643 + "province": "53",
  1644 + "city": "33"
  1645 + },
  1646 + {
  1647 + "code": "533400",
  1648 + "name": "迪庆藏族自治州",
  1649 + "province": "53",
  1650 + "city": "34"
  1651 + },
  1652 + {
  1653 + "code": "540100",
  1654 + "name": "拉萨市",
  1655 + "province": "54",
  1656 + "city": "01"
  1657 + },
  1658 + {
  1659 + "code": "540200",
  1660 + "name": "日喀则市",
  1661 + "province": "54",
  1662 + "city": "02"
  1663 + },
  1664 + {
  1665 + "code": "540300",
  1666 + "name": "昌都市",
  1667 + "province": "54",
  1668 + "city": "03"
  1669 + },
  1670 + {
  1671 + "code": "540400",
  1672 + "name": "林芝市",
  1673 + "province": "54",
  1674 + "city": "04"
  1675 + },
  1676 + {
  1677 + "code": "540500",
  1678 + "name": "山南市",
  1679 + "province": "54",
  1680 + "city": "05"
  1681 + },
  1682 + {
  1683 + "code": "540600",
  1684 + "name": "那曲市",
  1685 + "province": "54",
  1686 + "city": "06"
  1687 + },
  1688 + {
  1689 + "code": "542500",
  1690 + "name": "阿里地区",
  1691 + "province": "54",
  1692 + "city": "25"
  1693 + },
  1694 + {
  1695 + "code": "610100",
  1696 + "name": "西安市",
  1697 + "province": "61",
  1698 + "city": "01"
  1699 + },
  1700 + {
  1701 + "code": "610200",
  1702 + "name": "铜川市",
  1703 + "province": "61",
  1704 + "city": "02"
  1705 + },
  1706 + {
  1707 + "code": "610300",
  1708 + "name": "宝鸡市",
  1709 + "province": "61",
  1710 + "city": "03"
  1711 + },
  1712 + {
  1713 + "code": "610400",
  1714 + "name": "咸阳市",
  1715 + "province": "61",
  1716 + "city": "04"
  1717 + },
  1718 + {
  1719 + "code": "610500",
  1720 + "name": "渭南市",
  1721 + "province": "61",
  1722 + "city": "05"
  1723 + },
  1724 + {
  1725 + "code": "610600",
  1726 + "name": "延安市",
  1727 + "province": "61",
  1728 + "city": "06"
  1729 + },
  1730 + {
  1731 + "code": "610700",
  1732 + "name": "汉中市",
  1733 + "province": "61",
  1734 + "city": "07"
  1735 + },
  1736 + {
  1737 + "code": "610800",
  1738 + "name": "榆林市",
  1739 + "province": "61",
  1740 + "city": "08"
  1741 + },
  1742 + {
  1743 + "code": "610900",
  1744 + "name": "安康市",
  1745 + "province": "61",
  1746 + "city": "09"
  1747 + },
  1748 + {
  1749 + "code": "611000",
  1750 + "name": "商洛市",
  1751 + "province": "61",
  1752 + "city": "10"
  1753 + },
  1754 + {
  1755 + "code": "620100",
  1756 + "name": "兰州市",
  1757 + "province": "62",
  1758 + "city": "01"
  1759 + },
  1760 + {
  1761 + "code": "620200",
  1762 + "name": "嘉峪关市",
  1763 + "province": "62",
  1764 + "city": "02"
  1765 + },
  1766 + {
  1767 + "code": "620300",
  1768 + "name": "金昌市",
  1769 + "province": "62",
  1770 + "city": "03"
  1771 + },
  1772 + {
  1773 + "code": "620400",
  1774 + "name": "白银市",
  1775 + "province": "62",
  1776 + "city": "04"
  1777 + },
  1778 + {
  1779 + "code": "620500",
  1780 + "name": "天水市",
  1781 + "province": "62",
  1782 + "city": "05"
  1783 + },
  1784 + {
  1785 + "code": "620600",
  1786 + "name": "武威市",
  1787 + "province": "62",
  1788 + "city": "06"
  1789 + },
  1790 + {
  1791 + "code": "620700",
  1792 + "name": "张掖市",
  1793 + "province": "62",
  1794 + "city": "07"
  1795 + },
  1796 + {
  1797 + "code": "620800",
  1798 + "name": "平凉市",
  1799 + "province": "62",
  1800 + "city": "08"
  1801 + },
  1802 + {
  1803 + "code": "620900",
  1804 + "name": "酒泉市",
  1805 + "province": "62",
  1806 + "city": "09"
  1807 + },
  1808 + {
  1809 + "code": "621000",
  1810 + "name": "庆阳市",
  1811 + "province": "62",
  1812 + "city": "10"
  1813 + },
  1814 + {
  1815 + "code": "621100",
  1816 + "name": "定西市",
  1817 + "province": "62",
  1818 + "city": "11"
  1819 + },
  1820 + {
  1821 + "code": "621200",
  1822 + "name": "陇南市",
  1823 + "province": "62",
  1824 + "city": "12"
  1825 + },
  1826 + {
  1827 + "code": "622900",
  1828 + "name": "临夏回族自治州",
  1829 + "province": "62",
  1830 + "city": "29"
  1831 + },
  1832 + {
  1833 + "code": "623000",
  1834 + "name": "甘南藏族自治州",
  1835 + "province": "62",
  1836 + "city": "30"
  1837 + },
  1838 + {
  1839 + "code": "630100",
  1840 + "name": "西宁市",
  1841 + "province": "63",
  1842 + "city": "01"
  1843 + },
  1844 + {
  1845 + "code": "630200",
  1846 + "name": "海东市",
  1847 + "province": "63",
  1848 + "city": "02"
  1849 + },
  1850 + {
  1851 + "code": "632200",
  1852 + "name": "海北藏族自治州",
  1853 + "province": "63",
  1854 + "city": "22"
  1855 + },
  1856 + {
  1857 + "code": "632300",
  1858 + "name": "黄南藏族自治州",
  1859 + "province": "63",
  1860 + "city": "23"
  1861 + },
  1862 + {
  1863 + "code": "632500",
  1864 + "name": "海南藏族自治州",
  1865 + "province": "63",
  1866 + "city": "25"
  1867 + },
  1868 + {
  1869 + "code": "632600",
  1870 + "name": "果洛藏族自治州",
  1871 + "province": "63",
  1872 + "city": "26"
  1873 + },
  1874 + {
  1875 + "code": "632700",
  1876 + "name": "玉树藏族自治州",
  1877 + "province": "63",
  1878 + "city": "27"
  1879 + },
  1880 + {
  1881 + "code": "632800",
  1882 + "name": "海西蒙古族藏族自治州",
  1883 + "province": "63",
  1884 + "city": "28"
  1885 + },
  1886 + {
  1887 + "code": "640100",
  1888 + "name": "银川市",
  1889 + "province": "64",
  1890 + "city": "01"
  1891 + },
  1892 + {
  1893 + "code": "640200",
  1894 + "name": "石嘴山市",
  1895 + "province": "64",
  1896 + "city": "02"
  1897 + },
  1898 + {
  1899 + "code": "640300",
  1900 + "name": "吴忠市",
  1901 + "province": "64",
  1902 + "city": "03"
  1903 + },
  1904 + {
  1905 + "code": "640400",
  1906 + "name": "固原市",
  1907 + "province": "64",
  1908 + "city": "04"
  1909 + },
  1910 + {
  1911 + "code": "640500",
  1912 + "name": "中卫市",
  1913 + "province": "64",
  1914 + "city": "05"
  1915 + },
  1916 + {
  1917 + "code": "650100",
  1918 + "name": "乌鲁木齐市",
  1919 + "province": "65",
  1920 + "city": "01"
  1921 + },
  1922 + {
  1923 + "code": "650200",
  1924 + "name": "克拉玛依市",
  1925 + "province": "65",
  1926 + "city": "02"
  1927 + },
  1928 + {
  1929 + "code": "650400",
  1930 + "name": "吐鲁番市",
  1931 + "province": "65",
  1932 + "city": "04"
  1933 + },
  1934 + {
  1935 + "code": "650500",
  1936 + "name": "哈密市",
  1937 + "province": "65",
  1938 + "city": "05"
  1939 + },
  1940 + {
  1941 + "code": "652300",
  1942 + "name": "昌吉回族自治州",
  1943 + "province": "65",
  1944 + "city": "23"
  1945 + },
  1946 + {
  1947 + "code": "652700",
  1948 + "name": "博尔塔拉蒙古自治州",
  1949 + "province": "65",
  1950 + "city": "27"
  1951 + },
  1952 + {
  1953 + "code": "652800",
  1954 + "name": "巴音郭楞蒙古自治州",
  1955 + "province": "65",
  1956 + "city": "28"
  1957 + },
  1958 + {
  1959 + "code": "652900",
  1960 + "name": "阿克苏地区",
  1961 + "province": "65",
  1962 + "city": "29"
  1963 + },
  1964 + {
  1965 + "code": "653000",
  1966 + "name": "克孜勒苏柯尔克孜自治州",
  1967 + "province": "65",
  1968 + "city": "30"
  1969 + },
  1970 + {
  1971 + "code": "653100",
  1972 + "name": "喀什地区",
  1973 + "province": "65",
  1974 + "city": "31"
  1975 + },
  1976 + {
  1977 + "code": "653200",
  1978 + "name": "和田地区",
  1979 + "province": "65",
  1980 + "city": "32"
  1981 + },
  1982 + {
  1983 + "code": "654000",
  1984 + "name": "伊犁哈萨克自治州",
  1985 + "province": "65",
  1986 + "city": "40"
  1987 + },
  1988 + {
  1989 + "code": "654200",
  1990 + "name": "塔城地区",
  1991 + "province": "65",
  1992 + "city": "42"
  1993 + },
  1994 + {
  1995 + "code": "654300",
  1996 + "name": "阿勒泰地区",
  1997 + "province": "65",
  1998 + "city": "43"
  1999 + },
  2000 + {
  2001 + "code": "429000",
  2002 + "name": "省直辖县级行政区划",
  2003 + "province": "42",
  2004 + "city": "90"
  2005 + }
  2006 +]
  1 +[
  2 + {
  3 + "code": "110000",
  4 + "name": "北京市",
  5 + "province": "11"
  6 + },
  7 + {
  8 + "code": "120000",
  9 + "name": "天津市",
  10 + "province": "12"
  11 + },
  12 + {
  13 + "code": "130000",
  14 + "name": "河北省",
  15 + "province": "13"
  16 + },
  17 + {
  18 + "code": "140000",
  19 + "name": "山西省",
  20 + "province": "14"
  21 + },
  22 + {
  23 + "code": "150000",
  24 + "name": "内蒙古自治区",
  25 + "province": "15"
  26 + },
  27 + {
  28 + "code": "210000",
  29 + "name": "辽宁省",
  30 + "province": "21"
  31 + },
  32 + {
  33 + "code": "220000",
  34 + "name": "吉林省",
  35 + "province": "22"
  36 + },
  37 + {
  38 + "code": "230000",
  39 + "name": "黑龙江省",
  40 + "province": "23"
  41 + },
  42 + {
  43 + "code": "310000",
  44 + "name": "上海市",
  45 + "province": "31"
  46 + },
  47 + {
  48 + "code": "320000",
  49 + "name": "江苏省",
  50 + "province": "32"
  51 + },
  52 + {
  53 + "code": "330000",
  54 + "name": "浙江省",
  55 + "province": "33"
  56 + },
  57 + {
  58 + "code": "340000",
  59 + "name": "安徽省",
  60 + "province": "34"
  61 + },
  62 + {
  63 + "code": "350000",
  64 + "name": "福建省",
  65 + "province": "35"
  66 + },
  67 + {
  68 + "code": "360000",
  69 + "name": "江西省",
  70 + "province": "36"
  71 + },
  72 + {
  73 + "code": "370000",
  74 + "name": "山东省",
  75 + "province": "37"
  76 + },
  77 + {
  78 + "code": "410000",
  79 + "name": "河南省",
  80 + "province": "41"
  81 + },
  82 + {
  83 + "code": "420000",
  84 + "name": "湖北省",
  85 + "province": "42"
  86 + },
  87 + {
  88 + "code": "430000",
  89 + "name": "湖南省",
  90 + "province": "43"
  91 + },
  92 + {
  93 + "code": "440000",
  94 + "name": "广东省",
  95 + "province": "44"
  96 + },
  97 + {
  98 + "code": "450000",
  99 + "name": "广西壮族自治区",
  100 + "province": "45"
  101 + },
  102 + {
  103 + "code": "460000",
  104 + "name": "海南省",
  105 + "province": "46"
  106 + },
  107 + {
  108 + "code": "500000",
  109 + "name": "重庆市",
  110 + "province": "50"
  111 + },
  112 + {
  113 + "code": "510000",
  114 + "name": "四川省",
  115 + "province": "51"
  116 + },
  117 + {
  118 + "code": "520000",
  119 + "name": "贵州省",
  120 + "province": "52"
  121 + },
  122 + {
  123 + "code": "530000",
  124 + "name": "云南省",
  125 + "province": "53"
  126 + },
  127 + {
  128 + "code": "540000",
  129 + "name": "西藏自治区",
  130 + "province": "54"
  131 + },
  132 + {
  133 + "code": "610000",
  134 + "name": "陕西省",
  135 + "province": "61"
  136 + },
  137 + {
  138 + "code": "620000",
  139 + "name": "甘肃省",
  140 + "province": "62"
  141 + },
  142 + {
  143 + "code": "630000",
  144 + "name": "青海省",
  145 + "province": "63"
  146 + },
  147 + {
  148 + "code": "640000",
  149 + "name": "宁夏回族自治区",
  150 + "province": "64"
  151 + },
  152 + {
  153 + "code": "650000",
  154 + "name": "新疆维吾尔自治区",
  155 + "province": "65"
  156 + },
  157 + {
  158 + "code": "710000",
  159 + "name": "台湾省",
  160 + "province": "71"
  161 + },
  162 + {
  163 + "code": "810000",
  164 + "name": "香港特别行政区",
  165 + "province": "81"
  166 + },
  167 + {
  168 + "code": "820000",
  169 + "name": "澳门特别行政区",
  170 + "province": "82"
  171 + }
  172 +]
@@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/domain"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/im" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/im"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/repository" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/repository"
  10 + "time"
10 ) 11 )
11 12
12 // PgImService 网易云信IM服务 13 // PgImService 网易云信IM服务
@@ -53,6 +54,7 @@ func (ptr *PgImService) InitOrUpdateUserIMInfo(userId int64, flag int) (*domain. @@ -53,6 +54,7 @@ func (ptr *PgImService) InitOrUpdateUserIMInfo(userId int64, flag int) (*domain.
53 userBase.Im.CsAccountId = fmt.Sprintf("%v", getRandomCustomerAccount(userId)) 54 userBase.Im.CsAccountId = fmt.Sprintf("%v", getRandomCustomerAccount(userId))
54 } 55 }
55 userBase.Im.ImToken = checkImResponse.ImToken 56 userBase.Im.ImToken = checkImResponse.ImToken
  57 + userBase.LastLogIn(time.Now())
56 if userBase, err = userBaseRepository.Save(userBase); err != nil { 58 if userBase, err = userBaseRepository.Save(userBase); err != nil {
57 59
58 } 60 }
@@ -13,8 +13,8 @@ type Company struct { @@ -13,8 +13,8 @@ type Company struct {
13 CompanyConfig *domain.CompanyConfig `comment:"企业配置信息"` 13 CompanyConfig *domain.CompanyConfig `comment:"企业配置信息"`
14 // 企业基本信息 14 // 企业基本信息
15 CompanyInfo *domain.CompanyInfo `comment:"企业基本信息"` 15 CompanyInfo *domain.CompanyInfo `comment:"企业基本信息"`
16 - // 公司状态 1:已注册 2:待认证 3:已认证  
17 - Status int `comment:"公司状态 1:已注册 2:待认证 3:已认证"` 16 + // 公司状态 1:已注册(待审核) 2:已通过 3:已拒绝
  17 + Status int `comment:"公司状态 1:已注册(待审核) 2:已通过 3:已拒绝"`
18 // 创建时间 18 // 创建时间
19 CreatedAt time.Time `comment:"创建时间"` 19 CreatedAt time.Time `comment:"创建时间"`
20 // 更新时间 20 // 更新时间
@@ -150,6 +150,10 @@ func (repository *CompanyRepository) Find(queryOptions map[string]interface{}) ( @@ -150,6 +150,10 @@ func (repository *CompanyRepository) Find(queryOptions map[string]interface{}) (
150 companys := make([]*domain.Company, 0) 150 companys := make([]*domain.Company, 0)
151 query := sqlbuilder.BuildQuery(tx.Model(&companyModels), queryOptions) 151 query := sqlbuilder.BuildQuery(tx.Model(&companyModels), queryOptions)
152 query.SetOffsetAndLimit(20) 152 query.SetOffsetAndLimit(20)
  153 + query.SetWhereByQueryOption("status =?", "status")
  154 + if v, ok := queryOptions["companyName"]; ok && len(v.(string)) > 0 {
  155 + query.Where("company_info->>'companyName' like ?", fmt.Sprintf("%%%v%%", v))
  156 + }
153 query.SetOrderDirect("company_id", "DESC") 157 query.SetOrderDirect("company_id", "DESC")
154 if count, err := query.SelectAndCount(); err != nil { 158 if count, err := query.SelectAndCount(); err != nil {
155 return 0, companys, err 159 return 0, companys, err
@@ -201,6 +201,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int @@ -201,6 +201,9 @@ func (repository *UserRepository) Find(queryOptions map[string]interface{}) (int
201 if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int64)) > 0 { 201 if v, ok := queryOptions["inOrgIds"]; ok && len(v.([]int64)) > 0 {
202 query.Where(`organization_id in (?)`, pg.In(v)) 202 query.Where(`organization_id in (?)`, pg.In(v))
203 } 203 }
  204 + if v, ok := queryOptions["inCompanyIds"]; ok && len(v.([]int64)) > 0 {
  205 + query.Where(`company_id in (?)`, pg.In(v))
  206 + }
204 query.SetWhereByQueryOption("user_base_id=?", "userBaseId") 207 query.SetWhereByQueryOption("user_base_id=?", "userBaseId")
205 query.SetWhereByQueryOption("(user_type & ?)>0", "userType") 208 query.SetWhereByQueryOption("(user_type & ?)>0", "userType")
206 query.SetWhereByQueryOption("enable_status=?", "enableStatus") 209 query.SetWhereByQueryOption("enable_status=?", "enableStatus")
  1 +package controllers
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/web/beego"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/area"
  6 +)
  7 +
  8 +type AreaController struct {
  9 + beego.BaseController
  10 +}
  11 +
  12 +func (controller *AreaController) ProvinceList() {
  13 + data := area.Provinces()
  14 + controller.Response(map[string]interface{}{
  15 + "provinces": data,
  16 + }, nil)
  17 +}
  18 +
  19 +func (controller *AreaController) ProvinceCities() {
  20 + code := controller.GetString(":code")
  21 + data := area.ProvinceCities(code)
  22 + controller.Response(map[string]interface{}{
  23 + "cities": data,
  24 + }, nil)
  25 +}
@@ -29,6 +29,26 @@ func (controller *CompanyController) UpdateCompany() { @@ -29,6 +29,26 @@ func (controller *CompanyController) UpdateCompany() {
29 controller.Response(data, err) 29 controller.Response(data, err)
30 } 30 }
31 31
  32 +func (controller *CompanyController) AuditCompany() {
  33 + companyService := service.NewCompanyService(nil)
  34 + updateCompanyCommand := &command.AuditCompanyCommand{}
  35 + controller.Unmarshal(updateCompanyCommand)
  36 + companyId, _ := controller.GetInt64(":companyId")
  37 + updateCompanyCommand.CompanyId = companyId
  38 + data, err := companyService.AuditCompany(updateCompanyCommand)
  39 + controller.Response(data, err)
  40 +}
  41 +
  42 +func (controller *CompanyController) EnableCompany() {
  43 + companyService := service.NewCompanyService(nil)
  44 + updateCompanyCommand := &command.EnableCompanyCommand{}
  45 + controller.Unmarshal(updateCompanyCommand)
  46 + companyId, _ := controller.GetInt64(":companyId")
  47 + updateCompanyCommand.CompanyId = companyId
  48 + data, err := companyService.EnableCompany(updateCompanyCommand)
  49 + controller.Response(data, err)
  50 +}
  51 +
32 func (controller *CompanyController) GetCompany() { 52 func (controller *CompanyController) GetCompany() {
33 companyService := service.NewCompanyService(nil) 53 companyService := service.NewCompanyService(nil)
34 getCompanyQuery := &query.GetCompanyQuery{} 54 getCompanyQuery := &query.GetCompanyQuery{}
@@ -51,6 +71,7 @@ func (controller *CompanyController) RemoveCompany() { @@ -51,6 +71,7 @@ func (controller *CompanyController) RemoveCompany() {
51 func (controller *CompanyController) ListCompany() { 71 func (controller *CompanyController) ListCompany() {
52 companyService := service.NewCompanyService(nil) 72 companyService := service.NewCompanyService(nil)
53 listCompanyQuery := &query.ListCompanyQuery{} 73 listCompanyQuery := &query.ListCompanyQuery{}
  74 + controller.Unmarshal(listCompanyQuery)
54 data, err := companyService.ListCompany(listCompanyQuery) 75 data, err := companyService.ListCompany(listCompanyQuery)
55 controller.Response(data, err) 76 controller.Response(data, err)
56 } 77 }
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/port/beego/controllers"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/area/province", &controllers.AreaController{}, "Get:ProvinceList")
  10 + web.Router("/area/province/:code/cities", &controllers.AreaController{}, "Get:ProvinceCities")
  11 +}
@@ -14,6 +14,9 @@ func init() { @@ -14,6 +14,9 @@ func init() {
14 web.Router("/company/:companyId/customize-menus/", &controllers.CompanyController{}, "Get:ListCompanyCustomizeMenus") 14 web.Router("/company/:companyId/customize-menus/", &controllers.CompanyController{}, "Get:ListCompanyCustomizeMenus")
15 web.Router("/company/:companyId/customize-menus", &controllers.CompanyController{}, "Put:UpdateCompanyCustomizeMenus") 15 web.Router("/company/:companyId/customize-menus", &controllers.CompanyController{}, "Put:UpdateCompanyCustomizeMenus")
16 16
  17 + web.Router("/company/:companyId/audit", &controllers.CompanyController{}, "Post:AuditCompany")
  18 + web.Router("/company/:companyId/enable", &controllers.CompanyController{}, "Post:EnableCompany")
  19 +
17 // 适配web 20 // 适配web
18 //web.Router("/v1/web/menus/search", &controllers.CompanyController{}, "Post:SearchCompanyCustomizeMenus") 21 //web.Router("/v1/web/menus/search", &controllers.CompanyController{}, "Post:SearchCompanyCustomizeMenus")
19 //web.Router("/v1/web/menus", &controllers.CompanyController{}, "Put:AdapterUpdateCompanyCustomizeMenus") 22 //web.Router("/v1/web/menus", &controllers.CompanyController{}, "Put:AdapterUpdateCompanyCustomizeMenus")