소스 검색

Merge branch 'master' of http://8.136.199.33:3000/cxzhang/hongze_clpt into crm_14.7

xingzai 1 년 전
부모
커밋
e7801ee7a9

+ 107 - 33
controllers/activity_special.go

@@ -7,7 +7,6 @@ import (
 	"hongze/hongze_clpt/services"
 	"hongze/hongze_clpt/utils"
 	"strconv"
-	"strings"
 	"time"
 )
 
@@ -261,10 +260,22 @@ func (this *ActivitySpecialController) SpecialTripAdd() {
 			itemBill.Source = 1
 			itemBill.DoType = 1
 			itemBill.BillDetailed = -1 // 流水减一
-			itemBill.RegisterPlatform = 1
+			itemBill.RegisterPlatform = utils.REGISTER_PLATFORM
 			itemBill.ChartPermissionId = activityInfo.ChartPermissionId
 			itemBill.ChartPermissionName = activityInfo.ChartPermissionName
 
+			if activityInfo.ChartPermissionName == utils.CE_LUE_NAME {
+				//如果是策略行业,把代扣行业信息放入流水表,取消报名的时候,返点使用
+				maxChartPermissionId, maxChartPermissionName, err := services.GetSpecialBillMaxChartPermissionId(user)
+				if err != nil {
+					br.Msg = "操作失败"
+					br.ErrMsg = "获取销售信息失败,GetSpecialBillMaxChartPermissionId Err:" + err.Error()
+					return
+				}
+				itemBill.ChartPermissionId = maxChartPermissionId
+				itemBill.ChartPermissionName = maxChartPermissionName
+			}
+
 			var itemMeeting = new(models.CygxActivitySpecialMeetingDetail)
 			itemMeeting.UserId = user.UserId
 			itemMeeting.ActivityId = activityId
@@ -314,6 +325,14 @@ func (this *ActivitySpecialController) SpecialTripAdd() {
 						item.CountryCode = user.CountryCode
 					}
 				}
+
+				err = services.DeductTripRemainingtimesByUser(user, activityInfo) //扣除用户专项调研剩余次数
+				if err != nil {
+					br.Msg = "操作失败"
+					br.ErrMsg = "操作失败,Err:" + err.Error()
+					return
+				}
+
 				err = models.AddCygxActivitySpecialTrip(item)
 				if err != nil {
 					br.Msg = "操作失败"
@@ -321,6 +340,7 @@ func (this *ActivitySpecialController) SpecialTripAdd() {
 					return
 				}
 				//SignupStatus  int    `description:"返回状态:1:成功 、2 :人数已满 、3:调研次数已用完、 4:超时"`
+
 			} else {
 				updateParams := make(map[string]interface{})
 				updateParams["IsValid"] = 1
@@ -337,26 +357,41 @@ func (this *ActivitySpecialController) SpecialTripAdd() {
 				//48小时之内的取消也扣除一次参会记录
 				if time.Now().Add(+time.Hour * 48).After(resultTime) {
 					itemBill.BillDetailed = 0 //48小时之内,取消报名之后二次报名,不扣除流水记录
+				} else {
+					err = services.DeductTripRemainingtimesByUser(user, activityInfo) //扣除用户专项调研剩余次数
+					if err != nil {
+						br.Msg = "操作失败"
+						br.ErrMsg = "操作失败,Err:" + err.Error()
+						return
+					}
 				}
 			}
-			userType, tripRemaining, mapChartName, err := services.GetChartPermissionSpecialSurplusByCompany(user.CompanyId)
+			//userType, tripRemaining, mapChartName, err := services.GetChartPermissionSpecialSurplusByCompany(user.CompanyId)
+			//if err != nil {
+			//	br.Msg = "获取专项调研剩余次数失败"
+			//	br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+			//	return
+			//}
+			//if userType == 2 {
+			//	tripRemaining = tripRemaining + itemBill.BillDetailed
+			//	itemBill.Total = strconv.Itoa(tripRemaining) + "次"
+			//} else {
+			//	for k, num := range mapChartName {
+			//		if activityInfo.ChartPermissionName == k {
+			//			num = num + itemBill.BillDetailed
+			//		}
+			//		itemBill.Total += k + strconv.Itoa(num) + "次+"
+			//	}
+			//	itemBill.Total = strings.TrimRight(itemBill.Total, "+")
+			//}
+
+			totalText, err := services.HandleActivitySpecialTripBillTotalText(user)
 			if err != nil {
-				br.Msg = "获取专项调研剩余次数失败"
-				br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+				br.Msg = "报名失败,"
+				br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
 				return
 			}
-			if userType == 2 {
-				tripRemaining = tripRemaining + itemBill.BillDetailed
-				itemBill.Total = strconv.Itoa(tripRemaining) + "次"
-			} else {
-				for k, num := range mapChartName {
-					if activityInfo.ChartPermissionName == k {
-						num = num + itemBill.BillDetailed
-					}
-					itemBill.Total += k + strconv.Itoa(num) + "次+"
-				}
-				itemBill.Total = strings.TrimRight(itemBill.Total, "+")
-			}
+			itemBill.Total = totalText
 
 			//添加流水记录
 			err = models.AddCygxActivitySpecialTripBill(itemBill)
@@ -419,6 +454,16 @@ func (this *ActivitySpecialController) Tripcancel() {
 		return
 	}
 	activityId := req.ActivityId
+	total, err := models.GetUserActivitySpecialTripCount(user.UserId, activityId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
+		return
+	}
+	if total == 0 {
+		br.Msg = "报名已取消!"
+		return
+	}
 	activityInfo, errInfo := models.GetCygxActivitySpecialDetailById(uid, activityId)
 	if activityInfo == nil {
 		br.Msg = "操作失败"
@@ -443,34 +488,63 @@ func (this *ActivitySpecialController) Tripcancel() {
 	itemBill.Source = 1
 	itemBill.DoType = 2
 	itemBill.BillDetailed = 1 // 流水加一
-	itemBill.RegisterPlatform = 1
+	itemBill.RegisterPlatform = utils.REGISTER_PLATFORM
 	itemBill.ChartPermissionId = activityInfo.ChartPermissionId
 	itemBill.ChartPermissionName = activityInfo.ChartPermissionName
+
+	if activityInfo.ChartPermissionName == utils.CE_LUE_NAME {
+		//如果是策略行业,把代扣行业信息放入流水表,取消报名的时候,返点使用
+		lastTripBill, err := models.GetCygxActivitySpecialTripBillLastDetialByActivityId(activityInfo.ActivityId, user.UserId)
+		if err != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "获取销售信息失败,GetSpecialBillMaxChartPermissionId Err:" + err.Error()
+			return
+		}
+		itemBill.ChartPermissionId = lastTripBill.ChartPermissionId
+		itemBill.ChartPermissionName = lastTripBill.ChartPermissionName
+	}
+
 	resultTime := utils.StrTimeToTime(activityInfo.ActivityTime)
 	//48小时之内的取消也扣除一次参会记录
 	var isValid int
 	if time.Now().Add(+time.Hour * 48).After(resultTime) {
 		isValid = 1
 		itemBill.BillDetailed = 0 //48小时之内取消的活动扣点不返回
+	} else {
+		err = services.RebateTripRemainingtimesByUser(user, activityInfo) // 返点
+		if err != nil {
+			br.Msg = "操作失败"
+			br.ErrMsg = "操作失败,RebateTripRemainingtimesByUserErr:" + err.Error()
+			return
+		}
 	}
-	userType, tripRemaining, mapChartName, err := services.GetChartPermissionSpecialSurplusByCompany(user.CompanyId)
+	//userType, tripRemaining, mapChartName, err := services.GetChartPermissionSpecialSurplusByCompany(user.CompanyId)
+	//if err != nil {
+	//	br.Msg = "获取专项调研剩余次数失败"
+	//	br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+	//	return
+	//}
+	//if userType == 2 {
+	//	tripRemaining += itemBill.BillDetailed
+	//	itemBill.Total = strconv.Itoa(tripRemaining) + "次"
+	//} else {
+	//	for k, num := range mapChartName {
+	//		if activityInfo.ChartPermissionName == k {
+	//			num += itemBill.BillDetailed
+	//		}
+	//		itemBill.Total += k + strconv.Itoa(num) + "次+"
+	//	}
+	//	itemBill.Total = strings.TrimRight(itemBill.Total, "+")
+	//}
+
+	totalText, err := services.HandleActivitySpecialTripBillTotalText(user)
 	if err != nil {
-		br.Msg = "获取专项调研剩余次数失败"
-		br.ErrMsg = "获取专项调研剩余次数失败,err:" + err.Error()
+		br.Msg = "报名失败,"
+		br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
 		return
 	}
-	if userType == 2 {
-		tripRemaining += itemBill.BillDetailed
-		itemBill.Total = strconv.Itoa(tripRemaining) + "次"
-	} else {
-		for k, num := range mapChartName {
-			if activityInfo.ChartPermissionName == k {
-				num += itemBill.BillDetailed
-			}
-			itemBill.Total += k + strconv.Itoa(num) + "次+"
-		}
-		itemBill.Total = strings.TrimRight(itemBill.Total, "+")
-	}
+	itemBill.Total = totalText
+
 	err = models.CancelActivitySpecialTripIsValid(isValid, activityInfo.ActivityId, uid)
 	if err != nil {
 		br.Msg = "操作失败"

+ 4 - 2
controllers/article.go

@@ -159,6 +159,7 @@ func (this *ArticleController) Detail() {
 			hasPermission = 1
 			hasFree = 1
 			var articlePermissionName string
+			var matchTypeName string //查研观向这边的匹配类型
 			if detail.CategoryId > 0 {
 				articlePermission, err := models.GetArticlePermission(detail.CategoryId)
 				if err != nil {
@@ -172,6 +173,7 @@ func (this *ArticleController) Detail() {
 					return
 				}
 				articlePermissionName = articlePermission.PermissionName
+				matchTypeName = articlePermission.MatchTypeName
 			} else {
 				articlePermissionName = detail.CategoryName
 			}
@@ -216,8 +218,8 @@ func (this *ArticleController) Detail() {
 			//		}
 			//	}
 			//}
-			//大行业通过权限校验,再校验主客观权限。只有医药、消费、科技、智造,才会校验主客观权限
-			if hasPersion && utils.InArrayByStr([]string{utils.YI_YAO_NAME, utils.XIAO_FEI_NAME, utils.KE_JI_NAME, utils.ZHI_ZAO_NAME}, articlePermissionName) {
+			//大行业通过权限校验,再校验主客观权限。只有医药、消费、科技、智造,才会校验主客观权限,热点问答这个匹配类型下的所有报告,也不做主客观校验
+			if 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 {

+ 9 - 1
controllers/morning_meeting.go

@@ -165,7 +165,15 @@ func (this *MorningMeetingController) GatherDetail() {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取失败,Err:" + err.Error()
 		}
-		detailResp.List = listMeet
+		var meetingreviewchaptIds []int
+		for _, v := range listMeet {
+			meetingreviewchaptIds = append(meetingreviewchaptIds, v.Id)
+		}
+		detailResp.List, err = services.GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "GetCygxMorningMeetingReviewChapterListByIds,Err:" + err.Error()
+		}
 	} else {
 		detailResp.List = make([]*models.CygxMorningMeetingGatherDetailListResp, 0)
 	}

+ 1 - 0
controllers/product_interior.go

@@ -122,6 +122,7 @@ func (this *ProductInteriorController) Detail() {
 	detail.PublishTime = utils.TimeRemoveHms2(detail.PublishTime)
 	resp.Detail = detail
 	detail.BodySlice = services.GetProductInteriorUrlBody(detail.Body)
+	resp.Disclaimers = utils.DISCLAIMERS_PRODUCT_INTERIOR // 免责声明
 	go services.AddCygxProductInteriorHistory(user, productInteriorId)
 	go services.ProductInteriorHistoryUserRmind(user, productInteriorId)
 	br.Ret = 200

+ 46 - 22
controllers/report.go

@@ -1332,41 +1332,65 @@ func (this *MobileReportController) Timeline() {
 		br.ErrMsg = "获取产业报告+晨会点评列表,Err:" + err.Error()
 		return
 	}
-	//查询用户今天是否看过时间线
-	count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
-	if err != nil {
-		br.Msg = "查询浏览记录数量失败"
-		br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
-		return
+	//处理晨会精华关联的标的,以及要跳转的文章ID
+	var meetingreviewchaptIds []int
+	mapchaptIdAndArticleId := make(map[int]int)                            // 晨会精华ID与跳转文章ID的映射关系
+	mapchaptIdListSubject := make(map[int][]*models.CygxIndustrialSubject) // 晨会精华ID与标的列表的映射关系
+	for _, v := range list {
+		if v.Resource == 3 {
+			meetingreviewchaptIds = append(meetingreviewchaptIds, v.Id)
+		}
 	}
-	var recordItem *models.CygxPageHistoryRecord
-	if count > 1 {
-		recordItem, err = models.GetTimeLineRecordItem(user.UserId, industrialManagementId)
+	if len(meetingreviewchaptIds) > 0 {
+		listMeet, err := services.GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds)
 		if err != nil {
-			br.Msg = "查询浏览记录失败"
-			br.ErrMsg = "查询浏览记录失败,Err:" + err.Error()
-			return
+			br.Msg = "获取失败"
+			br.ErrMsg = "GetCygxMorningMeetingReviewChapterListByIds,Err:" + err.Error()
+		}
+		for _, v := range listMeet {
+			mapchaptIdAndArticleId[v.Id] = v.LinkArticleId
+			mapchaptIdListSubject[v.Id] = v.ListSubject
 		}
 	}
 
+	//查询用户今天是否看过时间线
+	//count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
+	//if err != nil {
+	//	br.Msg = "查询浏览记录数量失败"
+	//	br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
+	//	return
+	//}
+	//var recordItem *models.CygxPageHistoryRecord
+	//if count > 1 {
+	//	recordItem, err = models.GetTimeLineRecordItem(user.UserId, industrialManagementId)
+	//	if err != nil {
+	//		br.Msg = "查询浏览记录失败"
+	//		br.ErrMsg = "查询浏览记录失败,Err:" + err.Error()
+	//		return
+	//	}
+	//}
+
 	for k, v := range list {
 		if v.SubCategoryName != "时间线" && v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
 			list[k].IsRed = true
 		}
-		timeLineRed := false
-		if count < 2 && v.SubCategoryName == "时间线" {
-			timeLineRed = true
-		} else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishDate)) {
-			timeLineRed = true
-		}
-		if v.SubCategoryName == "时间线" && timeLineRed {
-			list[k].IsRed = true
-		}
+		//timeLineRed := false
+		//if count < 2 && v.SubCategoryName == "时间线" {
+		//	timeLineRed = true
+		//} else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishDate)) {
+		//	timeLineRed = true
+		//}
+		//if v.SubCategoryName == "时间线" && timeLineRed {
+		list[k].IsRed = true
+		//}
 		if v.VideoUrl != "" {
 			list[k].IsHaveVideo = true
 		}
 		v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
-
+		if v.Resource == 3 {
+			v.LinkArticleId = mapchaptIdAndArticleId[v.Id]
+			v.ListSubject = mapchaptIdListSubject[v.Id]
+		}
 	}
 
 	//添加我的日程访问记录

+ 1 - 0
controllers/research.go

@@ -165,6 +165,7 @@ func (this *MobileResearchController) ArticleNewList() {
 			ButtonStyle:     styleMap[v.ArticleTypeId],
 			List:            v.List,
 			SpecialColumnId: v.SpecialColumnId,
+			TopTime:         v.TopTime,
 		}
 		if v.IsSpecial == 1 {
 			//去除图片标签

+ 5 - 0
controllers/tag.go

@@ -4,6 +4,7 @@ import (
 	"encoding/json"
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/services"
+	"hongze/hongze_clpt/utils"
 )
 
 type TagController struct {
@@ -81,6 +82,10 @@ func (this *TagController) TagCustomizeList() {
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
+	item := new(models.ChartPermissionResp)
+	item.ChartPermissionId = utils.GU_SHOU_ID
+	item.PermissionName = utils.GU_SHOU_NAME
+	listPermission = append(listPermission, item)
 
 	resp.List = list
 	resp.ListPermission = listPermission

+ 36 - 0
models/activity_special_permission_points.go

@@ -0,0 +1,36 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxActivitySpecialPermissionPoints struct {
+	Id                  int       `orm:"column(id);pk"`
+	CompanyId           int       `description:"公司ID"`
+	Points              int       `description:"剩余点数"`
+	CompanyName         string    `description:"公司名称"`
+	ChartPermissionId   int       `description:"行业id"`
+	ChartPermissionName string    `description:"行业名称"`
+	CreateTime          time.Time `description:"创建时间"`
+	ModifyTime          time.Time `description:"更新时间"`
+}
+
+// 获取公司每个行业剩余研选点数列表
+func GetCygxActivitySpecialPermissionPointsList(condition string, pars []interface{}) (items []*CygxActivitySpecialPermissionPoints, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_activity_special_permission_points WHERE 1 = 1  `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+// 更新公司每个行业剩余研选点数
+func UpdateCygxActivitySpecialPermissionPoints(points, companyId, chartPermissionId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_activity_special_permission_points SET points = ?  WHERE company_id=?  AND chart_permission_id=? `
+	_, err = o.Raw(sql, points, companyId, chartPermissionId).Exec()
+	return
+}

+ 8 - 0
models/activity_special_trip.go

@@ -59,6 +59,14 @@ func GetUserActivitySpecialTripCount(uid, activityId int) (count int, err error)
 	return
 }
 
+// 获取某一用户有效报名数量
+func GetUserActivitySpecialTripIsValidCount(uid, activityId int) (count int, err error) {
+	sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_special_trip  WHERE  user_id=?  AND   activity_id =?  AND  is_valid = 1 `
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, uid, activityId).QueryRow(&count)
+	return
+}
+
 // 获取某一活动的报名的数量
 func GetActivitySpecialTripCountByActivityId(condition string, pars []interface{}) (count int, err error) {
 	sqlCount := `SELECT COUNT(1) AS count FROM cygx_activity_special_trip as t    WHERE    1 = 1 ` + condition

+ 11 - 0
models/activity_special_trip_bill.go

@@ -79,3 +79,14 @@ func GetCygxActivitySpecialTripBillList(condition string, pars []interface{}) (i
 	_, err = o.Raw(sql, pars).QueryRows(&item)
 	return
 }
+
+// GetCygxActivitySpecialTripBillLastDetialByActivityId  根据活动ID获取最后一条扣点明细
+func GetCygxActivitySpecialTripBillLastDetialByActivityId(activityId, userId int) (item *CygxActivitySpecialTripBill, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *
+			FROM
+			cygx_activity_special_trip_bill  
+			WHERE 1 = 1  AND activity_id =?  AND  user_id = ?   ORDER BY id  DESC LIMIT 1 `
+	err = o.Raw(sql, activityId, userId).QueryRow(&item)
+	return
+}

+ 4 - 3
models/article.go

@@ -108,15 +108,16 @@ func GetArticleDetailById(articleId int) (item *ArticleDetail, err error) {
 	return
 }
 
-func GetArticlePermission(companyId int) (item *ChartPermission, err error) {
+func GetArticlePermission(companyId int) (item *ChartPermissionItemResp, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-			a.chart_permission_name as  permission_name
+			a.chart_permission_name as  permission_name,a.match_type_name
 			FROM
 			cygx_report_mapping AS a
 			WHERE
-			a.category_id = ?`
+			a.category_id = ? LIMIT  1 `
 	err = o.Raw(sql, companyId).QueryRow(&item)
+	//_, err = o.Raw(sql, companyId).QueryRows(&item)
 	return
 }
 

+ 8 - 0
models/chart_permission.go

@@ -16,6 +16,14 @@ type ChartPermission struct {
 	IsShowSustainable bool   `description:"是否展示限免标签"`
 	ImageUrlM         string `description:"图片地址"`
 }
+type ChartPermissionItemResp struct {
+	ChartPermissionId int    `description:"权限id"`
+	PermissionName    string `description:"权限名称"`
+	IsShowSustainable bool   `description:"是否展示限免标签"`
+	ImageUrlM         string `description:"图片地址"`
+	IsChoose          bool   `description:"是否选择"`
+	MatchTypeName     string `description:"匹配类型名称"`
+}
 
 type CompanyReportPermission struct {
 	CompanyReportPermissionId int `orm:"column(company_report_permission_id);pk"`

+ 13 - 8
models/cygx_morning_meeting_gather.go

@@ -67,14 +67,19 @@ func GetCygxMorningMeetingGatherById(condition string, pars []interface{}) (item
 }
 
 type CygxMorningMeetingGatherDetailListResp struct {
-	Id                  int    `description:"ID"`
-	IndustryId          int    `description:"产业id"` // 产业id
-	IndustryName        string `description:"产业名称"` // 产业名称
-	ChartPermissionName string `description:"行业名称"` // 行业名称
-	ChartPermissionId   int    `description:"行业id"` // 行业id
-	MeetingId           int    `description:"主表id"` // 主表id
-	Content             string `description:"内容"`   // 内容
-	PublishTime         string `description:"发布日期"`
+	Id                   int                      `description:"ID"`
+	IndustryId           int                      `description:"产业id"` // 产业id
+	IndustryName         string                   `description:"产业名称"` // 产业名称
+	ChartPermissionName  string                   `description:"行业名称"` // 行业名称
+	ChartPermissionId    int                      `description:"行业id"` // 行业id
+	MeetingId            int                      `description:"主表id"` // 主表id
+	Content              string                   `description:"内容"`   // 内容
+	PublishTime          string                   `description:"发布日期"`
+	ReportLink           string                   `description:"报告链接"`
+	LinkArticleId        int                      `description:"报告ID链接"`
+	Title                string                   `description:"标题"`
+	IndustrialSubjectIds string                   `description:"标的id"`
+	ListSubject          []*CygxIndustrialSubject `description:"标的列表"`
 }
 
 type CygxMorningMeetingGatherDetailResp struct {

+ 1 - 0
models/home.go

@@ -84,6 +84,7 @@ type ArticleListResp struct {
 	SpecialColumnId     int      `description:"专栏栏目id"`
 	SpecialType         int      `description:"专栏类型 1:笔记,2:观点"`
 	List                []*IndustrialManagementIdInt
+	TopTime             int `description:"置顶时间"`
 }
 
 type HomeChartListResp struct {

+ 5 - 6
models/industrial_subject.go

@@ -2,7 +2,6 @@ package models
 
 import (
 	"github.com/beego/beego/v2/client/orm"
-	"time"
 )
 
 type IndustrialSubjectByArticle struct {
@@ -19,11 +18,11 @@ type SubjectArticlGroupList struct {
 }
 
 type CygxIndustrialSubject struct {
-	IndustrialSubjectId    int       `orm:"column(industrial_subject_id);pk" description:"标的id"`
-	IndustrialManagementId int       `description:"产业id"`
-	SubjectName            string    `description:"标的名称"`
-	CreateTime             time.Time `description:"创建时间"`
-	Source                 int       `description:"来源,1正常添加,2:通过文章添加,3通过活动添加(默认为1)"`
+	IndustrialSubjectId    int    `orm:"column(industrial_subject_id);pk" description:"标的id"`
+	IndustrialManagementId int    `description:"产业id"`
+	SubjectName            string `description:"标的名称"`
+	CreateTime             string `description:"创建时间"`
+	Source                 int    `description:"来源,1正常添加,2:通过文章添加,3通过活动添加(默认为1)"`
 }
 
 // 获取标的列表

+ 3 - 2
models/product_interior.go

@@ -120,8 +120,9 @@ func GetCygxProductInteriorList(condition string, pars []interface{}, startSize,
 
 type GetCygxProductInteriorDetailResp struct {
 	Detail        *CygxProductInteriorResp
-	HasPermission int  `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
-	IsShow        bool `description:"是否展示"`
+	HasPermission int    `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	IsShow        bool   `description:"是否展示"`
+	Disclaimers   string `description:"免责声明"`
 }
 
 // 通过ID获取详情

+ 30 - 27
models/report.go

@@ -596,17 +596,19 @@ type TimeLineReportItem struct {
 	ArticleId int    `description:"文章id"`
 	Title     string `description:"标题"`
 	//PublishTime     string `description:"发布时间"`
-	PublishDate     string `description:"发布时间"`
-	Content         string `description:"内容"`
-	VideoUrl        string `description:"视频链接"`
-	VoiceUrl        string `description:"音频链接"`
-	IsHaveVideo     bool   `description:"是否包含视频"`
-	ImgUrlPc        string `description:"pc图片"`
-	SubCategoryName string `description:"二级分类"`
-	IsRed           bool   `description:"是否标红"`
-	Readnum         int    `description:"阅读数量"`
-	Resource        int    `description:"来源类型,1:文章、2:产品内测、3:晨报点评 4:活动回放视频 5:活动回放音频 "`
-	Type            int    `description:"类型: 1-音频; 2-活动视频; 3-产业视频 、 4-系列问答视频"`
+	PublishDate     string                   `description:"发布时间"`
+	Content         string                   `description:"内容"`
+	VideoUrl        string                   `description:"视频链接"`
+	VoiceUrl        string                   `description:"音频链接"`
+	IsHaveVideo     bool                     `description:"是否包含视频"`
+	ImgUrlPc        string                   `description:"pc图片"`
+	SubCategoryName string                   `description:"二级分类"`
+	IsRed           bool                     `description:"是否标红"`
+	Readnum         int                      `description:"阅读数量"`
+	Resource        int                      `description:"来源类型,1:文章、2:产品内测、3:晨报点评 4:活动回放视频 5:活动回放音频 "`
+	Type            int                      `description:"类型: 1-音频; 2-活动视频; 3-产业视频 、 4-系列问答视频"`
+	LinkArticleId   int                      `description:"晨会精华报告ID链接"`
+	ListSubject     []*CygxIndustrialSubject `description:"标的列表"`
 }
 
 // 获取产业报告+晨会点评列表
@@ -638,12 +640,12 @@ FROM
 	SELECT
 		mmc.id,
 		0 as  article_id,
-		mmc.content AS title,
+		mmc.title,
 		mm.publish_time AS publish_date,
 		'' AS video_url,
 		'' AS voice_url,
 		'时间线' AS sub_category_name,
-		'' AS content,
+		mmc.content,
 		3 AS resource,
 		0 AS type,
 		0  AS readnum 
@@ -850,6 +852,7 @@ type ArticleResearchResp struct {
 	IndustryTags    []string                     `description:"研选专栏行业标签"`
 	CompanyTags     []string                     `description:"研选专栏公司标签"`
 	SpecialColumnId int                          `description:"专栏栏目id"`
+	TopTime         int                          `description:"置顶时间"`
 }
 
 // 获取数量
@@ -890,7 +893,8 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 			0 AS special_type,
 			0 AS special_column_id,
 			'' AS company_tags, 
-			'' AS industry_tags
+			'' AS industry_tags,
+			a.top_time
 		FROM
 			cygx_article AS a
 			LEFT JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
@@ -921,16 +925,17 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 		a.type AS special_type,
 		b.id AS special_column_id,
 		a.company_tags AS company_tags, 
-		a.industry_tags AS industry_tags 
+		a.industry_tags AS industry_tags,
+		0 as top_time
 	FROM
 	cygx_yanxuan_special AS a
 	JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id
 	WHERE
 	1 = 1  AND a.status = 3 `
-		sql += ` GROUP BY article_id ORDER  BY publish_date DESC  LIMIT ?,? `
+		sql += ` GROUP BY article_id ORDER  BY  top_time DESC , publish_date DESC  LIMIT ?,? `
 		_, err = o.Raw(sql, userId, userId, pars, startSize, pageSize).QueryRows(&items)
 	} else {
-		sql += ` GROUP BY a.article_id ORDER  BY a.publish_date DESC  LIMIT ?,? `
+		sql += ` GROUP BY  a.article_id ORDER  BY top_time DESC , a.publish_date DESC  LIMIT ?,? `
 		_, err = o.Raw(sql, userId, pars, startSize, pageSize).QueryRows(&items)
 	}
 	return
@@ -954,7 +959,8 @@ func GetArticleResearchListYx(condition string, pars []interface{}, startSize, p
 			0 AS special_type,
 			0 AS special_column_id,
 			'' AS company_tags, 
-			'' AS industry_tags
+			'' AS industry_tags,
+			a.top_time
 		FROM
 			cygx_article AS a
 			INNER JOIN cygx_article_department AS d ON d.department_id = a.department_id 
@@ -963,8 +969,8 @@ func GetArticleResearchListYx(condition string, pars []interface{}, startSize, p
 	if condition != "" {
 		sql += condition
 	}
-	if needYanxuanSpecial {
-		sql += `UNION ALL
+
+	sql += `UNION ALL
 	SELECT
 		a.id AS article_id,
 		a.title AS title,
@@ -981,18 +987,15 @@ func GetArticleResearchListYx(condition string, pars []interface{}, startSize, p
 		a.type AS special_type,
 		b.id AS special_column_id,
 		a.company_tags AS company_tags, 
-		a.industry_tags AS industry_tags 
+		a.industry_tags AS industry_tags,
+		0 as top_time
 	FROM
 	cygx_yanxuan_special AS a
 	JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id
 	WHERE
 	1 = 1  AND a.status = 3 `
-		sql += ` GROUP BY article_id ORDER  BY publish_date DESC  LIMIT ?,? `
-		_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-	} else {
-		sql += ` GROUP BY a.article_id ORDER  BY a.publish_date DESC  LIMIT ?,? `
-		_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-	}
+	sql += ` 	GROUP BY  article_id ORDER  BY top_time DESC , publish_date DESC   LIMIT  ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }
 

+ 8 - 0
services/activity_special.go

@@ -950,6 +950,14 @@ func GetSpecialDetailUserPower(user *models.WxUserItem, activityInfo *models.Cyg
 		err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())
 		return
 	}
+
+	//如果有升级权限的自动添加策略的升级权限
+	if permissionStr != "" {
+		if activityInfo.ChartPermissionName == utils.CE_LUE_NAME {
+			permissionStr += "," + utils.CE_LUE_NAME
+		}
+	}
+
 	//如果没有对应的升级权限,则返回
 	if !strings.Contains(permissionStr, activityInfo.ChartPermissionName) {
 		return

+ 192 - 1
services/activity_special_trip.go

@@ -20,7 +20,7 @@ func SpecialTripPopupMsg(activityInfo *models.CygxActivitySpecialDetail, user *m
 		return
 	}
 
-	errMsg, _, e := GetTripRemainingtimesBycompany(user, activityInfo)
+	errMsg, e := CheckTripRemainingtimesBycompany(user, activityInfo)
 	if e != nil {
 		err = errors.New("获取客户剩余报名次数失败 GetActivitySpecialUserType, Err: " + e.Error())
 		return
@@ -159,6 +159,197 @@ func GetTripRemainingtimesBycompany(user *models.WxUserItem, activityInfo *model
 	return
 }
 
+// 校验是否还有剩余次数
+func CheckTripRemainingtimesBycompany(user *models.WxUserItem, activityInfo *models.CygxActivitySpecialDetail) (errMsg string, err error) {
+	msgTemplate := "您的专项调研次数已用完,如仍想参加,请与您的对口销售商议"
+	companyId := user.CompanyId
+	chartPermissionName := activityInfo.ChartPermissionName
+
+	companyDetail, e := models.GetCompanyDetailByIdGroup(companyId)
+	if e != nil {
+		err = errors.New("GetCompanyDetailByIdGroup, Err:" + e.Error())
+		return
+	}
+	//永续客户不限制次数
+	if companyDetail.Status == utils.COMPANY_STATUS_FOREVER {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = " AND  company_id  = ?  AND points  > 0   ORDER BY  chart_permission_id DESC  "
+	pars = append(pars, companyId)
+	activitySpecialPermissionPointsList, e := models.GetCygxActivitySpecialPermissionPointsList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetCygxActivitySpecialPermissionPointsList, Err:" + e.Error())
+		return
+	}
+	//如果没有剩余的点数,就返回
+	if len(activitySpecialPermissionPointsList) == 0 {
+		errMsg = msgTemplate
+		return
+	}
+
+	//判断是不是策略行业的活动,策略的任何一个行业有剩余点数都能参加
+	if chartPermissionName == utils.CE_LUE_NAME {
+		return
+	} else {
+		for _, v := range activitySpecialPermissionPointsList {
+			if v.ChartPermissionName == chartPermissionName || v.ChartPermissionId == 0 {
+				return
+			} // 如果对应行业有剩余次数,或者是属于大套餐且有次数,那么校验也通过
+		}
+	}
+	errMsg = msgTemplate
+	return
+
+}
+
+// GetSpecialBillMaxChartPermissionId  获取专项调研剩余点数最多的行业
+func GetSpecialBillMaxChartPermissionId(user *models.WxUserItem) (maxChartPermissionId int, maxChartPermissionName string, err error) {
+	companyId := user.CompanyId
+	var condition string
+	var pars []interface{}
+	condition = " AND  company_id  = ?  AND points  > 0   ORDER BY  points DESC LIMIT 1   "
+	pars = append(pars, companyId)
+
+	activitySpecialPermissionPointsList, e := models.GetCygxActivitySpecialPermissionPointsList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetCygxActivitySpecialPermissionPointsList, Err:" + e.Error())
+		return
+	}
+	for _, v := range activitySpecialPermissionPointsList {
+		maxChartPermissionId = v.ChartPermissionId
+		maxChartPermissionName = v.ChartPermissionName
+	}
+	return
+}
+
+// DeductTripRemainingtimesByUser 扣除用户专项调研剩余次数
+func DeductTripRemainingtimesByUser(user *models.WxUserItem, activityInfo *models.CygxActivitySpecialDetail) (err error) {
+	msgTemplate := "您的专项调研次数已用完,如仍想参加,请与您的对口销售商议"
+	companyId := user.CompanyId
+	chartPermissionName := activityInfo.ChartPermissionName
+	var condition string
+	var pars []interface{}
+	condition = " AND  company_id  = ?  AND points  > 0   ORDER BY  points DESC LIMIT 1   "
+	pars = append(pars, companyId)
+
+	//判断是不是策略行业的活动,如果不是策略就获取对应行业的点数 ,策略的任何一个行业有剩余点数都能参加
+	if chartPermissionName != utils.CE_LUE_NAME {
+		pars = make([]interface{}, 0)
+		condition = " AND  company_id  = ?  AND  chart_permission_id  = ?   AND points  > 0   ORDER BY  points DESC LIMIT 1   "
+		pars = append(pars, companyId, activityInfo.ChartPermissionId)
+	}
+	activitySpecialPermissionPointsList, e := models.GetCygxActivitySpecialPermissionPointsList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetCygxActivitySpecialPermissionPointsList, Err:" + e.Error())
+		return
+	}
+	//如果没有剩余的点数,就返回
+	if len(activitySpecialPermissionPointsList) == 0 {
+		err = errors.New(msgTemplate)
+		return
+	}
+	var maxChartPermissionId int // 剩余点数最多的行业
+	var points int               // 剩余点数
+	for _, v := range activitySpecialPermissionPointsList {
+		maxChartPermissionId = v.ChartPermissionId
+		points = v.Points - 1
+	}
+	//更新对应行业剩余点数
+	e = models.UpdateCygxActivitySpecialPermissionPoints(points, companyId, maxChartPermissionId)
+	if e != nil {
+		err = errors.New("UpdateCygxActivitySpecialPermissionPoints, Err:" + e.Error())
+		return
+	}
+	return
+}
+
+// RebateTripRemainingtimesByUser 返点用户专项调研剩余次数
+func RebateTripRemainingtimesByUser(user *models.WxUserItem, activityInfo *models.CygxActivitySpecialDetail) (err error) {
+	companyId := user.CompanyId
+	chartPermissionName := activityInfo.ChartPermissionName
+	var condition string
+	var pars []interface{}
+	condition = " AND  company_id  = ?    ORDER BY  points DESC LIMIT 1   "
+	pars = append(pars, companyId)
+
+	//判断是不是策略行业的活动,如果不是策略就获取对应行业的点数 ,策略的任何一个行业有剩余点数都能参加
+	if chartPermissionName != utils.CE_LUE_NAME {
+		pars = make([]interface{}, 0)
+		condition = " AND  company_id  = ?  AND  chart_permission_id  = ?   LIMIT 1   "
+		pars = append(pars, companyId, activityInfo.ChartPermissionId)
+	} else {
+		lastTripBill, e := models.GetCygxActivitySpecialTripBillLastDetialByActivityId(activityInfo.ActivityId, user.UserId)
+		if e != nil {
+			err = errors.New("GetActivitySpecialTripCountByActivitySpecial, Err: " + e.Error())
+			return
+		}
+
+		pars = make([]interface{}, 0)
+		condition = " AND  company_id  = ?  AND  chart_permission_id  = ?    LIMIT 1   "
+		pars = append(pars, companyId, lastTripBill.ChartPermissionId)
+	}
+	activitySpecialPermissionPointsList, e := models.GetCygxActivitySpecialPermissionPointsList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetCygxActivitySpecialPermissionPointsList, Err:" + e.Error())
+		return
+	}
+
+	var maxChartPermissionId int // 剩余点数最多的行业(返点行业)
+	var points int               // 剩余点数
+	for _, v := range activitySpecialPermissionPointsList {
+		maxChartPermissionId = v.ChartPermissionId
+		points = v.Points + 1
+	}
+	//更新对应行业剩余点数
+	e = models.UpdateCygxActivitySpecialPermissionPoints(points, companyId, maxChartPermissionId)
+	if e != nil {
+		err = errors.New("UpdateCygxActivitySpecialPermissionPoints, Err:" + e.Error())
+		return
+	}
+	return
+}
+
+// 预处理专项调研流水明细表描述内容
+func HandleActivitySpecialTripBillTotalText(user *models.WxUserItem) (totalText string, err error) {
+	companyId := user.CompanyId
+	companyDetail, e := models.GetCompanyDetailByIdGroup(companyId)
+	if e != nil {
+		err = errors.New("GetCompanyDetailByIdGroup, Err:" + e.Error())
+		return
+	}
+	//永续客户不限制次数
+	if companyDetail.Status == utils.COMPANY_STATUS_FOREVER {
+		totalText = "0次"
+		return
+	}
+	var condition string
+	var pars []interface{}
+	pars = make([]interface{}, 0)
+	condition = " AND  company_id  = ?  AND points  != 0   ORDER BY  chart_permission_id DESC  "
+	pars = append(pars, companyId)
+	activitySpecialPermissionPointsList, e := models.GetCygxActivitySpecialPermissionPointsList(condition, pars)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetCygxActivitySpecialPermissionPointsList, Err:" + e.Error())
+		return
+	}
+
+	var itemBillTotal []string
+	for _, v := range activitySpecialPermissionPointsList {
+		if v.ChartPermissionId > 0 {
+			itemBillTotal = append(itemBillTotal, fmt.Sprint(v.ChartPermissionName, v.Points, "次")) // 行业套餐客户展示规则
+		}
+		if v.ChartPermissionId == 0 {
+			totalText = fmt.Sprint(v.Points, "次") // 大套餐客户展示规则
+		}
+	}
+	if len(itemBillTotal) > 0 {
+		totalText = strings.Join(itemBillTotal, "+")
+	}
+	return
+}
+
 // 用户搜专项调研操作操作行为,模板消息推送
 func ActivitySpecialUserRmind(user *models.WxUserItem, activityId, TripStatus int) (err error) {
 	defer func() {

+ 26 - 26
services/article_red.go

@@ -23,42 +23,42 @@ func GetShowTimeLineIsRed(user *models.WxUserItem, industrialManagementId int) (
 		return
 	}
 	//查询用户今天是否看过时间线
-	haveMorningMeeting := false
-	var morningMeetingTime string
-	count, e := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
-	if e != nil {
-		err = errors.New("GetTimeLineRecordCount, Err: " + e.Error())
-		return
-	}
-	var recordItem *models.CygxPageHistoryRecord
-	if count > 1 {
-		recordItem, e = models.GetTimeLineRecordItem(user.UserId, industrialManagementId)
-		if e != nil {
-			err = errors.New("GetTimeLineRecordCount, Err: " + e.Error())
-			return
-		}
-	}
+	//haveMorningMeeting := false
+	//var morningMeetingTime string
+	//count, e := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
+	//if e != nil {
+	//	err = errors.New("GetTimeLineRecordCount, Err: " + e.Error())
+	//	return
+	//}
+	//var recordItem *models.CygxPageHistoryRecord
+	//if count > 1 {
+	//	recordItem, e = models.GetTimeLineRecordItem(user.UserId, industrialManagementId)
+	//	if e != nil {
+	//		err = errors.New("GetTimeLineRecordCount, Err: " + e.Error())
+	//		return
+	//	}
+	//}
 
 	for _, v := range timeLineList {
 		if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
 			if v.SubCategoryName == "时间线" {
-				haveMorningMeeting = true
-				morningMeetingTime = v.PublishDate
+				//haveMorningMeeting = true
+				//morningMeetingTime = v.PublishDate
 				continue
 			}
 			timeLineItem.IsRed = true
 		}
 	}
 	//因为无法记录用户是否看过晨会点评,所以用用户今天是否看过时间线来判断是否显示小红点,这里是判断分类的小红点
-	timeLineRed := false
-	if count < 2 {
-		timeLineRed = true
-	} else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(morningMeetingTime)) {
-		timeLineRed = true
-	}
-	if !timeLineItem.IsRed && timeLineRed && haveMorningMeeting {
-		timeLineItem.IsRed = true
-	}
+	//timeLineRed := false
+	//if count < 2 {
+	//	timeLineRed = true
+	//} else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(morningMeetingTime)) {
+	//	timeLineRed = true
+	//}
+	//if !timeLineItem.IsRed && timeLineRed && haveMorningMeeting {
+	//	timeLineItem.IsRed = true
+	//}
 	isRed = timeLineItem.IsRed
 	return
 

+ 5 - 5
services/es_comprehensive.go

@@ -414,13 +414,13 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 
 	//处理晨会精华
 	if len(meetingreviewchaptIds) > 0 {
-		pars = make([]interface{}, 0)
-		condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
-		pars = append(pars, meetingreviewchaptIds)
+		//pars = make([]interface{}, 0)
+		//condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
+		//pars = append(pars, meetingreviewchaptIds)
 
-		listrMeet, e := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+		listrMeet, e := GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds)
 		if e != nil {
-			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			err = errors.New("GetCygxMorningMeetingReviewChapterListByIds, Err: " + e.Error())
 			return
 		}
 		for _, v := range listrMeet {

+ 71 - 0
services/morning_meeting.go

@@ -5,6 +5,8 @@ import (
 	"fmt"
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/utils"
+	"strconv"
+	"strings"
 	"time"
 )
 
@@ -48,3 +50,72 @@ func AddCygxMorningMeetingReviewChapterHistory(user *models.WxUserItem, articleI
 	}
 	return
 }
+
+// 通过晨会精华子ID,获取出参列表详情
+func GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds []int) (items []*models.CygxMorningMeetingGatherDetailListResp, err error) {
+	lenArr := len(meetingreviewchaptIds)
+	if lenArr == 0 {
+		return
+	}
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("通过晨会精华子ID,获取出参列表详情失败 ,GetCygxMorningMeetingReviewChapterListByIds err"+err.Error(), "meetingreviewchaptIds:", meetingreviewchaptIds), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+
+	pars = make([]interface{}, 0)
+	condition = ` AND c.id IN (` + utils.GetOrmInReplace(lenArr) + `)`
+	pars = append(pars, meetingreviewchaptIds)
+
+	//查询晨会
+	listrMeet, e := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxMorningMeetingReviewChapterList, Err: " + e.Error())
+		return
+	}
+
+	//获取晨会相关的标的
+	var subjectIds []string
+	for _, v := range listrMeet {
+		if v.IndustrialSubjectIds != "" {
+			slice := strings.Split(v.IndustrialSubjectIds, ",")
+			for _, vS := range slice {
+				subjectIds = append(subjectIds, vS)
+			}
+		}
+	}
+
+	lensubjectIds := len(subjectIds)
+	if lensubjectIds > 0 {
+		//获取标的信息
+		pars = make([]interface{}, 0)
+		condition = ` AND industrial_subject_id  IN (` + utils.GetOrmInReplace(lensubjectIds) + `)`
+		pars = append(pars, subjectIds)
+		listsubject, e := models.GetCygxIndustrialSubjectListCondition(condition, pars)
+		if e != nil {
+			err = errors.New("GetCygxIndustrialSubjectListCondition, Err: " + e.Error())
+			return
+		}
+
+		var meetSubjectItems = make(map[string]*models.CygxIndustrialSubject)
+		for _, v := range listsubject {
+			meetSubjectItems[strconv.Itoa(v.IndustrialSubjectId)] = v
+		}
+
+		//建立标的与晨会的映射关系
+		for _, v := range listrMeet {
+			if v.IndustrialSubjectIds != "" {
+				slice := strings.Split(v.IndustrialSubjectIds, ",")
+				for _, vS := range slice {
+					if meetSubjectItems[vS] != nil {
+						v.ListSubject = append(v.ListSubject, meetSubjectItems[vS])
+					}
+				}
+			}
+		}
+	}
+	items = listrMeet
+	return
+}

+ 6 - 6
services/resource_data.go

@@ -135,13 +135,13 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 
 	//处理晨会精华
 	if len(meetingreviewchaptIds) > 0 {
-		pars = make([]interface{}, 0)
-		condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
-		pars = append(pars, meetingreviewchaptIds)
-
-		listrMeet, e := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
+		//pars = make([]interface{}, 0)
+		//condition = ` AND c.id IN (` + utils.GetOrmInReplace(len(meetingreviewchaptIds)) + `)`
+		//pars = append(pars, meetingreviewchaptIds)
+		//
+		listrMeet, e := GetCygxMorningMeetingReviewChapterListByIds(meetingreviewchaptIds)
 		if e != nil {
-			err = errors.New("GetResourceDataList, Err: " + e.Error())
+			err = errors.New("GetCygxMorningMeetingReviewChapterListByIds, Err: " + e.Error())
 			return
 		}
 		for _, v := range listrMeet {

+ 20 - 7
utils/constants.go

@@ -22,13 +22,14 @@ const (
 )
 
 const (
-	APPNAME             = "弘则-策略平台网页版"
-	EmailSendToUsers    = "cxzhang@hzinsights.com"
-	ApiAuthorization    = "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkiLCJwaG9uZV9udW1iZXIiOiIxMjM0NTY3ODkiLCJuYW1lIjoi5YW25LuWIiwiZW50cmFuY2UiOiJwYXNzd3dvcmQiLCJpYXQiOjE2MzQ4NzA1OTQsImV4cCI6MTYzNDg3NDE5NH0.tho2L9jsbDPn8ltEGUVDve_nHsh0Kzf6ZrSz0RcZ0ag"
-	ApiUrl              = "https://vmp.hzinsights.com/v2api/"
-	CHART_INFO_HTTP_URL = "https://vmp.hzinsights.com/v2/charts/"
-	DISCLAIMERS         = "本文为用户投稿,用户在平台中发表的所有资料、言论等仅代表个人观点,与本平台立场无关,不对您构成任何投资建议。本平台对文中陈述、观点判断保持中立,不对所包含内容及数据的真实性、准确性、可靠性或完整性提供任何明示或暗示的保证。请读者仅作参考,并请自行承担全部责任。"
-	REGISTER_PLATFORM   = 2 // 来源 1小程序,2:网页
+	APPNAME                             = "弘则-策略平台网页版"
+	EmailSendToUsers                    = "cxzhang@hzinsights.com"
+	ApiAuthorization                    = "bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkiLCJwaG9uZV9udW1iZXIiOiIxMjM0NTY3ODkiLCJuYW1lIjoi5YW25LuWIiwiZW50cmFuY2UiOiJwYXNzd3dvcmQiLCJpYXQiOjE2MzQ4NzA1OTQsImV4cCI6MTYzNDg3NDE5NH0.tho2L9jsbDPn8ltEGUVDve_nHsh0Kzf6ZrSz0RcZ0ag"
+	ApiUrl                              = "https://vmp.hzinsights.com/v2api/"
+	CHART_INFO_HTTP_URL                 = "https://vmp.hzinsights.com/v2/charts/"
+	DISCLAIMERS                         = "本文为用户投稿,用户在平台中发表的所有资料、言论等仅代表个人观点,与本平台立场无关,不对您构成任何投资建议。本平台对文中陈述、观点判断保持中立,不对所包含内容及数据的真实性、准确性、可靠性或完整性提供任何明示或暗示的保证。请读者仅作参考,并请自行承担全部责任。"
+	DISCLAIMERS_PRODUCT_INTERIOR string = "<pstyle=\"text-align: center;\">免责声明</p><p>本报告仅供弘则弥道(上海)投资咨询有限公司正式签约的机构客户使用,不会因接收人/接收机构收到本报告而将其视为客户。本报告根据国际和行业通行的准则,以合法渠道获得这些信息,尽可能保证可靠、准确和完整,但并不保证报告所述信息的准确性和完整性,也不保证本报告所包含的信息或建议在本报告发出后不会发生任何变更。本报告中所提供的信息仅供参考。报告中的内容不对投资者做出的最终操作建议做任何的担保,也没有任何形式的分享投资收益或者分担投资损失的书面或口头承诺。不作为客户在投资、法律、会计或税务等方面的最终操作建议,也不作为道义的、责任的和法律的依据或者凭证,无论是否已经明示或者暗示。在任何情况下,本公司不对客户/接收人/接收机构因使用报告中内容所引致的一切损失负责任,客户/接收人/接收机构需自行承担全部风险。</p><p><br/></p>" // 产品内测免责声明
+	REGISTER_PLATFORM                   = 2                                                                                                                                                                                                                                                                                                                                                                                                                            // 来源 1小程序,2:网页
 )
 
 // 手机号,电子邮箱正则
@@ -257,3 +258,15 @@ const (
 	ACTIVITY_ZJDHH_V1_MSG string = "该活动为非公开活动,如有专家访谈需求请联系对口销售" // 限制人数为1的专家电话会用户C端报名,提示消息内容
 	FULLSTARFFED_MSG      string = "FullStarffed"              // 报名的时候人数已满的状态
 )
+
+// 客户状态
+const (
+	COMPANY_STATUS_TRY_OUT   = "试用"
+	COMPANY_STATUS_FOREVER   = "永续"
+	COMPANY_STATUS_FREEZE    = "冻结"
+	COMPANY_STATUS_LOSE      = "流失"
+	COMPANY_STATUS_LOSE_FLAG = "loss"
+	COMPANY_STATUS_FORMAL    = "正式"
+	COMPANY_STATUS_POTENTIAL = "潜在"
+	COMPANY_STATUS_CLOSE     = "关闭"
+)