123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package user
- import (
- logger "eta/eta_mini_ht_api/common/component/log"
- "eta/eta_mini_ht_api/models/user"
- )
- type AreaCodeDTO struct {
- CodeName string `json:"codeName"`
- CodeValue string `json:"codeValue"`
- }
- func GetAreaCodes() (areaCodes []AreaCodeDTO, err error) {
- list, err := user.GetAreaCodes()
- if err != nil {
- logger.Error("获取手机区号失败:%v", err)
- return
- }
- for _, areaCode := range list {
- areaCodes = append(areaCodes, convertToAreaCodeDTO(areaCode))
- }
- return
- }
- func GetValidAreaCodes() (areaCodes []AreaCodeDTO, err error) {
- list, err := user.GetValidAreaCodes()
- if err != nil {
- logger.Error("获取手机区号失败:%v", err)
- return
- }
- for _, areaCode := range list {
- areaCodes = append(areaCodes, convertToAreaCodeDTO(areaCode))
- }
- return
- }
- func convertToAreaCodeDTO(areaCode user.AreaCode) AreaCodeDTO {
- return AreaCodeDTO{
- CodeName: areaCode.CodeName,
- CodeValue: areaCode.CodeValue,
- }
- }
|