xingzai 1 éve
szülő
commit
110449a8a7

+ 3 - 3
controllers/activity.go

@@ -2180,7 +2180,7 @@ func (this *ActivityController) ScheduleList() {
 	var condition string
 	var conditionCount string
 	var pars []interface{}
-	condition += ` AND art.publish_status = 1    `
+	condition += ` AND art.publish_status = 1  AND chart_permission_id  =  31    `
 	//if source == 1 {
 	//	condition += ` AND art.yidong_activity_id = '' `
 	//	conditionCount += ` AND art.yidong_activity_id = '' `
@@ -2193,7 +2193,7 @@ func (this *ActivityController) ScheduleList() {
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
-	conditionCount = ` 	AND art.active_state = 2 `
+	conditionCount = ` 	AND art.active_state = 2  AND chart_permission_id  =  31 `
 	totalCount, err := models.GetScheduleCount(conditionCount, uid) //获取正在进行中的活动数量
 	if err != nil {
 		br.Msg = "获取失败"
@@ -2227,7 +2227,7 @@ func (this *ActivityController) ScheduleList() {
 			return
 		}
 		pageSize = pageSize - len(listHave)
-		condition = ` AND art.publish_status = 1 AND art.active_state IN(1,3) `
+		condition = ` AND art.publish_status = 1 AND art.active_state IN(1,3)  art.AND chart_permission_id  =  31`
 		//if source == 1 {
 		//	condition += ` AND art.yidong_activity_id = '' `
 		//}

+ 0 - 752
controllers/activity_special.go

@@ -1,752 +0,0 @@
-package controllers
-
-import (
-	"encoding/json"
-	"github.com/rdlucklib/rdluck_tools/paging"
-	"hongze/hongze_web_mfyx/models"
-	"hongze/hongze_web_mfyx/services"
-	"hongze/hongze_web_mfyx/utils"
-	"strconv"
-	"time"
-)
-
-// 专项调研活动
-type ActivitySpecialController struct {
-	BaseAuthController
-}
-
-// @Title 专项产业调研列表
-// @Description 获取专项产业调研列表接口
-// @Param   PageSize   query   int  true       "每页数据条数"
-// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
-// @Param   ChartPermissionIds   query   string  false     "行业id 多个用 , 隔开"
-// @Param   ActiveState   query   string  false       "活动进行状态 未开始:1、进行中2、已结束3"
-// @Param   WhichDay   query   string  false       "哪一天 今天:1、明天:2, 本周:3 上周:4,本月:5上月:6多个用 , 隔开"
-// @Success 200 {object} models.GetCygxActivitySpecialDetailListResp
-// @router /list [get]
-func (this *ActivitySpecialController) SpecialList() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,SysUser Is Empty"
-		return
-	}
-	pageSize, _ := this.GetInt("PageSize")
-	currentIndex, _ := this.GetInt("CurrentIndex")
-	chartPermissionIds := this.GetString("ChartPermissionIds")
-	whichDay := this.GetString("WhichDay")
-	activeState := this.GetString("ActiveState")
-	if pageSize <= 0 {
-		pageSize = utils.PageSize20
-	}
-	if currentIndex <= 0 {
-		currentIndex = 1
-	}
-	if activeState == "1" {
-		activeState = ""
-	}
-	conditionActivity := services.ActivityLabelSpecialSql(chartPermissionIds, whichDay, activeState)
-
-	list, total, errList := services.GetActivitySpecialList(user, currentIndex, pageSize, "", conditionActivity, activeState)
-	if errList != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + errList.Error()
-		return
-	}
-	page := paging.GetPaging(currentIndex, pageSize, total)
-	resp := new(models.GetCygxActivitySpecialDetailListResp)
-	count, err := models.GetCygxUserFollowSpecial(user.UserId)
-	if err != nil {
-		br.Msg = "获取数据失败!"
-		br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
-		return
-	}
-	if count == 1 && user.UserId > 0 {
-		resp.IsFollow = true
-	}
-	if user.Mobile != "" {
-		resp.IsBindingMobile = true
-	}
-
-	if len(list) == 0 {
-		list = make([]*models.CygxActivitySpecialDetail, 0)
-	}
-	resp.List = list
-	resp.Paging = page
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title  专项产业调研详情
-// @Description 获取专项产业调研详情接口
-// @Param   ActivityId   query   int  true       "活动ID"
-// @Success Ret=200 {object} models.CygxActivitySpecialResp
-// @router /detail [get]
-func (this *ActivitySpecialController) SpecialDetail() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	uid := user.UserId
-	activityId, _ := this.GetInt("ActivityId")
-	if activityId < 1 {
-		br.Msg = "请输入活动ID"
-		return
-	}
-	resp := new(models.CygxActivitySpecialResp)
-	activityInfo, err := models.GetCygxActivitySpecialDetailById(uid, activityId)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "活动ID错误,Err:" + "activityId:" + strconv.Itoa(activityId)
-		return
-	}
-	if activityInfo == nil {
-		br.Msg = "活动不存在"
-		br.ErrMsg = "活动ID错误,Err:" + "activityId:" + strconv.Itoa(activityId)
-		return
-	}
-	//havePower, err := services.GetSpecialDetailUserPower(user, activityInfo)
-	//if err != nil {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-	//	return
-	//}
-	var havePower bool
-	havePower = true
-	//判断有没有对应的权限,如果没有则给出对应的状态码
-	if havePower {
-		resp.HasPermission = 1
-		count, err := models.GetCygxUserFollowSpecial(user.UserId)
-		if err != nil {
-			br.Msg = "获取数据失败!"
-			br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
-			return
-		}
-		if count == 1 {
-			resp.IsFollow = true
-		}
-		activityInfo, err := services.HandleActivitySpecialShow(activityInfo, user)
-		if err != nil {
-			br.Msg = "获取数据失败!"
-			br.ErrMsg = "HandleActivitySpecialShow,Err:" + err.Error()
-			return
-		}
-		var condition string
-		var pars []interface{}
-
-		condition += ` AND t.activity_id =  ? AND t.is_cancel = 0 `
-		pars = append(pars, activityInfo.ActivityId)
-
-		tripTota, err := models.GetActivitySpecialTripCountByActivityId(condition, pars)
-		if err != nil {
-			br.Msg = "获取数据失败!"
-			br.ErrMsg = "GetActivitySpecialTripCountByActivityId,Err:" + err.Error()
-			return
-		}
-		activityInfo.TripNum = tripTota
-		activityInfo.ActivityTypeName = "专项调研"
-		resp.Detail = activityInfo
-		resp.Detail = activityInfo
-	} else {
-		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-			return
-		}
-		resp.PopupMsg = popupMsg
-		resp.HasPermission = hasPermission
-		resp.SellerName = sellerName
-		resp.SellerMobile = sellerMobile
-	}
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title报名
-// @Description 报名
-// @Param	request	body models.ActivityIdRep true "type json string"
-// @Success Ret=200 {object} models.SignupSpecialStatus
-// @router /trip/add [post]
-func (this *ActivitySpecialController) SpecialTripAdd() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	uid := user.UserId
-	var req models.ActivityIdRep
-	resp := new(models.SignupSpecialStatus)
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		return
-	}
-	activityId := req.ActivityId
-	activityInfo, errInfo := models.GetCygxActivitySpecialDetail(activityId)
-	if activityInfo == nil {
-		br.Msg = "操作失败"
-		br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
-		return
-	}
-	if errInfo != nil {
-		br.Msg = "操作失败"
-		br.ErrMsg = "操作失败,Err:" + errInfo.Error()
-		return
-	}
-
-	havePower, err := services.GetSpecialDetailUserPower(user, activityInfo)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-		return
-	}
-
-	//判断有没有对应的权限,如果没有则给出对应的状态码
-	if havePower {
-		resp.HasPermission = 1
-		signupStatus, popupMsg, popupMsg2, err := services.SpecialTripPopupMsg(activityInfo, user)
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "SpecialTripPopupMsg,Err:" + err.Error()
-			return
-		}
-		resp.PopupMsg = popupMsg
-		resp.PopupMsg2 = popupMsg2
-		resp.SignupStatus = signupStatus
-
-		if signupStatus == 1 {
-			total, err := models.GetUserActivitySpecialTripCount(user.UserId, activityId)
-			if err != nil {
-				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
-				return
-			}
-			//流水记录表
-			itemBill := new(models.CygxActivitySpecialTripBill)
-			itemBill.UserId = user.UserId
-			itemBill.ActivityId = activityInfo.ActivityId
-			itemBill.CreateTime = time.Now()
-			itemBill.Mobile = user.Mobile
-			itemBill.Email = user.Email
-			itemBill.CompanyId = user.CompanyId
-			itemBill.CompanyName = user.CompanyName
-			itemBill.RealName = user.RealName
-			itemBill.Source = 1
-			itemBill.DoType = 1
-			itemBill.BillDetailed = -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
-			itemMeeting.CreateTime = time.Now()
-			itemMeeting.Mobile = user.Mobile
-			itemMeeting.Email = user.Email
-			itemMeeting.CompanyId = user.CompanyId
-			itemMeeting.CompanyName = user.CompanyName
-			itemMeeting.RealName = user.RealName
-
-			go services.ActivitySpecialUserRmind(user, activityId, 2)
-			go services.ActivitySpecialUserAddTrip(user, activityId)
-			//判断是删除还是添加
-			if total == 0 {
-				//获取销售信息
-				sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-				if err != nil {
-					br.Msg = "操作失败"
-					br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-					return
-				}
-				item := new(models.CygxActivitySpecialTrip)
-				item.UserId = uid
-				item.RealName = user.RealName
-				item.ActivityId = activityId
-				item.CreateTime = time.Now()
-				item.Mobile = user.Mobile
-				item.Email = user.Email
-				item.CompanyId = user.CompanyId
-				item.CompanyName = user.CompanyName
-				item.IsValid = 1
-				if sellerItem != nil {
-					item.SellerName = sellerItem.RealName
-				}
-				if user.OutboundMobile != "" {
-					item.OutboundMobile = user.OutboundMobile
-					if user.OutboundCountryCode == "" {
-						item.CountryCode = "86"
-					} else {
-						item.CountryCode = user.OutboundCountryCode
-					}
-				} else {
-					item.OutboundMobile = user.Mobile
-					if user.CountryCode == "" {
-						item.CountryCode = "86"
-					} else {
-						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 = "操作失败"
-					br.ErrMsg = "操作失败,Err:" + err.Error()
-					return
-				}
-				//SignupStatus  int    `description:"返回状态:1:成功 、2 :人数已满 、3:调研次数已用完、 4:超时"`
-
-			} else {
-				updateParams := make(map[string]interface{})
-				updateParams["IsValid"] = 1
-				updateParams["CreateTime"] = time.Now()
-				updateParams["IsCancel"] = 0
-				whereParam := map[string]interface{}{"user_id": user.UserId, "activity_id": activityId}
-				err = models.UpdateByExpr(models.CygxActivitySpecialTrip{}, whereParam, updateParams)
-				if err != nil {
-					br.Msg = "报名失败,"
-					br.ErrMsg = "二次报名,更改报名是否有效状态失败,Err:" + err.Error()
-					return
-				}
-				resultTime := utils.StrTimeToTime(activityInfo.ActivityTime)
-				//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)
-			//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()
-				return
-			}
-			itemBill.Total = totalText
-
-			//添加流水记录
-			err = models.AddCygxActivitySpecialTripBill(itemBill)
-			if err != nil {
-				br.Msg = "报名失败,"
-				br.ErrMsg = "AddCygxActivitySpecialTripBill,Err:" + err.Error()
-				return
-			}
-			//添加数据到会信息
-			err = models.AddCygxActivitySpecialMeetingDetail(itemMeeting)
-			if err != nil {
-				br.Msg = "报名失败,"
-				br.ErrMsg = "AddCygxActivitySpecialMeetingDetail,Err:" + err.Error()
-				return
-			}
-		}
-	} else {
-		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-			return
-		}
-		resp.PopupMsg = popupMsg
-		resp.HasPermission = hasPermission
-		resp.SellerName = sellerName
-		resp.SellerMobile = sellerMobile
-	}
-	resp.ActivityId = activityId
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "操作成功"
-	br.Data = resp
-}
-
-// @Title 取消报名
-// @Description 取消报名
-// @Param	request	body models.ActivityIdRep true "type json string"
-// @Success Ret=200 {object} models.SignupStatus
-// @router /trip/cancel [post]
-func (this *ActivitySpecialController) Tripcancel() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	uid := user.UserId
-	var req models.ActivityIdRep
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		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 = "操作失败"
-		br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
-		return
-	}
-	if errInfo != nil {
-		br.Msg = "操作失败"
-		br.ErrMsg = "操作失败,Err:" + errInfo.Error()
-		return
-	}
-	//流水记录表
-	itemBill := new(models.CygxActivitySpecialTripBill)
-	itemBill.UserId = user.UserId
-	itemBill.ActivityId = activityInfo.ActivityId
-	itemBill.CreateTime = time.Now()
-	itemBill.Mobile = user.Mobile
-	itemBill.Email = user.Email
-	itemBill.CompanyId = user.CompanyId
-	itemBill.CompanyName = user.CompanyName
-	itemBill.RealName = user.RealName
-	itemBill.Source = 1
-	itemBill.DoType = 2
-	itemBill.BillDetailed = 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)
-	//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()
-		return
-	}
-	itemBill.Total = totalText
-
-	err = models.CancelActivitySpecialTripIsValid(isValid, activityInfo.ActivityId, uid)
-	if err != nil {
-		br.Msg = "操作失败"
-		br.ErrMsg = "CancelActivitySpecialTrip,Err:" + err.Error()
-		return
-	}
-	err = models.CancelCygxActivitySpecialMeetingDetail(uid, activityId)
-	if err != nil {
-		br.Msg = "操作失败"
-		br.ErrMsg = "CancelCygxActivitySpecialMeetingDetail,Err:" + err.Error()
-		return
-	}
-	go models.AddCygxActivitySpecialTripBill(itemBill)
-
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "已取消"
-}
-
-// @Title 感兴趣、不感兴趣
-// @Description 感兴趣、不感兴趣接口
-// @Param	request	body models.ActivityIdRep true "type json string"
-// @Success Ret=200 {object} models.SignupSpecialStatus
-// @router /signup/add [post]
-func (this *ActivitySpecialController) SpecialSignupAdd() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	uid := user.UserId
-	var req models.ActivityIdRep
-	resp := new(models.SignupSpecialStatus)
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		return
-	}
-	activityId := req.ActivityId
-	activityInfo, errInfo := models.GetCygxActivitySpecialDetail(activityId)
-	if activityInfo == nil {
-		br.Msg = "操作失败"
-		br.ErrMsg = "活动ID错误,不存在activityId:" + strconv.Itoa(activityId)
-		return
-	}
-	if errInfo != nil {
-		br.Msg = "操作失败"
-		br.ErrMsg = "操作失败,Err:" + errInfo.Error()
-		return
-	}
-	//havePower, err := services.GetSpecialDetailUserPower(user, activityInfo)
-	//if err != nil {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-	//	return
-	//}
-	var havePower bool
-	havePower = true
-	//判断有没有对应的权限,如果没有则给出对应的状态码
-	if havePower {
-		resp.HasPermission = 1
-		total, err := models.GetUserCygxActivitySpecialSignup(user.UserId, activityId)
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取日程数量信息失败,Err:" + err.Error()
-			return
-		}
-		resp.SignupStatus = 1
-		//判断是删除还是添加
-		if total == 0 {
-			//获取销售信息
-			sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-			if err != nil {
-				br.Msg = "操作失败"
-				br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-				return
-			}
-			item := new(models.CygxActivitySpecialSignup)
-			item.RegisterPlatform = utils.REGISTER_PLATFORM
-			item.UserId = uid
-			item.RealName = user.RealName
-			item.ActivityId = activityId
-			item.CreateTime = time.Now()
-			item.Mobile = user.Mobile
-			item.Email = user.Email
-			item.CompanyId = user.CompanyId
-			item.CompanyName = user.CompanyName
-			if sellerItem != nil {
-				item.SellerName = sellerItem.RealName
-			}
-			err = models.AddCygxActivitySpecialSignup(item)
-			if err != nil {
-				br.Msg = "操作失败"
-				br.ErrMsg = "操作失败,Err:" + err.Error()
-				return
-			}
-			resp.Status = 1
-			resp.PopupMsg = "感谢反馈"
-			resp.PopupMsg2 = "此调研具体行程尚未确认,待预报名人数满10人后弘则会确定行程并推送给您活动日期,只有在确认行程中再次报名才完成占位。"
-			//给所属销售发送消息
-			//if sellerItem.Mobile != "" {
-			//	openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
-			//	if openIpItem != nil && openIpItem.OpenId != "" {
-			//		if sellerItem != nil {
-			//			//go services.SendSpecialTemplateMsg(user.RealName+"【"+user.CompanyName+"】", time.Now().Format(utils.FormatDateTime), user.Mobile, activityInfo.ResearchTheme, "sale", openIpItem)
-			//		}
-			//	}
-			//}
-			// 给芳姐发消息
-			actList, _ := models.GetActivityListSpecialByActivityId(activityId)
-			if len(actList) == 10 {
-				go services.SendWxMsgActivitySpecial10(activityInfo)
-			}
-			//用户专项调研操作行为,模板消息推送
-			//go services.SpecialActivityUserRemind(user, activityInfo, 1)
-		} else {
-			err = models.DeleteCygxActivitySpecialSignup(user.UserId, activityId)
-			if err != nil {
-				br.Msg = "操作失败"
-				br.ErrMsg = "操作失败,Err:" + err.Error()
-				return
-			}
-			resp.Status = 2
-		}
-	} else {
-		hasPermission, sellerName, sellerMobile, popupMsg, err := services.GetUserHasPermission(user)
-		if err != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
-			return
-		}
-		resp.PopupMsg = popupMsg
-		resp.HasPermission = hasPermission
-		resp.SellerName = sellerName
-		resp.SellerMobile = sellerMobile
-	}
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "操作成功"
-	br.Data = resp
-}
-
-// @Title 新调研通知取消跟添加
-// @Description 新调研通知取消跟添加接口
-// @Param	request	body models.ArticleCollectResp true "type json string"
-// @Success 200
-// @router /follow [post]
-func (this *ActivitySpecialController) SpecialMsg() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请重新登录"
-		br.Ret = 408
-		return
-	}
-	resp := new(models.ArticleCollectResp)
-	count, err := models.GetCygxUserFollowSpecial(user.UserId)
-	if err != nil {
-		br.Msg = "获取数据失败!"
-		br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
-		return
-	}
-	if count == 0 {
-		item := new(models.CygxUserFollowSpecial)
-		item.UserId = user.UserId
-		item.RealName = user.RealName
-		item.CreateTime = time.Now()
-		item.Mobile = user.Mobile
-		item.Email = user.Email
-		item.CompanyId = user.CompanyId
-		item.CompanyName = user.CompanyName
-		item.CreateTime = time.Now()
-		err := models.AddUserFollowSpecial(item)
-		if err != nil {
-			br.Msg = "操作失败!"
-			br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
-			return
-		}
-		resp.Status = 1
-	} else {
-		err := models.DeleteCygxUserFollowSpecial(user.UserId)
-		if err != nil {
-			br.Msg = "操作失败!"
-			br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
-			return
-		}
-		resp.Status = 2
-	}
-	br.Ret = 200
-	br.Data = resp
-	br.Success = true
-	br.Msg = "操作成功!"
-}

+ 35 - 37
controllers/banner.go

@@ -167,43 +167,6 @@ func (this *BaseBannerController) List() {
 	br.Data = resp
 }
 
-// @Title 记录点击信息
-// @Description 记录点击信息
-// @Param	request	body cygx.CygxBannerIdReq true "type json string"
-// @Success 200 Ret=200 发布成功
-// @router /add/history [post]
-func (this *BannerController) History() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	var req models.CygxBannerIdReq
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		return
-	}
-	bannerId := req.BannerId
-	if bannerId == 0 {
-		br.Msg = "参数错误"
-		br.ErrMsg = "参数错误,id不可为空"
-		return
-	}
-	go services.AddCygxBannerHistory(user, bannerId)
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "记录成功"
-}
-
 // @Title 研选banner列表
 // @Description 研选banner列表接口
 // @Success Ret=200 {object} cygx.CygxBannerListResp
@@ -300,3 +263,38 @@ func (this *BannerController) YxSurvey() {
 	br.Success = true
 	br.Msg = "记录成功"
 }
+
+// @Title 首页banner图片
+// @Description 研选banner列表接口
+// @Success Ret=200 {object} cygx.BannerUrHomeListResp
+// @router /listhome [get]
+func (this *BaseBannerController) ListHome() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	resp := new(models.BannerUrHomeListResp)
+	key := "web_mfyx_banner_list"
+	conf, e := models.GetConfigByCode(key)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取首页头部导航失败, Err: " + e.Error()
+		return
+	}
+	if conf.ConfigValue == "" {
+		br.Msg = "获取失败"
+		br.ErrMsg = "首页头部导航配置值有误"
+		return
+	}
+	if e = json.Unmarshal([]byte(conf.ConfigValue), &resp); e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "首页头部导航配置值解析失败, Err: " + e.Error()
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 60 - 90
controllers/home.go

@@ -255,8 +255,9 @@ func (this *MobileHomeController) List() {
 
 // @Title 首页列表接口
 // @Description 首页列表接口
-// @Param   TagIds   query   string  true       "标签选择"
-// @Param   ChartPermissionId   query   int	  false     "行业id"
+// @Param   LabelKeyword   query   string  true       "标签关键词"
+// @Param   HashtagKeyword   query   string  true       "主题关键词"
+// @Param   KeyWord   query   string  true       "搜索关键词"
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Success 200 {object} models.HomeArtAndChartListResp
@@ -274,11 +275,12 @@ func (this *MobileHomeController) NewList() {
 		br.Ret = 408
 		return
 	}
-	//uid := user.UserId
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
-	tagIds := this.GetString("TagIds")
-	chartPermissionId, _ := this.GetInt("ChartPermissionId")
+	labelKeyword := this.GetString("LabelKeyword")
+	hashtagKeyword := this.GetString("HashtagKeyword")
+	keyWord := this.GetString("KeyWord")
+
 	var startSize int
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20
@@ -290,114 +292,82 @@ func (this *MobileHomeController) NewList() {
 	startSize = paging.StartIndex(currentIndex, pageSize)
 
 	var condition string
-	var conditionInit string
 	var pars []interface{}
+	var yanxuanActivityIds []int
+	var yanxuanArticleIds []int
+	//var yanxuanspecialIds []int
+
+	if hashtagKeyword != "" {
+
+	}
+
 	var total int
+	var list []*models.CygxResourceDataNewResp
 	var err error
 	resp := new(models.HomeResourceDataListNewResp)
 
-	if tagIds != "" {
-		conditionTagIdsInit, err := services.GetConditionInitByTagIds(tagIds, chartPermissionId)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取活动权限数据失败,GetConditionInitByTagIds Err:" + err.Error()
-			return
+	if keyWord == "" {
+		condition += " AND source IN ('article','activity','yanxuanspecial')   " // 只有研选的文章、研选的活动、研选的专栏这三种
+		if labelKeyword == "" {
+			//查询近一个月的数据
+			condition += " AND search_order_time  >   '" + time.Now().AddDate(0, 0, -60).Format(utils.FormatDateTime) + "'"
+			yanxuanActivityIds = services.GetYanxuanActivityIds(user) // 获取所有的研选活动ID
+			yanxuanArticleIds = services.GetYanxuanArticleIds()       //获取所有研选文章ID
+		} else {
+			yanxuanActivityIds, yanxuanArticleIds, err = services.GetConditionInitByTagIds(user, labelKeyword)
+			if err != nil {
+				br.Msg = "获取失败"
+				br.ErrMsg = "获取活动权限数据失败,GetConditionInitByTagIds Err:" + err.Error()
+				return
+			}
+			//如果不是 "全部报告" 、 "专栏" 的关键词查询,就不做研选专栏的查询
+			if labelKeyword != utils.LABEL_L2_1 && labelKeyword != utils.LABEL_L2_2 {
+				condition += `  AND IF ( source = 'yanxuanspecial' , source_id   IN (0) ,1=1 ) `
+			}
 		}
-		conditionInit += conditionTagIdsInit
-	}
-	//行业筛选
-	if chartPermissionId > 0 {
-		conditionInit += " AND chart_permission_id  =  " + strconv.Itoa(chartPermissionId)
-	}
 
-	if tagIds == "" && chartPermissionId == 0 {
-		//查询近一个月的数据
-		conditionInit += " AND publish_date  >   '" + time.Now().AddDate(0, 0, -30).Format(utils.FormatDateTime) + "'"
-	}
-	//return
-	//conditionInit += `  AND source IN ('newchart')`
-	if user.CompanyId <= 1 {
-		condition += " AND source IN ('roadshow','article') "
-		startSize = 0
-		pageSize = utils.PageSize5
-	} else {
-		condition += ` AND source NOT IN ('activity','activityspecial','newchart','industrialsourceHz','industrialsourceYx') ` + conditionInit
-		//conditionActivity, err := services.GetActivityonditionList(user, "", "", "", "1,2,3", "", 0, 0, "", 0, 1)
-		conditionActivity, err := services.ActivityConditioninitSql(user, "", 0)
-		if err != nil && err.Error() != utils.ErrNoRow() {
+		yanxuanArticleIds = append(yanxuanArticleIds, 0)
+		yanxuanActivityIds = append(yanxuanActivityIds, 0)
+		//yanxuanspecialIds = append(yanxuanspecialIds, 0)
+		condition += `  AND IF ( source = 'article' , source_id   IN (` + utils.GetOrmInReplace(len(yanxuanArticleIds)) + `) ,1=1 ) `
+		pars = append(pars, yanxuanArticleIds)
+
+		condition += `  AND IF ( source = 'activity' , source_id   IN (` + utils.GetOrmInReplace(len(yanxuanActivityIds)) + `) ,1=1 ) `
+		pars = append(pars, yanxuanActivityIds)
+
+		total, err = models.GetResourceDataCount(condition, pars)
+		if err != nil {
 			br.Msg = "获取失败"
-			br.ErrMsg = "获取活动权限数据失败,Err:" + err.Error()
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
-		conditionActivity += `  AND art.publish_status = 1 `
-		var conditionOrder string
-		conditionOrder = ` ORDER BY art.activity_time DESC ,  art.active_state ASC   `
-		conditionActivity += conditionOrder
-		actPageSize := 200
-		if tagIds != "" {
-			actPageSize = 2000
-		}
-		listActivity, err := models.GetActivityListHomeNew(conditionActivity, 0, actPageSize)
+		list, err = services.GetResourceDataList(condition, pars, startSize, pageSize, user)
 		if err != nil {
 			br.Msg = "获取失败"
-			br.ErrMsg = "获取可见活动数据失败,Err:" + err.Error()
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
+	} else {
 
-		var activityIds []int
-		for _, v := range listActivity {
-			activityIds = append(activityIds, v.ActivityId)
+		tmpResult, tmpTotalResult, err := services.SqlComprehensiveSearch(user, keyWord, startSize, pageSize)
+		if err != nil {
+			br.Msg = "检索失败"
+			br.ErrMsg = "检索失败,Err:" + err.Error()
+			return
 		}
-		lenActivityIds := len(activityIds)
-
-		listActivitySpecial, _, err := services.GetActivitySpecialList(user, 1, 200, "", "", "")
+		total = tmpTotalResult
+		list, err = services.GetResourceDataEsList(tmpResult, user)
 		if err != nil {
 			br.Msg = "获取失败"
-			br.ErrMsg = "获取专项调研可见权限失败失败,Err:" + err.Error()
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
-
-		var activityspecialIds []int
-		for _, v := range listActivitySpecial {
-			activityspecialIds = append(activityspecialIds, v.ActivityId)
-		}
-		lenActivityspecialIds := len(activityspecialIds)
-
-		//if lenActivityIds > 0 && tagIds == "" {
-		if lenActivityIds > 0 {
-			condition += ` OR ( source = 'activity' AND source_id IN (` + utils.GetOrmInReplace(lenActivityIds) + `) ` + conditionInit + ` )    `
-			pars = append(pars, activityIds)
-		}
-
-		if lenActivityspecialIds > 0 {
-			condition += ` OR ( source = 'activityspecial' AND source_id IN (` + utils.GetOrmInReplace(lenActivityspecialIds) + `) ` + conditionInit + ` )   `
-			pars = append(pars, activityspecialIds)
-		}
-	}
-	//return
-	total, err = models.GetResourceDataCount(condition, pars)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取数据总数失败,Err:" + err.Error()
-		return
-	}
-	//return
-	if user.CompanyId <= 1 {
-		total = utils.PageSize5
 	}
-
 	page := paging.GetPaging(currentIndex, pageSize, total)
-	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial"`
-	list, err := services.GetResourceDataList(condition, pars, startSize, pageSize, user)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取数据列表失败,Err:" + err.Error()
-		return
-	}
-	if len(list) == 0 {
-		list = make([]*models.CygxResourceDataNewResp, 0)
+
+	if currentIndex == 1 && keyWord != "" {
+		go services.AddSearchKeyWord(user, keyWord, 1)
 	}
-	page = paging.GetPaging(currentIndex, pageSize, total)
 	resp.Paging = page
 	resp.List = list
 	br.Ret = 200

+ 0 - 224
controllers/morning_meeting.go

@@ -1,224 +0,0 @@
-package controllers
-
-import (
-	"encoding/json"
-	"github.com/rdlucklib/rdluck_tools/paging"
-	"hongze/hongze_web_mfyx/models"
-	"hongze/hongze_web_mfyx/services"
-	"hongze/hongze_web_mfyx/utils"
-	"strconv"
-	"strings"
-)
-
-// 晨会精华
-type MorningMeetingController struct {
-	BaseAuthController
-}
-
-// @Title 晨会精华汇总列表
-// @Description 晨会精华汇总列表接口
-// @Param   PageSize   query   int  true       "每页数据条数"
-// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
-// @Success Ret=200 {object} cygx.GetCygxTacticsTimeLineResp
-// @router /gather/list [get]
-func (this *MorningMeetingController) GatherList() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	resp := new(models.CygxMorningMeetingGatherListResp)
-	pageSize, _ := this.GetInt("PageSize")
-	currentIndex, _ := this.GetInt("CurrentIndex")
-
-	var startSize int
-	if pageSize <= 0 {
-		pageSize = utils.PageSize20
-	}
-	if currentIndex <= 0 {
-		currentIndex = 1
-	}
-	startSize = utils.StartIndex(currentIndex, pageSize)
-	var condition string
-	var pars []interface{}
-	condition += ` AND status = 1  AND  meeting_ids != '' `
-	total, err := models.GetCygxMorningMeetingGatherCount(condition, pars)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	condition += "	ORDER BY publish_time DESC ,id  DESC "
-	list, err := models.GetCygxMorningMeetingGatherList(condition, pars, startSize, pageSize)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	var meetids string
-	for _, v := range list {
-		meetids += v.MeetingIds + ","
-	}
-	meetids = strings.TrimRight(meetids, ",")
-	mapMeetName := make(map[string]string)
-	if meetids != "" {
-		pars = make([]interface{}, 0)
-		condition = ` 	AND id  IN(` + meetids + `)  AND  status = 1   `
-		listMeet, err := models.GetCygxMorningMeetingReviewsList(condition, pars, 0, 10000)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败,Err:" + err.Error()
-		}
-		for _, v := range listMeet {
-			mapMeetName[strconv.Itoa(v.Id)] = v.IndustryNames
-		}
-	}
-	page := paging.GetPaging(currentIndex, pageSize, total)
-	for _, v := range list {
-		item := new(models.CygxMorningMeetingGatherResp)
-		item.Id = v.Id
-		item.Title = v.Title
-		sliceMeetingIds := strings.Split(v.MeetingIds, ",")
-		for _, vM := range sliceMeetingIds {
-			if mapMeetName[vM] != "" {
-				item.IndustryName += mapMeetName[vM] + ","
-			}
-		}
-		item.IndustryName = strings.TrimRight(item.IndustryName, ",")
-		item.IndustryName = strings.Replace(item.IndustryName, ",", "】、【", -1)
-		item.IndustryName = "【" + item.IndustryName + "】"
-		resp.List = append(resp.List, item)
-	}
-	resp.Paging = page
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title 晨会精华汇总详情
-// @Description 晨会精华汇总详情接口
-// @Param   Id   query   int  true       "Id"
-// @Success Ret=200 {object} cygx.GetCygxTacticsTimeLineResp
-// @router /gather/detail [get]
-func (this *MorningMeetingController) GatherDetail() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	id, _ := this.GetInt("Id")
-	resp := new(models.CygxMorningMeetingGatherDetailResp)
-	hasPermission, err := services.GetUserhasPermission(user)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
-	}
-	if hasPermission != 1 {
-		br.Ret = 200
-		br.Success = true
-		br.Msg = "获取成功"
-		br.Data = resp
-		return
-	}
-	var condition string
-	var pars []interface{}
-	condition += ` AND status = 1 AND  id = ?  `
-	pars = append(pars, id)
-	total, err := models.GetCygxMorningMeetingGatherCount(condition, pars)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	if total == 0 {
-		br.Msg = "内容不存在,或未发布"
-	}
-	detail, err := models.GetCygxMorningMeetingGatherById(condition, pars)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	var meetids string
-	meetids = detail.MeetingIds
-	detailResp := new(models.CygxMorningMeetingGatherDetail)
-	if meetids != "" {
-		pars = make([]interface{}, 0)
-		condition = ` 	AND meeting_id  IN(` + meetids + `) `
-		listMeet, err := models.GetCygxMorningMeetingReviewChapterList(condition, pars)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败,Err:" + err.Error()
-		}
-		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)
-	}
-	detailResp.Id = detail.Id
-	detailResp.Title = detail.Title
-	detailResp.PublishTime = utils.GetTimeDateRemoveYear(detail.PublishTime)
-	detailResp.Department = "弘则产品组"
-	resp.Detail = detailResp
-	resp.HasPermission = hasPermission
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title 晨会精华点击记录
-// @Description 晨会精华点击记录接口
-// @Param	request	body models.ArticleCollectResp true "type json string"
-// @Success 200
-// @router /history/add [post]
-func (this *MorningMeetingController) SpecialMsg() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请重新登录"
-		br.Ret = 408
-		return
-	}
-	var req models.AddCygxMorningMeetingReviewChapterHistoryReq
-
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		return
-	}
-	articleId := req.Id
-	sourcePage := req.SourcePage
-
-	go services.AddCygxMorningMeetingReviewChapterHistory(user, articleId, sourcePage)
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "操作成功!"
-}

+ 0 - 132
controllers/product_interior.go

@@ -1,132 +0,0 @@
-package controllers
-
-import (
-	"github.com/rdlucklib/rdluck_tools/paging"
-	"hongze/hongze_web_mfyx/models"
-	"hongze/hongze_web_mfyx/services"
-	"hongze/hongze_web_mfyx/utils"
-)
-
-// 产品内测
-type ProductInteriorController struct {
-	BaseAuthController
-}
-
-// @Title 列表
-// @Description 列表接口
-// @Param   PageSize   query   int  true       "每页数据条数"
-// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
-// @Success Ret=200 {object} cygx.GetCygxTacticsTimeLineResp
-// @router /list [get]
-func (this *ProductInteriorController) List() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	resp := new(models.GetCygxProductInteriorResp)
-	pageSize, _ := this.GetInt("PageSize")
-	currentIndex, _ := this.GetInt("CurrentIndex")
-
-	var startSize int
-	if pageSize <= 0 {
-		pageSize = utils.PageSize20
-	}
-	if currentIndex <= 0 {
-		currentIndex = 1
-	}
-	startSize = utils.StartIndex(currentIndex, pageSize)
-	var condition string
-	var pars []interface{}
-	condition += ` AND art.status = 1 `
-	total, err := models.GetCygxProductInteriorCount(condition, pars)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	condition += "	ORDER BY art.publish_time DESC , art.product_interior_id DESC "
-	list, err := models.GetCygxProductInteriorList(condition, pars, startSize, pageSize)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	for _, v := range list {
-		v.PublishTime = utils.TimeRemoveHms(v.PublishTime)
-	}
-	page := paging.GetPaging(currentIndex, pageSize, total)
-	resp.List = list
-	resp.Paging = page
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title  详情
-// @Description 获取详情接口
-// @Param   ProductInteriorId   query   int  true       "ID"
-// @Success Ret=200 {object} cygx.GetCygxProductInteriorDetailResp
-// @router /detail [get]
-func (this *ProductInteriorController) Detail() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	resp := new(models.GetCygxProductInteriorDetailResp)
-	productInteriorId, _ := this.GetInt("ProductInteriorId")
-	if productInteriorId < 1 {
-		br.Msg = "请输入详情ID"
-		return
-	}
-	detail, err := models.GetCygxProductInteriorDetail(productInteriorId)
-	if err != nil {
-		br.Msg = "详情不存在"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	//判断用户权限
-	hasPermission, err := services.GetUserhasPermission(user)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
-	}
-	//未设置全部可见的只能给弘则内部查看
-	if detail.VisibleRange == 1 || user.CompanyId == utils.HZ_COMPANY_ID {
-		resp.IsShow = true
-	}
-	resp.HasPermission = hasPermission
-	if hasPermission != 1 || !resp.IsShow {
-		br.Ret = 200
-		br.Success = true
-		br.Msg = "获取成功"
-		br.Data = resp
-		return
-	}
-	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
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}

+ 0 - 418
controllers/report_selection.go

@@ -1,418 +0,0 @@
-package controllers
-
-import (
-	"encoding/json"
-	"hongze/hongze_web_mfyx/models"
-	"hongze/hongze_web_mfyx/services"
-	"hongze/hongze_web_mfyx/utils"
-	"strconv"
-	"strings"
-	"time"
-)
-
-// 报告
-type ReportSelectionController struct {
-	BaseAuthController
-}
-
-// @Title 获取报告精选详情
-// @Description 获取报告精选详情接口
-// @Param   ArticleId   query   int  true       "报告ID"
-// @Param   IsBestNew   query   bool  false       "是否获取最新的一篇报告"
-// @Success 200 {object} models.ReportSelectionLetailResp
-// @router /detail [get]
-func (this *ReportSelectionController) Detail() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请重新登录"
-		br.Ret = 408
-		return
-	}
-	//uid := user.UserId
-	articleId, _ := this.GetInt("ArticleId")
-	isBestNew, _ := this.GetBool("IsBestNew")
-	if isBestNew {
-		tbdb := "cygx_report_selection"
-		condition := ` AND publish_status = 1  `
-		var pars []interface{}
-		list, err := models.GetReportSelectionListPublic(condition, "1", tbdb, pars, 0, 1)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取失败,Err:" + err.Error()
-			return
-		}
-		for _, v := range list {
-			articleId = v.ArticleId
-		}
-	}
-	if articleId < 1 {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "报告ID错误" + strconv.Itoa(articleId)
-		return
-	}
-
-	PermissionNameMap, err := services.GetPermissionNameMap()
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
-		return
-	}
-
-	PermissionIcoMap, err := services.GetPermissionNameIcoMap()
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败 GetPermissionNameMap,Err:" + err.Error()
-		return
-	}
-
-	resp := new(models.ReportSelectionLetailResp)
-	//判断用户权限
-	hasPermission, err := services.GetUserhasPermission(user)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
-	}
-	detail, err := models.GetCygxReportSelectionInfoById(articleId)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "报告不存在,Err:" + err.Error() + "articleId:" + strconv.Itoa(articleId)
-		return
-	}
-	//未设置全部可见的只能给弘则内部查看
-	if detail.VisibleRange == 1 || user.CompanyId == utils.HZ_COMPANY_ID {
-		resp.IsShow = true
-	}
-	resp.HasPermission = hasPermission
-	if hasPermission != 1 || !resp.IsShow {
-		br.Ret = 200
-		br.Success = true
-		br.Msg = "获取成功"
-		resp.Detail = detail
-		br.Data = resp
-		return
-	}
-	if detail.ReportLink != "" {
-		articleIdLink, _ := services.GetReportLinkToArticleid(detail.ReportLink)
-		detail.CeLueArticleId = articleIdLink
-	}
-	articleStockMap, _ := services.GetArticleStockMap()
-	detail.PublishDate = utils.StrTimeToTime(detail.PublishDate).Format("2006-01-02")
-	existMap := make(map[int]int)
-	var items []*models.ReportSelectionChartPermission
-	var itemsSubject []*models.ReportSelectionChartLogPermission
-	listLog, err := models.GetReportSelectionlogListAll(articleId)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取子类信息失败,Err:" + err.Error()
-		return
-	}
-	detail.VideoPlaySeconds = utils.Mp3Time(detail.VideoPlaySeconds)
-	//获取行业核心逻辑汇总
-	listChartLog, err := models.GetCygxReportSelectionChartLogRepList(articleId)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	mapChartLog := make(map[string]string)
-	for _, v := range listChartLog {
-		mapChartLog[v.ChartPermissionName] = v.BodyChartSummary
-	}
-	for _, v := range listLog {
-		v.PermissionName = PermissionNameMap[v.ChartPermissionId]
-		item := new(models.ReportSelectionChartPermission)
-		itemSubject := new(models.ReportSelectionChartLogPermission)
-		itemSubject.PermissionName = v.PermissionName
-		if existMap[v.ChartPermissionId] == 0 {
-			//item.PermissionName = v.PermissionName + "领域深度报告和调研"
-			item.PermissionName = v.PermissionName
-			item.ChartPermissionId = v.ChartPermissionId
-			item.IcoLink = v.IcoLink
-			listSonLog, err := models.GetReportSelectionlogSonListAll(articleId, v.ChartPermissionId)
-			if err != nil && err.Error() != utils.ErrNoRow() {
-				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取信息失败,Err:" + err.Error()
-				return
-			}
-			for k2, v2 := range listSonLog {
-				if v2.IndustrialManagementId != "" {
-					listIndustrial, err := models.GetIndustrialByIds(v2.IndustrialManagementId)
-					if err != nil && err.Error() != utils.ErrNoRow() {
-						br.Msg = "获取信息失败"
-						br.ErrMsg = "获取信息失败,Err:" + err.Error()
-						return
-					}
-					//后台如果勾了隐藏那么这里就不展示  V11.3  2023-08-17
-					if listSonLog[k2].IsShowOverviewArticle == 1 {
-						listSonLog[k2].OverviewArticleId = articleStockMap[v2.SubjectName]
-					} else {
-						listSonLog[k2].OverviewArticleId = 0
-					}
-					listSonLog[k2].List = listIndustrial
-					//listSonLog[k2].IsShowApplyButton = true
-					if v2.Label != "" {
-						CompanyLabelSlice := strings.Split(v2.Label, "{|}")
-						for _, vCompanyLabel := range CompanyLabelSlice {
-							v2.CompanyLabel = append(v2.CompanyLabel, vCompanyLabel+"#")
-						}
-					}
-				}
-				itemSubject.ListSubject = append(itemSubject.ListSubject, &models.ReportSelectionChartLogSubjectName{SubjectName: v2.SubjectName, IsNew: v2.IsNew, IndustrialSubjectId: v2.IndustrialSubjectId})
-			}
-			item.BodyChartSummary = mapChartLog[v.PermissionName]
-			item.List = listSonLog
-			item.PermissionName = PermissionNameMap[v.ChartPermissionId]
-			item.IcoLink = PermissionIcoMap[v.ChartPermissionId]
-			items = append(items, item)
-			itemsSubject = append(itemsSubject, itemSubject)
-			//itemLogs = make([]*models.CygxReportSelectionLogDetail, 0)
-		}
-		existMap[v.ChartPermissionId] = v.ChartPermissionId
-	}
-	//historyRecord := new(models.CygxReportHistoryRecord)
-	//historyRecord.UserId = uid
-	//historyRecord.ArticleId = articleId
-	//historyRecord.CreateTime = time.Now()
-	//historyRecord.Mobile = user.Mobile
-	//historyRecord.Email = user.Email
-	//historyRecord.CompanyId = user.CompanyId
-	//historyRecord.CompanyName = user.CompanyName
-	//historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
-	//historyRecord.ReportType = "bgjx"
-	//sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	//if err != nil && err.Error() != utils.ErrNoRow() {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-	//	return
-	//}
-	//historyRecord.RealName = user.RealName
-	//if sellerItem != nil {
-	//	historyRecord.SellerName = sellerItem.RealName
-	//}
-	//go services.AddCygxReportHistoryRecord(user, articleId, "bgjx")
-	resp.List = items
-	resp.ListPermissionSubject = itemsSubject
-	resp.Detail = detail
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title 标的点击记录
-// @Description 标的点击记录接口
-// @Param	request	body models.AddCygxReportSelectionSubjectHistoryReq true "type json string"
-// @router /click/history [post]
-func (this *ReportSelectionController) ClickHistory() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请重新登录"
-		br.Ret = 408
-		return
-	}
-	var req models.AddCygxReportSelectionSubjectHistoryReq
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		return
-	}
-	if req.ArticleId <= 0 {
-		br.Msg = "文章不存在"
-		br.ErrMsg = "文章不存在,文章ID错误"
-		return
-	}
-	if req.IndustrialSubjectId <= 0 {
-		br.Msg = "标的ID不存在"
-		br.ErrMsg = "标的ID不存在,标的ID错误"
-		return
-	}
-	item := models.CygxReportSelectionSubjectHistory{
-		UserId:              user.UserId,
-		ArticleId:           req.ArticleId,
-		CreateTime:          time.Now(),
-		ModifyTime:          time.Now(),
-		Mobile:              user.Mobile,
-		Email:               user.Email,
-		CompanyId:           user.CompanyId,
-		CompanyName:         user.CompanyName,
-		IndustrialSubjectId: req.IndustrialSubjectId,
-		RegisterPlatform:    utils.REGISTER_PLATFORM,
-	}
-	err = models.AddCygxReportSelectionSubjectHistory(&item)
-	if err != nil {
-		br.Msg = "记录失败"
-		br.ErrMsg = "记录失败,Err:" + err.Error()
-		return
-	}
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "记录成功"
-}
-
-// @Title 上传文章阅读时间
-// @Description 上传文章阅读时间接口
-// @Param  request	body models.AddStopTimeRep true "type json string"
-// @Success 200 {object} models.ArticleDetailResp
-// @router /addStopTime [post]
-func (this *ReportSelectionController) AddStopTime() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	var req models.AddReportSelectionStopTimeRep
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		return
-	}
-	uid := user.UserId
-	articleId := req.ArticleId
-	stopTime := req.StopTime
-	outType := req.OutType
-	source := req.Source
-	var reportType string
-	if source == 1 {
-		reportType = "bgjx"
-	} else if source == 2 {
-		reportType = "bzyjhz"
-	} else if source == 3 {
-		reportType = "szjyhz"
-	}
-	hasPermission, err := services.GetUserhasPermission(user)
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取用户权限信息失败,Err:" + err.Error()
-	}
-
-	if hasPermission == 1 {
-		historyRecord := new(models.CygxReportHistoryRecord)
-		historyRecord.UserId = uid
-		historyRecord.ArticleId = articleId
-		historyRecord.CreateTime = time.Now().Add(-time.Second * time.Duration(stopTime))
-		historyRecord.Mobile = user.Mobile
-		historyRecord.Email = user.Email
-		historyRecord.CompanyId = user.CompanyId
-		historyRecord.CompanyName = user.CompanyName
-		historyRecord.StopTime = stopTime
-		historyRecord.OutType = outType
-		historyRecord.ReportType = reportType
-		historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
-		sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-			return
-		}
-		historyRecord.RealName = user.RealName
-		if sellerItem != nil {
-			historyRecord.SellerName = sellerItem.RealName
-		}
-		go services.AddCygxReportHistoryRecord(historyRecord)
-	}
-
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "操作成功"
-}
-
-// @Title 报告精选申请路演
-// @Description 报告精选申请路演
-// @Param	request	body cygx.CygxBannerIdReq true "type json string"
-// @Success 200 Ret=200 提交成功
-// @router /report_selection_log/apply [post]
-func (this *ReportSelectionController) ReportSelectionLogApply() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	var req models.CygxReportSelectionLogApplyReq
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		return
-	}
-	articleId := req.ArticleId
-	subjectName := req.SubjectName
-
-	var condition string
-	var pars []interface{}
-	condition += ` AND  article_id = ? AND subject_name = ? AND user_id = ?  `
-	pars = append(pars, articleId, subjectName, user.UserId)
-	totalApply, err := models.GetCygxReportSelectionLogApplyCount(condition, pars)
-	if err != nil {
-		br.Msg = "申请失败!"
-		br.ErrMsg = "申请失败,Err:" + err.Error()
-		return
-	}
-	if totalApply > 0 {
-		br.Msg = "您已提交过此公司的路演申请,请等待销售与您联系!"
-		return
-	}
-
-	logDetail, err := models.GetCygxReportSelectionLogDetail(articleId, subjectName)
-	if err != nil {
-		br.Msg = "申请失败!"
-		br.ErrMsg = "申请失败,Err:" + err.Error()
-		return
-	}
-
-	item := new(models.CygxReportSelectionLogApply)
-	item.UserId = user.UserId
-	item.CreateTime = time.Now()
-	item.ModifyTime = time.Now()
-	item.Mobile = user.Mobile
-	item.Email = user.Email
-	item.CompanyId = user.CompanyId
-	item.CompanyName = user.CompanyName
-	item.ArticleId = logDetail.ArticleId
-	item.SubjectName = logDetail.SubjectName
-	item.IndustrialSubjectId = logDetail.IndustrialSubjectId
-	item.RegisterPlatform = utils.REGISTER_PLATFORM
-	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		return
-	}
-	item.RealName = user.RealName
-	if sellerItem != nil {
-		item.SellerName = sellerItem.RealName
-	}
-	_, err = models.AddCygxReportSelectionLogApply(item)
-	if err != nil {
-		br.Msg = "申请失败"
-		br.ErrMsg = "申请失败,Err:" + err.Error()
-		return
-	}
-	go services.SendCygxReportSelectionLogApplyTemplateMsg(user, logDetail.SubjectName)
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "记录成功"
-}

+ 0 - 64
controllers/search.go

@@ -353,67 +353,3 @@ func (this *MobileSearchController) BrowseHistoryList() {
 	br.Success = true
 	br.Data = resp
 }
-
-// @Title 综合搜索接口
-// @Description 综合搜索接口
-// @Param   PageSize   query   int  true       "每页数据条数"
-// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
-// @Param   KeyWord   query   string  true       "搜索关键词"
-// @Success 200 {object} models.SearchItem
-// @router /comprehensive/list [get]
-func (this *MobileSearchController) ComprehensiveList() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	pageSize, _ := this.GetInt("PageSize")
-	currentIndex, _ := this.GetInt("CurrentIndex")
-	var startSize int
-	if pageSize <= 0 {
-		pageSize = utils.PageSize20
-	}
-	if currentIndex <= 0 {
-		currentIndex = 1
-	}
-	startSize = paging.StartIndex(currentIndex, pageSize)
-	keyWord := this.GetString("KeyWord")
-	if keyWord == "" {
-		br.Msg = "请输入搜索词"
-		br.ErrMsg = "请输入搜索词"
-		return
-	}
-	user := this.User
-	if user == nil {
-		br.Msg = "请重新登录"
-		br.Ret = 408
-		return
-	}
-	resp := new(models.HomeResourceDataListNewResp)
-	tmpResult, tmpTotalResult, err := services.SqlComprehensiveSearch(keyWord, startSize, pageSize)
-	if err != nil {
-		br.Msg = "检索失败"
-		br.ErrMsg = "检索失败,Err:" + err.Error()
-		return
-	}
-
-	list, err := services.GetResourceDataEsList(tmpResult, user)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取数据失败,Err:" + err.Error()
-		return
-	}
-	if len(list) == 0 {
-		list = make([]*models.CygxResourceDataNewResp, 0)
-	}
-	if currentIndex == 1 {
-		go services.AddSearchKeyWord(user, keyWord, 1)
-	}
-	resp.List = list
-	page := paging.GetPaging(currentIndex, pageSize, int(tmpTotalResult))
-	resp.Paging = page
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}

+ 0 - 139
controllers/tactics.go

@@ -1,139 +0,0 @@
-package controllers
-
-import (
-	"encoding/json"
-	"github.com/rdlucklib/rdluck_tools/paging"
-	"hongze/hongze_web_mfyx/models"
-	"hongze/hongze_web_mfyx/utils"
-	"time"
-)
-
-type MobileTacticsController struct {
-	BaseAuthMobileController
-}
-
-// @Title 时间线列表
-// @Description 时间线列表接口
-// @Param   PageSize   query   int  true       "每页数据条数"
-// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
-// @Success 200 {object} models.GetCygxTacticsTimeLineResp
-// @router /tacticsTimeLine/list [get]
-func (this *MobileTacticsController) TacticsTimeLineList() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	resp := new(models.GetCygxTacticsTimeLineResp)
-	pageSize, _ := this.GetInt("PageSize")
-	currentIndex, _ := this.GetInt("CurrentIndex")
-	var startSize int
-	if pageSize <= 0 {
-		pageSize = utils.PageSize20
-	}
-	if currentIndex <= 0 {
-		currentIndex = 1
-	}
-	startSize = utils.StartIndex(currentIndex, pageSize)
-	var condition string
-	var pars []interface{}
-	condition += ` AND art.status = 1 `
-	total, err := models.GetCygxTacticsTimeLineCount(condition, pars)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	condition += "	ORDER BY art.publish_time DESC , art.time_line_id DESC "
-	list, err := models.GetCygxTacticsTimeLineList(condition, pars, startSize, pageSize)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败,Err:" + err.Error()
-		return
-	}
-	for _, v := range list {
-		v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
-	}
-	if len(list) == 0 {
-		list = make([]*models.CygxTacticsTimeLineResp, 0)
-	}
-	cf, err := models.GetConfigByCode(utils.CYGX_TACTICS_TIME_LINE_STATUS)
-	if err != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取数据失败,Err:" + err.Error()
-		return
-	}
-	//如果不是弘则用户,并且设置了内部可见,那么数据就隐藏
-	if user.CompanyId != utils.HZ_COMPANY_ID && cf.ConfigValue != "1" {
-		list = make([]*models.CygxTacticsTimeLineResp, 0)
-	}
-	page := paging.GetPaging(currentIndex, pageSize, total)
-	resp.List = list
-	resp.Paging = page
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
-
-// @Title 时间线用户点击记录
-// @Description 时间线用户点击记录接口
-// @Param	request	body models.TacticsTimeLineTimeLineIdReq true "type json string"
-// @Success Ret=200 新增成功
-// @router /tacticsTimeLine/history [post]
-func (this *MobileTacticsController) History() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-	user := this.User
-	if user == nil {
-		br.Msg = "请登录"
-		br.ErrMsg = "请登录,用户信息为空"
-		br.Ret = 408
-		return
-	}
-	var req models.TacticsTimeLineTimeLineIdReq
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
-	if err != nil {
-		br.Msg = "参数解析异常!"
-		br.ErrMsg = "参数解析失败,Err:" + err.Error()
-		return
-	}
-	timeLineId := req.TimeLineId
-	if timeLineId == 0 {
-		br.Msg = "时间线ID错误"
-		return
-	}
-	var sellerName string
-	sellerName, err = models.GetCompanySellerName(user.CompanyId)
-	if err != nil {
-		br.Msg = "报名失败!"
-		br.ErrMsg = "获取对应销售失败,Err:" + err.Error()
-		return
-	}
-	item := models.CygxTacticsTimeLineHistory{
-		TimeLineId:  timeLineId,
-		UserId:      user.UserId,
-		Mobile:      user.Mobile,
-		Email:       user.Email,
-		CompanyId:   user.CompanyId,
-		CompanyName: user.CompanyName,
-		RealName:    user.RealName,
-		SellerName:  sellerName,
-		CreateTime:  time.Now(),
-		ModifyTime:  time.Now(),
-	}
-	err = models.AddCygxTacticsTimeLineHistory(&item)
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-}

+ 40 - 0
controllers/tag.go

@@ -11,6 +11,10 @@ type TagController struct {
 	BaseAuthController
 }
 
+type BaseTagController struct {
+	BaseCommonController
+}
+
 // @Title 获取标签列表-自定义顺序
 // @Description 获取标签列表-自定义顺序接口
 // @Success 200 {object} cygx.ChartPermissionResp
@@ -131,3 +135,39 @@ func (this *TagController) History() {
 	br.Success = true
 	br.Msg = "记录成功"
 }
+
+// @Title 首页标签列表
+// @Description 首页标签列表接口
+// @Success 200 {object} cygx.CygxTagListLabelResp
+// @router /list/label [get]
+func (this *BaseTagController) ListLabel() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	resp := new(models.CygxTagListLabelResp)
+	key := "mfyx_tag_list"
+	conf, e := models.GetConfigByCode(key)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取首页头部导航失败, Err: " + e.Error()
+		return
+	}
+	if conf.ConfigValue == "" {
+		br.Msg = "获取失败"
+		br.ErrMsg = "首页头部导航配置值有误"
+		return
+	}
+
+	if e = json.Unmarshal([]byte(conf.ConfigValue), &resp); e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "首页头部导航配置值解析失败, Err: " + e.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 41 - 50
controllers/user.go

@@ -183,64 +183,55 @@ func (this *UserController) Detail() {
 		}
 		if companyItem != nil && companyItem.CompanyId > 0 {
 			resp.CompanyName = companyItem.CompanyName
-			//if companyItem.Status == "试用" || companyItem.Status == "永续" || companyItem.Status == "正式" {
-			//permissionStr, err := models.GetCompanyPermissionByUser(companyItem.CompanyId)
-			//if err != nil {
-			//	br.Msg = "获取信息失败"
-			//	br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
-			//	return
-			//}
-			var permissionStr string
-			permissionList, err := models.GetCompanyPermissionList(companyItem.CompanyId)
-			if err != nil {
+			// 获取用户所在公司剩余的点
+			companyPointsNum, err := models.GetCompanyPoints(user.CompanyId)
+			if err != nil && err.Error() != utils.ErrNoRow() {
 				br.Msg = "获取信息失败"
-				br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+				br.ErrMsg = "获取用户所在公司剩余的点失败,Err:" + err.Error()
 				return
 			}
+			resp.CompanyPointsNum = companyPointsNum
 
-			mapIsUpgrade := make(map[string]string)
-			mapZhukKeGuan := make(map[string]int)
-			for _, v := range permissionList {
-				mapZhukKeGuan[v.PermissionName] += 1
-				if v.IsUpgrade == 1 {
-					mapIsUpgrade[v.PermissionName] = v.PermissionName + "(升级)"
-				}
+			userYanxunaDetail, err := models.GetCygxUserYanxuanPermissionDetailByUserId(user.UserId)
+
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取信息失败,GetCygxUserYanxuanPermissionDetailByUserId Err:" + err.Error()
+				return
 			}
-			mapPermissionName := make(map[string]string)
-			//处理升级,并且合并主客观
-			for _, v := range permissionList {
-				if _, ok := mapPermissionName[v.PermissionName]; ok {
-					continue
+
+			if userYanxunaDetail != nil {
+				resp.PermissionStatus = userYanxunaDetail.Status
+				resp.StartDate = userYanxunaDetail.StartDate
+				resp.EndDate = userYanxunaDetail.EndDate
+				//resp.PermissionName = utils.CHART_PERMISSION_NAME_MF_YANXUAN
+			} else {
+
+				//查询研选的权限状态
+				var condition string
+				var pars []interface{}
+				condition += " AND company_id = ?  AND status  IN ('正式','试用')  AND chart_permission_id = ?   ORDER BY company_report_permission_id DESC LIMIT 1  "
+				pars = append(pars, user.CompanyId, utils.CHART_PERMISSION_ID_YANXUAN)
+				companyReportPermissionDetail, err := models.GetCompanyReportPermissionDetailByCondition(condition, pars)
+				if err != nil && err.Error() != utils.ErrNoRow() {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取用户所在公司剩余的点失败,Err:" + err.Error()
+					return
+				}
+				companyProduct, err := models.GetCompanyProductDetail(user.CompanyId, 2)
+				if err != nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+					return
 				}
-				if _, ok := mapIsUpgrade[v.PermissionName]; ok {
-					permissionStr += mapIsUpgrade[v.PermissionName] + ","
+
+				if companyReportPermissionDetail == nil || companyProduct.IsSuspend == 1 {
+					//hasPermission = 1
 				} else {
-					if mapZhukKeGuan[v.PermissionName] == 1 {
-						permissionStr += v.Remark + ","
-					} else {
-						permissionStr += v.PermissionName + ","
-					}
+					resp.PermissionStatus = companyReportPermissionDetail.Status
+					resp.StartDate = companyReportPermissionDetail.StartDate
+					resp.EndDate = companyReportPermissionDetail.EndDate
 				}
-				mapPermissionName[v.PermissionName] = v.PermissionName
-			}
-			permissionStr = strings.TrimRight(permissionStr, ",")
-			//permissionStrOld, err := models.GetCompanyPermission(companyItem.CompanyId)
-			//if err != nil {
-			//	br.Msg = "获取信息失败"
-			//	br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
-			//	return
-			//}
-			//permissionStrListOld := strings.Split(permissionStrOld, ",")
-			//for _, v := range permissionStrListOld {
-			//	if strings.Count(permissionStr, v) > 1 {
-			//		permissionStr = strings.Replace(permissionStr, v+"(主观)", v, -1)
-			//		permissionStr = strings.Replace(permissionStr, v+"(客观),", "", -1)
-			//	}
-			//}
-
-			finalPermissionList := strings.Split(permissionStr, ",")
-			for _, per := range finalPermissionList {
-				resp.PermissionName = append(resp.PermissionName, per)
 			}
 
 		}

+ 23 - 0
models/activity.go

@@ -640,3 +640,26 @@ func GetActivityListByCondition(condition string, pars []interface{}) (items []*
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
+
+// 列表
+func GetCygxActivityIdList(condition string, pars []interface{}) (items []*CygxActivity, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT activity_id FROM cygx_activity as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}
+
+// 列表
+func GetCygxActivityListPage(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxActivity, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_activity as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 8 - 9
models/activity_help_ask.go

@@ -19,7 +19,7 @@ type CygxActivityHelpAsk struct {
 	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
 }
 
-//添加优化建议
+// 添加优化建议
 func AddActivityHelpAsk(item *CygxActivityHelpAsk) (lastId int64, err error) {
 	o := orm.NewOrm()
 	lastId, err = o.Insert(item)
@@ -40,14 +40,13 @@ type CygxAskList struct {
 }
 
 type CygxAskListResp struct {
-	List []*CygxAskList
+	List   []*CygxAskList
 	Paging *paging.PagingItem
 }
 
-
 //report_or_activity_id
 
-//主题列表
+// 主题列表
 func GetActivityAskList(userId, startSize, pageSize int) (items []*CygxAskList, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -59,12 +58,12 @@ func GetActivityAskList(userId, startSize, pageSize int) (items []*CygxAskList,
 			cygx_activity_help_ask AS k
 			INNER JOIN cygx_activity AS a ON a.activity_id = k.activity_id 
 		WHERE
-			user_id = ? AND a.publish_status = 1 ORDER BY k.ask_id DESC  LIMIT ?,?  `
+			user_id = ? AND a.publish_status = 1 AND a.chart_permission_id = 31  ORDER BY k.ask_id DESC  LIMIT ?,?  `
 	_, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
 	return
 }
 
-//主题列表
+// 主题列表
 func GetActivityAskCount(userId int) (count int, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -73,12 +72,12 @@ func GetActivityAskCount(userId int) (count int, err error) {
 			cygx_activity_help_ask AS k
 			INNER JOIN cygx_activity AS a ON a.activity_id = k.activity_id 
 		WHERE
-			user_id = ? AND a.publish_status = 1 ORDER BY k.ask_id DESC `
+			user_id = ? AND a.publish_status = 1 AND a.chart_permission_id = 31 ORDER BY k.ask_id DESC `
 	err = o.Raw(sql, userId).QueryRow(&count)
 	return
 }
 
-//列表
+// 列表
 func GetArticleAskList(userId int) (items []*CygxAskList, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
@@ -90,7 +89,7 @@ func GetArticleAskList(userId int) (items []*CygxAskList, err error) {
 			cygx_article_ask AS k
 			INNER JOIN cygx_article AS a ON a.article_id = k.article_id 
 		WHERE
-			user_id = ? AND a.publish_status = 1 ORDER BY k.ask_id DESC`
+			user_id = ? AND a.publish_status = 1 AND   a.article_type_id  > 0  ORDER BY k.ask_id DESC`
 	_, err = o.Raw(sql, userId).QueryRows(&items)
 	return
 }

+ 11 - 0
models/article.go

@@ -538,3 +538,14 @@ func GetCygxCygxArticleListByConditionSoloTag(articleTypeCondSlice, activityType
 
 	return
 }
+
+// 列表
+func GetCygxCygxArticleIdList(condition string, pars []interface{}) (items []*CygxArticle, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT article_id FROM cygx_article as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
+	return
+}

+ 5 - 3
models/article_comment.go

@@ -41,11 +41,12 @@ type AddCygxArticleCommentReq struct {
 func GetCommentList(userId, startSize, pageSize int) (items []*CygxArticleComment, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-			* 
+			c.* 
 		FROM
 			cygx_article_comment AS c
+			INNER JOIN cygx_article as  a ON c.article_id = a.article_id 
 		WHERE
-			user_id = ? ORDER BY c.create_time DESC LIMIT ?,?  `
+			user_id = ?  AND  a.article_type_id  > 0  ORDER BY c.create_time DESC LIMIT ?,?  `
 
 	_, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
 	return
@@ -58,8 +59,9 @@ func GetCommentListCount(userId int) (count int, err error) {
 			COUNT( 1 ) as count 
 		FROM
 			cygx_article_comment AS c
+			INNER JOIN cygx_article as  a ON c.article_id = a.article_id 
 		WHERE
-			user_id = ? ORDER BY c.create_time DESC  `
+			user_id = ?  AND  a.article_type_id  > 0  `
 
 	err = o.Raw(sql, userId).QueryRow(&count)
 	return

+ 11 - 5
models/banner.go

@@ -76,11 +76,6 @@ type BannerUrlResp struct {
 	Body              string `description:"内容"`
 }
 
-type BannerUrlYxResp struct {
-	IndexImg string `description:"小程序封面图"`
-	Path     string `description:"小程序路径"`
-}
-
 type BannerUrlYxListResp struct {
 	ListA []*BannerUrlYxResp
 	ListB []*BannerUrlYxResp
@@ -94,3 +89,14 @@ func GetCygxBannerImgList() (items []*CygxBannerImgResp, err error) {
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+type BannerUrlYxResp struct {
+	IndexImg string `description:"小程序封面图"`
+	Path     string `description:"小程序路径"`
+	Describe string `description:"描述"`
+}
+
+type BannerUrHomeListResp struct {
+	ListA []*BannerUrlYxResp
+	ListB []*BannerUrlYxResp
+}

+ 11 - 0
models/cygx_tag.go

@@ -143,3 +143,14 @@ type CygxTagListResp struct {
 	List           []*CygxTagList `description:"TagId"`
 	ListPermission []*ChartPermissionResp
 }
+
+type CygxHashtagReq struct {
+	Hashtag   string   `description:"主题标签"`
+	CheckList []string // ABCD勾选了哪几列
+}
+
+type CygxTagListLabelResp struct {
+	List1 []string
+	List2 []string
+	List3 []*CygxHashtagReq
+}

+ 8 - 3
models/user.go

@@ -146,6 +146,10 @@ type UserDetailResp struct {
 	OutboundMobile      string   `description:"外呼手机号"`
 	OutboundCountryCode string   `description:"外呼手机号区号"`
 	PermissionName      []string `description:"拥有权限分类"`
+	PermissionStatus    string   `description:"状态"`
+	StartDate           string   `description:"开始日期"`
+	EndDate             string   `description:"结束日期"`
+	CompanyPointsNum    float64  `description:"公司剩余点数"`
 }
 
 type CheckStatusResp struct {
@@ -364,7 +368,7 @@ func GetArticleUserCollectCount(userId int) (count int, err error) {
 	sql := `SELECT SUM(count) AS count FROM (
 			SELECT COUNT(1) AS count FROM cygx_article_collect AS a 
 			INNER JOIN cygx_article as art ON art.article_id = a.article_id 
-			WHERE a.user_id=? AND art.publish_status = 1  
+			WHERE a.user_id=? AND art.publish_status = 1  AND  art.article_type_id  > 0 
 			UNION ALL
 			SELECT COUNT(1) AS count FROM cygx_yanxuan_special_collect AS a
 			INNER JOIN cygx_yanxuan_special as b ON b.id = a.yanxuan_special_id 
@@ -397,6 +401,7 @@ func GetArticleUserCollectList(startSize, pageSize, userId int) (items []*Articl
 			FROM cygx_article_collect AS a 
 			INNER JOIN cygx_article as art ON art.article_id = a.article_id
 			WHERE a.user_id=? 
+			AND  art.article_type_id  > 0 
 			UNION ALL
 	SELECT
 		a.id AS article_id,
@@ -432,13 +437,13 @@ LIMIT ?,? `
 func GetArticleUserBrowseHistoryCount(userId int, endDate string) (count int, err error) {
 	sql := `SELECT COUNT( 1 ) as count
 			FROM
-			( SELECT count(*) FROM cygx_article_history_record AS a WHERE a.user_id = ? AND a.create_time >= ? GROUP BY a.article_id ) b  `
+			( SELECT count(*) FROM cygx_article as art INNER JOIN  cygx_article_history_record_newpv AS a     ON  art.article_id = a.article_id AND  article_type_id  > 0   WHERE a.user_id = ? AND a.create_time >= ? GROUP BY a.article_id ) b  `
 	err = orm.NewOrm().Raw(sql, userId, endDate).QueryRow(&count)
 	return
 }
 
 func GetArticleUserBrowseHistoryList(startSize, pageSize, userId int, endDate string) (items []*ArticleReportBillboardResp, err error) {
-	sql := `SELECT a.* ,	MAX( a.id ) AS mid   FROM cygx_article_history_record AS a
+	sql := `SELECT a.* ,	MAX( a.id ) AS mid   FROM  cygx_article as art INNER JOIN  cygx_article_history_record_newpv AS a     ON  art.article_id = a.article_id AND  article_type_id  > 0 
 			WHERE a.user_id=? AND a.create_time>=?  GROUP BY a.article_id
            ORDER BY mid  DESC LIMIT ?,? `
 	_, err = orm.NewOrm().Raw(sql, userId, endDate, startSize, pageSize).QueryRows(&items)

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 109 - 262
routers/commentsRouter.go


+ 3 - 25
routers/router.go

@@ -92,11 +92,7 @@ func init() {
 				&controllers.ActivityNoLoginController{},
 			),
 		),
-		web.NSNamespace("/activity_special",
-			web.NSInclude(
-				&controllers.ActivitySpecialController{},
-			),
-		),
+
 		web.NSNamespace("/advice",
 			web.NSInclude(
 				&controllers.AdviceController{},
@@ -107,32 +103,13 @@ func init() {
 				&controllers.MobileResearchController{},
 			),
 		),
-		web.NSNamespace("/report_selection",
-			web.NSInclude(
-				&controllers.ReportSelectionController{},
-			),
-		),
-		web.NSNamespace("/morning_meeting",
-			web.NSInclude(
-				&controllers.MorningMeetingController{},
-			),
-		),
-		web.NSNamespace("/product_interior",
-			web.NSInclude(
-				&controllers.ProductInteriorController{},
-			),
-		),
+
 		web.NSNamespace("/config",
 			web.NSInclude(
 				&controllers.ConfigController{},
 				&controllers.BaseConfigController{},
 			),
 		),
-		web.NSNamespace("/tactics",
-			web.NSInclude(
-				&controllers.MobileTacticsController{},
-			),
-		),
 		web.NSNamespace("/banner",
 			web.NSInclude(
 				&controllers.BannerController{},
@@ -142,6 +119,7 @@ func init() {
 		web.NSNamespace("/tag",
 			web.NSInclude(
 				&controllers.TagController{},
+				&controllers.BaseTagController{},
 			),
 		),
 		web.NSNamespace("/collection",

+ 35 - 6
services/activity.go

@@ -459,12 +459,6 @@ func ActivityConditioninitSql(user *models.WxUserItem, condition string, isPower
 	return
 }
 
-// 获取可见的活动
-func HandleActivityPowerList(listActivity []*models.CygxActivity, user *models.WxUserItem) (items []*models.CygxActivity, err error) {
-
-	return
-}
-
 // 5.3版本活动标签字符串处理
 func LabelStr(label string, isShowSubjectName int, temporaryLabel string) (labelNew string) {
 	slicebr := strings.Split(label, "-")
@@ -1849,3 +1843,38 @@ func ActivityVideoUserRmind(user *models.WxUserItem, activityId, fileType int) (
 	}
 	return
 }
+
+// GetYanxuanActivityIds 获取研选活动ID
+func GetYanxuanActivityIds(user *models.WxUserItem) (activityIds []int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("获取研选活动ID GetYanxuanActivityIds,失败:"+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	condition = `  AND  chart_permission_id  = 31  AND yidong_activity_id = '' AND art.publish_status = 1  `
+	//pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+	if user.CompanyId > 1 {
+		conditionActivity, e := ActivityConditioninitSql(user, condition, 0)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = errors.New("ActivityConditioninitSql, Err: " + e.Error())
+			return
+		}
+		condition += conditionActivity
+	}
+
+	condition += ` ORDER BY art.activity_time DESC ,  art.active_state ASC   `
+	list, e := models.GetCygxActivityListPage(condition, pars, 0, 2000)
+	if e != nil {
+		err = errors.New("GetCygxActivityIdList, Err: " + e.Error())
+		return
+	}
+
+	for _, v := range list {
+		activityIds = append(activityIds, v.ActivityId)
+	}
+	return
+}

+ 23 - 0
services/article.go

@@ -776,3 +776,26 @@ func GetYxArticleIdMap(articleIds []int) (mapResp map[int]bool) {
 	}
 	return
 }
+
+// GetYanxuanArticleIds 获取研选文章ID
+func GetYanxuanArticleIds() (articleIds []int) {
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("获取研选文章ID GetYanxuanArticleIds,失败:"+err.Error(), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	condition = ` AND  article_type_id > 0   `
+	list, e := models.GetCygxCygxArticleIdList(condition, pars)
+	if e != nil {
+		err = errors.New("GetCygxCygxArticleIdList, Err: " + e.Error())
+		return
+	}
+	for _, v := range list {
+		articleIds = append(articleIds, v.ArticleId)
+	}
+	return
+}

+ 35 - 3
services/es_comprehensive.go

@@ -859,11 +859,35 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 	return
 }
 
-func SqlComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int, err error) {
+func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int, err error) {
+	yanxuanActivityIds := GetYanxuanActivityIds(user) // 获取所有的研选活动ID
+	yanxuanArticleIds := GetYanxuanArticleIds()       //获取所有研选文章ID
+	yanxuanArticleIds = append(yanxuanArticleIds, 0)
+	yanxuanActivityIds = append(yanxuanActivityIds, 0)
+
+	var yanxuanArticleIdsStr []string
+	var yanxuanActivityIdsStr []string
+
+	for _, v := range yanxuanArticleIds {
+		yanxuanArticleIdsStr = append(yanxuanArticleIdsStr, strconv.Itoa(v))
+	}
+
+	for _, v := range yanxuanActivityIds {
+		yanxuanActivityIdsStr = append(yanxuanActivityIdsStr, strconv.Itoa(v))
+	}
+
+	//yanxuanspecialIds = append(yanxuanspecialIds, 0)
+	condition := " AND source IN ('article','activity','yanxuanspecial')   " // 只有研选的文章、研选的活动、研选的专栏这三种
+	condition += `  AND IF ( source = 'article' , source_id   IN (` + strings.Join(yanxuanArticleIdsStr, ",") + `) ,1=1 ) `
+	//pars = append(pars, yanxuanArticleIds)
+
+	condition += `  AND IF ( source = 'activity' , source_id   IN (` + strings.Join(yanxuanActivityIdsStr, ",") + `) ,1=1 ) `
+	//pars = append(pars, yanxuanActivityIds)
+
 	keyWord = "%" + keyWord + "%"
 	var conditionTitle string
 	var parsTitle []interface{}
-	conditionTitle = " AND search_title LIKE ? "
+	conditionTitle = " AND search_title LIKE ? " + condition
 	parsTitle = append(parsTitle, keyWord)
 	totalTitle, e := models.GetResourceDataCount(conditionTitle, parsTitle)
 	if e != nil {
@@ -874,7 +898,7 @@ func SqlComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*
 	var conditionContent string
 	var parsContent []interface{}
 
-	conditionContent = " AND search_content LIKE ? AND search_title  NOT LIKE ?  "
+	conditionContent = " AND search_content LIKE ? AND search_title  NOT LIKE ?  " + condition
 	parsContent = append(parsContent, keyWord, keyWord)
 	totalContent, e := models.GetResourceDataCount(conditionContent, parsContent)
 	if e != nil {
@@ -884,7 +908,11 @@ func SqlComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*
 	var searchTotal int
 	searchTotal = (startSize/pageSize + 1) * pageSize
 	var list []*models.CygxResourceData
+	fmt.Println("totalTitle", totalTitle)
+	fmt.Println("totalContent", totalContent)
+	fmt.Println(searchTotal)
 	if totalTitle >= searchTotal {
+		fmt.Println("1")
 		//全部都是标题搜索
 		list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
 		if e != nil && e.Error() != utils.ErrNoRow() {
@@ -892,15 +920,19 @@ func SqlComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*
 			return
 		}
 	} else if totalTitle <= searchTotal-pageSize {
+		fmt.Println("2")
 		//全部都是内容搜索
 		startSize = startSize - totalTitle
+
 		list, e = models.GetResourceDataListCondition(conditionContent, parsContent, startSize, pageSize)
 		if e != nil && e.Error() != utils.ErrNoRow() {
 			err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
 			return
 		}
 	} else {
+		fmt.Println("3")
 		//一半标题搜索,一半内容搜索
+
 		list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
 		if e != nil && e.Error() != utils.ErrNoRow() {
 			err = errors.New("GetResourceDataListCondition, Err: " + e.Error())

+ 48 - 189
services/tag.go

@@ -5,7 +5,6 @@ import (
 	"hongze/hongze_web_mfyx/models"
 	"hongze/hongze_web_mfyx/utils"
 	"strconv"
-	"strings"
 	"time"
 )
 
@@ -46,217 +45,77 @@ func AddCygxTagHistory(user *models.WxUserItem, tagId int) (err error) {
 //	fmt.Println(conditionInit)
 //}
 
-func GetConditionInitByTagIds(tagIds string, chartPermissionId int) (conditionInit string, err error) {
-	if tagIds == "" {
-		return
-	}
+func GetConditionInitByTagIds(user *models.WxUserItem, labelKeyword string) (yanxuanActivityIdsResp, yanxuanArticleIdsResp []int, err error) {
+	var yanxuanActivityIds []int
+	var yanxuanArticleIds []int
 	var condition string
 	var pars []interface{}
-	var searchTag, industries, subjectNames []string
-	tagslice := strings.Split(tagIds, ",")
-	condition = ` AND tag_id IN (` + utils.GetOrmInReplace(len(tagslice)) + `)`
-	pars = append(pars, tagslice)
-	listTag, e := models.GetCygxTagListCondition(condition, pars, 0, 0)
-	if e != nil {
-		err = errors.New("GetCygxTagListCondition, Err: " + e.Error())
-		return
-	}
-
-	var tagType int // 定义特殊标签的类型,判断传过来的参数是否有固定标签的搜索
-	for _, tagInfo := range listTag {
-		//ActivityTypes 与 ArticleTypes 进行合并
-		if tagInfo.ActivityTypes != "" {
-			sliceObj := strings.Split(tagInfo.ActivityTypes, ",")
-			for _, v := range sliceObj {
-				searchTag = append(searchTag, v)
-			}
-		}
-		if tagInfo.ArticleTypes != "" {
-			sliceObj := strings.Split(tagInfo.ArticleTypes, ",")
-			for _, v := range sliceObj {
-				searchTag = append(searchTag, v)
-			}
-		}
-		if tagInfo.Industries != "" {
-			sliceObj := strings.Split(tagInfo.Industries, ",")
-			for _, v := range sliceObj {
-				industries = append(industries, v)
-			}
-			//industries = append(industries, tagInfo.Industries)
-		}
-		if tagInfo.SubjectNames != "" {
-			sliceObj := strings.Split(tagInfo.SubjectNames, ",")
-			for _, v := range sliceObj {
-				subjectNames = append(subjectNames, v)
-			}
-			//subjectNames = append(subjectNames, tagInfo.SubjectNames)
-		}
-
-		if tagType == 0 && tagInfo.TagType > 0 {
-			tagType = tagInfo.TagType
-		}
-	}
-
-	switch tagType {
-	case 0: // 无固定标签
-		//拼接search_tag 搜索内容
-		if len(searchTag) > 0 {
-			//search_tag_two 兼容报告类型一对多的这种,时间不够,产品也有可能变先这么做
-			conditionInit += " AND ( search_tag IN  ('" + strings.Join(searchTag, "','") + "')  OR search_tag_two IN( '" + strings.Join(searchTag, "','") + "' )  )"
-		}
-
-		var resourceDataIds []int //cygx_resource_data 主键ID
-		//如果产业有组合,那么就去捞产业相关的内容
-		if len(industries) > 0 {
-			var conditionIndustry string
-			var parsIndustry []interface{}
-			conditionIndustry += " AND industry_name IN  ('" + strings.Join(industries, "','") + "')"
-			listIndustry, e := models.GetTopOneMonthArtReadNumIndustryAll(conditionIndustry, parsIndustry)
-			if e != nil {
-				err = errors.New("GetTopOneMonthArtReadNumIndustryAll, Err: " + e.Error())
-				return
-			}
-			var industrialManagementIds []int // 产业ID合集
-			for _, v := range listIndustry {
-				industrialManagementIds = append(industrialManagementIds, v.IndustrialManagementId)
-			}
-
-			var conditionIndustryResource string
-			var parsIndustryResource []interface{}
-			lenArrindustrial := len(industrialManagementIds)
-			conditionIndustryResource = ` AND industrial_management_id IN (` + utils.GetOrmInReplace(lenArrindustrial) + `)`
-			parsIndustryResource = append(parsIndustryResource, industrialManagementIds)
-
-			if lenArrindustrial > 0 {
-				listResourceDataIndustrial, e := models.GetCygxResourceDataIndustrialGroupManagementList(conditionIndustryResource, parsIndustryResource, 0, 0)
-				//return
-				if e != nil {
-					err = errors.New("GetCygxResourceDataIndustrialGroupManagementList, Err: " + e.Error())
-					return
-				}
-				for _, v := range listResourceDataIndustrial {
-					resourceDataIds = append(resourceDataIds, v.ResourceDataId)
-				}
-			}
-		}
-		//return
-		//如果标的有组合,那么就去捞标的相关的内容
-		if len(subjectNames) > 0 {
-			var conditionsubject string
-			var parssubject []interface{}
-			conditionsubject += " AND subject_name IN  ('" + strings.Join(subjectNames, "','") + "')"
-			listsubject, e := models.GetCygxIndustrialSubjectListCondition(conditionsubject, parssubject)
-			if e != nil {
-				err = errors.New("GetTopOneMonthArtReadNumIndustry, Err: " + e.Error())
-				return
-			}
-			var industrialsubjectIds []int // 标的ID集合
-			for _, v := range listsubject {
-				industrialsubjectIds = append(industrialsubjectIds, v.IndustrialSubjectId)
-			}
-			var conditionsubjectResource string
-			var parssubjectResource []interface{}
-			lenArrsubject := len(industrialsubjectIds)
-			conditionsubjectResource = ` AND industrial_subject_id IN (` + utils.GetOrmInReplace(lenArrsubject) + `)`
-			parssubjectResource = append(parssubjectResource, industrialsubjectIds)
-			if lenArrsubject > 0 {
-				listResourceDatasubject, e := models.GetCygxResourceDataIndustrialGroupSubjectList(conditionsubjectResource, parssubjectResource, 0, 0)
-				if e != nil {
-					err = errors.New("GetCygxResourceDataIndustrialGroupSubjectList, Err: " + e.Error())
-					return
-				}
-				for _, v := range listResourceDatasubject {
-					resourceDataIds = append(resourceDataIds, v.ResourceDataId)
-				}
-			}
+	switch labelKeyword {
+	case utils.LABEL_L1_1: // 全部活动
+		yanxuanActivityIds = GetYanxuanActivityIds(user) // 获取所有的研选活动ID
+	case "买方交流": // 买方交流 ->买方线下交流
+		condition = `   AND  chart_permission_id  = ? AND yidong_activity_id = ''  AND activity_type_id = 8  `
+		pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+		list, e := models.GetCygxActivityIdList(condition, pars)
+		if e != nil {
+			err = errors.New("GetCygxActivityIdList, Err: " + e.Error())
+			return
 		}
-
-		//拼接 cygx_resource_data 表主键查询ID
-		if len(resourceDataIds) > 0 {
-			var resourceDataIdStrs []string
-			resourceDataIdMap := make(map[int]bool)
-			for _, v := range resourceDataIds {
-				if resourceDataIdMap[v] {
-					continue
-				}
-				resourceDataIdStrs = append(resourceDataIdStrs, strconv.Itoa(v))
-				resourceDataIdMap[v] = true
-			}
-			conditionInit += " AND id IN  (" + strings.Join(resourceDataIdStrs, ",") + ") "
+		for _, v := range list {
+			yanxuanActivityIds = append(yanxuanActivityIds, v.ActivityId)
 		}
-	case 1: // 热门活动
-		conf, e := models.GetConfigByCode(utils.CYGX_TAG_HOT_ACTIVITY_ID)
+	case "专家调研": // 专家调研->专家电话会+专家线下沙龙
+		condition = `   AND  chart_permission_id  = ? AND yidong_activity_id = ''  AND activity_type_id IN  (1,5) `
+		pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+		list, e := models.GetCygxActivityIdList(condition, pars)
 		if e != nil {
-			err = errors.New("GetConfigByCode, Err: " + e.Error())
+			err = errors.New("GetCygxActivityIdList, Err: " + e.Error())
 			return
 		}
-		//主键ID赋值为0,进行空查询
-		if conf.ConfigValue == "" {
-			conditionInit += " AND id = 0  "
-			return
+		for _, v := range list {
+			yanxuanActivityIds = append(yanxuanActivityIds, v.ActivityId)
 		}
-		pars = make([]interface{}, 0)
-		condition = " AND activity_id IN ( " + conf.ConfigValue + ")  AND publish_status = 1   AND active_state  IN (1,2) "
-		listActivity, e := models.GetActivityListByCondition(condition, pars)
+
+	case "上市公司小范围": // 上市公司小范围->公司调研电话会
+		condition = `   AND  chart_permission_id  = ? AND yidong_activity_id = ''  AND activity_type_id = 3 `
+		pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+		list, e := models.GetCygxActivityIdList(condition, pars)
 		if e != nil {
-			err = errors.New("GetActivityListByCondition, Err: " + e.Error())
+			err = errors.New("GetCygxActivityIdList, Err: " + e.Error())
 			return
 		}
-		if len(listActivity) == 0 {
-			conditionInit += " AND id = 0  "
-			return
+		for _, v := range list {
+			yanxuanActivityIds = append(yanxuanActivityIds, v.ActivityId)
 		}
+	case "全部报告": // 全部报告
+		yanxuanArticleIds = GetYanxuanArticleIds() //获取所有研选文章ID
 
-		//拼接查询热门活动的SQL、
-		var activityIds []string
-		for _, v := range listActivity {
-			activityIds = append(activityIds, strconv.Itoa(v.ActivityId))
-		}
-		conditionInit = " AND source_id IN ( " + strings.Join(activityIds, ",") + ")  AND source = '" + utils.CYGX_OBJ_ACTIVITY + "'"
+	case "专栏": //专栏
+
+	case "纪要": //纪要
 
-	case 2: //海外研究 查询海外研究的文章,以及海外的活动
-		condition = " AND category_id IN ( SELECT category_id_celue FROM cygx_report_mapping_group WHERE id_cygx IN ( 35,39 ) ) AND publish_status = 1"
-		pars = make([]interface{}, 0)
-		articleList, e := models.GetArticleList(condition, pars)
+		condition = ` AND  article_type_id > 0  AND  article_type_id != 12  `
+		list, e := models.GetCygxCygxArticleIdList(condition, pars)
 		if e != nil {
-			err = errors.New("GetArticleList, Err: " + e.Error())
+			err = errors.New("GetCygxCygxArticleIdList, Err: " + e.Error())
 			return
 		}
-		//文章一定会有值,这里就不做为空判断了 。。。
-		var articleIds []string
-		for _, v := range articleList {
-			articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
+		for _, v := range list {
+			yanxuanArticleIds = append(yanxuanArticleIds, v.ArticleId)
 		}
 
-		//海外举办的活动查询
-		condition = " AND  area_type = 2  AND publish_status = 1   "
-		listActivity, e := models.GetActivityListByCondition(condition, pars)
+	case "买方沙龙": // 买方沙龙
+		condition = `  AND  article_type_id = 12  `
+		list, e := models.GetCygxCygxArticleIdList(condition, pars)
 		if e != nil {
-			err = errors.New("GetActivityListByCondition, Err: " + e.Error())
+			err = errors.New("GetCygxCygxArticleIdList, Err: " + e.Error())
 			return
 		}
-		//判断是否有海外活动,如果有就拼接,报告与活动的查询SQL
-		if len(listActivity) == 0 {
-			conditionInit = " AND source_id IN ( " + strings.Join(articleIds, ",") + ")  AND source = '" + utils.CYGX_OBJ_ARTICLE + "'"
-		} else {
-			var activityIds []string
-			for _, v := range listActivity {
-				activityIds = append(activityIds, strconv.Itoa(v.ActivityId))
-			}
-			var conditionchartInit string
-			//行业筛选
-			if chartPermissionId > 0 {
-				conditionchartInit += " AND chart_permission_id  =  " + strconv.Itoa(chartPermissionId)
-			}
-			conditionInit = " AND  ( source_id IN ( " + strings.Join(articleIds, ",") + ") " + conditionchartInit + "  AND source = '" + utils.CYGX_OBJ_ARTICLE + "') OR   (source_id IN ( " + strings.Join(activityIds, ",") + ") " + conditionchartInit + "   AND source = '" + utils.CYGX_OBJ_ACTIVITY + " ' )"
+		for _, v := range list {
+			yanxuanArticleIds = append(yanxuanArticleIds, v.ArticleId)
 		}
-
-	case 3: // 路演回放
-		conditionInit = "  AND source  IN('activityvoice','activityvideo')  AND  search_tag = '路演回放' "
-
-	case 4: // 语音问答
-		conditionInit = "   AND source = '" + utils.CYGX_OBJ_ASKSERIEVIDEO + "'"
 	}
-
+	yanxuanActivityIdsResp = yanxuanActivityIds
+	yanxuanArticleIdsResp = yanxuanArticleIds
 	return
 }

+ 15 - 0
utils/constants.go

@@ -270,3 +270,18 @@ const (
 	COMPANY_STATUS_POTENTIAL = "潜在"
 	COMPANY_STATUS_CLOSE     = "关闭"
 )
+
+// 首页自定义标签
+const (
+	LABEL_L1_1 string = "全部活动"    // 全部活动
+	LABEL_L1_2 string = "买方交流"    // 买方交流
+	LABEL_L1_3 string = "专家调研"    // 专家调研
+	LABEL_L1_4 string = "上市公司小范围" // 上市公司小范围
+	LABEL_L2_1 string = "全部报告"    // 全部报告
+	LABEL_L2_2 string = "专栏"      // 专栏
+	LABEL_L2_3 string = "纪要"      // 纪要
+	LABEL_L2_4 string = "买方沙龙"    // 买方沙龙
+	LABEL_L3_1 string = "主题a"     // 主题a
+	LABEL_L3_2 string = "主题b"     // 主题b
+	LABEL_L3_3 string = "主题c"     // 主题c
+)

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott