You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.0 KiB

package DataEX
import (
"fmt"
"time"
)
type ESData struct {
SystemId string `json:"system_id"`
DatasourceId string `json:"datasource_id"`
ProvinceId string `json:"province_code"`
ProvinceName string `json:"province_name"`
CityId string `json:"city_code"`
CityName string `json:"city_name"`
AreaId string `json:"district_code"`
AreaName string `json:"district_name"`
Area2Id string `json:"district2_code"`
Area2Name string `json:"district2_name"`
Area3Id string `json:"district3_code"`
Area3Name string `json:"district3_name"`
BureauId string `json:"bureau_id"`
RegionId string `json:"region_id"`
MainId string `json:"main_id"`
OrgId string `json:"org_id"`
OrgName string `json:"org_name" `
OrgType int `json:"org_type"`
SchoolType string `json:"school_type"`
SchoolTypeName string `json:"school_typename"`
DeptId string `json:"dept_id"`
StageId string `json:"stage_id"`
GradeId string `json:"grade_id"`
ClassId string `json:"class_id"`
DataId string `json:"data_id"`
FileUri string `json:"file_uri"`
BeginTime JsonDate `json:"begin_time"`
EndTime JsonDate `json:"end_time"`
DelFlag int `json:"del_flag"`
EnableFlag int `json:"enable_flag"`
DataContent map[string]interface{} `json:"data_content"`
}
//add by zhangjun 2020-07-01
type JsonDate time.Time
const (
timeFormat = "2006/01/02 15:04:05"
)
// JsonDate反序列化
func (t *JsonDate) UnmarshalJSON(data []byte) (err error) {
newTime, err := time.ParseInLocation("\""+timeFormat+"\"", string(data), time.Local)
*t = JsonDate(newTime)
return
}
// JsonDate序列化
func (t JsonDate) MarshalJSON() ([]byte, error) {
timeStr := fmt.Sprintf("\"%s\"", time.Time(t).Format(timeFormat))
return []byte(timeStr),nil
}
// string方法
func (t JsonDate) String() string {
return time.Time(t).Format(timeFormat)
}