|
@@ -2,8 +2,10 @@ package controllers
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_clpt/models"
|
|
|
"hongze/hongze_clpt/services"
|
|
|
+ "hongze/hongze_clpt/utils"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
)
|
|
@@ -13,6 +15,129 @@ type MicroRoadShowController struct {
|
|
|
BaseAuthController
|
|
|
}
|
|
|
|
|
|
+// @Title 微路演列表
|
|
|
+// @Description 微路演列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param KeyWord query string false "搜索关键词"
|
|
|
+// @Param AudioId query int false "音频ID"
|
|
|
+// @Param VideoId query int false "视频ID"
|
|
|
+// @Param ActivityVideoId query int false "活动视频ID"
|
|
|
+// @Param Filter query int false "筛选条件 0:全部 1:视频 2:音频"
|
|
|
+// @Success 200 {object} models.HomeListResp
|
|
|
+// @router /list [get]
|
|
|
+func (this *MicroRoadShowController) List() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ keywords := this.GetString("KeyWord")
|
|
|
+ audioId, _ := this.GetInt("AudioId")
|
|
|
+ videoId, _ := this.GetInt("VideoId")
|
|
|
+ activityVideoId, _ := this.GetInt("ActivityVideoId")
|
|
|
+ filter, _ := this.GetInt("Filter", 0)
|
|
|
+
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+
|
|
|
+ // 微路演列表
|
|
|
+ list, total, e := services.GetMicroRoadShowPageListV8(pageSize, currentIndex, audioId, videoId, activityVideoId, filter, keywords)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 用户权限
|
|
|
+ authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取默认图配置
|
|
|
+ audioMap, videoMap, audioShareMap, videoShareMap, e := services.GetMicroRoadShowDefaultImgConfig()
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for i := range list {
|
|
|
+ // 权限
|
|
|
+ au := new(models.UserPermissionAuthInfo)
|
|
|
+ au.SellerName = authInfo.SellerName
|
|
|
+ au.SellerMobile = authInfo.SellerMobile
|
|
|
+ au.HasPermission = authInfo.HasPermission
|
|
|
+ au.OperationMode = authInfo.OperationMode
|
|
|
+ if au.HasPermission == 1 {
|
|
|
+ // 非宏观权限进一步判断是否有权限
|
|
|
+ if list[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, list[i].ChartPermissionName) {
|
|
|
+ au.HasPermission = 2
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 无权限的弹框提示
|
|
|
+ if au.HasPermission != 1 {
|
|
|
+ if au.OperationMode == services.UserPermissionOperationModeCall {
|
|
|
+ if list[i].Type == 1 {
|
|
|
+ au.PopupMsg = services.UserPermissionPopupMsgCallActivity
|
|
|
+ } else {
|
|
|
+ au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if list[i].Type == 1 {
|
|
|
+ au.PopupMsg = services.UserPermissionPopupMsgApplyActivity
|
|
|
+ } else {
|
|
|
+ au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list[i].AuthInfo = au
|
|
|
+ list[i].PublishTime = utils.StrTimeToTime(list[i].PublishTime).Format(utils.FormatDate)
|
|
|
+ // 默认图
|
|
|
+ if list[i].BackgroundImg == "" {
|
|
|
+ if list[i].Type == 1 {
|
|
|
+ list[i].BackgroundImg = audioMap[list[i].ChartPermissionId]
|
|
|
+ } else {
|
|
|
+ list[i].BackgroundImg = videoMap[list[i].ChartPermissionId]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 分享图
|
|
|
+ if list[i].ShareImg == "" {
|
|
|
+ if list[i].Type == 1 {
|
|
|
+ list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
|
|
|
+ } else {
|
|
|
+ list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ resp := new(models.MicroRoadShowListResp)
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ resp.List = list
|
|
|
+ resp.Paging = page
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
// @Title 视频详情
|
|
|
// @Description 时间线接口
|
|
|
// @Param VideoId query int true "视频ID"
|