init
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/config"
|
||||
"SciencesServer/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Gender struct {
|
||||
@ -108,6 +110,23 @@ type Area struct {
|
||||
Address string `gorm:"column:address;type:varchar(255);default:null;comment:详细地址" json:"address"`
|
||||
}
|
||||
|
||||
func (m *Area) FormatBasic() string {
|
||||
address := make([]string, 0)
|
||||
address = append(address, config.SettingAreaInfo[config.DefaultChinaAreaCode][m.Province])
|
||||
|
||||
if m.City != "" {
|
||||
address = append(address, config.SettingAreaInfo[m.Province][m.City])
|
||||
}
|
||||
if m.District != "" {
|
||||
address = append(address, config.SettingAreaInfo[m.City][m.District])
|
||||
}
|
||||
return strings.Join(address, "-")
|
||||
}
|
||||
|
||||
func (m *Area) FormatDetail() string {
|
||||
return m.FormatBasic() + ";" + m.Address
|
||||
}
|
||||
|
||||
// Position 坐标信息
|
||||
type Position struct {
|
||||
Longitude float64 `json:"longitude"` // 经度
|
||||
|
Reference in New Issue
Block a user