|
@@ -50,34 +50,39 @@ type CygxArticle struct {
|
|
|
}
|
|
|
|
|
|
type ArticleDetail struct {
|
|
|
- ArticleId int `description:"报告id"`
|
|
|
- ArticleIdMd5 string `description:"报告MD5id"`
|
|
|
- IsReport int `description:"是否属于报告,1是,0否"`
|
|
|
- Title string `description:"标题"`
|
|
|
- CategoryName string `description:"一级分类"`
|
|
|
- CategoryId int `description:"分类ID"`
|
|
|
- CreateDate string `description:"创建时间"`
|
|
|
- PublishDate string `description:"发布时间"`
|
|
|
- Body string `description:"内容"`
|
|
|
- Abstract string `description:"摘要"`
|
|
|
- Annotation string `description:"核心观点"`
|
|
|
- IsInterviewApply bool `description:"是否申请访谈:true,已申请,false:未申请"`
|
|
|
- InterviewApplyStatus string `description:"当前访谈申请状态:'待邀请','待访谈','已完成','已取消'"`
|
|
|
- IsFollow bool `description:"是否关注,1是,0否"`
|
|
|
- FollowNum int `description:"关注数量"`
|
|
|
- IsCollect bool `description:"是否收藏:true,已收藏,false:未收藏"`
|
|
|
- CollectionNum int `description:"收藏数量"`
|
|
|
- DepartmentId int `description:"作者ID"`
|
|
|
- DepartmentImgUrl string `description:"作者头像"`
|
|
|
- NickName string `description:"作者昵称"`
|
|
|
- HttpUrl string `description:"文章链接跳转地址"`
|
|
|
- IsNeedJump bool `description:"是否需要跳转链接地址"`
|
|
|
- Seller SellerResp `description:"作者昵称"`
|
|
|
- DepartmentDetail *DepartmentResp `description:"作者昵称"`
|
|
|
- Disclaimers string `description:"免责声明"`
|
|
|
- IsSpecialArticle bool `description:"是否属于专项调研报告"`
|
|
|
- SubCategoryName string `description:"二级分类"`
|
|
|
- ArticleTypeId int `description:"文章类型ID"`
|
|
|
+ ArticleId int `description:"报告id"`
|
|
|
+ ArticleIdMd5 string `description:"报告MD5id"`
|
|
|
+ IsReport int `description:"是否属于报告,1是,0否"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ CategoryName string `description:"一级分类"`
|
|
|
+ CategoryId int `description:"分类ID"`
|
|
|
+ CreateDate string `description:"创建时间"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
+ Body string `description:"内容"`
|
|
|
+ Abstract string `description:"摘要"`
|
|
|
+ Annotation string `description:"核心观点"`
|
|
|
+ IsInterviewApply bool `description:"是否申请访谈:true,已申请,false:未申请"`
|
|
|
+ InterviewApplyStatus string `description:"当前访谈申请状态:'待邀请','待访谈','已完成','已取消'"`
|
|
|
+ IsFollow bool `description:"是否关注,1是,0否"`
|
|
|
+ FollowNum int `description:"关注数量"`
|
|
|
+ IsCollect bool `description:"是否收藏:true,已收藏,false:未收藏"`
|
|
|
+ CollectionNum int `description:"收藏数量"`
|
|
|
+ DepartmentId int `description:"作者ID"`
|
|
|
+ DepartmentImgUrl string `description:"作者头像"`
|
|
|
+ NickName string `description:"作者昵称"`
|
|
|
+ HttpUrl string `description:"文章链接跳转地址"`
|
|
|
+ IsNeedJump bool `description:"是否需要跳转链接地址"`
|
|
|
+ Seller SellerResp `description:"作者昵称"`
|
|
|
+ DepartmentDetail *DepartmentResp `description:"作者昵称"`
|
|
|
+ Disclaimers string `description:"免责声明"`
|
|
|
+ IsSpecialArticle bool `description:"是否属于专项调研报告"`
|
|
|
+ SubCategoryName string `description:"二级分类"`
|
|
|
+ ArticleTypeId int `description:"文章类型ID"`
|
|
|
+ IsApplyAppointmentExpert bool `description:"是否预约过专家"`
|
|
|
+}
|
|
|
+
|
|
|
+type CygxArticleIdReq struct {
|
|
|
+ ArticleId int `description:"文章id"`
|
|
|
}
|
|
|
|
|
|
type SellerResp struct {
|
|
@@ -364,12 +369,11 @@ func GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, indu
|
|
|
artSql += articleTypesCond
|
|
|
}
|
|
|
err = o.Raw(artSql).QueryRow(&artIds)
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
actSql += ` WHERE 1=1 `
|
|
|
if activityTypesCond != "" || (articleTypesCond == "" && activityTypesCond == "") {
|
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
@@ -382,7 +386,7 @@ func GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, indu
|
|
|
actSql += activityTypesCond
|
|
|
}
|
|
|
err = o.Raw(actSql).QueryRow(&actIds)
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -390,14 +394,14 @@ func GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, indu
|
|
|
if strings.Contains(articleTypeStr, "晨会精华") {
|
|
|
mmSql += ` WHERE 1=1 `
|
|
|
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 != "" {
|
|
|
mmSql += ` AND cis.subject_name In (` + subjectNameStr + `) `
|
|
|
} else if industryStr != "" && subjectNameStr == "" {
|
|
|
mmSql += ` AND im.industry_name In (` + industryStr + `) `
|
|
|
}
|
|
|
err = o.Raw(mmSql).QueryRow(&mmIds)
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
@@ -405,7 +409,6 @@ func GetCygxCygxArticleListByCondition(articleTypesCond, activityTypesCond, indu
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 单个tag时用,取合集
|
|
|
func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityTypesCondSlice, industriesCondSlice, subjectNamesSlice, articleTypeSlice []string) (artIds, actIds, mmIds string, err error) {
|
|
|
o := orm.NewOrm()
|
|
@@ -416,7 +419,7 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
mmSql := ` SELECT GROUP_CONCAT(DISTINCT mmc.id SEPARATOR ',') AS mm_ids FROM cygx_morning_meeting_review_chapter as mmc `
|
|
|
|
|
|
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
|
|
|
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
|
|
@@ -428,7 +431,7 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
}
|
|
|
}
|
|
|
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
|
|
|
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
|
|
@@ -450,7 +453,6 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
subjectNameStr := subjectNamesSlice[i]
|
|
|
articleTypeStr := articleTypeSlice[i]
|
|
|
|
|
|
-
|
|
|
if articleTypesCond != "" || (articleTypesCond == "" && activityTypesCond == "") {
|
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
|
artSql += articleTypesCond + ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
@@ -462,7 +464,7 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
artSql += articleTypesCond
|
|
|
}
|
|
|
|
|
|
- if i == len(articleTypeCondSlice) -1 {
|
|
|
+ if i == len(articleTypeCondSlice)-1 {
|
|
|
artSql += `)) `
|
|
|
} else {
|
|
|
artSql += `) OR (1=1 `
|
|
@@ -471,8 +473,6 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
isNeedArt = true
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if activityTypesCond != "" || (articleTypesCond == "" && activityTypesCond == "") {
|
|
|
if industryStr != "" && subjectNameStr != "" {
|
|
|
actSql += activityTypesCond + ` AND (im.industry_name In (` + industryStr + `) OR cis.subject_name In (` + subjectNameStr + `) )`
|
|
@@ -484,7 +484,7 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
actSql += activityTypesCond
|
|
|
}
|
|
|
|
|
|
- if i == len(articleTypeCondSlice) -1 {
|
|
|
+ if i == len(articleTypeCondSlice)-1 {
|
|
|
actSql += `)) `
|
|
|
} else {
|
|
|
actSql += `) OR (1=1 `
|
|
@@ -495,14 +495,14 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
|
|
|
if strings.Contains(articleTypeStr, "晨会精华") {
|
|
|
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 != "" {
|
|
|
mmSql += ` AND cis.subject_name In (` + subjectNameStr + `) `
|
|
|
} else if industryStr != "" && subjectNameStr == "" {
|
|
|
mmSql += ` AND im.industry_name In (` + industryStr + `) `
|
|
|
}
|
|
|
|
|
|
- if i == len(articleTypeCondSlice) -1 {
|
|
|
+ if i == len(articleTypeCondSlice)-1 {
|
|
|
mmSql += `)) `
|
|
|
} else {
|
|
|
mmSql += `) OR (1=1 `
|
|
@@ -514,23 +514,22 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
|
|
|
|
|
|
if isNeedArt {
|
|
|
err = o.Raw(artSql).QueryRow(&artIds)
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- if isNeedAct{
|
|
|
+ if isNeedAct {
|
|
|
err = o.Raw(actSql).QueryRow(&actIds)
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
if isNeedMm {
|
|
|
err = o.Raw(mmSql).QueryRow(&mmIds)
|
|
|
- if err != nil{
|
|
|
+ if err != nil {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return
|
|
|
}
|