|
@@ -211,6 +211,12 @@ func (this *ArticleController) Detail() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ //判断用户是否开通了个人研选权限,如果有权限后缀拼接权限名称
|
|
|
+ mfyxUserPermissionTotal := services.GetMfyxUserPermissionTotal(uid)
|
|
|
+ if mfyxUserPermissionTotal == 1 {
|
|
|
+ companyPermission += "," + utils.CHART_PERMISSION_NAME_MF_YANXUAN
|
|
|
+ }
|
|
|
+
|
|
|
if companyPermission == "" {
|
|
|
if applyCount > 0 {
|
|
|
hasPermission = 5
|
|
@@ -253,7 +259,8 @@ func (this *ArticleController) Detail() {
|
|
|
br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- if userType == 1 && strings.Contains(detail.CategoryName, "研选") {
|
|
|
+ //永续客户,无法查看研选权限,但是下面的联系人,单独开通研选后,也可以查看研选内容
|
|
|
+ if userType == 1 && strings.Contains(detail.CategoryName, "研选") && mfyxUserPermissionTotal == 0 {
|
|
|
hasPersion = false
|
|
|
}
|
|
|
//if detail.IsReport == 1 {
|
|
@@ -649,182 +656,6 @@ func (this *ArticleController) InterviewApply() {
|
|
|
br.Data = resp
|
|
|
}
|
|
|
|
|
|
-// @Title 获取报告详情
|
|
|
-// @Description 获取报告详情接口
|
|
|
-// @Param ArticleIdMd5 query int true "报告ID"
|
|
|
-// @Success 200 {object} models.ArticleDetailResp
|
|
|
-// @router /look/detail [get]
|
|
|
-func (this *ArticleControllerMobile) DetailMd5() {
|
|
|
- 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
|
|
|
-
|
|
|
- articleIdMd5 := this.GetString("ArticleIdMd5")
|
|
|
- if articleIdMd5 == "" {
|
|
|
- br.Msg = "参数错误"
|
|
|
- br.ErrMsg = "参数错误"
|
|
|
- return
|
|
|
- }
|
|
|
- resp := new(models.ArticleDetailResp)
|
|
|
- detail, err := models.GetArticleDetailByIdMd5(articleIdMd5)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- articleId := detail.ArticleId
|
|
|
- detail.Body = html.UnescapeString(detail.Body)
|
|
|
-
|
|
|
- hasPermission := 2
|
|
|
- //`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
|
|
|
- if user.CompanyId > 1 {
|
|
|
- companyPermission, err := models.GetCompanyPermission(user.CompanyId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取公司权限失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- detail.Body = html.UnescapeString(detail.Body)
|
|
|
- detail.Body = strings.Replace(detail.Body, "<p data-f-id=\"pbf\" style=\"text-align: center; font-size: 14px; margin-top: 30px; opacity: 0.65; font-family: sans-serif;\">Powered by <a href=\"https://www.froala.com/wysiwyg-editor?pb=1\" title=\"Froala Editor\">Froala Editor</a></p>", "", -1)
|
|
|
- detail.Body = strings.Replace(detail.Body, "pre", "div", -1)
|
|
|
- detail.Abstract, _ = services.GetReportContentTextSubNew(detail.Abstract)
|
|
|
- if companyPermission == "" {
|
|
|
- hasPermission = 2
|
|
|
- } else {
|
|
|
- var articlePermissionPermissionName string
|
|
|
- if detail.CategoryId > 0 {
|
|
|
- articlePermission, err := models.GetArticlePermission(detail.CategoryId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + articleIdMd5
|
|
|
- return
|
|
|
- }
|
|
|
- if articlePermission == nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "报告权限不存在,Err:" + articleIdMd5
|
|
|
- return
|
|
|
- }
|
|
|
- articlePermissionPermissionName = articlePermission.PermissionName
|
|
|
- } else {
|
|
|
- articlePermissionPermissionName = detail.CategoryName
|
|
|
- }
|
|
|
- var hasPersion bool
|
|
|
- slice := strings.Split(articlePermissionPermissionName, ",")
|
|
|
- for _, v := range slice {
|
|
|
- if strings.Contains(companyPermission, v) {
|
|
|
- hasPersion = true
|
|
|
- }
|
|
|
- }
|
|
|
- userType, _, err := services.GetUserType(user.CompanyId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if userType == 1 && strings.Contains(detail.CategoryName, "研选") {
|
|
|
- hasPersion = false
|
|
|
- }
|
|
|
- if detail.IsReport == 1 {
|
|
|
- detailCategory, err := models.GetdetailByCategoryIdSando(detail.CategoryId)
|
|
|
- if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取信息失败,Err:" + err.Error() + "categoryID 不存在:" + strconv.Itoa(detail.CategoryId)
|
|
|
- return
|
|
|
- }
|
|
|
- permissionStr, err := models.GetCompanyPermissionByUser(user.CompanyId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if detailCategory != nil {
|
|
|
- if detailCategory.PermissionType == 1 {
|
|
|
- if !strings.Contains(permissionStr, detailCategory.ChartPermissionName+"(主观)") {
|
|
|
- hasPersion = false
|
|
|
- }
|
|
|
- } else if detailCategory.PermissionType == 2 {
|
|
|
- if !strings.Contains(permissionStr, detailCategory.ChartPermissionName+"(客观)") {
|
|
|
- hasPersion = false
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if hasPersion {
|
|
|
- hasPermission = 1
|
|
|
- record := new(models.CygxArticleHistoryRecordNewpv)
|
|
|
- record.UserId = uid
|
|
|
- record.ArticleId = articleId
|
|
|
- record.CreateTime = time.Now()
|
|
|
- record.ModifyTime = time.Now()
|
|
|
- record.Mobile = user.Mobile
|
|
|
- record.Email = user.Email
|
|
|
- record.CompanyId = user.CompanyId
|
|
|
- record.CompanyName = user.CompanyName
|
|
|
- //新增浏览记录
|
|
|
- go models.AddCygxArticleViewRecordNewpv(record)
|
|
|
-
|
|
|
- //30分钟之内阅读同一篇文章不错二次推送
|
|
|
- key := "CYGX_ARTICLE_READ" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
|
|
|
- if !utils.Rc.IsExist(key) {
|
|
|
- go services.ArticleUserRemind(user, detail, 1)
|
|
|
- utils.Rc.Put(key, 1, 30*time.Second)
|
|
|
- }
|
|
|
- }
|
|
|
- if hasPermission == 1 {
|
|
|
- key := "CYGX_ARTICLE_" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
|
|
|
- if !utils.Rc.IsExist(key) {
|
|
|
- //新增浏览记录
|
|
|
- record := new(models.CygxArticleViewRecord)
|
|
|
- record.UserId = uid
|
|
|
- record.ArticleId = articleId
|
|
|
- record.CreateTime = time.Now()
|
|
|
- record.Mobile = user.Mobile
|
|
|
- record.Email = user.Email
|
|
|
- record.CompanyId = user.CompanyId
|
|
|
- record.CompanyName = user.CompanyName
|
|
|
- go models.AddCygxArticleViewRecord(record)
|
|
|
- utils.Rc.Put(key, 1, 5*time.Second)
|
|
|
- models.ModifyReportLastViewTime(uid)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //作者头像
|
|
|
- if detail.DepartmentId > 0 {
|
|
|
- departmentDetail, err := models.GetArticleDepartmentDateilById(detail.DepartmentId)
|
|
|
- if err == nil {
|
|
|
- detail.DepartmentImgUrl = departmentDetail.ImgUrl
|
|
|
- detail.NickName = departmentDetail.NickName
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- detail.SellerAndMobile = "" //业务需要强制处理为空
|
|
|
- resp.HasPermission = hasPermission
|
|
|
- if hasPermission == 1 {
|
|
|
- detail.Abstract, _ = services.GetReportContentTextSub(detail.Abstract)
|
|
|
- resp.Detail = detail
|
|
|
- } else {
|
|
|
- if user.Mobile != "" {
|
|
|
- resp.Mobile = user.Mobile
|
|
|
- } else {
|
|
|
- resp.Mobile = user.Email
|
|
|
- }
|
|
|
- }
|
|
|
- br.Ret = 200
|
|
|
- br.Success = true
|
|
|
- br.Msg = "获取成功"
|
|
|
- br.Data = resp
|
|
|
-}
|
|
|
-
|
|
|
// @Title 上传文章阅读时间
|
|
|
// @Description 上传文章阅读时间接口
|
|
|
// @Param request body models.AddStopTimeRep true "type json string"
|