|
@@ -1078,4 +1078,186 @@ func (this *UserController) AskList() {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 我的收藏微路演列表
|
|
|
+// @Description 我的收藏微路演列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Success 200 {object} models.HomeListResp
|
|
|
+// @router /collect/microRoadShow [get]
|
|
|
+func (this *UserController) Mycollect() {
|
|
|
+ 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")
|
|
|
+
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ userId := user.UserId
|
|
|
+ listMycollect, err := models.GetUserMicroRoadshowCollectList(userId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var audioIds []string
|
|
|
+ var videoIds []string
|
|
|
+ var activityVideoIds []string
|
|
|
+ for _, item := range listMycollect {
|
|
|
+ if item.ActivityVoiceId > 0 {
|
|
|
+ audioIds = append(audioIds, strconv.Itoa(item.ActivityVoiceId))
|
|
|
+ } else if item.VideoId > 0 {
|
|
|
+ videoIds = append(videoIds, strconv.Itoa(item.VideoId))
|
|
|
+ } else if item.ActivityVideoId > 0 {
|
|
|
+ activityVideoIds = append(activityVideoIds, strconv.Itoa(item.ActivityVideoId))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(audioIds) == 0 && len(videoIds) == 0 && len(activityVideoIds) == 0 {
|
|
|
+ resp := new(models.MicroRoadShowListResp)
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, 0)
|
|
|
+ resp.List = make([]*models.MicroRoadShowPageList, 0)
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ audioIdstr := strings.Join(audioIds, ",")
|
|
|
+ ideoIdsStr := strings.Join(videoIds, ",")
|
|
|
+ activityVideoIdsStr := strings.Join(activityVideoIds, ",")
|
|
|
+ // 微路演列表
|
|
|
+ list, total, e := services.GetMicroRoadShowMycollect(pageSize, currentIndex, audioIdstr, ideoIdsStr, activityVideoIdsStr)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, item := range list {
|
|
|
+ if item.Type == 1 {
|
|
|
+ //音频
|
|
|
+ count, err := models.GetVoiceCollectCount(user.UserId, item.Id)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if count > 0 {
|
|
|
+ item.IsCollect = true
|
|
|
+ }
|
|
|
+ } else if item.Type == 2 {
|
|
|
+ //活动视频
|
|
|
+ count, err := models.GetActivityVideoCollectCount(user.UserId, item.Id)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if count > 0 {
|
|
|
+ item.IsCollect = true
|
|
|
+ }
|
|
|
+ } else if item.Type == 3 {
|
|
|
+ //微路演视频
|
|
|
+ count, err := models.GetVideoCollectCount(user.UserId, item.Id)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取数据失败!"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if count > 0 {
|
|
|
+ item.IsCollect = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 用户权限
|
|
|
+ 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
|
|
|
}
|