调整UI
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"videoweb/app/service/authser"
|
||||
"videoweb/app/service/commentser"
|
||||
"videoweb/app/service/playletser"
|
||||
"videoweb/app/service/videoser"
|
||||
@@ -92,13 +90,9 @@ func Play(c *gin.Context) {
|
||||
SortOrder: commentser.SortHot,
|
||||
})
|
||||
|
||||
unlockCost := int64(0)
|
||||
balance := int64(0)
|
||||
canWatch := false
|
||||
episode := 0
|
||||
if chapter != nil {
|
||||
unlockCost = chapter.UnlockCost()
|
||||
balance = chapter.Balance
|
||||
canWatch = chapter.AllowWatch()
|
||||
episode = chapter.CurrentEpisode
|
||||
}
|
||||
@@ -117,9 +111,6 @@ func Play(c *gin.Context) {
|
||||
if episode <= 0 {
|
||||
episode = 1
|
||||
}
|
||||
if unlockCost <= 0 {
|
||||
unlockCost = int64(playletser.FirstUnlockCost(playlet.PlayletChapterInfo))
|
||||
}
|
||||
|
||||
previewURL := strings.TrimSpace(playlet.Preview)
|
||||
mainURL := ""
|
||||
@@ -139,9 +130,6 @@ func Play(c *gin.Context) {
|
||||
"mainURL": mainURL,
|
||||
"previewURL": previewURL,
|
||||
"hasPreview": previewURL != "",
|
||||
"unlockCost": unlockCost,
|
||||
"balance": balance,
|
||||
"balanceText": authser.FormatRecharge(balance),
|
||||
"nextChapterID": playletser.NextChapterID(playlet, chapterID),
|
||||
"advitise": playlet.Advitise,
|
||||
"related": playlet.RelatedRecommendData,
|
||||
@@ -157,7 +145,6 @@ func Play(c *gin.Context) {
|
||||
"commentSize": comments.PageSize,
|
||||
"commentObjectID": commentObjectID,
|
||||
"commentObjectType": commentObjectType,
|
||||
"trackerDrama": dramaTrackingData(playlet, chapter, chapterID, episode),
|
||||
"playResponse": gin.H{
|
||||
"playlet": playlet,
|
||||
"chapter": chapter,
|
||||
@@ -174,76 +161,9 @@ func Play(c *gin.Context) {
|
||||
},
|
||||
}
|
||||
data["canonicalPath"] = playletser.PlayPath(playlet.Slug, playlet.ID)
|
||||
attachRechargeModal(c, data)
|
||||
HTMLOK(c, "play.html", data)
|
||||
}
|
||||
|
||||
func dramaTrackingData(playlet *playletser.PlayletInfoResp, chapter *playletser.PlayletChapterInfoResp, chapterID int64, episode int) gin.H {
|
||||
name := strings.TrimSpace(playlet.PlayName)
|
||||
if name == "" {
|
||||
name = strings.TrimSpace(playlet.Title)
|
||||
}
|
||||
totalEpisode := playlet.TotalEpisode
|
||||
if totalEpisode <= 0 {
|
||||
totalEpisode = len(playlet.PlayletChapterInfo)
|
||||
}
|
||||
if totalEpisode <= 0 {
|
||||
totalEpisode = 1
|
||||
}
|
||||
data := gin.H{
|
||||
"MediaID": "",
|
||||
"DramaID": playlet.ID,
|
||||
"DramaTitle": name,
|
||||
"Episode": max(1, episode),
|
||||
"TotalEpisode": totalEpisode,
|
||||
"VideoID": chapterID,
|
||||
"DramaTypeID": "default",
|
||||
"DramaTypeName": "默认分类",
|
||||
"DramaTagKey": "default",
|
||||
"DramaTagName": "默认标签",
|
||||
"DramaDuration": 0,
|
||||
"RecommendTraceID": "",
|
||||
}
|
||||
if chapter != nil {
|
||||
if chapter.ID > 0 {
|
||||
data["VideoID"] = chapter.ID
|
||||
}
|
||||
if chapter.MediaTime > 0 {
|
||||
data["DramaDuration"] = chapter.MediaTime
|
||||
}
|
||||
}
|
||||
for i, id := range playlet.ThemeIDs {
|
||||
if id <= 0 || i >= len(playlet.ThemeNames) {
|
||||
continue
|
||||
}
|
||||
name := strings.TrimSpace(playlet.ThemeNames[i])
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
data["DramaTypeID"] = strconv.FormatInt(id, 10)
|
||||
data["DramaTypeName"] = name
|
||||
break
|
||||
}
|
||||
tagIDs := make([]string, 0, len(playlet.TagIDs))
|
||||
tagNames := make([]string, 0, len(playlet.TagIDs))
|
||||
for i, id := range playlet.TagIDs {
|
||||
if id <= 0 || i >= len(playlet.TagNames) {
|
||||
continue
|
||||
}
|
||||
name := strings.TrimSpace(playlet.TagNames[i])
|
||||
if name == "" {
|
||||
continue
|
||||
}
|
||||
tagIDs = append(tagIDs, strconv.FormatInt(id, 10))
|
||||
tagNames = append(tagNames, name)
|
||||
}
|
||||
if len(tagIDs) > 0 {
|
||||
data["DramaTagKey"] = strings.Join(tagIDs, ",")
|
||||
data["DramaTagName"] = strings.Join(tagNames, ",")
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// SeriesPlay 视频播放页:GET /api/app/video/detail。
|
||||
// 文档:http://172.104.181.99:25319/swagger/index.html#/视频相关接口/get_api_app_video_detail
|
||||
func SeriesPlay(c *gin.Context) {
|
||||
@@ -369,8 +289,6 @@ func SeriesPlay(c *gin.Context) {
|
||||
"list": comments.List,
|
||||
"apis": []string{
|
||||
"GET /api/app/comment/list",
|
||||
"POST /api/app/comment/send",
|
||||
"POST /api/app/comment/like/set",
|
||||
},
|
||||
},
|
||||
"playDebug": gin.H{
|
||||
@@ -383,6 +301,5 @@ func SeriesPlay(c *gin.Context) {
|
||||
if strings.TrimSpace(c.Param("guessPage")) != "" {
|
||||
data["canonicalPath"] = videoser.VideoPlayURL(video.Slug, video.ID)
|
||||
}
|
||||
attachRechargeModal(c, data)
|
||||
HTMLOK(c, "seriesPlay.html", data)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user