|
@@ -25,6 +25,7 @@ func (m *Media) ToView() *ESMedia {
|
|
AuthorId: m.AuthorId,
|
|
AuthorId: m.AuthorId,
|
|
AuthorName: m.AuthorName,
|
|
AuthorName: m.AuthorName,
|
|
MediaType: m.MediaType,
|
|
MediaType: m.MediaType,
|
|
|
|
+ CoverSrc: m.CoverSrc,
|
|
Src: m.Src,
|
|
Src: m.Src,
|
|
MediaName: m.MediaName,
|
|
MediaName: m.MediaName,
|
|
SourceType: m.SourceType,
|
|
SourceType: m.SourceType,
|
|
@@ -38,7 +39,7 @@ type ESMedia struct {
|
|
MediaId int `json:"mediaId"`
|
|
MediaId int `json:"mediaId"`
|
|
AuthorId int `json:"authorId"`
|
|
AuthorId int `json:"authorId"`
|
|
AuthorName string `json:"authorName"`
|
|
AuthorName string `json:"authorName"`
|
|
- CoverSrc int `json:"coverSrc"`
|
|
|
|
|
|
+ CoverSrc string `json:"coverSrc"`
|
|
MediaType MediaType `json:"mediaType"`
|
|
MediaType MediaType `json:"mediaType"`
|
|
Src string `json:"src"`
|
|
Src string `json:"src"`
|
|
MediaName string `json:"mediaName"`
|
|
MediaName string `json:"mediaName"`
|
|
@@ -69,23 +70,24 @@ func (m *Media) ToMediaView() (message *MediaView) {
|
|
AuthorName: m.AuthorName,
|
|
AuthorName: m.AuthorName,
|
|
MediaType: m.MediaType,
|
|
MediaType: m.MediaType,
|
|
Src: m.Src,
|
|
Src: m.Src,
|
|
|
|
+ CoverSrc: m.CoverSrc,
|
|
MediaName: m.MediaName,
|
|
MediaName: m.MediaName,
|
|
SourceType: m.SourceType,
|
|
SourceType: m.SourceType,
|
|
MediaPlayMilliseconds: m.MediaPlayMilliseconds,
|
|
MediaPlayMilliseconds: m.MediaPlayMilliseconds,
|
|
PermissionIds: m.PermissionIds,
|
|
PermissionIds: m.PermissionIds,
|
|
PublishedTime: m.PublishedTime.Format(time.DateTime),
|
|
PublishedTime: m.PublishedTime.Format(time.DateTime),
|
|
}
|
|
}
|
|
- image, err := GetImageById(m.CoverSrc)
|
|
|
|
- if err != nil || image == nil {
|
|
|
|
- message.CoverSrc = ""
|
|
|
|
- } else {
|
|
|
|
- message.CoverSrc = image.SrcUrl
|
|
|
|
- }
|
|
|
|
|
|
+ //image, err := GetImageById(m.CoverSrc)
|
|
|
|
+ //if err != nil || image == nil {
|
|
|
|
+ // message.CoverSrc = ""
|
|
|
|
+ //} else {
|
|
|
|
+ // message.CoverSrc = image.SrcUrl
|
|
|
|
+ //}
|
|
ids := strings.Split(m.PermissionIds, ",")
|
|
ids := strings.Split(m.PermissionIds, ",")
|
|
var idList []int
|
|
var idList []int
|
|
for _, id := range ids {
|
|
for _, id := range ids {
|
|
var idInt int
|
|
var idInt int
|
|
- idInt, err = strconv.Atoi(id)
|
|
|
|
|
|
+ idInt, err := strconv.Atoi(id)
|
|
if err != nil {
|
|
if err != nil {
|
|
utils.FileLog.Error("转换品种名称失败:%v", err)
|
|
utils.FileLog.Error("转换品种名称失败:%v", err)
|
|
break
|
|
break
|
|
@@ -108,6 +110,7 @@ func (m *Media) ToMessageView() (message *MessageMedia) {
|
|
AuthorName: m.AuthorName,
|
|
AuthorName: m.AuthorName,
|
|
MediaType: m.MediaType,
|
|
MediaType: m.MediaType,
|
|
Src: m.Src,
|
|
Src: m.Src,
|
|
|
|
+ CoverSrc: m.CoverSrc,
|
|
MediaName: m.MediaName,
|
|
MediaName: m.MediaName,
|
|
SourceType: m.SourceType,
|
|
SourceType: m.SourceType,
|
|
SendStatus: m.SendStatus,
|
|
SendStatus: m.SendStatus,
|
|
@@ -115,17 +118,17 @@ func (m *Media) ToMessageView() (message *MessageMedia) {
|
|
PermissionIds: m.PermissionIds,
|
|
PermissionIds: m.PermissionIds,
|
|
PublishedTime: m.PublishedTime.Format(time.DateTime),
|
|
PublishedTime: m.PublishedTime.Format(time.DateTime),
|
|
}
|
|
}
|
|
- image, err := GetImageById(m.CoverSrc)
|
|
|
|
- if err != nil || image == nil {
|
|
|
|
- message.CoverSrc = ""
|
|
|
|
- } else {
|
|
|
|
- message.CoverSrc = image.SrcUrl
|
|
|
|
- }
|
|
|
|
|
|
+ //image, err := GetImageById(m.CoverSrc)
|
|
|
|
+ //if err != nil || image == nil {
|
|
|
|
+ // message.CoverSrc = ""
|
|
|
|
+ //} else {
|
|
|
|
+ // message.CoverSrc = image.SrcUrl
|
|
|
|
+ //}
|
|
ids := strings.Split(m.PermissionIds, ",")
|
|
ids := strings.Split(m.PermissionIds, ",")
|
|
var idList []int
|
|
var idList []int
|
|
for _, id := range ids {
|
|
for _, id := range ids {
|
|
var idInt int
|
|
var idInt int
|
|
- idInt, err = strconv.Atoi(id)
|
|
|
|
|
|
+ idInt, err := strconv.Atoi(id)
|
|
if err != nil {
|
|
if err != nil {
|
|
utils.FileLog.Error("转换品种名称失败:%v", err)
|
|
utils.FileLog.Error("转换品种名称失败:%v", err)
|
|
break
|
|
break
|
|
@@ -161,7 +164,7 @@ type Media struct {
|
|
Id int `orm:"pk;auto" description:"id"`
|
|
Id int `orm:"pk;auto" description:"id"`
|
|
AuthorId int `description:"author_id"`
|
|
AuthorId int `description:"author_id"`
|
|
AuthorName string `description:"author_name"`
|
|
AuthorName string `description:"author_name"`
|
|
- CoverSrc int `description:"cover_src"`
|
|
|
|
|
|
+ CoverSrc string `description:"cover_src"`
|
|
MediaType MediaType `description:"media_type"`
|
|
MediaType MediaType `description:"media_type"`
|
|
Src string `description:"src"`
|
|
Src string `description:"src"`
|
|
MediaName string `description:"media_name"`
|
|
MediaName string `description:"media_name"`
|