|
@@ -2,7 +2,6 @@ package controllers
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
- "fmt"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
"hongze/hongze_cygx/services"
|
|
|
"hongze/hongze_cygx/utils"
|
|
@@ -56,7 +55,6 @@ func (this *ArticleController) Detail() {
|
|
|
br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- fmt.Println(user.CompanyId)
|
|
|
//`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
|
|
|
if user.CompanyId > 1 {
|
|
|
companyPermission, err := models.GetCompanyPermission(user.CompanyId)
|
|
@@ -65,18 +63,14 @@ func (this *ArticleController) Detail() {
|
|
|
br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
detail, err = models.GetArticleDetailById(articleId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- fmt.Println(detail.Department)
|
|
|
-
|
|
|
detail.Body = html.UnescapeString(detail.Body)
|
|
|
detail.Abstract = html.UnescapeString(detail.Abstract)
|
|
|
- fmt.Println(companyPermission)
|
|
|
if companyPermission == "" {
|
|
|
if applyCount > 0 {
|
|
|
hasPermission = 5
|
|
@@ -118,10 +112,7 @@ func (this *ArticleController) Detail() {
|
|
|
// hasPermission = 3
|
|
|
// }
|
|
|
//}
|
|
|
-
|
|
|
- articlePermission, err := models.GetArticlePermission(detail.SubCategoryName)
|
|
|
- fmt.Println(articlePermission)
|
|
|
- fmt.Println(detail.SubCategoryName)
|
|
|
+ articlePermission, err := models.GetArticlePermission(detail.CategoryId)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
|
|
@@ -132,22 +123,19 @@ func (this *ArticleController) Detail() {
|
|
|
br.ErrMsg = "报告权限不存在,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
|
|
|
return
|
|
|
}
|
|
|
- for _, p := range articlePermission {
|
|
|
- if strings.Contains(companyPermission, p.PermissionName) {
|
|
|
- hasPermission = 1
|
|
|
- historyRecord := new(models.CygxArticleHistoryRecord)
|
|
|
- historyRecord.UserId = uid
|
|
|
- historyRecord.ArticleId = articleId
|
|
|
- historyRecord.CreateTime = time.Now()
|
|
|
- historyRecord.Mobile = user.Mobile
|
|
|
- historyRecord.Email = user.Email
|
|
|
- historyRecord.CompanyId = user.CompanyId
|
|
|
- historyRecord.CompanyName = user.CompanyName
|
|
|
- go models.AddCygxArticleHistoryRecord(historyRecord)
|
|
|
- break
|
|
|
- } else { //无该行业权限
|
|
|
- hasPermission = 3
|
|
|
- }
|
|
|
+ if strings.Contains(companyPermission, articlePermission.PermissionName) {
|
|
|
+ hasPermission = 1
|
|
|
+ historyRecord := new(models.CygxArticleHistoryRecord)
|
|
|
+ historyRecord.UserId = uid
|
|
|
+ historyRecord.ArticleId = articleId
|
|
|
+ historyRecord.CreateTime = time.Now()
|
|
|
+ historyRecord.Mobile = user.Mobile
|
|
|
+ historyRecord.Email = user.Email
|
|
|
+ historyRecord.CompanyId = user.CompanyId
|
|
|
+ historyRecord.CompanyName = user.CompanyName
|
|
|
+ go models.AddCygxArticleHistoryRecord(historyRecord)
|
|
|
+ } else { //无该行业权限
|
|
|
+ hasPermission = 3
|
|
|
}
|
|
|
if hasPermission == 1 {
|
|
|
key := "CYGX_ARTICLE_" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
|
|
@@ -173,18 +161,15 @@ func (this *ArticleController) Detail() {
|
|
|
br.ErrMsg = "判断是否已收藏失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if collectCount > 0 {
|
|
|
detail.IsCollect = true
|
|
|
}
|
|
|
-
|
|
|
interviewApplyItem, err := models.GetArticleInterviewApply(uid, articleId)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
if interviewApplyItem != nil && interviewApplyItem.InterviewApplyId > 0 {
|
|
|
detail.IsInterviewApply = true
|
|
|
detail.InterviewApplyStatus = interviewApplyItem.Status
|