1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package user
- import (
- userDao "eta/eta_mini_ht_api/models/user"
- )
- 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"`
- }
- type MetaData struct {
- SourceId int `json:"reportId"`
- AuthorId int `json:"AuthorId"`
- AuthorName string `json:"authorName"`
- PublishedTime string `json:"publishedTime"`
- }
- 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)
- }
|