|
@@ -83,7 +83,7 @@ func GetReportContentTextSubNew(content string) (contentSub string, err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func GetReportContentTextSubByarticle(content, abstract string, articleId int) (contentSub string, err error) {
|
|
func GetReportContentTextSubByarticle(content, abstract string, articleId int) (contentSub string, err error) {
|
|
var lenabstract int
|
|
var lenabstract int
|
|
|
|
|
|
@@ -110,7 +110,7 @@ func GetReportContentTextSubByarticle(content, abstract string, articleId int) (
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func GetArticleAll() {
|
|
func GetArticleAll() {
|
|
var err error
|
|
var err error
|
|
defer func() {
|
|
defer func() {
|
|
@@ -129,7 +129,7 @@ func GetArticleAll() {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func FixArticleContent(articleId int) {
|
|
func FixArticleContent(articleId int) {
|
|
item, err := models.GetArticleDetailById(articleId)
|
|
item, err := models.GetArticleDetailById(articleId)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -326,7 +326,7 @@ func FixArticleImgUrl(body string) (contentSub string, err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func FixArticleFirstCount(body string) (contentSub string, err error) {
|
|
func FixArticleFirstCount(body string) (contentSub string, err error) {
|
|
|
|
|
|
doc, err := goquery.NewDocumentFromReader(strings.NewReader(body))
|
|
doc, err := goquery.NewDocumentFromReader(strings.NewReader(body))
|
|
@@ -376,7 +376,7 @@ func SynchronizationArtclehistory() {
|
|
fmt.Println("同步结束")
|
|
fmt.Println("同步结束")
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func StatisticalReport() {
|
|
func StatisticalReport() {
|
|
var isSummaryNumAll, isClassNum, pvNumAll, uvNumAll int
|
|
var isSummaryNumAll, isClassNum, pvNumAll, uvNumAll int
|
|
list, err := models.GetChartPermissionActivity()
|
|
list, err := models.GetChartPermissionActivity()
|
|
@@ -561,7 +561,7 @@ func PushViewRecordNewRedisData(reportViewRecord *ReportViewRecord, companyId in
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
func GetCeLueArticlePv(cont context.Context) (err error) {
|
|
func GetCeLueArticlePv(cont context.Context) (err error) {
|
|
defer func() {
|
|
defer func() {
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -690,7 +690,7 @@ func init122() {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func HandleArticleListByApi(artcleId int) (err error) {
|
|
func HandleArticleListByApi(artcleId int) (err error) {
|
|
defer func() {
|
|
defer func() {
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -1167,7 +1167,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
|
|
func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
|
|
|
|
|
|
cacheKey := fmt.Sprint(utils.CACHE_KEY_ARTICLE_ID_TEMPLATE, ":ArticleId", articleId)
|
|
cacheKey := fmt.Sprint(utils.CACHE_KEY_ARTICLE_ID_TEMPLATE, ":ArticleId", articleId)
|
|
@@ -1597,7 +1597,7 @@ func DoArticleOnenIdWxTemplateMsg(articleId int) (err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func GetSpecialArticleDetailUserPower(user *models.WxUserItem, articleInfo *models.ArticleDetail) (havePower bool, err error) {
|
|
func GetSpecialArticleDetailUserPower(user *models.WxUserItem, articleInfo *models.ArticleDetail) (havePower bool, err error) {
|
|
permissionStr, e := GetCompanyPermissionUpgrade(user.CompanyId)
|
|
permissionStr, e := GetCompanyPermissionUpgrade(user.CompanyId)
|
|
if e != nil {
|
|
if e != nil {
|
|
@@ -1627,7 +1627,7 @@ func GetSpecialArticleDetailUserPower(user *models.WxUserItem, articleInfo *mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
func GetArticNewLabelWhithActivity3Month() (labelMap map[int]bool, err error) {
|
|
func GetArticNewLabelWhithActivity3Month() (labelMap map[int]bool, err error) {
|
|
var condition string
|
|
var condition string
|
|
var pars []interface{}
|
|
var pars []interface{}
|
|
@@ -1676,7 +1676,7 @@ func GetArticNewLabelWhithActivity3Month() (labelMap map[int]bool, err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeArticle, err error) {
|
|
func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeArticle, err error) {
|
|
|
|
|
|
detailResearch, e := models.GetConfigByCode("category_research_img_url")
|
|
detailResearch, e := models.GetConfigByCode("category_research_img_url")
|
|
@@ -1814,7 +1814,7 @@ func HandleArticleCategoryImg(list []*models.HomeArticle) (items []*models.HomeA
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
|
|
func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
|
|
if item.ArticleId >= utils.SummaryArticleId {
|
|
if item.ArticleId >= utils.SummaryArticleId {
|
|
item.Annotation = YxArticleAnnotation(item)
|
|
item.Annotation = YxArticleAnnotation(item)
|
|
@@ -1887,7 +1887,7 @@ func ArticleAnnotation(item *models.HomeArticle) (annotation string) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
+
|
|
func YxArticleAnnotation(article *models.HomeArticle) (annotation string) {
|
|
func YxArticleAnnotation(article *models.HomeArticle) (annotation string) {
|
|
|
|
|
|
if strings.Count(article.Body, "<hr") == 0 {
|
|
if strings.Count(article.Body, "<hr") == 0 {
|
|
@@ -1938,3 +1938,34 @@ func YxArticleAnnotation(article *models.HomeArticle) (annotation string) {
|
|
annotation = body
|
|
annotation = body
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+func GetReportLinkToArticleid(reportLink string) (articleId int, err error) {
|
|
|
|
+ defer func() {
|
|
|
|
+ if err != nil {
|
|
|
|
+ go utils.SendAlarmMsg("通过接解析带有Md5的文章链接获取文章ID失败"+err.Error(), 2)
|
|
|
|
+ }
|
|
|
|
+ }()
|
|
|
|
+ var artMd5 string
|
|
|
|
+
|
|
|
|
+ strnum1 := strings.Index(reportLink, "id=")
|
|
|
|
+ if strnum1 > 0 {
|
|
|
|
+ sliceId := strings.Split(reportLink, "id=")
|
|
|
|
+ if len(sliceId) > 1 {
|
|
|
|
+ reportLink = sliceId[1]
|
|
|
|
+ sliceMd5Id := strings.Split(reportLink, "&")
|
|
|
|
+ artMd5 = sliceMd5Id[0]
|
|
|
|
+ }
|
|
|
|
+ if artMd5 != "" {
|
|
|
|
+ detail, errArt := models.GetArticleDetailByIdMd5(artMd5)
|
|
|
|
+ if errArt != nil && errArt.Error() != utils.ErrNoRow() {
|
|
|
|
+ err = errArt
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if detail != nil {
|
|
|
|
+ articleId = detail.ArticleId
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+}
|