|
@@ -100,15 +100,15 @@ func (m *Media) ToMediaView() (message *MediaView) {
|
|
|
}
|
|
|
func (m *Media) ToMessageView() (message *MessageMedia) {
|
|
|
message = &MessageMedia{
|
|
|
- MediaId: m.Id,
|
|
|
- AuthorId: m.AuthorId,
|
|
|
- AuthorName: m.AuthorName,
|
|
|
- MediaType: m.MediaType,
|
|
|
- Src: m.Src,
|
|
|
- CoverSrc: m.CoverSrc,
|
|
|
- MediaName: m.MediaName,
|
|
|
- SourceType: m.SourceType,
|
|
|
- //SendStatus: m.SendStatus,
|
|
|
+ MediaId: m.Id,
|
|
|
+ AuthorId: m.AuthorId,
|
|
|
+ AuthorName: m.AuthorName,
|
|
|
+ MediaType: m.MediaType,
|
|
|
+ Src: m.Src,
|
|
|
+ CoverSrc: m.CoverSrc,
|
|
|
+ MediaName: m.MediaName,
|
|
|
+ SourceType: m.SourceType,
|
|
|
+ SendStatus: m.SendStatus,
|
|
|
MediaPlayMilliseconds: m.MediaPlayMilliseconds,
|
|
|
PermissionIds: m.PermissionIds,
|
|
|
PublishedTime: m.PublishedTime.Format(time.DateTime),
|
|
@@ -141,36 +141,36 @@ func (m *Media) ToMessageView() (message *MessageMedia) {
|
|
|
}
|
|
|
|
|
|
type MessageMedia struct {
|
|
|
- MediaId int `json:"mediaId"`
|
|
|
- AuthorId int `json:"authorId"`
|
|
|
- AuthorName string `json:"authorName"`
|
|
|
- CoverSrc string `json:"coverSrc"`
|
|
|
- MediaType MediaType `json:"mediaType"`
|
|
|
- Src string `json:"src"`
|
|
|
- MediaName string `json:"mediaName"`
|
|
|
- SourceType string `json:"sourceType"`
|
|
|
- //SendStatus SendStatus `json:"sendStatus"`
|
|
|
- MediaPlayMilliseconds int `json:"mediaPlayMilliseconds"`
|
|
|
- PermissionIds string `json:"permissionIds"`
|
|
|
- PermissionNames string `description:"permission_names"`
|
|
|
- PublishedTime string `json:"publishedTime"`
|
|
|
+ MediaId int `json:"mediaId"`
|
|
|
+ AuthorId int `json:"authorId"`
|
|
|
+ AuthorName string `json:"authorName"`
|
|
|
+ CoverSrc string `json:"coverSrc"`
|
|
|
+ MediaType MediaType `json:"mediaType"`
|
|
|
+ Src string `json:"src"`
|
|
|
+ MediaName string `json:"mediaName"`
|
|
|
+ SourceType string `json:"sourceType"`
|
|
|
+ SendStatus SendStatus `json:"sendStatus"`
|
|
|
+ MediaPlayMilliseconds int `json:"mediaPlayMilliseconds"`
|
|
|
+ PermissionIds string `json:"permissionIds"`
|
|
|
+ PermissionNames string `description:"permission_names"`
|
|
|
+ PublishedTime string `json:"publishedTime"`
|
|
|
}
|
|
|
type Media struct {
|
|
|
- Id int `orm:"pk;auto" description:"id"`
|
|
|
- AuthorId int `description:"author_id"`
|
|
|
- AuthorName string `description:"author_name"`
|
|
|
- CoverSrc string `description:"cover_src"`
|
|
|
- MediaType MediaType `description:"media_type"`
|
|
|
- Src string `description:"src"`
|
|
|
- MediaName string `description:"media_name"`
|
|
|
- SourceType string `description:"source_type"`
|
|
|
- MediaPlayMilliseconds int `description:"media_play_milliseconds"`
|
|
|
- PermissionIds string `description:"permission_ids"`
|
|
|
- PublishedTime time.Time `description:"published_time"`
|
|
|
- //SendStatus SendStatus `json:"sendStatus"`
|
|
|
- Deleted int `description:"deleted"`
|
|
|
- CreatedTime time.Time `description:"created_time"`
|
|
|
- UpdatedTime time.Time `description:"updated_time"`
|
|
|
+ Id int `orm:"pk;auto" description:"id"`
|
|
|
+ AuthorId int `description:"author_id"`
|
|
|
+ AuthorName string `description:"author_name"`
|
|
|
+ CoverSrc string `description:"cover_src"`
|
|
|
+ MediaType MediaType `description:"media_type"`
|
|
|
+ Src string `description:"src"`
|
|
|
+ MediaName string `description:"media_name"`
|
|
|
+ SourceType string `description:"source_type"`
|
|
|
+ MediaPlayMilliseconds int `description:"media_play_milliseconds"`
|
|
|
+ PermissionIds string `description:"permission_ids"`
|
|
|
+ PublishedTime time.Time `description:"published_time"`
|
|
|
+ SendStatus SendStatus `json:"sendStatus"`
|
|
|
+ Deleted int `description:"deleted"`
|
|
|
+ CreatedTime time.Time `description:"created_time"`
|
|
|
+ UpdatedTime time.Time `description:"updated_time"`
|
|
|
}
|
|
|
|
|
|
func GetMediaCountByCondition(media MediaType, condition string, pars []interface{}) (count int, err error) {
|
|
@@ -184,7 +184,7 @@ func GetMediaCountByCondition(media MediaType, condition string, pars []interfac
|
|
|
}
|
|
|
func (m *Media) UpdateSendStatus(statusType SendStatus) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- //m.SendStatus = statusType
|
|
|
+ m.SendStatus = statusType
|
|
|
_, err = o.Update(m, "send_status")
|
|
|
return
|
|
|
}
|