package message import ( userDao "eta/eta_mini_ht_api/models/message" ) type MetaInfoDTO struct { Id int `json:"id"` Meta string `json:"Meta,omitempty"` From string `json:"From,omitempty"` To string `json:"To,omitempty"` SourceType string `json:"SourceType,omitempty"` MetaType string `json:"MetaType,omitempty"` } func CreateMetaInfo(dto MetaInfoDTO) (err error) { return userDao.CreateMetaInfo(convertToMetaInfo(dto)) } func convertToMetaInfo(dto MetaInfoDTO) userDao.MetaInfo { return userDao.MetaInfo{ Meta: dto.Meta, From: dto.From, To: dto.To, SourceType: userDao.SourceType(dto.SourceType), MetaType: userDao.MetaType(dto.MetaType), } } func convertToMetaDTO(dto userDao.MetaInfo) MetaInfoDTO { return MetaInfoDTO{ Id: dto.Id, Meta: dto.Meta, From: dto.From, To: dto.To, SourceType: string(dto.SourceType), MetaType: string(dto.MetaType), } } func GetInitMetaInfos() (list []MetaInfoDTO) { metas := userDao.GetInitMetaInfos() for _, meta := range metas { list = append(list, convertToMetaDTO(meta)) } return } func PendingMetaInfo(id int) bool { return userDao.PendingMetaInfo(id) }