|
@@ -79,6 +79,10 @@ type CygxArticleEs struct {
|
|
MatchTypeName string `description:"匹配类型"`
|
|
MatchTypeName string `description:"匹配类型"`
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+type CygxArticleIdReq struct {
|
|
|
|
+ ArticleId int `description:"文章id"`
|
|
|
|
+}
|
|
|
|
+
|
|
// 新增文章
|
|
// 新增文章
|
|
func AddCygxArticle(item *CygxArticle) (lastId int64, err error) {
|
|
func AddCygxArticle(item *CygxArticle) (lastId int64, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
@@ -119,57 +123,58 @@ type HomeArticle struct {
|
|
}
|
|
}
|
|
|
|
|
|
type ArticleDetail struct {
|
|
type ArticleDetail struct {
|
|
- ArticleId int `description:"报告id"`
|
|
|
|
- Title string `description:"标题"`
|
|
|
|
- TitleEn string `description:"英文标题 "`
|
|
|
|
- UpdateFrequency string `description:"更新周期"`
|
|
|
|
- CreateDate string `description:"创建时间"`
|
|
|
|
- PublishDate string `description:"发布时间"`
|
|
|
|
- Body string `description:"内容"`
|
|
|
|
- Abstract string `description:"摘要"`
|
|
|
|
- CategoryName string `description:"一级分类"`
|
|
|
|
- SubCategoryName string `description:"二级分类"`
|
|
|
|
- IsCollect bool `description:"是否收藏:true,已收藏,false:未收藏"`
|
|
|
|
- IsInterviewApply bool `description:"是否申请访谈:true,已申请,false:未申请"`
|
|
|
|
- BodyText string `description:"内容"`
|
|
|
|
- InterviewApplyStatus string `description:"当前访谈申请状态:'待邀请','待访谈','已完成','已取消'"`
|
|
|
|
- InterviewDate string `description:"访谈时间"`
|
|
|
|
- ExpertBackground string `description:"专家背景"`
|
|
|
|
- ExpertNumber string `description:"专家编号"`
|
|
|
|
- Department string `description:"作者"`
|
|
|
|
- SellerMobile string `description:"销售手机号"`
|
|
|
|
- SellerName string `description:"销售名称"`
|
|
|
|
- ArticleIdMd5 string `description:"纪要id"`
|
|
|
|
- IsClass int `description:"是否归类,1是,0否"`
|
|
|
|
- CategoryId int `description:"分类ID"`
|
|
|
|
- IsSummary int `description:"是否是纪要库,1是,0否"`
|
|
|
|
- IsReport int `description:"是否属于报告,1是,0否"`
|
|
|
|
- IsResearch bool `description:"是否属于研选"`
|
|
|
|
- FileLink string `description:"下载预览链接"`
|
|
|
|
- SellerAndMobile string `description:"销售和手机号"`
|
|
|
|
- IsFollow bool `description:"是否关注,1是,0否"`
|
|
|
|
- IsBelongSummary bool `description:"是否属于纪要库"`
|
|
|
|
- IsBelongReport bool `description:"是否属于报告"`
|
|
|
|
- FollowNum int `description:"关注数量"`
|
|
|
|
- CollectionNum int `description:"收藏数量"`
|
|
|
|
- DepartmentId int `description:"作者ID"`
|
|
|
|
- DepartmentImgUrl string `description:"作者头像"`
|
|
|
|
- NickName string `description:"作者昵称"`
|
|
|
|
- SubjectIds string `description:"文章关联标的的ID字符串"`
|
|
|
|
- IndustrialAndSubjectIds string `description:"文章关联产业和标的的ID字符串"`
|
|
|
|
- IndustrialManagementId int `description:"文章关联产业ID"`
|
|
|
|
- SellerList []*SellerRep
|
|
|
|
- HttpUrl string `description:"文章链接跳转地址"`
|
|
|
|
- IsNeedJump bool `description:"是否需要跳转链接地址"`
|
|
|
|
- ReportLink string `description:"报告链接"`
|
|
|
|
- IsShowLinkButton int `description:"这种报告类型是否展示查看报告链接"`
|
|
|
|
- ArticleTypeId int `description:"文章类型ID"`
|
|
|
|
- IsSpecialArticle bool `description:"是否属于专项调研报告"`
|
|
|
|
- Annotation string `description:"核心观点"`
|
|
|
|
- IsShowFollowButton bool `description:"是否展示关注取关按钮"`
|
|
|
|
- IsFollowButton bool `description:"是否关注"`
|
|
|
|
- IsRoadShow bool `description:"是否是路演精华"`
|
|
|
|
- ReportType int `description:"报告类型,1行业报告,2产业报告,0无"`
|
|
|
|
|
|
+ ArticleId int `description:"报告id"`
|
|
|
|
+ Title string `description:"标题"`
|
|
|
|
+ TitleEn string `description:"英文标题 "`
|
|
|
|
+ UpdateFrequency string `description:"更新周期"`
|
|
|
|
+ CreateDate string `description:"创建时间"`
|
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
|
+ Body string `description:"内容"`
|
|
|
|
+ Abstract string `description:"摘要"`
|
|
|
|
+ CategoryName string `description:"一级分类"`
|
|
|
|
+ SubCategoryName string `description:"二级分类"`
|
|
|
|
+ IsCollect bool `description:"是否收藏:true,已收藏,false:未收藏"`
|
|
|
|
+ IsInterviewApply bool `description:"是否申请访谈:true,已申请,false:未申请"`
|
|
|
|
+ BodyText string `description:"内容"`
|
|
|
|
+ InterviewApplyStatus string `description:"当前访谈申请状态:'待邀请','待访谈','已完成','已取消'"`
|
|
|
|
+ InterviewDate string `description:"访谈时间"`
|
|
|
|
+ ExpertBackground string `description:"专家背景"`
|
|
|
|
+ ExpertNumber string `description:"专家编号"`
|
|
|
|
+ Department string `description:"作者"`
|
|
|
|
+ SellerMobile string `description:"销售手机号"`
|
|
|
|
+ SellerName string `description:"销售名称"`
|
|
|
|
+ ArticleIdMd5 string `description:"纪要id"`
|
|
|
|
+ IsClass int `description:"是否归类,1是,0否"`
|
|
|
|
+ CategoryId int `description:"分类ID"`
|
|
|
|
+ IsSummary int `description:"是否是纪要库,1是,0否"`
|
|
|
|
+ IsReport int `description:"是否属于报告,1是,0否"`
|
|
|
|
+ IsResearch bool `description:"是否属于研选"`
|
|
|
|
+ FileLink string `description:"下载预览链接"`
|
|
|
|
+ SellerAndMobile string `description:"销售和手机号"`
|
|
|
|
+ IsFollow bool `description:"是否关注,1是,0否"`
|
|
|
|
+ IsBelongSummary bool `description:"是否属于纪要库"`
|
|
|
|
+ IsBelongReport bool `description:"是否属于报告"`
|
|
|
|
+ FollowNum int `description:"关注数量"`
|
|
|
|
+ CollectionNum int `description:"收藏数量"`
|
|
|
|
+ DepartmentId int `description:"作者ID"`
|
|
|
|
+ DepartmentImgUrl string `description:"作者头像"`
|
|
|
|
+ NickName string `description:"作者昵称"`
|
|
|
|
+ SubjectIds string `description:"文章关联标的的ID字符串"`
|
|
|
|
+ IndustrialAndSubjectIds string `description:"文章关联产业和标的的ID字符串"`
|
|
|
|
+ IndustrialManagementId int `description:"文章关联产业ID"`
|
|
|
|
+ SellerList []*SellerRep
|
|
|
|
+ HttpUrl string `description:"文章链接跳转地址"`
|
|
|
|
+ IsNeedJump bool `description:"是否需要跳转链接地址"`
|
|
|
|
+ ReportLink string `description:"报告链接"`
|
|
|
|
+ IsShowLinkButton int `description:"这种报告类型是否展示查看报告链接"`
|
|
|
|
+ ArticleTypeId int `description:"文章类型ID"`
|
|
|
|
+ IsSpecialArticle bool `description:"是否属于专项调研报告"`
|
|
|
|
+ Annotation string `description:"核心观点"`
|
|
|
|
+ IsShowFollowButton bool `description:"是否展示关注取关按钮"`
|
|
|
|
+ IsFollowButton bool `description:"是否关注"`
|
|
|
|
+ IsRoadShow bool `description:"是否是路演精华"`
|
|
|
|
+ ReportType int `description:"报告类型,1行业报告,2产业报告,0无"`
|
|
|
|
+ IsApplyAppointmentExpert bool `description:"是否预约过专家"`
|
|
}
|
|
}
|
|
|
|
|
|
type ArticleDetailFileLink struct {
|
|
type ArticleDetailFileLink struct {
|
|
@@ -794,7 +799,6 @@ func GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, indu
|
|
err = o.Raw(artSql).QueryRow(&artIds)
|
|
err = o.Raw(artSql).QueryRow(&artIds)
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
actSql += ` WHERE 1=1 `
|
|
actSql += ` WHERE 1=1 `
|
|
if activityTypesCond != "" || (articleTypesCond == "" && activityTypesCond == "") {
|
|
if activityTypesCond != "" || (articleTypesCond == "" && activityTypesCond == "") {
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
@@ -812,7 +816,7 @@ func GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, indu
|
|
if strings.Contains(articleTypeStr, "晨会精华") {
|
|
if strings.Contains(articleTypeStr, "晨会精华") {
|
|
mmSql += ` WHERE 1=1 `
|
|
mmSql += ` WHERE 1=1 `
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
- mmSql += ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
|
|
|
|
+ mmSql += ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
} else if industryStr == "" && subjectNameStr != "" {
|
|
} else if industryStr == "" && subjectNameStr != "" {
|
|
mmSql += ` AND cis.subject_name In (` + subjectNameStr + `) `
|
|
mmSql += ` AND cis.subject_name In (` + subjectNameStr + `) `
|
|
} else if industryStr != "" && subjectNameStr == "" {
|
|
} else if industryStr != "" && subjectNameStr == "" {
|
|
@@ -824,8 +828,6 @@ func GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, indu
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
// 单个tag时用,取合集
|
|
// 单个tag时用,取合集
|
|
func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityTypesCondSlice, industriesCondSlice, subjectNamesSlice, articleTypeSlice []string) (artIds, actIds, mmIds string, err error) {
|
|
func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityTypesCondSlice, industriesCondSlice, subjectNamesSlice, articleTypeSlice []string) (artIds, actIds, mmIds string, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
@@ -836,7 +838,7 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
mmSql := ` SELECT GROUP_CONCAT(DISTINCT mmc.id SEPARATOR ',') AS mm_ids FROM cygx_morning_meeting_review_chapter as mmc `
|
|
mmSql := ` SELECT GROUP_CONCAT(DISTINCT mmc.id SEPARATOR ',') AS mm_ids FROM cygx_morning_meeting_review_chapter as mmc `
|
|
|
|
|
|
for _, s := range industriesCondSlice {
|
|
for _, s := range industriesCondSlice {
|
|
- if s != ""{
|
|
|
|
|
|
+ if s != "" {
|
|
artSql += ` INNER JOIN cygx_industrial_article_group_management AS iam ON iam.article_id = art.article_id
|
|
artSql += ` INNER JOIN cygx_industrial_article_group_management AS iam ON iam.article_id = art.article_id
|
|
INNER JOIN cygx_industrial_management AS im ON im.industrial_management_id=iam.industrial_management_id `
|
|
INNER JOIN cygx_industrial_management AS im ON im.industrial_management_id=iam.industrial_management_id `
|
|
actSql += ` INNER JOIN cygx_industrial_activity_group_management AS iam ON iam.activity_id = act.activity_id
|
|
actSql += ` INNER JOIN cygx_industrial_activity_group_management AS iam ON iam.activity_id = act.activity_id
|
|
@@ -848,7 +850,7 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for _, s := range subjectNamesSlice {
|
|
for _, s := range subjectNamesSlice {
|
|
- if s != ""{
|
|
|
|
|
|
+ if s != "" {
|
|
artSql += ` INNER JOIN cygx_industrial_article_group_subject AS ias ON ias.article_id = art.article_id
|
|
artSql += ` INNER JOIN cygx_industrial_article_group_subject AS ias ON ias.article_id = art.article_id
|
|
INNER JOIN cygx_industrial_subject AS cis ON cis.industrial_subject_id=ias.industrial_subject_id `
|
|
INNER JOIN cygx_industrial_subject AS cis ON cis.industrial_subject_id=ias.industrial_subject_id `
|
|
actSql += ` INNER JOIN cygx_industrial_activity_group_subject AS ias ON ias.activity_id = act.activity_id
|
|
actSql += ` INNER JOIN cygx_industrial_activity_group_subject AS ias ON ias.activity_id = act.activity_id
|
|
@@ -870,7 +872,6 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
subjectNameStr := subjectNamesSlice[i]
|
|
subjectNameStr := subjectNamesSlice[i]
|
|
articleTypeStr := articleTypeSlice[i]
|
|
articleTypeStr := articleTypeSlice[i]
|
|
|
|
|
|
-
|
|
|
|
if articleTypesCond != "" || (articleTypesCond == "" && activityTypesCond == "") {
|
|
if articleTypesCond != "" || (articleTypesCond == "" && activityTypesCond == "") {
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
artSql += articleTypesCond + ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
artSql += articleTypesCond + ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
@@ -882,7 +883,7 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
artSql += articleTypesCond
|
|
artSql += articleTypesCond
|
|
}
|
|
}
|
|
|
|
|
|
- if i == len(articleTypeCondSlice) -1 {
|
|
|
|
|
|
+ if i == len(articleTypeCondSlice)-1 {
|
|
artSql += `)) `
|
|
artSql += `)) `
|
|
} else {
|
|
} else {
|
|
artSql += `) OR (1=1 `
|
|
artSql += `) OR (1=1 `
|
|
@@ -891,8 +892,6 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
isNeedArt = true
|
|
isNeedArt = true
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
if activityTypesCond != "" || (articleTypesCond == "" && activityTypesCond == "") {
|
|
if activityTypesCond != "" || (articleTypesCond == "" && activityTypesCond == "") {
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
actSql += activityTypesCond + ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
actSql += activityTypesCond + ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
@@ -904,7 +903,7 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
actSql += activityTypesCond
|
|
actSql += activityTypesCond
|
|
}
|
|
}
|
|
|
|
|
|
- if i == len(articleTypeCondSlice) -1 {
|
|
|
|
|
|
+ if i == len(articleTypeCondSlice)-1 {
|
|
actSql += `)) `
|
|
actSql += `)) `
|
|
} else {
|
|
} else {
|
|
actSql += `) OR (1=1 `
|
|
actSql += `) OR (1=1 `
|
|
@@ -915,14 +914,14 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
|
|
|
if strings.Contains(articleTypeStr, "晨会精华") {
|
|
if strings.Contains(articleTypeStr, "晨会精华") {
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
- mmSql += ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
|
|
|
|
+ mmSql += ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
} else if industryStr == "" && subjectNameStr != "" {
|
|
} else if industryStr == "" && subjectNameStr != "" {
|
|
mmSql += ` AND cis.subject_name In (` + subjectNameStr + `) `
|
|
mmSql += ` AND cis.subject_name In (` + subjectNameStr + `) `
|
|
} else if industryStr != "" && subjectNameStr == "" {
|
|
} else if industryStr != "" && subjectNameStr == "" {
|
|
mmSql += ` AND im.industry_name In (` + industryStr + `) `
|
|
mmSql += ` AND im.industry_name In (` + industryStr + `) `
|
|
}
|
|
}
|
|
|
|
|
|
- if i == len(articleTypeCondSlice) -1 {
|
|
|
|
|
|
+ if i == len(articleTypeCondSlice)-1 {
|
|
mmSql += `)) `
|
|
mmSql += `)) `
|
|
} else {
|
|
} else {
|
|
mmSql += `) OR (1=1 `
|
|
mmSql += `) OR (1=1 `
|
|
@@ -934,23 +933,22 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
|
|
|
if isNeedArt {
|
|
if isNeedArt {
|
|
err = o.Raw(artSql).QueryRow(&artIds)
|
|
err = o.Raw(artSql).QueryRow(&artIds)
|
|
- if err != nil{
|
|
|
|
|
|
+ if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if isNeedAct{
|
|
|
|
|
|
+ if isNeedAct {
|
|
err = o.Raw(actSql).QueryRow(&actIds)
|
|
err = o.Raw(actSql).QueryRow(&actIds)
|
|
- if err != nil{
|
|
|
|
|
|
+ if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if isNeedMm {
|
|
if isNeedMm {
|
|
err = o.Raw(mmSql).QueryRow(&mmIds)
|
|
err = o.Raw(mmSql).QueryRow(&mmIds)
|
|
- if err != nil{
|
|
|
|
|
|
+ if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|