Преглед на файлове

Merge branch 'cygx_13.8' of http://8.136.199.33:3000/cxzhang/hongze_clpt into debug

xingzai преди 5 месеца
родител
ревизия
868238e531
променени са 5 файла, в които са добавени 87 реда и са изтрити 41 реда
  1. 4 0
      controllers/report.go
  2. 18 0
      controllers/user.go
  3. 13 40
      services/ficc_reporrt.go
  4. 50 1
      services/user_permission.go
  5. 2 0
      utils/constants.go

+ 4 - 0
controllers/report.go

@@ -2199,6 +2199,10 @@ func (this *MobileReportController) TacticsList() {
 		if v.Resource == 2 {
 			item.Pv = productInteriorMapPv[v.ArticleId]
 		}
+
+		if v.ReportId > 0 {
+			item.Resource = 3
+		}
 		listResp = append(listResp, item)
 	}
 	if len(listResp) == 0 {

+ 18 - 0
controllers/user.go

@@ -420,6 +420,24 @@ func (this *UserController) ApplyTryOut() {
 		title = YanxuanSpecialBySpeciaDetail.Title
 		source = "yanxuanspecial"
 		isResearch = true
+	} else if tryType == utils.CYGX_OBJ_FICC_REPORT {
+		// FICC研报小程序
+		detailFiccReport, err := models.GetArticleDetailByReportId(detailId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取研报信息失败,Err:" + err.Error()
+			return
+		}
+		title = detailFiccReport.Title
+		source = utils.CYGX_OBJ_FICC_REPORT
+		if utils.RunMode == "release" {
+			redirectUrl = utils.WX_MSG_PATH_FICC_REPORT_DETAIL + strconv.Itoa(detailId)
+		}
+
+	} else if tryType == utils.CYGX_OBJ_FICC_REPORT_XCX {
+		// FICC研报小程序弹窗
+		title = "周期股语音播报"
+		source = utils.CYGX_OBJ_FICC_REPORT_XCX
 	}
 
 	//缓存校验

+ 13 - 40
services/ficc_reporrt.go

@@ -234,58 +234,31 @@ func GetReportDetail(userinfo *models.WxUserItem, reportId int) (reportDetail fi
 			return
 		}
 	}
-	//判断是否已经申请过
-	applyCount, e := models.GetApplyRecordCount(userinfo.UserId)
-	if e != nil {
-		err = errors.New("判断是否已申请过试用失败")
-		return
-	}
 	var hasPermission int
+	var hasPower bool
 	if userinfo.CompanyId > 1 {
 		companyPermission, e := models.GetCompanyPermission(userinfo.CompanyId)
 		if e != nil {
-			err = errors.New("获取用户权限信息失败")
+			err = errors.New("GetCompanyPermission")
 			return
 		}
-		fmt.Println(companyPermission)
-		if companyPermission == "" {
-			if applyCount > 0 {
-				hasPermission = 6
-			} else {
-				hasPermission = 2
-			}
-		} else {
-			var hasPersion bool
+		if companyPermission != "" {
 			slice := strings.Split(companyPermission, ",")
 			if utils.InArrayByStr(slice, "周期") {
-				hasPersion = true
-			}
-			if hasPersion {
-				hasPermission = 1
-			} else { //无该行业权限
-				if applyCount == 0 {
-					hasPermission = 4
-				} else {
-					hasPermission = 3
-				}
+				hasPower = true
 			}
 		}
-		//获取销售手机号
-		sellerItem, e := models.GetSellerByCompanyId(userinfo.CompanyId)
-		if e != nil && e.Error() != utils.ErrNoRow() {
-			err = errors.New("获取销售数据失败")
+	}
+
+	if hasPower {
+		hasPermission = 1
+	} else {
+		hasPermission, e = GetUserPermissionCode(userinfo.UserId, userinfo.CompanyId)
+		if e != nil {
+			err = errors.New("GetUserPermissionCode")
 			return
 		}
-		if sellerItem != nil {
-			reportDetail.SellerMobile = sellerItem.Mobile
-			reportDetail.SellerName = sellerItem.RealName
-		}
-	} else { //潜在客户
-		if applyCount > 0 {
-			hasPermission = 6
-		} else {
-			hasPermission = 5
-		}
+		reportDetail.SellerName, reportDetail.SellerMobile, _ = GetSellerName(userinfo)
 	}
 	reportDetail.HasPermission = hasPermission
 

+ 50 - 1
services/user_permission.go

@@ -202,7 +202,7 @@ func GetUserRaiPermissionYanXuanInfo(user *models.WxUserItem) (hasPermission int
 }
 
 // 获取权益销售姓名
-func GetSellerName(user *models.WxUserItem) (sellerName string, sellerId int) {
+func GetSellerName(user *models.WxUserItem) (sellerName, mobile string, sellerId int) {
 	var err error
 	defer func() {
 		if err != nil {
@@ -232,6 +232,7 @@ func GetSellerName(user *models.WxUserItem) (sellerName string, sellerId int) {
 	}
 	sellerName = sealldetail.RealName
 	sellerId = sealldetail.AdminId
+	mobile = sealldetail.Mobile
 	return
 }
 
@@ -273,3 +274,51 @@ func GetUserDetailPermissionCode(userId, companyId int) (permission int, err err
 	}
 	return
 }
+
+// 获取用户权限状态  https://hzstatic.hzinsights.com/static/images/202402/20240205/LpE6dspJCLzfQoCoE8SFMDiLuxXk.png(状态码说明)
+func GetUserPermissionCode(userId, companyId int) (permission int, err error) {
+	// 用户申请记录
+	applyCount, e := models.GetApplyRecordCount(userId)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("获取用户申请信息失败, Err: " + e.Error())
+		return
+	}
+
+	if companyId == 1 {
+		// 潜在用户
+		if applyCount > 0 {
+			permission = 6
+		} else {
+			permission = 7
+		}
+	} else {
+		//权益客户
+		raiCount, e := models.GetCompanyProductCount(companyId, utils.COMPANY_PRODUCT_RAI_ID)
+		if e != nil {
+			err = errors.New("获取用户申请信息失败, Err: " + e.Error())
+			return
+		}
+		if raiCount == 1 {
+			if applyCount > 0 {
+				permission = 2
+			} else {
+				permission = 3
+			}
+		} else {
+			//ficc 客户
+			ficcCount, e := models.GetCompanyProductCount(companyId, utils.COMPANY_PRODUCT_FICC_ID)
+			if e != nil {
+				err = errors.New("获取用户申请信息失败, Err: " + e.Error())
+				return
+			}
+			if ficcCount == 1 {
+				if applyCount > 0 {
+					permission = 4
+				} else {
+					permission = 5
+				}
+			}
+		}
+	}
+	return
+}

+ 2 - 0
utils/constants.go

@@ -195,6 +195,7 @@ const (
 	WX_MSG_PATH_PRODUCTINTERIOR_DETAIL   = "reportPages/internalDetials/internalDetials?id="              //产品内测详情模板消息地址
 	WX_MSG_PATH_THIS_WEEK_DETAIL         = "reportPages/reportSecretDetail/reportSecretDetail?type=2&id=" //本周研究汇总详情模板消息地址
 	WX_MSG_PATH_LAST_WEEK_DETAIL         = "reportPages/reportSecretDetail/reportSecretDetail?type=3&id=" //上周纪要汇总详情模板消息地址
+	WX_MSG_PATH_FICC_REPORT_DETAIL       = "pages-ficc/reportDetail/reportDetail?id="                     //FICC研报详情
 )
 
 // 研选公账号跳转地址
@@ -263,6 +264,7 @@ const (
 	CYGX_OBJ_YANXUANSPECIAL     string = "yanxuanspecial"     // 对象类型:研选专栏
 	CYGX_OBJ_ASKSERIEVIDEO      string = "askserievideo"      // 对象类型:问答系列视频
 	CYGX_OBJ_FICC_REPORT        string = "ficcreport"         // 对象类型:FICC研报
+	CYGX_OBJ_FICC_REPORT_XCX    string = "ficcreportxcx"      // 对象类型:FICC研报小程序
 )
 
 const (