Sfoglia il codice sorgente

Merge branch 'cygx_13.8' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 6 mesi fa
parent
commit
558f6c981f

+ 23 - 1
controllers/home.go

@@ -738,9 +738,31 @@ func (this *HomeController) NewList() {
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
+
+	var permissionName string
+	if chartPermissionId > 0 {
+		chartPermissioninfo, err := models.GetChartPermissionById(chartPermissionId)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		}
+		permissionName = chartPermissioninfo.PermissionName
+	}
+
+	if currentIndex == 1 && len(list) > 0 && permissionName == utils.ZHOU_QI_NAME && tagIds == "" { // 如果是第一页信息,选择了周期行业,同时没有选择别的筛选条件就 在第三个拼接 FICC研报的跳转信息
+		for k, v := range list {
+			resp.List = append(resp.List, v)
+			if k == 1 {
+				resp.List = append(resp.List, services.GetFiccReportXcxItem(user))
+			}
+		}
+	} else {
+		resp.List = list
+	}
+
 	page = paging.GetPaging(currentIndex, pageSize, total)
 	resp.Paging = page
-	resp.List = list
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 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 {

+ 16 - 0
models/resource_data.go

@@ -22,6 +22,21 @@ type CygxResourceData struct {
 	SearchOrderTime   string    `description:"搜索排序时间"`
 }
 
+// FICC研报小程序
+type FiccReportXcx struct {
+	Source        string `description:"资源类型"`
+	Title         string `description:"标题"`
+	SecondTitle   string `description:"副标题"`
+	ImgUrl        string `description:"背景图片"`
+	HasPermission int    `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	Mobile        string `description:"用户手机号"`
+	SellerMobile  string `description:"销售电话"`
+	SellerName    string `description:"销售姓名"`
+	Appid         string `description:"FICC研报小程序Appid"`
+	SourceUrl     string `description:"跳转资源地址"`
+	ThirdCode     string `description:"三方加密标识"`
+}
+
 type CygxResourceDataResp struct {
 	Id                 int                                     `orm:"column(id);pk"`
 	BodyHighlight      []string                                `description:"搜索高亮展示结果"`
@@ -45,6 +60,7 @@ type CygxResourceDataResp struct {
 	YanxuanSpecial     *CygxYanxuanSpecialCenterResp           `description:"研选专栏"`
 	AskserieVideo      *MicroRoadShowPageList                  `description:"活动音频"`
 	FiccReport         *HomeArticle                            `description:"FICC研报"`
+	FiccReportXcx      *FiccReportXcx                          `description:"FICC研报"`
 }
 
 // Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`

+ 20 - 0
services/config.go

@@ -131,3 +131,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
+}

+ 55 - 2
services/ficc_report.go

@@ -45,14 +45,13 @@ func GetMinClassify(reportInfo *ficc_report.Report) (minClassifyId int, minClass
 	return
 }
 
-// 获取报告详情
 // 获取报告详情
 func GetReportDetail(userinfo *models.WxUserItem, reportId int) (reportDetail ficc_report.ReportDetail, err error) {
 	//var errMsg string
 	defer func() {
 		if err != nil {
 			fmt.Println(err)
-			go utils.SendAlarmMsg(fmt.Sprint("获取研报详情失败 GetFiccYbDetailByApi ,err:", err.Error(), "ReportId:", reportId), 2)
+			go utils.SendAlarmMsg(fmt.Sprint("获取研报详情失败 GetReportDetail ,err:", err.Error(), "ReportId:", reportId), 2)
 		}
 	}()
 
@@ -185,6 +184,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()
 
 	//版头版尾样式
 	{
@@ -542,3 +542,56 @@ func GetFiccRreportToCygxArticle() (err error) {
 	}
 	return
 }
+
+// 根据用户信息,获取跳转研报小程序详情信息
+func GetFiccReportXcxItem(user *models.WxUserItem) (itemSourceResp *models.CygxResourceDataResp) {
+
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg(fmt.Sprint("根据用户信息,获取跳转研报小程序详情信息失败 GetFiccReportXcxItem ,err:", err.Error(), "UserId:", user.UserId), 2)
+		}
+	}()
+	itemSource := new(models.CygxResourceDataResp)
+	itemSource.Source = utils.CYGX_OBJ_FICC_REPORT
+
+	itemResp := new(models.FiccReportXcx)
+	itemResp.Source = utils.CYGX_OBJ_FICC_REPORT
+	itemResp.Title = "每日原油播报"
+	itemResp.SecondTitle = "欧美市场隔夜复盘"
+	itemResp.ImgUrl = utils.FICC_REPORT_ICO_HOME
+	itemResp.Mobile = user.Mobile
+	itemResp.SellerMobile = ""
+	itemResp.SellerName = ""
+	itemResp.Appid = utils.FICC_REPORT_APPID
+	itemResp.SourceUrl = "pages/voice/voice?thirdCode="
+	itemResp.ThirdCode = strconv.Itoa(user.UserId)
+
+	//var hasPermission int
+	var hasPersion bool
+	if user.CompanyId > 1 {
+		companyPermission, e := models.GetCompanyPermission(user.CompanyId)
+		if e != nil {
+			err = errors.New("获取用户权限信息失败" + e.Error())
+			return
+		}
+		if companyPermission != "" {
+			slice := strings.Split(companyPermission, ",")
+			if utils.InArrayByStr(slice, "周期") {
+				hasPersion = true
+			}
+		}
+	}
+	if hasPersion {
+		itemResp.HasPermission = 1
+	} else {
+		itemResp.HasPermission, itemResp.SellerName, itemResp.SellerMobile, _, err = GetUserHasPermissionArticle(user)
+		if err != nil {
+			return
+		}
+	}
+	itemSource.FiccReportXcx = itemResp
+	itemSourceResp = itemSource
+	return
+}

+ 1 - 0
services/resource_data.go

@@ -471,6 +471,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			//fmt.Println(v.ArticleId)
 			v.Body = ""
 			v.BodyHtml = ""
+			//v.Source = utils.CYGX_OBJ_YANXUANSPECIAL
 			mapItems[fmt.Sprint("ficcreport", v.ReportId)].FiccReport = v
 		}
 

+ 2 - 0
utils/constants.go

@@ -312,4 +312,6 @@ var ACTIVITY_SPECIAL_TRIP_PERMISSION_NAME_OTHER = []string{"策略", "固收", "
 const (
 	DEFAULT_REPORT_SHARE_BG_IMG = "https://hzstatic.hzinsights.com/static/icon/hzyb/rddp-share-bg.png" // 分享默认背景图
 	ALIYUN_YBIMG_HOST           = "https://hzstatic.hzinsights.com/static/yb_wx/"
+	FICC_REPORT_APPID           = "wxb059c872d79b9967"
+	FICC_REPORT_ICO_HOME        = "https://hzstatic.hzinsights.com/cygx/config/ficc_report_ico.png" // FICC研报小程序首页封面图
 )