瀏覽代碼

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into crm/crm_16.5

zhangchuanxing 2 月之前
父節點
當前提交
e1ea41e459
共有 7 個文件被更改,包括 79 次插入8 次删除
  1. 19 1
      controllers/article.go
  2. 7 0
      models/article.go
  3. 1 1
      models/ficc_report/report_chapter.go
  4. 1 0
      models/report.go
  5. 4 2
      services/article.go
  6. 45 2
      services/ficc_report.go
  7. 2 2
      services/sms.go

+ 19 - 1
controllers/article.go

@@ -303,8 +303,26 @@ func (this *ArticleController) Detail() {
 			//}
 			//}
 
+			//如果是下面这几种类型的不用校验主客观权限
+			var NocheckPerssionZK bool //是否需要校验主观客观权限
+			if detail.SeriesName == "产业跟踪" {
+				NocheckPerssionZK = true
+			}
+			if articlePermissionName == "医药" && detail.SeriesName == "医药周报" {
+				NocheckPerssionZK = true
+			}
+			if articlePermissionName == "消费" && (detail.SeriesName == "消费周报" || detail.SeriesName == "周度思考") {
+				NocheckPerssionZK = true
+			}
+			if articlePermissionName == "科技" && detail.SeriesName == "科技前言(周报)" {
+				NocheckPerssionZK = true
+			}
+			if articlePermissionName == "智造" && (detail.SeriesName == "本周荟" || detail.SeriesName == "智造精粹") {
+				NocheckPerssionZK = true
+			}
+
 			//大行业通过权限校验,再校验主客观权限。只有医药、消费、科技、智造,才会校验主客观权限,热点问答这个匹配类型下的所有报告,也不做主客观校验
-			if hasPersion && utils.InArrayByStr([]string{utils.YI_YAO_NAME, utils.XIAO_FEI_NAME, utils.KE_JI_NAME, utils.ZHI_ZAO_NAME}, articlePermissionName) && matchTypeName != "热点问答" {
+			if !NocheckPerssionZK && hasPersion && utils.InArrayByStr([]string{utils.YI_YAO_NAME, utils.XIAO_FEI_NAME, utils.KE_JI_NAME, utils.ZHI_ZAO_NAME}, articlePermissionName) && matchTypeName != "热点问答" {
 				hasPersion = services.CheckArticlePermissionType(articleId, user)
 			}
 			if hasPersion {

+ 7 - 0
models/article.go

@@ -794,6 +794,13 @@ func ModifyArticleTitleByarticleId(articleId int, title string) (err error) {
 	return
 }
 
+func ModifyArticleFiccBodyByreport_id(report_id int, body string) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_article SET body= ?  WHERE report_id=? `
+	_, err = o.Raw(sql, body, report_id).Exec()
+	return
+}
+
 // 获取数量
 func GetCygxArticleCount(condition string, pars []interface{}) (count int, err error) {
 	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_article as art WHERE 1= 1  `

+ 1 - 1
models/ficc_report/report_chapter.go

@@ -85,7 +85,7 @@ func GetListByReportId(reportId int, classifyNameFirst string) (items []*ReportC
 		where = " AND  report_id = ? AND publish_state = 2"
 	}
 	o := orm.NewOrmUsingDB("rddp")
-	sql := `SELECT report_chapter_id, report_id, type_id, type_name, abstract, title, author, publish_time, trend,video_url,video_name,video_play_seconds,video_size
+	sql := `SELECT report_chapter_id, report_id, type_id, type_name, abstract, title, author, publish_time, trend,video_url,video_name,video_play_seconds,video_size,content
 			FROM  report_chapter
 			WHERE 1=1 ` + where + `   ORDER  BY  sort asc, report_chapter_id asc  `
 	_, err = o.Raw(sql, reportId).QueryRows(&items)

+ 1 - 0
models/report.go

@@ -1591,6 +1591,7 @@ func GetReportAndproductIndustrylListimgZhouqi(condition string, startSize, page
 			art.category_id,
 			art.title,
 			art.publish_date,
+			art.sub_category_name,
 			1 AS resource 
 		FROM
 			cygx_article AS art 

+ 4 - 2
services/article.go

@@ -282,10 +282,9 @@ func GetCeLueArticlePv(cont context.Context) (err error) {
 			record.CreateTime = item.CreateTime
 			record.ModifyTime = time.Now()
 			record.CreateDateApi = time.Now()
-
+			record.Mobile = v.Mobile
 			if mapUserCompany[v.Mobile] != nil {
 				mapUser := mapUserCompany[v.Mobile]
-				record.Mobile = mapUser.Mobile
 				record.CompanyName = mapUser.CompanyName
 				record.CompanyStatus = mapUser.Status
 				record.SellerName = mapUser.SellerName
@@ -1521,6 +1520,9 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
 		if v.Pv > 999 {
 			list[k].Pv = 999
 		}
+		if v.SubCategoryName == "宏观G2观察" {
+			list[k].Title = "【宏观G2观察】" + v.Title
+		}
 	}
 
 	if len(list) == 0 {

+ 45 - 2
services/ficc_report.go

@@ -432,10 +432,48 @@ func GetChapterListByReportChapterIdList(classifyNameFirst string, reportId int,
 }
 
 //func init() {
-//	GetFiccRreportToCygxArticle()
+//	var condition string
+//	var pars []interface{}
+//	condition += ` AND  report_id > 0 AND body = ''   `
+//	articleList, e := models.GetCygxCygxArticleList(condition, pars, 0, 99)
+//	if e != nil {
+//		fmt.Println(e)
+//		return
+//	}
+//	for k, v := range articleList {
+//		fmt.Println("kkk", k)
+//		content := GetReportChapterPermissionMappingItemListByReportId(v.ReportId, "晨会纪要")
+//		e = models.ModifyArticleFiccBodyByreport_id(v.ReportId, content)
+//		if e != nil {
+//			fmt.Println(e)
+//			return
+//		}
+//	}
 //	//UpdateFICCReportResourceData(5542)
 //}
 
+// 根据ID获取FICC研报章节内容详情
+func GetReportChapterPermissionMappingItemListByReportId(reportId int, classifyNameFirst string) (content string) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg(fmt.Sprint("根据ID获取FICC研报章节内容详情失败 ,GetReportChapterPermissionMappingItemListByReportId err:", err.Error()), 2)
+		}
+	}()
+	chapterList, e := ficc_report.GetListByReportId(reportId, classifyNameFirst)
+	if e != nil {
+		err = errors.New("GetListByReportId, Err: " + e.Error())
+		return
+	}
+	for _, v := range chapterList {
+		bodyText, _ := GetReportContentTextSubNew(v.Content)
+		content += bodyText
+	}
+	fmt.Println(content)
+	return
+}
+
 // 获取FICC研报到查研观向数据库中
 func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
 	//func GetFiccRreportToCygxArticle() (err error) {
@@ -501,7 +539,12 @@ func GetFiccRreportToCygxArticle(cont context.Context) (err error) {
 				item.Title = "FICC/周期品晨会纪要"
 			}
 			item.CategoryName = utils.ZHOU_QI_NAME
-			item.Body = v.Content
+
+			if v.Content == "" {
+				item.Body = GetReportChapterPermissionMappingItemListByReportId(v.Id, v.ClassifyNameFirst)
+			} else {
+				item.Body = v.Content
+			}
 			item.Abstract = v.Abstract
 			item.FieldName = v.ClassifyNameSecond
 			item.CreateDate = time.Now().Format(utils.FormatDate)

+ 2 - 2
services/sms.go

@@ -11,7 +11,7 @@ import (
 
 func SendSmsCode(mobile, vcode string) bool {
 	flag := false
-	tplId := "250078"
+	tplId := "65692"
 	result, err := sendSms(mobile, tplId, vcode)
 	if err != nil {
 		fmt.Println("发送短信失败")
@@ -96,7 +96,7 @@ func sendSmsGj(mobile, code, areaNum string) (rs []byte, err error) {
 	param := url.Values{}
 	//配置请求参数,方法内部已处理urlencode问题,中文参数可以直接传参
 	param.Set("mobile", mobile)           //接受短信的用户手机号码
-	param.Set("tplId", "12335")           //您申请的短信模板ID,根据实际情况修改
+	param.Set("tplId", "10054")           //您申请的短信模板ID,根据实际情况修改
 	param.Set("tplValue", "#code#="+code) //您设置的模板变量,根据实际情况
 	param.Set("key", utils.JhGjAppKey)    //应用APPKEY(应用详细页查询)
 	param.Set("areaNum", areaNum)         //应用APPKEY(应用详细页查询)