xingzai 1 rok pred
rodič
commit
17fac8a63a

+ 15 - 10
controllers/cygx/cygx_activity_type.go

@@ -16,6 +16,7 @@ type ActivityTypeCoAntroller struct {
 // @Title 活动类型列表
 // @Description活动类型列表接口
 // @Param   IsResearch   query   bool  true       "是否为研选"
+// @Param   IsGetAll   query   bool  true       "是否获取所有"
 // @Success 200 {object} cygx.ActivityTypeListResp
 // @router /activityType/list [get]
 func (this *ActivityTypeCoAntroller) List() {
@@ -32,13 +33,17 @@ func (this *ActivityTypeCoAntroller) List() {
 		return
 	}
 	isResearch, _ := this.GetBool("IsResearch", false)
+	isGetAll, _ := this.GetBool("IsGetAll", false)
 	var condition string
 	resp := new(cygx.ActivityTypeListResp)
-	if isResearch {
-		condition = " source_type IN (0,2) "
-	} else {
-		condition = " source_type IN (0,1) "
+	if !isGetAll {
+		if isResearch {
+			condition = " AND source_type IN (0,2) "
+		} else {
+			condition = " AND source_type IN (0,1) "
+		}
 	}
+
 	list, err := cygx.GetActivityTypeSearchList(condition)
 	if err != nil {
 		br.Msg = "获取失败"
@@ -122,13 +127,13 @@ func (this *ActivityTypeCoAntroller) ListSearch() {
 	resp := new(cygx.ActivityTypeListResp)
 	var condition string
 	if searchType == 1 {
-		condition += ` activity_type_id  IN (1,2)`
+		condition += ` AND  activity_type_id  IN (1,2)`
 	} else if searchType == 2 {
-		condition += ` activity_type_id  IN (5,6)`
+		condition += ` AND activity_type_id  IN (5,6)`
 	} else if searchType == 3 {
-		condition += ` activity_type_id  IN (3,4)`
+		condition += ` AND activity_type_id  IN (3,4)`
 	} else {
-		condition += ` activity_type_id  IN (7)`
+		condition += ` AND activity_type_id  IN (7)`
 	}
 	list, err := cygx.GetActivityTypeSearchList(condition)
 	if err != nil {
@@ -167,9 +172,9 @@ func (this *ActivityTypeCoAntroller) MeetType() {
 	resp := new(cygx.ActivityTypeListResp)
 	var condition string
 	if meetType == 1 {
-		condition += ` activity_type =1 `
+		condition += ` AND activity_type =1 `
 	} else {
-		condition += ` activity_type  = 0 `
+		condition += ` AND activity_type  = 0 `
 	}
 	if isResearch {
 		condition += " AND  source_type IN (0,2) "

+ 1 - 1
models/cygx/activity_type.go

@@ -37,7 +37,7 @@ func GetActivityTypeDetailById(activityTypeId int) (item *ActivityType, err erro
 // 列表
 func GetActivityTypeSearchList(condition string) (items []*ActivityType, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_activity_type WHERE  ` + condition + `  ORDER BY sort DESC`
+	sql := `SELECT * FROM cygx_activity_type WHERE 1= 1  ` + condition + `  ORDER BY sort DESC`
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }

+ 12 - 0
models/cygx/cygx_morning_meeting_review_chapter.go

@@ -53,6 +53,18 @@ func GetCygxMorningMeetingReviewsListById(meetingId int) (items []*CygxMorningMe
 	return
 }
 
+// 列表
+func GetCygxMorningMeetingReviewChapterList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxMorningMeetingReviewChapter, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
 type IndustrialSubjectItem struct {
 	IndustrialSubjectId int    `orm:"column(industrial_subject_id);pk" description:"标的id"`
 	SubjectName         string `description:"标的名称"`

+ 1 - 1
models/cygx/resource_data.go

@@ -44,7 +44,7 @@ func UpdateResourceData(sourceId int, source, publishDate string) (err error) {
 func UpdateResourceDataByItem(item *CygxResourceData) (err error) {
 	o := orm.NewOrm()
 	updateParams := make(map[string]interface{})
-	updateParams["PublishDate"] = item.PublishDate
+	//updateParams["PublishDate"] = item.PublishDate
 	updateParams["SearchTag"] = item.SearchTag
 	ptrStructOrTableName := "cygx_resource_data"
 	whereParam := map[string]interface{}{"source_id": item.SourceId, "source": item.Source}

+ 25 - 24
services/cygx/resource_data.go

@@ -421,17 +421,18 @@ func UpdateProductInteriorResourceData(sourceId int) {
 			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
 			return
 		}
-		//detail, e := cygx.GetCygxProductInteriorDetail(sourceId)
-		//if e != nil {
-		//	err = errors.New("GetCygxReportSelectionInfoById, Err: " + err.Error())
-		//	return
-		//}
+		detail, e := cygx.GetCygxProductInteriorDetail(sourceId)
+		if e != nil {
+			err = errors.New("GetCygxReportSelectionInfoById, Err: " + err.Error())
+			return
+		}
+		mapMatchTypeName := GetCygxReportMappingCygxListMap() //报告匹配类型
 		var resourceDataId int
 		publishDate := time.Now().Format(utils.FormatDateTime)
 		item := new(cygx.CygxResourceData)
 		item.SourceId = sourceId
 		item.Source = source
-		item.SearchTag = "产品内测"
+		item.SearchTag = mapMatchTypeName[detail.MatchTypeId]
 		item.PublishDate = publishDate
 		item.CreateTime = time.Now()
 		if totalData == 0 {
@@ -735,7 +736,7 @@ func UpdateMinutesSummaryResourceData(sourceId int) {
 	return
 }
 
-func init21232() {
+func init1() {
 	var condition string
 	var pars []interface{}
 	//
@@ -763,33 +764,33 @@ func init21232() {
 	//	}
 	//}
 
-	{
-		//文章
-		list, err := cygx.GetArticlList(condition, pars, 0, 9999999)
-		if err != nil {
-			fmt.Println(err)
-		}
-		for _, v := range list {
-			fmt.Println(v.ArticleId)
-			UpdateArticleResourceData(v.ArticleId)
-		}
-	}
-
 	//{
-	//	//产品内测
-	//	list, err := cygx.GetCygxProductInteriorList(condition, pars, 0, 9999999)
+	//	//文章
+	//	list, err := cygx.GetArticlList(condition, pars, 0, 9999999)
 	//	if err != nil {
 	//		fmt.Println(err)
 	//	}
 	//	for _, v := range list {
-	//		fmt.Println(v.ProductInteriorId)
-	//		UpdateProductInteriorResourceData(v.ProductInteriorId)
+	//		fmt.Println(v.ArticleId)
+	//		UpdateArticleResourceData(v.ArticleId)
 	//	}
 	//}
+
+	{
+		//产品内测
+		list, err := cygx.GetCygxProductInteriorList(condition, pars, 0, 9999999)
+		if err != nil {
+			fmt.Println(err)
+		}
+		for _, v := range list {
+			fmt.Println(v.ProductInteriorId)
+			UpdateProductInteriorResourceData(v.ProductInteriorId)
+		}
+	}
 	//
 	//{
 	//	//晨会精华
-	//	list, err := cygx.GetCygxMorningMeetingGatherList(condition, pars, 0, 9999999)
+	//	list, err := cygx.GetCygxMorningMeetingReviewChapterList(condition, pars, 0, 9999999)
 	//	if err != nil {
 	//		fmt.Println(err)
 	//	}