|
@@ -3,9 +3,11 @@ package controllers
|
|
import (
|
|
import (
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
"hongze/hongze_clpt/models"
|
|
"hongze/hongze_clpt/models"
|
|
"hongze/hongze_clpt/services"
|
|
"hongze/hongze_clpt/services"
|
|
"hongze/hongze_clpt/utils"
|
|
"hongze/hongze_clpt/utils"
|
|
|
|
+ "sort"
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
"time"
|
|
"time"
|
|
@@ -153,10 +155,91 @@ func (this *UserController) Detail() {
|
|
}
|
|
}
|
|
resp := new(models.UserDetailResp)
|
|
resp := new(models.UserDetailResp)
|
|
resp.UserId = user.UserId
|
|
resp.UserId = user.UserId
|
|
|
|
+ resp.UserName = user.RealName
|
|
resp.Headimgurl = user.Headimgurl
|
|
resp.Headimgurl = user.Headimgurl
|
|
resp.Mobile = user.Mobile
|
|
resp.Mobile = user.Mobile
|
|
resp.Email = user.Email
|
|
resp.Email = user.Email
|
|
resp.CompanyName = user.CompanyName
|
|
resp.CompanyName = user.CompanyName
|
|
|
|
+ userDetail, err := models.GetUserDetailByUserId(user.UserId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取用户信息失败"
|
|
|
|
+ br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.OutboundCountryCode = userDetail.OutboundCountryCode
|
|
|
|
+ resp.OutboundMobile = userDetail.OutboundMobile
|
|
|
|
+
|
|
|
|
+ if user.CompanyId > 1 {
|
|
|
|
+ companyItem, err := models.GetCompanyDetailById(user.CompanyId)
|
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if companyItem != nil && companyItem.CompanyId > 0 {
|
|
|
|
+ resp.CompanyName = companyItem.CompanyName
|
|
|
|
+ //if companyItem.Status == "试用" || companyItem.Status == "永续" || companyItem.Status == "正式" {
|
|
|
|
+ //permissionStr, err := models.GetCompanyPermissionByUser(companyItem.CompanyId)
|
|
|
|
+ //if err != nil {
|
|
|
|
+ // br.Msg = "获取信息失败"
|
|
|
|
+ // br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ var permissionStr string
|
|
|
|
+ permissionList, err := models.GetCompanyPermissionList(companyItem.CompanyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ mapIsUpgrade := make(map[string]string)
|
|
|
|
+ mapZhukKeGuan := make(map[string]int)
|
|
|
|
+ for _, v := range permissionList {
|
|
|
|
+ mapZhukKeGuan[v.PermissionName] += 1
|
|
|
|
+ if v.IsUpgrade == 1 {
|
|
|
|
+ mapIsUpgrade[v.PermissionName] = v.PermissionName + "(升级)"
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ mapPermissionName := make(map[string]string)
|
|
|
|
+ //处理升级,并且合并主客观
|
|
|
|
+ for _, v := range permissionList {
|
|
|
|
+ if _, ok := mapPermissionName[v.PermissionName]; ok {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ if _, ok := mapIsUpgrade[v.PermissionName]; ok {
|
|
|
|
+ permissionStr += mapIsUpgrade[v.PermissionName] + ","
|
|
|
|
+ } else {
|
|
|
|
+ if mapZhukKeGuan[v.PermissionName] == 1 {
|
|
|
|
+ permissionStr += v.Remark + ","
|
|
|
|
+ } else {
|
|
|
|
+ permissionStr += v.PermissionName + ","
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ mapPermissionName[v.PermissionName] = v.PermissionName
|
|
|
|
+ }
|
|
|
|
+ permissionStr = strings.TrimRight(permissionStr, ",")
|
|
|
|
+ //permissionStrOld, err := models.GetCompanyPermission(companyItem.CompanyId)
|
|
|
|
+ //if err != nil {
|
|
|
|
+ // br.Msg = "获取信息失败"
|
|
|
|
+ // br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ //}
|
|
|
|
+ //permissionStrListOld := strings.Split(permissionStrOld, ",")
|
|
|
|
+ //for _, v := range permissionStrListOld {
|
|
|
|
+ // if strings.Count(permissionStr, v) > 1 {
|
|
|
|
+ // permissionStr = strings.Replace(permissionStr, v+"(主观)", v, -1)
|
|
|
|
+ // permissionStr = strings.Replace(permissionStr, v+"(客观),", "", -1)
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ finalPermissionList := strings.Split(permissionStr, ",")
|
|
|
|
+ for _, per := range finalPermissionList {
|
|
|
|
+ resp.PermissionName = append(resp.PermissionName, per)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if resp.Headimgurl == "" {
|
|
if resp.Headimgurl == "" {
|
|
resp.Headimgurl = utils.DefaultHeadimgurl
|
|
resp.Headimgurl = utils.DefaultHeadimgurl
|
|
}
|
|
}
|
|
@@ -412,3 +495,852 @@ func (this *UserController) ApplyTryOut() {
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Data = sellerMobile
|
|
br.Data = sellerMobile
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// @Title 用户修改外呼手机号以及区号
|
|
|
|
+// @Description 用户修改外呼手机号以及区号接口
|
|
|
|
+// @Param request body models.OutboundMobileItem true "type json string"
|
|
|
|
+// @Success Ret=200 操作成功
|
|
|
|
+// @router /countryCcode/addOutboundMobile [POST]
|
|
|
|
+func (this *UserController) AddOutboundMobile() {
|
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
|
+ defer func() {
|
|
|
|
+ this.Data["json"] = br
|
|
|
|
+ this.ServeJSON()
|
|
|
|
+ }()
|
|
|
|
+ user := this.User
|
|
|
|
+ uid := user.UserId
|
|
|
|
+ if user == nil {
|
|
|
|
+ br.Msg = "请登录"
|
|
|
|
+ br.ErrMsg = "请登录,用户信息为空"
|
|
|
|
+ br.Ret = 408
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var req models.OutboundMobileItem
|
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if req.OutboundMobile == "" {
|
|
|
|
+ br.Msg = "请填写区号!"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item := new(models.OutboundMobileItem)
|
|
|
|
+ item.OutboundMobile = req.OutboundMobile
|
|
|
|
+ item.OutboundCountryCode = req.OutboundCountryCode
|
|
|
|
+ //item.ActivityId = req.ActivityId
|
|
|
|
+ //if req.ActivityId == 0 {
|
|
|
|
+ // err = models.AddOutboundMobile(item, uid)
|
|
|
|
+ //} else {
|
|
|
|
+ // if user.Mobile == "" && user.OutboundMobile == "" {
|
|
|
|
+ // items := new(models.CygxActivitySignup)
|
|
|
|
+ // items.UserId = uid
|
|
|
|
+ // items.ActivityId = req.ActivityId
|
|
|
|
+ // items.CreateTime = time.Now()
|
|
|
|
+ // items.Mobile = user.Mobile
|
|
|
|
+ // items.Email = user.Email
|
|
|
|
+ // items.CompanyId = user.CompanyId
|
|
|
|
+ // items.CompanyName = user.CompanyName
|
|
|
|
+ // items.SignupType = 1
|
|
|
|
+ // items.FailType = 0
|
|
|
|
+ // items.DoFailType = 0
|
|
|
|
+ // items.OutboundMobile = req.OutboundMobile
|
|
|
|
+ // items.CountryCode = req.OutboundCountryCode
|
|
|
|
+ // _, err = models.AddActivitySignupFromEmail(items)
|
|
|
|
+ // } else {
|
|
|
|
+ // total, err := models.GetActivityCountByIdWithUid(item.ActivityId, uid)
|
|
|
|
+ // if total == 0 {
|
|
|
|
+ // br.Msg = "报名信息不存在"
|
|
|
|
+ // br.ErrMsg = "报名信息不存在,Err:" + "活动ActivityId:" + strconv.Itoa(item.ActivityId) + "用户Uid:" + strconv.Itoa(uid)
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
|
|
+ // if err != nil {
|
|
|
|
+ // br.Msg = "操作失败"
|
|
|
|
+ // br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
|
|
+ // err = models.AddOutboundMobile(item, uid)
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ err = models.AddOutboundMobile(item, uid)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "操作失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "操作成功"
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// @Title 校验用户状态信息
|
|
|
|
+// @Description 校验用户状态信息
|
|
|
|
+// @Success 200 {object} models.CheckStatusResp
|
|
|
|
+// @router /check/status [get]
|
|
|
|
+func (this *UserController) CheckLogin() {
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ uid := user.UserId
|
|
|
|
+ resp := new(models.CheckStatusResp)
|
|
|
|
+ if uid > 0 {
|
|
|
|
+ //判断token是否过期
|
|
|
|
+ userRecord, err := models.GetUserSessionByUserId(uid)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取用户信息失败"
|
|
|
|
+ br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ permissionStr, err := models.GetCompanyPermission(user.CompanyId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp.PermissionName = permissionStr
|
|
|
|
+
|
|
|
|
+ if user.Mobile == "" && user.Email == "" {
|
|
|
|
+ resp.IsBind = true
|
|
|
|
+ }
|
|
|
|
+ if userRecord.UnionId == "" {
|
|
|
|
+ resp.IsAuth = true
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ resp.IsBind = true
|
|
|
|
+ if user.UnionId == "" {
|
|
|
|
+ resp.IsAuth = true
|
|
|
|
+ }
|
|
|
|
+ resp.PermissionName = ""
|
|
|
|
+ }
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "获取成功"
|
|
|
|
+ br.Data = resp
|
|
|
|
+ br.Ret = 200
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// @Title 更改用户微信头像
|
|
|
|
+// @Description 更改用户微信头像
|
|
|
|
+// @Param request body models.Headimgurl true "type json string"
|
|
|
|
+// @Success 200 {object} models.ArticleDetailFileLink
|
|
|
|
+// @router /headimgurl/update [post]
|
|
|
|
+func (this *UserController) HeadimgurlUpdate() {
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ var req models.Headimgurl
|
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ uid := user.UserId
|
|
|
|
+ headimgurl := req.Headimgurl
|
|
|
|
+ if headimgurl == "" {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "头像信息不能为空"
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ err = models.UpdateUserHeadimgurl(headimgurl, uid)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "操作失败"
|
|
|
|
+ br.ErrMsg = "头像信息不能为空"
|
|
|
|
+ }
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "操作成功"
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// @Title 获取我的收藏
|
|
|
|
+// @Description 获取我的收藏列表
|
|
|
|
+// @Param PageSize query int true "PageSize"
|
|
|
|
+// @Param CurrentIndex query int true "CurrentIndex"
|
|
|
|
+// @Success 200 {object} models.ArticleCollectListResp
|
|
|
|
+// @router /collect/list [get]
|
|
|
|
+func (this *UserController) CollectList() {
|
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
|
+ defer func() {
|
|
|
|
+ this.Data["json"] = br
|
|
|
|
+ this.ServeJSON()
|
|
|
|
+ }()
|
|
|
|
+ userId := this.User.UserId
|
|
|
|
+ var pageSize, currentIndex, startSize int
|
|
|
|
+ pageSize, _ = this.GetInt("PageSize")
|
|
|
|
+ currentIndex, _ = this.GetInt("CurrentIndex")
|
|
|
|
+ if pageSize <= 0 {
|
|
|
|
+ pageSize = utils.PageSize20
|
|
|
|
+ }
|
|
|
|
+ if currentIndex <= 0 {
|
|
|
|
+ currentIndex = 1
|
|
|
|
+ }
|
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
|
+
|
|
|
|
+ total, err := models.GetArticleUserCollectCount(userId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ list, err := models.GetArticleUserCollectList(startSize, pageSize, userId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp := new(models.ArticleReportBillboardLIstPageResp)
|
|
|
|
+ if len(list) == 0 {
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ resp.List = list
|
|
|
|
+ resp.Paging = page
|
|
|
|
+ br.Msg = "获取成功!"
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+ var articleIds []string
|
|
|
|
+ for _, v := range list {
|
|
|
|
+ articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
|
|
|
|
+ }
|
|
|
|
+ articleIdStr := strings.Join(articleIds, ",")
|
|
|
|
+
|
|
|
|
+ //获取文章关联的产业
|
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
|
+ condition = ` AND mg.article_id IN ( ` + utils.GetOrmInReplace(len(articleIds)) + ` ) `
|
|
|
|
+ pars = append(pars, articleIds)
|
|
|
|
+ industrialList, err := models.GetIndustrialListByarticleId(pars, condition)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取失败,GetSubjectList Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ industrialMap := make(map[int][]*models.IndustrialManagementIdInt)
|
|
|
|
+ if len(industrialList) > 0 {
|
|
|
|
+ for _, v := range industrialList {
|
|
|
|
+ item := new(models.IndustrialManagementIdInt)
|
|
|
|
+ item.ArticleId = v.ArticleId
|
|
|
|
+ if v.ArticleId > utils.SummaryArticleId {
|
|
|
|
+ item.IsResearch = true
|
|
|
|
+ }
|
|
|
|
+ item.IndustrialManagementId = v.IndustrialManagementId
|
|
|
|
+ item.IndustryName = v.IndustryName
|
|
|
|
+ item.ChartPermissionId = v.ChartPermissionId
|
|
|
|
+ industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for k, v := range list {
|
|
|
|
+ if len(industrialMap[v.ArticleId]) > 0 {
|
|
|
|
+ list[k].List = industrialMap[v.ArticleId]
|
|
|
|
+ } else {
|
|
|
|
+ list[k].List = make([]*models.IndustrialManagementIdInt, 0)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ articleMap := make(map[int]*models.ArticleDetail)
|
|
|
|
+ if articleIdStr != "" {
|
|
|
|
+ articleList, err := models.GetArticleDetailByIdStr(articleIdStr)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取报告详情信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for _, v := range articleList {
|
|
|
|
+ if _, ok := articleMap[v.ArticleId]; !ok {
|
|
|
|
+ articleMap[v.ArticleId] = v
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //处理文章PV收藏等数量
|
|
|
|
+ mapArticleCollectNum := make(map[int]*models.CygxArticleNum)
|
|
|
|
+ if len(articleIds) > 0 {
|
|
|
|
+ articleCollectNumList, err := models.GetArticleCollectNum(articleIds, userId)
|
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取失败,GetArticleCollectNum Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for _, v := range articleCollectNumList {
|
|
|
|
+ mapArticleCollectNum[v.ArticleId] = v
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ lenList := len(list)
|
|
|
|
+ for i := 0; i < lenList; i++ {
|
|
|
|
+ item := list[i]
|
|
|
|
+ article := articleMap[item.ArticleId]
|
|
|
|
+ list[i].Title = article.Title
|
|
|
|
+ list[i].DepartmentId = article.DepartmentId
|
|
|
|
+ list[i].NickName = article.NickName
|
|
|
|
+ list[i].PublishDate = article.PublishDate
|
|
|
|
+ if article.ArticleId < utils.SummaryArticleId {
|
|
|
|
+ list[i].Source = 1
|
|
|
|
+ } else {
|
|
|
|
+ list[i].Source = 2
|
|
|
|
+ }
|
|
|
|
+ if mapArticleCollectNum[article.ArticleId] != nil {
|
|
|
|
+ list[i].CollectNum = mapArticleCollectNum[article.ArticleId].CollectNum
|
|
|
|
+ list[i].Pv = mapArticleCollectNum[article.ArticleId].Pv
|
|
|
|
+ list[i].IsCollect = mapArticleCollectNum[article.ArticleId].IsCollect
|
|
|
|
+ }
|
|
|
|
+ //list[i].TitleEn = article.TitleEn
|
|
|
|
+ //list[i].UpdateFrequency = article.UpdateFrequency
|
|
|
|
+ //list[i].CreateDate = article.CreateDate
|
|
|
|
+ //list[i].Body, _ = services.GetReportContentTextSub(article.Body)
|
|
|
|
+ //list[i].Abstract = article.Abstract
|
|
|
|
+ //list[i].CategoryName = article.CategoryName
|
|
|
|
+ //list[i].SubCategoryName = article.SubCategoryName
|
|
|
|
+ }
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ resp.List = list
|
|
|
|
+ resp.Paging = page
|
|
|
|
+ br.Msg = "获取成功!"
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// @Title 获取我的留言
|
|
|
|
+// @Description 获取我的留言列表
|
|
|
|
+// @Param PageSize query int true "PageSize"
|
|
|
|
+// @Param CurrentIndex query int true "CurrentIndex"
|
|
|
|
+// @Success 200 {object} models.CygxCommentListResp
|
|
|
|
+// @router /comment/list [get]
|
|
|
|
+func (this *UserController) CommnetList() {
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var pageSize, currentIndex, startSize int
|
|
|
|
+ pageSize, _ = this.GetInt("PageSize")
|
|
|
|
+ currentIndex, _ = this.GetInt("CurrentIndex")
|
|
|
|
+ if pageSize <= 0 {
|
|
|
|
+ pageSize = utils.PageSize20
|
|
|
|
+ }
|
|
|
|
+ if currentIndex <= 0 {
|
|
|
|
+ currentIndex = 1
|
|
|
|
+ }
|
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
|
+
|
|
|
|
+ userId := this.User.UserId
|
|
|
|
+ total, err := models.GetCommentListCount(userId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ commentlist, err := models.GetCommentList(userId, startSize, pageSize)
|
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取我的留言列表失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ resp := new(models.CygxCommentListResp)
|
|
|
|
+
|
|
|
|
+ for _, comment := range commentlist {
|
|
|
|
+ item := models.CygxArticleCommentResp{
|
|
|
|
+ Id: comment.Id,
|
|
|
|
+ UserId: comment.UserId,
|
|
|
|
+ ArticleId: comment.ArticleId,
|
|
|
|
+ IndustryId: comment.IndustryId,
|
|
|
|
+ ActivityId: comment.ActivityId,
|
|
|
|
+ VideoId: comment.VideoId,
|
|
|
|
+ CreateTime: comment.CreateTime.Format(utils.FormatDateTime),
|
|
|
|
+ Mobile: comment.Mobile,
|
|
|
|
+ Email: comment.Email,
|
|
|
|
+ CompanyId: comment.CompanyId,
|
|
|
|
+ CompanyName: comment.CompanyName,
|
|
|
|
+ Content: comment.Content,
|
|
|
|
+ Title: comment.Title,
|
|
|
|
+ }
|
|
|
|
+ if comment.ArticleId > 0 {
|
|
|
|
+ item.RedirectType = 1
|
|
|
|
+ } else if comment.IndustryId > 0 {
|
|
|
|
+ detail, err := models.GetIndustrialManagementDetail(comment.IndustryId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ item.RedirectType = 3
|
|
|
|
+ item.ChartPermissionId = detail.ChartPermissionId
|
|
|
|
+ } else if comment.ActivityId > 0 && comment.VideoId == 0 {
|
|
|
|
+ item.RedirectType = 2
|
|
|
|
+ } else if comment.IndustryId == 0 && comment.VideoId > 0 {
|
|
|
|
+ item.RedirectType = 4
|
|
|
|
+ }
|
|
|
|
+ resp.List = append(resp.List, &item)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ resp.Paging = page
|
|
|
|
+
|
|
|
|
+ br.Msg = "获取成功!"
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// @Title 我的足迹
|
|
|
|
+// @Description 获取我的足迹列表
|
|
|
|
+// @Param PageSize query int true "PageSize"
|
|
|
|
+// @Param CurrentIndex query int true "CurrentIndex"
|
|
|
|
+// @Success 200 {object} models.ArticleBrowseHistoryListResp
|
|
|
|
+// @router /browse/history/list [get]
|
|
|
|
+func (this *UserController) BrowseHistoryList() {
|
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
|
+ defer func() {
|
|
|
|
+ this.Data["json"] = br
|
|
|
|
+ this.ServeJSON()
|
|
|
|
+ }()
|
|
|
|
+ userId := this.User.UserId
|
|
|
|
+ var pageSize, currentIndex, startSize int
|
|
|
|
+ pageSize, _ = this.GetInt("PageSize")
|
|
|
|
+ currentIndex, _ = this.GetInt("CurrentIndex")
|
|
|
|
+ if pageSize <= 0 {
|
|
|
|
+ pageSize = utils.PageSize20
|
|
|
|
+ }
|
|
|
|
+ if currentIndex <= 0 {
|
|
|
|
+ currentIndex = 1
|
|
|
|
+ }
|
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
|
+
|
|
|
|
+ endDate := time.Now().AddDate(0, -1, 0).Format(utils.FormatDate)
|
|
|
|
+ total, err := models.GetArticleUserBrowseHistoryCount(userId, endDate)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ list, err := models.GetArticleUserBrowseHistoryList(startSize, pageSize, userId, endDate)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ resp := new(models.ArticleReportBillboardLIstPageResp)
|
|
|
|
+ if len(list) == 0 {
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ resp.List = list
|
|
|
|
+ resp.Paging = page
|
|
|
|
+ br.Msg = "获取成功!"
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var articleIds []string
|
|
|
|
+ var condition string
|
|
|
|
+ var pars []interface{}
|
|
|
|
+ for _, v := range list {
|
|
|
|
+ articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
|
|
|
|
+ }
|
|
|
|
+ articleIdStr := strings.Join(articleIds, ",")
|
|
|
|
+
|
|
|
|
+ //获取文章关联的产业
|
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
|
+ condition = ` AND mg.article_id IN ( ` + utils.GetOrmInReplace(len(articleIds)) + ` ) `
|
|
|
|
+ pars = append(pars, articleIds)
|
|
|
|
+ industrialList, err := models.GetIndustrialListByarticleId(pars, condition)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取失败,GetSubjectList Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ industrialMap := make(map[int][]*models.IndustrialManagementIdInt)
|
|
|
|
+ if len(industrialList) > 0 {
|
|
|
|
+ for _, v := range industrialList {
|
|
|
|
+ item := new(models.IndustrialManagementIdInt)
|
|
|
|
+ item.ArticleId = v.ArticleId
|
|
|
|
+ if v.ArticleId > utils.SummaryArticleId {
|
|
|
|
+ item.IsResearch = true
|
|
|
|
+ }
|
|
|
|
+ item.IndustrialManagementId = v.IndustrialManagementId
|
|
|
|
+ item.IndustryName = v.IndustryName
|
|
|
|
+ item.ChartPermissionId = v.ChartPermissionId
|
|
|
|
+ industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for k, v := range list {
|
|
|
|
+ if len(industrialMap[v.ArticleId]) > 0 {
|
|
|
|
+ list[k].List = industrialMap[v.ArticleId]
|
|
|
|
+ } else {
|
|
|
|
+ list[k].List = make([]*models.IndustrialManagementIdInt, 0)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ articleMap := make(map[int]*models.ArticleDetail)
|
|
|
|
+ if articleIdStr != "" {
|
|
|
|
+ articleList, err := models.GetArticleDetailByIdStr(articleIdStr)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取报告详情信息失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for _, v := range articleList {
|
|
|
|
+ if _, ok := articleMap[v.ArticleId]; !ok {
|
|
|
|
+ articleMap[v.ArticleId] = v
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //处理文章PV收藏等数量
|
|
|
|
+ mapArticleCollectNum := make(map[int]*models.CygxArticleNum)
|
|
|
|
+ if len(articleIds) > 0 {
|
|
|
|
+ articleCollectNumList, err := models.GetArticleCollectNum(articleIds, userId)
|
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取失败,GetArticleCollectNum Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for _, v := range articleCollectNumList {
|
|
|
|
+ mapArticleCollectNum[v.ArticleId] = v
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ lenList := len(list)
|
|
|
|
+ for i := 0; i < lenList; i++ {
|
|
|
|
+ item := list[i]
|
|
|
|
+ article := articleMap[item.ArticleId]
|
|
|
|
+ if article != nil {
|
|
|
|
+ list[i].Title = article.Title
|
|
|
|
+ list[i].PublishDate = utils.TimeRemoveHms2(article.PublishDate)
|
|
|
|
+ list[i].DepartmentId = article.DepartmentId
|
|
|
|
+ list[i].NickName = article.NickName
|
|
|
|
+ if article.ArticleId < utils.SummaryArticleId {
|
|
|
|
+ list[i].Source = 1
|
|
|
|
+ } else {
|
|
|
|
+ list[i].Source = 2
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if mapArticleCollectNum[article.ArticleId] != nil {
|
|
|
|
+ list[i].CollectNum = mapArticleCollectNum[article.ArticleId].CollectNum
|
|
|
|
+ list[i].Pv = mapArticleCollectNum[article.ArticleId].Pv
|
|
|
|
+ list[i].IsCollect = mapArticleCollectNum[article.ArticleId].IsCollect
|
|
|
|
+ }
|
|
|
|
+ //list[i].TitleEn = article.TitleEn
|
|
|
|
+ //list[i].UpdateFrequency = article.UpdateFrequency
|
|
|
|
+ //list[i].CreateDate = article.CreateDate
|
|
|
|
+ //list[i].Body, _ = services.GetReportContentTextSub(article.Body)
|
|
|
|
+ //list[i].Abstract = article.Abstract
|
|
|
|
+ //list[i].CategoryName = article.CategoryName
|
|
|
|
+ //list[i].SubCategoryName = article.SubCategoryName
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+
|
|
|
|
+ resp.List = list
|
|
|
|
+ resp.Paging = page
|
|
|
|
+ br.Msg = "获取成功!"
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// @Title 获取我的提问
|
|
|
|
+// @Description 获取我的提问列表
|
|
|
|
+// @Param PageSize query int true "PageSize"
|
|
|
|
+// @Param CurrentIndex query int true "CurrentIndex"
|
|
|
|
+// @Success 200 {object} models.CygxAskListResp
|
|
|
|
+// @router /ask/list [get]
|
|
|
|
+func (this *UserController) AskList() {
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var pageSize, currentIndex, startSize int
|
|
|
|
+ pageSize, _ = this.GetInt("PageSize")
|
|
|
|
+ currentIndex, _ = this.GetInt("CurrentIndex")
|
|
|
|
+ if pageSize <= 0 {
|
|
|
|
+ pageSize = utils.PageSize20
|
|
|
|
+ }
|
|
|
|
+ if currentIndex <= 0 {
|
|
|
|
+ currentIndex = 1
|
|
|
|
+ }
|
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ userId := this.User.UserId
|
|
|
|
+ total, err := models.GetActivityAskCount(userId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ listActcivity, err := models.GetActivityAskList(userId, startSize, pageSize)
|
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取活动问题失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for _, v := range listActcivity {
|
|
|
|
+ v.AskType = "Activity"
|
|
|
|
+ }
|
|
|
|
+ listArticle, err := models.GetArticleAskList(userId)
|
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
|
+ br.Msg = "获取失败"
|
|
|
|
+ br.ErrMsg = "获取文章问题失败,Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ for _, v := range listArticle {
|
|
|
|
+ v.AskType = "Report"
|
|
|
|
+ listActcivity = append(listActcivity, v)
|
|
|
|
+ }
|
|
|
|
+ resp := new(models.CygxAskListResp)
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ resp.Paging = page
|
|
|
|
+
|
|
|
|
+ resp.List = listActcivity
|
|
|
|
+ br.Msg = "获取成功!"
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ collectVoiceMap := make(map[int]time.Time, 0)
|
|
|
|
+ collectVideoMap := make(map[int]time.Time, 0)
|
|
|
|
+ collectActivityVideoMap := make(map[int]time.Time, 0)
|
|
|
|
+ var audioIds []string
|
|
|
|
+ var videoIds []string
|
|
|
|
+ var activityVideoIds []string
|
|
|
|
+ for _, item := range listMycollect {
|
|
|
|
+ if item.ActivityVoiceId > 0 {
|
|
|
|
+ audioIds = append(audioIds, strconv.Itoa(item.ActivityVoiceId))
|
|
|
|
+ collectVoiceMap[item.ActivityVoiceId] = item.CreateTime
|
|
|
|
+ } else if item.VideoId > 0 {
|
|
|
|
+ videoIds = append(videoIds, strconv.Itoa(item.VideoId))
|
|
|
|
+ collectVideoMap[item.VideoId] = item.CreateTime
|
|
|
|
+ } else if item.ActivityVideoId > 0 {
|
|
|
|
+ activityVideoIds = append(activityVideoIds, strconv.Itoa(item.ActivityVideoId))
|
|
|
|
+ collectActivityVideoMap[item.ActivityVideoId] = item.CreateTime
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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
|
|
|
|
+ }
|
|
|
|
+ if v,ok := collectVoiceMap[item.Id]; ok{
|
|
|
|
+ item.CollectTime = v
|
|
|
|
+ }
|
|
|
|
+ } 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
|
|
|
|
+ }
|
|
|
|
+ if v,ok := collectActivityVideoMap[item.Id]; ok{
|
|
|
|
+ item.CollectTime = v
|
|
|
|
+ }
|
|
|
|
+ } 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
|
|
|
|
+ }
|
|
|
|
+ if v,ok := collectVideoMap[item.Id]; ok{
|
|
|
|
+ item.CollectTime = v
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 用户权限
|
|
|
|
+ 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]
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var sortList models.MicroList
|
|
|
|
+
|
|
|
|
+ sortList = list
|
|
|
|
+ sort.Sort(sortList)
|
|
|
|
+
|
|
|
|
+ resp := new(models.MicroRoadShowListResp)
|
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
|
+ resp.List = sortList
|
|
|
|
+ resp.Paging = page
|
|
|
|
+
|
|
|
|
+ br.Ret = 200
|
|
|
|
+ br.Success = true
|
|
|
|
+ br.Msg = "获取成功"
|
|
|
|
+ br.Data = resp
|
|
|
|
+}
|