Browse Source

no message

xingzai 5 months ago
parent
commit
69cbc8d6d6
3 changed files with 56 additions and 3 deletions
  1. 1 0
      models/ficc_report/report.go
  2. 20 0
      services/config.go
  3. 35 3
      services/ficc_reporrt.go

+ 1 - 0
models/ficc_report/report.go

@@ -68,6 +68,7 @@ type ReportItem struct {
 	HeadStyle          string    `description:"版头样式" json:"head_style"`
 	EndStyle           string    `description:"版尾样式" json:"end_style"`
 	ArticleId          int       `description:"文章ID"`
+	Disclaimer         string    `description:"免责声明" json:"disclaimer"`
 }
 
 type Report struct {

+ 20 - 0
services/config.go

@@ -129,3 +129,23 @@ func CheckYxSpecialIsApprovalPersonnel(mobile string) (isApprovalPersonnel bool)
 	}
 	return
 }
+
+// FICC研报获取免责声明
+func GetConfigCodeDisclaimer() (configValue string) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("GetConfigCodeDisclaimer 获取FICC研报获取免责声明 失败, ErrMsg", err.Error()), 2)
+		}
+	}()
+	var configCode string
+	//获取配置项里面审核人员的手机号
+	configCode = "Disclaimer"
+	cnf, e := models.GetConfigByCode(configCode)
+	if e != nil {
+		err = errors.New("GetConfigByCode, Err: " + e.Error() + configCode)
+		return
+	}
+	configValue = cnf.ConfigValue
+	return
+}

+ 35 - 3
services/ficc_reporrt.go

@@ -253,12 +253,43 @@ func GetReportDetail(userinfo *models.WxUserItem, reportId int) (reportDetail fi
 	if hasPower {
 		hasPermission = 1
 	} else {
-		hasPermission, e = GetUserPermissionCode(userinfo.UserId, userinfo.CompanyId)
+		//hasPermission, e = GetUserPermissionCode(userinfo.UserId, userinfo.CompanyId)
+		//if e != nil {
+		//	err = errors.New("GetUserPermissionCode")
+		//	return
+		//}
+		reportDetail.SellerName, reportDetail.SellerMobile, _ = GetSellerName(userinfo)
+		applyCount, e := models.GetApplyRecordCount(userinfo.UserId)
 		if e != nil {
-			err = errors.New("GetUserPermissionCode")
+			err = errors.New("GetApplyRecordCount")
 			return
 		}
-		reportDetail.SellerName, reportDetail.SellerMobile, _ = GetSellerName(userinfo)
+		if userinfo.CompanyId > 1 {
+			companyPermission, e := models.GetCompanyPermission(userinfo.CompanyId)
+			if e != nil {
+				err = errors.New("GetCompanyPermission")
+				return
+			}
+			if companyPermission == "" {
+				if applyCount > 0 {
+					hasPermission = 6
+				} else {
+					hasPermission = 2
+				}
+			} else {
+				if applyCount == 0 {
+					hasPermission = 4
+				} else {
+					hasPermission = 3
+				}
+			}
+		} else { //潜在客户
+			if applyCount > 0 {
+				hasPermission = 6
+			} else {
+				hasPermission = 5
+			}
+		}
 	}
 	reportDetail.HasPermission = hasPermission
 
@@ -295,6 +326,7 @@ func GetReportDetail(userinfo *models.WxUserItem, reportId int) (reportDetail fi
 	reportItem.EndImg = reportInfo.EndImg
 	reportItem.CanvasColor = reportInfo.CanvasColor
 	reportItem.ArticleId = detailArticle.ArticleId
+	reportItem.Disclaimer = GetConfigCodeDisclaimer()
 
 	//版头版尾样式
 	{