瀏覽代碼

Merge branch 'cygx_3.2'

ziwen 2 年之前
父節點
當前提交
8be25cb5be

+ 229 - 0
controllers/activity.go

@@ -1730,3 +1730,232 @@ func (this *ActivityController) ActivityListSearch() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 我的日程
+// @Description 我的日程列表接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.GetCygxActivityListRep
+// @router /scheduleList [get]
+func (this *ActivityController) ScheduleList() {
+	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
+	}
+	uid := user.UserId
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	//source, _ := this.GetInt("Source")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	var condition string
+	var conditionCount string
+	var pars []interface{}
+	condition += ` AND art.publish_status = 1    `
+	//if source == 1 {
+	//	condition += ` AND art.yidong_activity_id = '' `
+	//	conditionCount += ` AND art.yidong_activity_id = '' `
+	//}
+	total, err := models.GetScheduleCount(conditionCount, uid)
+	specialtotal, err := models.GetSpecialScheduleCount(uid)
+	page := paging.GetPaging(currentIndex, pageSize, total+specialtotal)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	conditionCount = ` 	AND art.active_state = 2 `
+	totalCount, err := models.GetScheduleCount(conditionCount, uid) //获取正在进行中的活动数量
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	var list []*models.ActivityDetail
+	//全部都是进行中的活动
+	if totalCount > currentIndex*pageSize {
+		condition += ` AND art.active_state IN(2) `
+		//if source == 1 {
+		//	condition += ` AND art.yidong_activity_id = '' `
+		//}
+		listHave, errList := models.GetScheduleList(condition, pars, uid, startSize, pageSize)
+		list = listHave
+		if errList != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + errList.Error()
+			return
+		}
+	} else if totalCount > currentIndex-1*pageSize && totalCount < currentIndex*pageSize { //部分是进行中的活动
+		condition = `  AND art.publish_status = 1 AND art.active_state IN(2) `
+		//if source == 1 {
+		//	condition += ` AND art.yidong_activity_id = '' `
+		//}
+		listHave, errList := models.GetScheduleList(condition, pars, uid, startSize, pageSize)
+		list = listHave
+		if errList != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + errList.Error()
+			return
+		}
+		pageSize = pageSize - len(listHave)
+		condition = ` AND art.publish_status = 1 AND art.active_state IN(1,3) `
+		//if source == 1 {
+		//	condition += ` AND art.yidong_activity_id = '' `
+		//}
+		//listOther, errList := models.GetScheduleList(condition, pars, uid, startSize, pageSize)
+		listOther, errList := services.GetScheduleAndSpecilList(user, condition, startSize, pageSize)
+		if errList != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + errList.Error()
+			return
+		}
+		if len(listOther) > 0 {
+			for _, v := range listOther {
+				list = append(list, v)
+			}
+		}
+	} else {
+		condition += ` AND art.active_state IN(1,3)` //全部都不是进行中的活动
+		//listOther, errList := models.GetScheduleList(condition, pars, uid, startSize, pageSize)
+		listOther, errList := services.GetScheduleAndSpecilList(user, condition, startSize, pageSize)
+		list = listOther
+		if errList != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + errList.Error()
+			return
+		}
+	}
+	var isShow bool
+	isShow = services.GetShowSustainable()
+	detail, err := models.GetConfigByCode("city_img_url")
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "城市配置信息失败,Err:" + err.Error()
+		return
+	}
+	detailChart, err := models.GetConfigByCode("chart_img_url")
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
+		return
+	}
+
+	addressList := strings.Split(detail.ConfigValue, "{|}")
+	mapAddress := make(map[string]string)
+	chartList := strings.Split(detailChart.ConfigValue, "{|}")
+	mapChart := make(map[string]string)
+	var cityName string
+	var chartName string
+	var imgUrl string
+	var imgUrlChart string
+	var mapActivityId []int
+	for _, v := range addressList {
+		vslice := strings.Split(v, "_")
+		cityName = vslice[0]
+		imgUrl = vslice[len(vslice)-1]
+		mapAddress[cityName] = imgUrl
+	}
+	for _, v := range chartList {
+		vslice := strings.Split(v, "_")
+		chartName = vslice[0]
+		imgUrlChart = vslice[len(vslice)-1]
+		mapChart[chartName] = imgUrlChart
+	}
+	for k, v := range list {
+		if strings.Contains(v.ActivityName, "【") {
+			list[k].IsBrackets = 1
+		}
+		if v.SignupNum > v.LimitPeopleNum {
+			list[k].SignupNum = v.LimitPeopleNum
+		}
+		//是否展示限免标签
+		if isShow && strings.Contains(v.ChartPermissionName, "研选") {
+			list[k].IsShowSustainable = true
+		}
+		if strings.Contains(v.ChartPermissionName, "研选") && v.ActivityTypeId == 1 {
+			list[k].ActivityTypeName = "买方研选电话会"
+			//list[k].ImgUrlText = "https://hongze.oss-cn-shanghai.aliyuncs.com/static/images/202112/20211221/bIdfv8t86xrFRpDOeGGHXOmKEuKl.png"
+			list[k].ImgUrlText = utils.YAN_XUAN_IMG
+		}
+		if v.ActivityType == 0 && v.SourceType == 1{
+			if mapAddress[v.City] != "" {
+				list[k].ImgUrl = mapAddress[v.City]
+			} else {
+				list[k].ImgUrl = mapAddress["其它"]
+			}
+		} else {
+			if mapChart[v.ChartPermissionName] != "" {
+				list[k].ImgUrl = mapChart[v.ChartPermissionName]
+			}
+		}
+		expertTxt, _ := services.GetReportContentTextSub(v.Expert)
+		list[k].Expert = expertTxt
+		if v.IsHideAppointment == 0 {
+			list[k].IsShowAppointment = services.IsShowAppointment(v.ActivityTypeId, v.ChartPermissionName)
+		}
+		if v.ActivityTypeId == utils.C_CLASS_ACTIVITY_TYPE_ID {
+			list[k].IsCClassMeeting = true
+		}
+		mapActivityId = append(mapActivityId, v.ActivityId)
+	}
+
+	//添加我的日程访问记录
+	item := new(models.CygxPageHistoryRecord)
+	item.UserId = user.UserId
+	item.CreateTime = time.Now()
+	item.Mobile = user.Mobile
+	item.Email = user.Email
+	item.CompanyId = user.CompanyId
+	item.CompanyName = user.CompanyName
+	item.PageType = "MySchedule"
+	go models.AddCygxPageHistoryRecord(item)
+	resp := new(models.GetCygxActivityListRep)
+
+	//处理音频回放
+	mapActivityVoice, err := services.GetActivityVoiceResp(mapActivityId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetActivityVoiceResp,Err:" + err.Error()
+		return
+	}
+
+	//处理视频回放
+	mapActivityVideo, err := services.GetActivityVideoResp(mapActivityId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetActivityVideoResp,Err:" + err.Error()
+		return
+	}
+	for k, v := range list {
+		if mapActivityVoice[v.ActivityId] != nil {
+			list[k].FileType = 1
+			list[k].AudioLink = true
+			list[k].VoiceList = mapActivityVoice[v.ActivityId]
+		}
+		if mapActivityVideo[v.ActivityId] != nil {
+			list[k].FileType = 2
+			list[k].AudioLink = true
+			list[k].VideoDetail = mapActivityVideo[v.ActivityId]
+		}
+		//处理列表的标签是否展示逻辑
+		resp.List = append(resp.List, services.ActivityButtonShow(v, user))
+	}
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 82 - 0
controllers/advice.go

@@ -0,0 +1,82 @@
+package controllers
+
+import (
+	"encoding/json"
+	"hongze/hongze_clpt/models"
+	"strconv"
+	"strings"
+	"time"
+)
+
+//优化建议
+type AdviceController struct {
+	BaseAuthController
+}
+
+// @Title 新增优化建议
+// @Description 新增优化建议接口
+// @Param	request	body models.AddCygxAdviceReq true "type json string"
+// @Success Ret=200 新增成功
+// @router /add [post]
+func (this *AdviceController) ApplyApprove() {
+	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"
+		br.Ret = 408
+		return
+	}
+	var req models.AddCygxAdviceReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	if req.Advice == "" {
+		br.Msg = "建议内容不可为空"
+		return
+	}
+
+	companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
+	if err != nil {
+		br.Msg = "新增优化建议失败!"
+		br.ErrMsg = "获取客户详情失败,Err:" + err.Error()
+		return
+	}
+	if companyDetail == nil {
+		br.Msg = "新增优化建议失败!"
+		br.ErrMsg = "客户不存在,uid:" + strconv.Itoa(user.UserId)
+		return
+	}
+	var adviceImgUrl string
+	for _, s := range req.AdviceImgUrl {
+		adviceImgUrl += "#"+s
+	}
+	adviceImgUrl = strings.TrimLeft(adviceImgUrl, "#")
+	item := new(models.CygxAdvice)
+	item.UserId = user.UserId
+	item.UserRealName = user.RealName
+	item.CompanyId = user.CompanyId
+	item.CompanyName = companyDetail.CompanyName
+	item.SalesRealName = companyDetail.SellerName
+	item.Advice = req.Advice
+	item.AdviceImgUrl = adviceImgUrl
+	item.CreateTime = time.Now()
+	item.Mobile = user.Mobile
+	item.Email = user.Email
+	_, err = models.AddCygxAdvice(item)
+	if err != nil {
+		br.Msg = "新增优化建议失败"
+		br.ErrMsg = "新增优化建议失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "新增成功"
+}

+ 932 - 0
controllers/user.go

@@ -3,9 +3,11 @@ package controllers
 import (
 	"encoding/json"
 	"fmt"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/services"
 	"hongze/hongze_clpt/utils"
+	"sort"
 	"strconv"
 	"strings"
 	"time"
@@ -153,10 +155,91 @@ func (this *UserController) Detail() {
 	}
 	resp := new(models.UserDetailResp)
 	resp.UserId = user.UserId
+	resp.UserName = user.RealName
 	resp.Headimgurl = user.Headimgurl
 	resp.Mobile = user.Mobile
 	resp.Email = user.Email
 	resp.CompanyName = user.CompanyName
+	userDetail, err := models.GetUserDetailByUserId(user.UserId)
+	if err != nil {
+		br.Msg = "获取用户信息失败"
+		br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+		return
+	}
+	resp.OutboundCountryCode = userDetail.OutboundCountryCode
+	resp.OutboundMobile = userDetail.OutboundMobile
+
+	if user.CompanyId > 1 {
+		companyItem, err := models.GetCompanyDetailById(user.CompanyId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+			return
+		}
+		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 {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+				return
+			}
+
+			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 + "(升级)"
+				}
+			}
+			mapPermissionName := make(map[string]string)
+			//处理升级,并且合并主客观
+			for _, v := range permissionList {
+				if _, ok := mapPermissionName[v.PermissionName]; ok {
+					continue
+				}
+				if _, ok := mapIsUpgrade[v.PermissionName]; ok {
+					permissionStr += mapIsUpgrade[v.PermissionName] + ","
+				} else {
+					if mapZhukKeGuan[v.PermissionName] == 1 {
+						permissionStr += v.Remark + ","
+					} else {
+						permissionStr += v.PermissionName + ","
+					}
+				}
+				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)
+			}
+
+		}
+	}
 	if resp.Headimgurl == "" {
 		resp.Headimgurl = utils.DefaultHeadimgurl
 	}
@@ -412,3 +495,852 @@ func (this *UserController) ApplyTryOut() {
 	br.Success = true
 	br.Data = sellerMobile
 }
+
+// @Title 用户修改外呼手机号以及区号
+// @Description 用户修改外呼手机号以及区号接口
+// @Param	request	body models.OutboundMobileItem true "type json string"
+// @Success Ret=200 操作成功
+// @router /countryCcode/addOutboundMobile [POST]
+func (this *UserController) AddOutboundMobile() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	uid := user.UserId
+	if user == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,用户信息为空"
+		br.Ret = 408
+		return
+	}
+	var req models.OutboundMobileItem
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	if req.OutboundMobile == "" {
+		br.Msg = "请填写区号!"
+		return
+	}
+	item := new(models.OutboundMobileItem)
+	item.OutboundMobile = req.OutboundMobile
+	item.OutboundCountryCode = req.OutboundCountryCode
+	//item.ActivityId = req.ActivityId
+	//if req.ActivityId == 0 {
+	//	err = models.AddOutboundMobile(item, uid)
+	//} else {
+	//	if user.Mobile == "" && user.OutboundMobile == "" {
+	//		items := new(models.CygxActivitySignup)
+	//		items.UserId = uid
+	//		items.ActivityId = req.ActivityId
+	//		items.CreateTime = time.Now()
+	//		items.Mobile = user.Mobile
+	//		items.Email = user.Email
+	//		items.CompanyId = user.CompanyId
+	//		items.CompanyName = user.CompanyName
+	//		items.SignupType = 1
+	//		items.FailType = 0
+	//		items.DoFailType = 0
+	//		items.OutboundMobile = req.OutboundMobile
+	//		items.CountryCode = req.OutboundCountryCode
+	//		_, err = models.AddActivitySignupFromEmail(items)
+	//	} else {
+	//		total, err := models.GetActivityCountByIdWithUid(item.ActivityId, uid)
+	//		if total == 0 {
+	//			br.Msg = "报名信息不存在"
+	//			br.ErrMsg = "报名信息不存在,Err:" + "活动ActivityId:" + strconv.Itoa(item.ActivityId) + "用户Uid:" + strconv.Itoa(uid)
+	//			return
+	//		}
+	//		if err != nil {
+	//			br.Msg = "操作失败"
+	//			br.ErrMsg = "操作失败,Err:" + err.Error()
+	//			return
+	//		}
+	//		err = models.AddOutboundMobile(item, uid)
+	//	}
+	//}
+
+	err = models.AddOutboundMobile(item, uid)
+	if err != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "操作失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+}
+
+// @Title 校验用户状态信息
+// @Description 校验用户状态信息
+// @Success 200 {object} models.CheckStatusResp
+// @router /check/status [get]
+func (this *UserController) CheckLogin() {
+	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
+	resp := new(models.CheckStatusResp)
+	if uid > 0 {
+		//判断token是否过期
+		userRecord, err := models.GetUserSessionByUserId(uid)
+		if err != nil {
+			br.Msg = "获取用户信息失败"
+			br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+			return
+		}
+		permissionStr, err := models.GetCompanyPermission(user.CompanyId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+			return
+		}
+		resp.PermissionName = permissionStr
+
+		if user.Mobile == "" && user.Email == "" {
+			resp.IsBind = true
+		}
+		if userRecord.UnionId == "" {
+			resp.IsAuth = true
+		}
+	} else {
+		resp.IsBind = true
+		if user.UnionId == "" {
+			resp.IsAuth = true
+		}
+		resp.PermissionName = ""
+	}
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+	br.Ret = 200
+}
+
+// @Title 更改用户微信头像
+// @Description 更改用户微信头像
+// @Param	request	body models.Headimgurl true "type json string"
+// @Success 200 {object} models.ArticleDetailFileLink
+// @router /headimgurl/update [post]
+func (this *UserController) HeadimgurlUpdate() {
+	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.Headimgurl
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	uid := user.UserId
+	headimgurl := req.Headimgurl
+	if headimgurl == "" {
+		br.Msg = "操作失败"
+		br.ErrMsg = "头像信息不能为空"
+		return
+	}
+	err = models.UpdateUserHeadimgurl(headimgurl, uid)
+	if err != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "头像信息不能为空"
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+}
+
+// @Title 获取我的收藏
+// @Description 获取我的收藏列表
+// @Param   PageSize    query   int true       "PageSize"
+// @Param   CurrentIndex    query   int true       "CurrentIndex"
+// @Success 200 {object} models.ArticleCollectListResp
+// @router /collect/list [get]
+func (this *UserController) CollectList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	userId := this.User.UserId
+	var pageSize, currentIndex, startSize int
+	pageSize, _ = this.GetInt("PageSize")
+	currentIndex, _ = this.GetInt("CurrentIndex")
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+
+	total, err := models.GetArticleUserCollectCount(userId)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	list, err := models.GetArticleUserCollectList(startSize, pageSize, userId)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	resp := new(models.ArticleReportBillboardLIstPageResp)
+	if len(list) == 0 {
+		page := paging.GetPaging(currentIndex, pageSize, total)
+		resp.List = list
+		resp.Paging = page
+		br.Msg = "获取成功!"
+		br.Ret = 200
+		br.Success = true
+		br.Data = resp
+		return
+	}
+	var condition string
+	var pars []interface{}
+	var articleIds []string
+	for _, v := range list {
+		articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
+	}
+	articleIdStr := strings.Join(articleIds, ",")
+
+	//获取文章关联的产业
+	pars = make([]interface{}, 0)
+	condition = ` AND mg.article_id IN (  ` + utils.GetOrmInReplace(len(articleIds)) + ` )  `
+	pars = append(pars, articleIds)
+	industrialList, err := models.GetIndustrialListByarticleId(pars, condition)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,GetSubjectList Err:" + err.Error()
+		return
+	}
+	industrialMap := make(map[int][]*models.IndustrialManagementIdInt)
+	if len(industrialList) > 0 {
+		for _, v := range industrialList {
+			item := new(models.IndustrialManagementIdInt)
+			item.ArticleId = v.ArticleId
+			if v.ArticleId > utils.SummaryArticleId {
+				item.IsResearch = true
+			}
+			item.IndustrialManagementId = v.IndustrialManagementId
+			item.IndustryName = v.IndustryName
+			item.ChartPermissionId = v.ChartPermissionId
+			industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
+		}
+	}
+	for k, v := range list {
+		if len(industrialMap[v.ArticleId]) > 0 {
+			list[k].List = industrialMap[v.ArticleId]
+		} else {
+			list[k].List = make([]*models.IndustrialManagementIdInt, 0)
+		}
+	}
+
+	articleMap := make(map[int]*models.ArticleDetail)
+	if articleIdStr != "" {
+		articleList, err := models.GetArticleDetailByIdStr(articleIdStr)
+		if err != nil {
+			br.Msg = "获取数据失败"
+			br.ErrMsg = "获取报告详情信息失败,Err:" + err.Error()
+			return
+		}
+		for _, v := range articleList {
+			if _, ok := articleMap[v.ArticleId]; !ok {
+				articleMap[v.ArticleId] = v
+			}
+		}
+	}
+
+	//处理文章PV收藏等数量
+	mapArticleCollectNum := make(map[int]*models.CygxArticleNum)
+	if len(articleIds) > 0 {
+		articleCollectNumList, err := models.GetArticleCollectNum(articleIds, userId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,GetArticleCollectNum Err:" + err.Error()
+			return
+		}
+		for _, v := range articleCollectNumList {
+			mapArticleCollectNum[v.ArticleId] = v
+		}
+	}
+
+	lenList := len(list)
+	for i := 0; i < lenList; i++ {
+		item := list[i]
+		article := articleMap[item.ArticleId]
+		list[i].Title = article.Title
+		list[i].DepartmentId = article.DepartmentId
+		list[i].NickName = article.NickName
+		list[i].PublishDate = article.PublishDate
+		if article.ArticleId < utils.SummaryArticleId {
+			list[i].Source = 1
+		} else {
+			list[i].Source = 2
+		}
+		if mapArticleCollectNum[article.ArticleId] != nil {
+			list[i].CollectNum = mapArticleCollectNum[article.ArticleId].CollectNum
+			list[i].Pv = mapArticleCollectNum[article.ArticleId].Pv
+			list[i].IsCollect = mapArticleCollectNum[article.ArticleId].IsCollect
+		}
+		//list[i].TitleEn = article.TitleEn
+		//list[i].UpdateFrequency = article.UpdateFrequency
+		//list[i].CreateDate = article.CreateDate
+		//list[i].Body, _ = services.GetReportContentTextSub(article.Body)
+		//list[i].Abstract = article.Abstract
+		//list[i].CategoryName = article.CategoryName
+		//list[i].SubCategoryName = article.SubCategoryName
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.List = list
+	resp.Paging = page
+	br.Msg = "获取成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}
+
+
+// @Title 获取我的留言
+// @Description 获取我的留言列表
+// @Param   PageSize    query   int true       "PageSize"
+// @Param   CurrentIndex    query   int true       "CurrentIndex"
+// @Success 200 {object} models.CygxCommentListResp
+// @router /comment/list [get]
+func (this *UserController) CommnetList() {
+	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 pageSize, currentIndex, startSize int
+	pageSize, _ = this.GetInt("PageSize")
+	currentIndex, _ = this.GetInt("CurrentIndex")
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+
+	userId := this.User.UserId
+	total, err := models.GetCommentListCount(userId)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	commentlist, err := models.GetCommentList(userId, startSize, pageSize)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取我的留言列表失败,Err:" + err.Error()
+		return
+	}
+
+	resp := new(models.CygxCommentListResp)
+
+	for _, comment := range commentlist {
+		item := models.CygxArticleCommentResp{
+			Id:                comment.Id,
+			UserId:            comment.UserId,
+			ArticleId:         comment.ArticleId,
+			IndustryId:        comment.IndustryId,
+			ActivityId:        comment.ActivityId,
+			VideoId:           comment.VideoId,
+			CreateTime:        comment.CreateTime.Format(utils.FormatDateTime),
+			Mobile:            comment.Mobile,
+			Email:             comment.Email,
+			CompanyId:         comment.CompanyId,
+			CompanyName:       comment.CompanyName,
+			Content:           comment.Content,
+			Title:             comment.Title,
+		}
+		if comment.ArticleId > 0 {
+			item.RedirectType = 1
+		} else if comment.IndustryId > 0 {
+			detail, err := models.GetIndustrialManagementDetail(comment.IndustryId)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取信息失败,Err:" + err.Error()
+				return
+			}
+			item.RedirectType = 3
+			item.ChartPermissionId = detail.ChartPermissionId
+		} else if comment.ActivityId > 0 && comment.VideoId == 0 {
+			item.RedirectType = 2
+		} else if comment.IndustryId == 0 && comment.VideoId > 0 {
+			item.RedirectType = 4
+		}
+		resp.List = append(resp.List, &item)
+	}
+
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.Paging = page
+
+	br.Msg = "获取成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}
+
+// @Title 我的足迹
+// @Description 获取我的足迹列表
+// @Param   PageSize    query   int true       "PageSize"
+// @Param   CurrentIndex    query   int true       "CurrentIndex"
+// @Success 200 {object} models.ArticleBrowseHistoryListResp
+// @router /browse/history/list [get]
+func (this *UserController) BrowseHistoryList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	userId := this.User.UserId
+	var pageSize, currentIndex, startSize int
+	pageSize, _ = this.GetInt("PageSize")
+	currentIndex, _ = this.GetInt("CurrentIndex")
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+
+	endDate := time.Now().AddDate(0, -1, 0).Format(utils.FormatDate)
+	total, err := models.GetArticleUserBrowseHistoryCount(userId, endDate)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	list, err := models.GetArticleUserBrowseHistoryList(startSize, pageSize, userId, endDate)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	resp := new(models.ArticleReportBillboardLIstPageResp)
+	if len(list) == 0 {
+		page := paging.GetPaging(currentIndex, pageSize, total)
+		resp.List = list
+		resp.Paging = page
+		br.Msg = "获取成功!"
+		br.Ret = 200
+		br.Success = true
+		br.Data = resp
+		return
+	}
+
+	var articleIds []string
+	var condition string
+	var pars []interface{}
+	for _, v := range list {
+		articleIds = append(articleIds, strconv.Itoa(v.ArticleId))
+	}
+	articleIdStr := strings.Join(articleIds, ",")
+
+	//获取文章关联的产业
+	pars = make([]interface{}, 0)
+	condition = ` AND mg.article_id IN (  ` + utils.GetOrmInReplace(len(articleIds)) + ` )  `
+	pars = append(pars, articleIds)
+	industrialList, err := models.GetIndustrialListByarticleId(pars, condition)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,GetSubjectList Err:" + err.Error()
+		return
+	}
+	industrialMap := make(map[int][]*models.IndustrialManagementIdInt)
+	if len(industrialList) > 0 {
+		for _, v := range industrialList {
+			item := new(models.IndustrialManagementIdInt)
+			item.ArticleId = v.ArticleId
+			if v.ArticleId > utils.SummaryArticleId {
+				item.IsResearch = true
+			}
+			item.IndustrialManagementId = v.IndustrialManagementId
+			item.IndustryName = v.IndustryName
+			item.ChartPermissionId = v.ChartPermissionId
+			industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
+		}
+	}
+	for k, v := range list {
+		if len(industrialMap[v.ArticleId]) > 0 {
+			list[k].List = industrialMap[v.ArticleId]
+		} else {
+			list[k].List = make([]*models.IndustrialManagementIdInt, 0)
+		}
+	}
+
+	articleMap := make(map[int]*models.ArticleDetail)
+	if articleIdStr != "" {
+		articleList, err := models.GetArticleDetailByIdStr(articleIdStr)
+		if err != nil {
+			br.Msg = "获取数据失败"
+			br.ErrMsg = "获取报告详情信息失败,Err:" + err.Error()
+			return
+		}
+		for _, v := range articleList {
+			if _, ok := articleMap[v.ArticleId]; !ok {
+				articleMap[v.ArticleId] = v
+			}
+		}
+	}
+
+	//处理文章PV收藏等数量
+	mapArticleCollectNum := make(map[int]*models.CygxArticleNum)
+	if len(articleIds) > 0 {
+		articleCollectNumList, err := models.GetArticleCollectNum(articleIds, userId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,GetArticleCollectNum Err:" + err.Error()
+			return
+		}
+		for _, v := range articleCollectNumList {
+			mapArticleCollectNum[v.ArticleId] = v
+		}
+	}
+
+	lenList := len(list)
+	for i := 0; i < lenList; i++ {
+		item := list[i]
+		article := articleMap[item.ArticleId]
+		if article != nil {
+			list[i].Title = article.Title
+			list[i].PublishDate = utils.TimeRemoveHms2(article.PublishDate)
+			list[i].DepartmentId = article.DepartmentId
+			list[i].NickName = article.NickName
+			if article.ArticleId < utils.SummaryArticleId {
+				list[i].Source = 1
+			} else {
+				list[i].Source = 2
+			}
+
+			if mapArticleCollectNum[article.ArticleId] != nil {
+				list[i].CollectNum = mapArticleCollectNum[article.ArticleId].CollectNum
+				list[i].Pv = mapArticleCollectNum[article.ArticleId].Pv
+				list[i].IsCollect = mapArticleCollectNum[article.ArticleId].IsCollect
+			}
+			//list[i].TitleEn = article.TitleEn
+			//list[i].UpdateFrequency = article.UpdateFrequency
+			//list[i].CreateDate = article.CreateDate
+			//list[i].Body, _ = services.GetReportContentTextSub(article.Body)
+			//list[i].Abstract = article.Abstract
+			//list[i].CategoryName = article.CategoryName
+			//list[i].SubCategoryName = article.SubCategoryName
+		}
+	}
+	page := paging.GetPaging(currentIndex, pageSize, total)
+
+	resp.List = list
+	resp.Paging = page
+	br.Msg = "获取成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}
+
+// @Title 获取我的提问
+// @Description 获取我的提问列表
+// @Param   PageSize    query   int true       "PageSize"
+// @Param   CurrentIndex    query   int true       "CurrentIndex"
+// @Success 200 {object} models.CygxAskListResp
+// @router /ask/list [get]
+func (this *UserController) AskList() {
+	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 pageSize, currentIndex, startSize int
+	pageSize, _ = this.GetInt("PageSize")
+	currentIndex, _ = this.GetInt("CurrentIndex")
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+
+
+	userId := this.User.UserId
+	total, err := models.GetActivityAskCount(userId)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
+	listActcivity, err := models.GetActivityAskList(userId, startSize, pageSize)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取活动问题失败,Err:" + err.Error()
+		return
+	}
+	for _, v := range listActcivity {
+		v.AskType = "Activity"
+	}
+	listArticle, err := models.GetArticleAskList(userId)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取文章问题失败,Err:" + err.Error()
+		return
+	}
+	for _, v := range listArticle {
+		v.AskType = "Report"
+		listActcivity = append(listActcivity, v)
+	}
+	resp := new(models.CygxAskListResp)
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.Paging = page
+
+	resp.List = listActcivity
+	br.Msg = "获取成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}
+
+// @Title 我的收藏微路演列表
+// @Description 我的收藏微路演列表接口
+// @Param   PageSize		query	int		true	"每页数据条数"
+// @Param   CurrentIndex	query	int		true	"当前页页码,从1开始"
+// @Success 200 {object} models.HomeListResp
+// @router /collect/microRoadShow [get]
+func (this *UserController) Mycollect() {
+	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
+	}
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	userId := user.UserId
+	listMycollect, err := models.GetUserMicroRoadshowCollectList(userId)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	collectVoiceMap := make(map[int]time.Time, 0)
+	collectVideoMap := make(map[int]time.Time, 0)
+	collectActivityVideoMap := make(map[int]time.Time, 0)
+	var audioIds []string
+	var videoIds []string
+	var activityVideoIds []string
+	for _, item := range listMycollect {
+		if item.ActivityVoiceId > 0 {
+			audioIds = append(audioIds, strconv.Itoa(item.ActivityVoiceId))
+			collectVoiceMap[item.ActivityVoiceId] = item.CreateTime
+		} else if item.VideoId > 0 {
+			videoIds = append(videoIds, strconv.Itoa(item.VideoId))
+			collectVideoMap[item.VideoId] = item.CreateTime
+		} else if item.ActivityVideoId > 0 {
+			activityVideoIds = append(activityVideoIds, strconv.Itoa(item.ActivityVideoId))
+			collectActivityVideoMap[item.ActivityVideoId] = item.CreateTime
+		}
+	}
+
+	if len(audioIds) == 0 && len(videoIds) == 0 && len(activityVideoIds) == 0 {
+		resp := new(models.MicroRoadShowListResp)
+		page := paging.GetPaging(currentIndex, pageSize, 0)
+		resp.List = make([]*models.MicroRoadShowPageList, 0)
+		resp.Paging = page
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		br.Data = resp
+		return
+	}
+
+	audioIdstr := strings.Join(audioIds, ",")
+	ideoIdsStr := strings.Join(videoIds, ",")
+	activityVideoIdsStr := strings.Join(activityVideoIds, ",")
+	// 微路演列表
+	list, total, e := services.GetMicroRoadShowMycollect(pageSize, currentIndex, audioIdstr, ideoIdsStr, activityVideoIdsStr)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
+		return
+	}
+	for _, item := range list {
+		if item.Type == 1 {
+			//音频
+			count, err := models.GetVoiceCollectCount(user.UserId, item.Id)
+			if err != nil {
+				br.Msg = "获取数据失败!"
+				br.ErrMsg = "获取数据失败,Err:" + err.Error()
+				return
+			}
+			if count > 0 {
+				item.IsCollect = true
+			}
+			if v,ok := collectVoiceMap[item.Id]; ok{
+				item.CollectTime = v
+			}
+		} else if item.Type == 2 {
+			//活动视频
+			count, err := models.GetActivityVideoCollectCount(user.UserId, item.Id)
+			if err != nil {
+				br.Msg = "获取数据失败!"
+				br.ErrMsg = "获取数据失败,Err:" + err.Error()
+				return
+			}
+			if count > 0 {
+				item.IsCollect = true
+			}
+			if v,ok := collectActivityVideoMap[item.Id]; ok{
+				item.CollectTime = v
+			}
+		} else if item.Type == 3 {
+			//微路演视频
+			count, err := models.GetVideoCollectCount(user.UserId, item.Id)
+			if err != nil {
+				br.Msg = "获取数据失败!"
+				br.ErrMsg = "获取数据失败,Err:" + err.Error()
+				return
+			}
+			if count > 0 {
+				item.IsCollect = true
+			}
+			if v,ok := collectVideoMap[item.Id]; ok{
+				item.CollectTime = v
+			}
+		}
+	}
+	// 用户权限
+	authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
+		return
+	}
+
+	// 获取默认图配置
+	audioMap, videoMap, audioShareMap, videoShareMap, e := services.GetMicroRoadShowDefaultImgConfig()
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取微路演列表失败, Err: " + e.Error()
+		return
+	}
+
+	for i := range list {
+		// 权限
+		au := new(models.UserPermissionAuthInfo)
+		au.SellerName = authInfo.SellerName
+		au.SellerMobile = authInfo.SellerMobile
+		au.HasPermission = authInfo.HasPermission
+		au.OperationMode = authInfo.OperationMode
+		if au.HasPermission == 1 {
+			// 非宏观权限进一步判断是否有权限
+			if list[i].ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, list[i].ChartPermissionName) {
+				au.HasPermission = 2
+			}
+		}
+		// 无权限的弹框提示
+		if au.HasPermission != 1 {
+			if au.OperationMode == services.UserPermissionOperationModeCall {
+				if list[i].Type == 1 {
+					au.PopupMsg = services.UserPermissionPopupMsgCallActivity
+				} else {
+					au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
+				}
+			} else {
+				if list[i].Type == 1 {
+					au.PopupMsg = services.UserPermissionPopupMsgApplyActivity
+				} else {
+					au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
+				}
+			}
+		}
+		list[i].AuthInfo = au
+		list[i].PublishTime = utils.StrTimeToTime(list[i].PublishTime).Format(utils.FormatDate)
+		// 默认图
+		if list[i].BackgroundImg == "" {
+			if list[i].Type == 1 {
+				list[i].BackgroundImg = audioMap[list[i].ChartPermissionId]
+			} else {
+				list[i].BackgroundImg = videoMap[list[i].ChartPermissionId]
+			}
+		}
+		// 分享图
+		if list[i].ShareImg == "" {
+			if list[i].Type == 1 {
+				list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
+			} else {
+				list[i].ShareImg = videoShareMap[list[i].ChartPermissionId]
+			}
+		}
+	}
+
+	var sortList models.MicroList
+
+	sortList = list
+	sort.Sort(sortList)
+
+	resp := new(models.MicroRoadShowListResp)
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.List = sortList
+	resp.Paging = page
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 135 - 7
models/activity.go

@@ -138,6 +138,8 @@ type ActivityDetail struct {
 	TripImgLink             string                     `description:"专项产业调研行程链接"`
 	ActivityTimeEnd         string                     `description:"专项产业调研活动预期结束时间"`
 	AuthInfo                *UserPermissionAuthInfo    `description:"用户查看视频的权限"`
+	Days                    int                        `description:"调研天数"`
+	Title                   string                     `description:"标题"`
 }
 
 //活动详情
@@ -155,19 +157,19 @@ type ActivityListResp struct {
 	DistinguishedGuest      string                     `description:"嘉宾"`
 	Host                    string                     `description:"主持人"`
 	Speaker                 string                     `description:"主讲人"`
-	MainlandTell            string                     `description:"大陆拨入号"`
-	HongKongTell            string                     `description:"香港拨入号"`
-	TaiwanTell              string                     `description:"台湾拨入号"`
-	AmericaTell             string                     `description:"美国拨入号"`
+	MainlandTell            string                     `description:"大陆拨入号" json:"-"`
+	HongKongTell            string                     `description:"香港拨入号" json:"-"`
+	TaiwanTell              string                     `description:"台湾拨入号" json:"-"`
+	AmericaTell             string                     `description:"美国拨入号" json:"-"`
 	ParticipationCode       string                     `description:"参会密码"`
 	Theme                   string                     `description:"主题"`
 	Expert                  string                     `description:"专家"`
 	ActivityName            string                     `description:"活动名称"`
 	OnlineParticipation     string                     `description:"网络参会"`
-	ReportLink              string                     `description:"报告链接"`
+	ReportLink              string                     `description:"报告链接" json:"-"`
 	City                    string                     `description:"城市"`
-	Address                 string                     `description:"活动地址"`
-	Highlights              string                     `description:"活动亮点"`
+	Address                 string                     `description:"活动地址" json:"-"`
+	Highlights              string                     `description:"活动亮点" json:"-"`
 	Remarks                 string                     `description:"备注"`
 	IsSignup                int                        `description:"是否已报名 1是 ,0 否"`
 	SignupNum               int                        `description:"已报名人数"`
@@ -198,6 +200,11 @@ type ActivityListResp struct {
 	ArticleList             []*ActivityArticleResp
 	Listndustrial           []*IndustrialManagementRep `description:"活动关联的产业信息"`
 	AuthInfo                *UserPermissionAuthInfo    `description:"用户查看视频的权限"`
+	Explain                 string                     `description:"活动右上角提示"`
+	TripImgLink             string                     `description:"专项产业调研行程链接"`
+	IsTrip                  int                        `description:"是否报名 1是 ,0 否"`
+	TripStatus              int                        `description:"行程进行状态 1:预报名,2:确定行程"`
+	Days                    int                        `description:"调研天数"`
 }
 
 type ActivityArticleResp struct {
@@ -404,3 +411,124 @@ func GetActivitySpecialSearcheList(condition string, pars []interface{}, conditi
 	_, err = o.Raw(sql, pars, parsSpecil, startSize, pageSize).QueryRows(&items)
 	return
 }
+
+//获取我的日程数量
+func GetScheduleCount(condition string, uid int) (count int, err error) {
+	o := orm.NewOrm()
+	sqlCount := `SELECT COUNT( 1 ) AS count 
+				FROM cygx_my_schedule AS m
+				INNER JOIN cygx_activity AS art ON art.activity_id = m.activity_id 
+				WHERE
+				user_id = ?`
+	if condition != "" {
+		sqlCount += condition
+	}
+	err = o.Raw(sqlCount, uid).QueryRow(&count)
+	return
+}
+
+//获取我的日程数量
+func GetSpecialScheduleCount(uid int) (count int, err error) {
+	o := orm.NewOrm()
+	sqlCount := `
+SELECT COUNT( 1 ) AS count FROM
+			cygx_activity_special AS art
+			INNER JOIN cygx_activity_special_trip AS my ON my.activity_id = art.activity_id 
+		WHERE
+			1 = 1 AND my.user_id = ? AND my.is_cancel = 0`
+	err = o.Raw(sqlCount, uid).QueryRow(&count)
+	return
+}
+
+//我的日程列表
+func GetScheduleList(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*ActivityDetail, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT art.*,t.activity_type,t.img_url_text,c.image_url as  img_url,
+			( SELECT COUNT( 1 ) FROM cygx_activity_signup AS s WHERE s.activity_id = art.activity_id AND s.user_id = ? AND s.is_cancel = 0 AND s.do_fail_type = 0) AS is_signup,
+            ( SELECT COUNT( DISTINCT user_id ) FROM cygx_activity_signup AS s WHERE s.activity_id = art.activity_id AND  s.is_cancel = 0  AND s.do_fail_type = 0) AS signup_num ,
+			( SELECT COUNT( 1 ) FROM cygx_activity_appointment AS ap WHERE ap.activity_id = art.activity_id AND ap.user_id = ? ) AS is_appointment,
+			( SELECT COUNT( 1 ) FROM cygx_activity_meeting_reminder AS m WHERE m.activity_id = art.activity_id AND m.is_cancel = 0 AND m.user_id = ? ) AS is_cancel_meeting_reminder, 
+			1 AS source_type 
+            FROM cygx_activity AS art
+			INNER JOIN cygx_my_schedule as my ON my.activity_id = art.activity_id 
+			INNER JOIN cygx_activity_type  as t ON t.activity_type_id = art.activity_type_id
+			INNER JOIN  chart_permission  AS c ON c.chart_permission_id = art.chart_permission_id 
+            WHERE 1=1 AND my.user_id = ? `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` ORDER BY art.active_state ASC,art.activity_time ASC  LIMIT ?,?`
+	_, err = o.Raw(sql, pars, uid, uid, uid, uid, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+//我的日程列表 活动以及专项调研一起
+func GetScheduleAndSpecilList(condition string, pars []interface{}, conditionSpecil string, parsSpecil []interface{}, startSize, pageSize int) (items []*ActivityDetail, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			art.activity_id,
+			art.activity_time_text,
+			art.activity_name,
+			art.chart_permission_id,
+			art.active_state,
+			t.activity_type,
+			art.chart_permission_name,
+			art.distinguished_guest,
+			art.expert,
+			art.speaker,
+			"" AS trip_img_link,
+			"" AS activity_time_end,
+			art.yidong_activity_id,
+			art.is_can_appointment_minutes,
+			art.activity_type_id,
+			art.limit_people_num,
+			1 AS source_type,
+			art.activity_time,
+			0 AS days,
+			art.city AS city,
+			art.host 
+		FROM
+			cygx_activity AS art
+			INNER JOIN cygx_my_schedule AS my ON my.activity_id = art.activity_id
+			INNER JOIN cygx_activity_type AS t ON t.activity_type_id = art.activity_type_id
+			INNER JOIN chart_permission AS c ON c.chart_permission_id = art.chart_permission_id 
+		WHERE
+			1 = 1 `
+	if condition != `` {
+		sql += condition
+	}
+	sql += ` UNION ALL
+		SELECT
+			art.activity_id,
+			art.activity_time_text_by_day AS activity_time_text,
+			art.research_theme AS activity_name,
+			art.chart_permission_id,
+			"",
+			art.special_type AS activity_type,
+			art.chart_permission_name,
+			"",
+			"",
+			"",
+			art.trip_img_link_fix AS trip_img_link,
+			art.activity_time_end,
+			"",
+			"",
+			"",
+			"",
+			2 AS source_type,
+			art.activity_time,
+			art.days,
+			art.city,
+			art.host 
+		FROM
+			cygx_activity_special AS art
+			INNER JOIN cygx_activity_special_trip AS my ON my.activity_id = art.activity_id 
+		WHERE
+			1 = 1`
+	if conditionSpecil != "" {
+		sql += conditionSpecil
+	}
+	sql += ` ORDER BY activity_time DESC   LIMIT ?,?`
+	_, err = o.Raw(sql, pars, parsSpecil, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 20 - 3
models/activity_help_ask.go

@@ -2,6 +2,7 @@ package models
 
 import (
 	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"time"
 )
 
@@ -40,12 +41,14 @@ type CygxAskList struct {
 
 type CygxAskListResp struct {
 	List []*CygxAskList
+	Paging *paging.PagingItem
 }
 
+
 //report_or_activity_id
 
 //主题列表
-func GetActivityAskList(userId int) (items []*CygxAskList, err error) {
+func GetActivityAskList(userId, startSize, pageSize int) (items []*CygxAskList, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
 			k.activity_id as report_or_activity_id,
@@ -56,8 +59,22 @@ func GetActivityAskList(userId int) (items []*CygxAskList, 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`
-	_, err = o.Raw(sql, userId).QueryRows(&items)
+			user_id = ? AND a.publish_status = 1 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
+			COUNT( 1 ) as count 
+		FROM
+			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 `
+	err = o.Raw(sql, userId).QueryRow(&count)
 	return
 }
 

+ 1 - 0
models/activity_video.go

@@ -133,3 +133,4 @@ type ActivityVideoDetailResp struct {
 	VideoDetail *CygxActivityVideoDetailResp
 	AuthInfo    *UserPermissionAuthInfo
 }
+

+ 7 - 0
models/activity_voice.go

@@ -104,3 +104,10 @@ FROM
 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }
+
+// GetCygxActivityVoiceByActivityId 主键获取活动音频
+func GetCygxActivityVoiceByActivityId(activityId int) (item *CygxActivityVoice, err error) {
+	sql := `SELECT * FROM cygx_activity_voice WHERE activity_id = ? LIMIT 1`
+	err = orm.NewOrm().Raw(sql, activityId).QueryRow(&item)
+	return
+}

+ 32 - 0
models/advice.go

@@ -0,0 +1,32 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxAdvice struct {
+	AdviceId      int       `orm:"column(advice_id);pk" description:"优化建议id"`
+	UserId        int       `description:"用户id"`
+	UserRealName  string    `description:"姓名"`
+	CompanyId     int       `description:"公司id"`
+	CompanyName   string    `description:"公司名称"`
+	SalesRealName string    `description:"所属销售"`
+	Advice        string    `description:"优化建议"`
+	AdviceImgUrl  string    `description:"图片,多张用#分割"`
+	CreateTime    time.Time `description:"提交建议时间"`
+	Mobile        string    `description:"手机号"`
+	Email         string    `description:"邮箱"`
+}
+
+//添加优化建议
+func AddCygxAdvice(item *CygxAdvice) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+type AddCygxAdviceReq struct {
+	Advice       string `description:"优化建议"`
+	AdviceImgUrl []string `description:"图片,多张用#分割"`
+}

+ 9 - 0
models/article.go

@@ -196,3 +196,12 @@ func GetArticleList(condition string, pars []interface{}) (items []*ArticleDetai
 	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
+
+func GetArticleDetailByIdStr(articleIdStr string) (items []*ArticleDetail, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT 	art.*,d.nick_name FROM
+			cygx_article AS art
+			LEFT JOIN cygx_article_department AS d ON d.department_id = art.department_id  WHERE article_id IN(` + articleIdStr + `) `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 30 - 9
models/article_collect.go

@@ -7,15 +7,18 @@ import (
 )
 
 type CygxArticleCollect struct {
-	Id          int `orm:"column(id);pk"`
-	ArticleId   int
-	UserId      int
-	CreateTime  time.Time
-	Mobile      string `description:"手机号"`
-	Email       string `description:"邮箱"`
-	CompanyId   int    `description:"公司id"`
-	CompanyName string `description:"公司名称"`
-	RealName    string `description:"用户实际名称"`
+	Id              int `orm:"column(id);pk"`
+	ArticleId       int
+	ActivityVoiceId int
+	ActivityVideoId int
+	VideoId         int
+	UserId          int
+	CreateTime      time.Time
+	Mobile          string `description:"手机号"`
+	Email           string `description:"邮箱"`
+	CompanyId       int    `description:"公司id"`
+	CompanyName     string `description:"公司名称"`
+	RealName        string `description:"用户实际名称"`
 }
 
 //添加收藏信息
@@ -149,3 +152,21 @@ func GetArticleCollectNum(articleId []string, uid int) (items []*CygxArticleNum,
 	_, err = o.Raw(sql, uid, articleId).QueryRows(&items)
 	return
 }
+
+func GetVoiceCollectCount(userId, voiceId int) (count int, err error) {
+	sql := `SELECT COUNT(1) AS count FROM cygx_article_collect WHERE user_id=? AND activity_voice_id=? `
+	err = orm.NewOrm().Raw(sql, userId, voiceId).QueryRow(&count)
+	return
+}
+
+func GetActivityVideoCollectCount(userId, activityVideoId int) (count int, err error) {
+	sql := `SELECT COUNT(1) AS count FROM cygx_article_collect WHERE user_id=? AND activity_video_id=? `
+	err = orm.NewOrm().Raw(sql, userId, activityVideoId).QueryRow(&count)
+	return
+}
+
+func GetVideoCollectCount(userId, videoId int) (count int, err error) {
+	sql := `SELECT COUNT(1) AS count FROM cygx_article_collect WHERE user_id=? AND video_id=? `
+	err = orm.NewOrm().Raw(sql, userId, videoId).QueryRow(&count)
+	return
+}

+ 88 - 0
models/article_comment.go

@@ -0,0 +1,88 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"time"
+)
+
+type CygxArticleComment struct {
+	Id              int       `orm:"column(id);pk" description:"留言id"`
+	UserId          int       `description:"用户id"`
+	RealName        string    `description:"用户姓名"`
+	ArticleId       int       `description:"文章id"`
+	ActivityId      int       `description:"活动id"`
+	VideoId         int       `description:"视频id"`
+	ActivityVoiceId int       `description:"活动音频ID"`
+	IndustryId      int       `description:"产业id"`
+	CreateTime      time.Time `description:"创建时间"`
+	Mobile          string    `description:"手机号"`
+	Email           string    `description:"邮箱"`
+	CompanyId       int       `description:"公司id"`
+	CompanyName     string    `description:"公司名称"`
+	Content         string    `description:"内容"`
+	Title           string    `description:"标题"`
+}
+
+//添加留言
+func AddArticleComment(item *CygxArticleComment) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+type AddCygxArticleCommentReq struct {
+	ArticleId int    `description:"文章id"`
+	Content   string `description:"内容"`
+}
+
+//我的留言列表
+func GetCommentList(userId, startSize, pageSize int) (items []*CygxArticleComment, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			* 
+		FROM
+			cygx_article_comment AS c
+		WHERE
+			user_id = ? ORDER BY c.create_time DESC LIMIT ?,?  `
+
+	_, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+//我的留言列表
+func GetCommentListCount(userId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+			COUNT( 1 ) as count 
+		FROM
+			cygx_article_comment AS c
+		WHERE
+			user_id = ? ORDER BY c.create_time DESC  `
+
+	err = o.Raw(sql, userId).QueryRow(&count)
+	return
+}
+
+type CygxArticleCommentResp struct {
+	Id                int    `orm:"column(id);pk" description:"留言id"`
+	UserId            int    `description:"用户id"`
+	ArticleId         int    `description:"文章id"`
+	IndustryId        int    `description:"产业id"`
+	ActivityId        int    `description:"活动id"`
+	ChartPermissionId int    `description:"权限id"`
+	VideoId           int    `description:"视频id"`
+	CreateTime        string `description:"创建时间"`
+	Mobile            string `description:"手机号"`
+	Email             string `description:"邮箱"`
+	CompanyId         int    `description:"公司id"`
+	CompanyName       string `description:"公司名称"`
+	Content           string `description:"内容"`
+	Title             string `description:"标题"`
+	RedirectType      int    `description:"跳转类型 1文章 2活动音频 3产业视频 4活动视频"`
+}
+
+type CygxCommentListResp struct {
+	List   []*CygxArticleCommentResp
+	Paging *paging.PagingItem
+}

+ 22 - 0
models/company.go

@@ -192,3 +192,25 @@ func GetCompanyProductDetail(companyId, productId int) (item *CompanyProductDeti
 	err = o.Raw(sql, companyId, productId).QueryRow(&item)
 	return
 }
+
+type PermissionItem struct {
+	ChartPermissionId int    `description:"权限id"`
+	PermissionName    string `description:"权限名称"`
+	IsUpgrade         int    `description:"是否升级,1是,0否"`
+	Remark            string `description:"备注区分主观客观"`
+}
+
+func GetCompanyPermissionList(companyId int) (items []*PermissionItem, err error) {
+	sql := ` SELECT b.chart_permission_id,b.permission_name,b.remark,a.is_upgrade
+			FROM company_report_permission AS a
+			INNER JOIN chart_permission AS b ON a.chart_permission_id=b.chart_permission_id
+			INNER JOIN company_product AS c ON a.company_id=c.company_id AND a.product_id=c.product_id
+			WHERE  a.company_id=?
+			AND c.is_suspend=0
+            AND b.cygx_auth=1
+			AND c.status IN('正式','试用','永续')
+			AND a.status IN('正式','试用','永续')   ORDER BY b.sort ASC `
+	o := orm.NewOrm()
+	_, err = o.Raw(sql, companyId).QueryRows(&items)
+	return
+}

+ 2 - 0
models/db.go

@@ -53,6 +53,8 @@ func init() {
 		new(CygxActivityAppointment),
 		new(CygxActivityHelpAsk),
 		new(UserTemplateRecord),
+		new(CygxAdvice),
+		new(CygxPageHistoryRecord),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 30 - 14
models/micro_roadshow.go

@@ -15,20 +15,22 @@ type MicroRoadShowListResp struct {
 
 // MicroRoadShowPageList 微路演列表
 type MicroRoadShowPageList struct {
-	Id                     int    `description:"音视频ID"`
-	Title                  string `description:"标题"`
-	ResourceUrl            string `description:"链接"`
-	Type                   int    `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
-	PublishTime            string `description:"发布时间"`
-	BackgroundImg          string `description:"背景图"`
-	ShareImg               string `description:"分享封面图"`
-	ChartPermissionId      int    `description:"行业ID"`
-	ChartPermissionName    string `description:"行业名称"`
-	IndustryName           string `description:"产业名称"`
-	PlaySeconds            string `description:"音视频时长"`
-	ActivityId             int    `description:"活动ID"`
-	IndustrialManagementId int    `description:"产业ID"`
-	CreateTime             string `description:"视频创建时间"`
+	Id                     int       `description:"音视频ID"`
+	Title                  string    `description:"标题"`
+	ResourceUrl            string    `description:"链接"`
+	Type                   int       `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
+	PublishTime            string    `description:"发布时间"`
+	BackgroundImg          string    `description:"背景图"`
+	ShareImg               string    `description:"分享封面图"`
+	ChartPermissionId      int       `description:"行业ID"`
+	ChartPermissionName    string    `description:"行业名称"`
+	IndustryName           string    `description:"产业名称"`
+	PlaySeconds            string    `description:"音视频时长"`
+	ActivityId             int       `description:"活动ID"`
+	IsCollect              bool      `description:"是否收藏"`
+	IndustrialManagementId int       `description:"产业ID"`
+	CreateTime             string    `description:"视频创建时间"`
+	CollectTime            time.Time `description:"收藏时间"`
 	AuthInfo               *UserPermissionAuthInfo
 }
 
@@ -289,3 +291,17 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 	_, err = o.Raw(sql, pars, parsAct, parsAudio, startSize, pageSize).QueryRows(&list)
 	return
 }
+
+type MicroList []*MicroRoadShowPageList
+
+func (m MicroList) Len() int {
+	return len(m)
+}
+
+func (m MicroList) Less(i, j int) bool {
+	return m[i].CollectTime.After(m[j].CollectTime)
+}
+
+func (m MicroList) Swap(i, j int) {
+	m[i], m[j] = m[j], m[i]
+}

+ 44 - 0
models/page_history_record.go

@@ -0,0 +1,44 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxPageHistoryRecord struct {
+	Id                     int       `orm:"column(id);pk"`
+	UserId                 int       `description:"用户ID"`
+	CreateTime             time.Time `description:"创建时间"`
+	Mobile                 string    `description:"手机号"`
+	Email                  string    `description:"邮箱"`
+	CompanyId              int       `description:"公司id"`
+	CompanyName            string    `description:"公司名称"`
+	DetailId               string    `description:"详情ID"`
+	ChartPermissionId      int       `description:"行业ID"`
+	IndustrialManagementId string    `description:"产业ID"`
+	PageType               string    `description:"页面类型,纪要:Summary,纪要搜索:SummarySearch,报告:Report,报告搜索:ReportSearch,产业列表:IndustryList,活动:Activit,活动搜索:ActivitSearch,活动详情:ActivitParticulars,报告详情:ReportParticulars,已结束活动:OverActivity"`
+}
+
+type CygxPageHistoryRecordRep struct {
+	DetailId               string `description:"详情ID"`
+	ChartPermissionId      int    `description:"行业ID"`
+	IndustrialManagementId string `description:"产业ID"`
+	PageType               string `description:"页面类型,纪要:Summary,纪要搜索:SummarySearch,报告:Report,报告搜索:ReportSearch,产业列表:IndustryList,活动:Activit,活动搜索:ActivitSearch,活动详情:ActivitParticulars,报告详情:ReportParticulars , 我的日程:MySchedule, 更多标签:LabelMore , 文章复制:ArticleCopy"`
+}
+
+type CygxPageHistoryRecordHtgjRep struct {
+	DetailId               string `description:"详情ID"`
+	ChartPermissionId      int    `description:"行业ID"`
+	IndustrialManagementId string `description:"产业ID"`
+	CompanyCode            string `description:"机构编码"`
+	CompanyName            string `description:"机构名称"`
+	Email                  string `description:"机构邮箱"`
+	Sign                   string `description:"签名"`
+}
+
+//添加
+func AddCygxPageHistoryRecord(item *CygxPageHistoryRecord) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}

+ 20 - 0
models/report.go

@@ -394,3 +394,23 @@ func GetTimeLineReportIndustrialPublishdateList(industrialIdArr []int) (items []
 	_, err = o.Raw(sql, industrialIdArr).QueryRows(&items)
 	return
 }
+
+//报告榜单start
+type ArticleReportBillboardResp struct {
+	ArticleId      int    `description:"文章id"`
+	Title          string `description:"标题"`
+	PublishDate    string `description:"发布时间"`
+	PermissionName string `description:"行业名称"`
+	DepartmentId   int    `description:"作者Id"`
+	NickName       string `description:"作者昵称"`
+	IsCollect      bool   `description:"本人是否收藏"`
+	Pv             int    `description:"PV"`
+	CollectNum     int    `description:"收藏人数"`
+	Source         int    `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	List           []*IndustrialManagementIdInt
+}
+
+type ArticleReportBillboardLIstPageResp struct {
+	List   []*ArticleReportBillboardResp
+	Paging *paging.PagingItem
+}

+ 7 - 0
models/session.go

@@ -61,3 +61,10 @@ func BindSessionMobile(mobile, token string) (err error) {
 	_, err = o.Raw(sql, mobile, token).Exec()
 	return
 }
+
+//根据用户id和平台id获取用户关系
+func GetUserSessionByUserId(userId int) (item *CygxClptSession, err error) {
+	sql := `SELECT * FROM cygx_clpt_session WHERE user_id=? `
+	err = orm.NewOrm().Raw(sql, userId).QueryRow(&item)
+	return
+}

+ 87 - 6
models/user.go

@@ -1,6 +1,7 @@
 package models
 
 import (
+	"fmt"
 	"github.com/beego/beego/v2/client/orm"
 	"hongze/hongze_clpt/utils"
 	"time"
@@ -136,11 +137,15 @@ type LoginResp struct {
 }
 
 type UserDetailResp struct {
-	UserId      int    `description:"用户id"`
-	Headimgurl  string `description:"用户头像"`
-	Mobile      string `description:"手机号"`
-	Email       string `description:"邮箱"`
-	CompanyName string `description:"客户名称"`
+	UserId              int    `description:"用户id"`
+	UserName            string `description:"用户名称"`
+	Headimgurl          string `description:"用户头像"`
+	Mobile              string `description:"手机号"`
+	Email               string `description:"邮箱"`
+	CompanyName         string `description:"客户名称"`
+	OutboundMobile      string `description:"外呼手机号"`
+	OutboundCountryCode string `description:"外呼手机号区号"`
+	PermissionName      []string `description:"拥有权限分类"`
 }
 
 type CheckStatusResp struct {
@@ -174,7 +179,6 @@ type CountryCodeItem struct {
 type OutboundMobileItem struct {
 	OutboundMobile      string `description:"外呼手机号"`
 	OutboundCountryCode string `description:"外呼手机号区号"`
-	ActivityId          int    `description:"活动ID"`
 }
 
 type UserWhiteList struct {
@@ -295,3 +299,80 @@ func GetUserCompanyPermissionSand(companyId int) (items []*ChartPermissionResp,
 	_, err = o.Raw(sql, companyId).QueryRows(&items)
 	return
 }
+
+func AddOutboundMobile(item *OutboundMobileItem, userId int) (err error) {
+	o, err := orm.NewOrm().Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		fmt.Println(err)
+		if err == nil {
+			o.Commit()
+		} else {
+			o.Rollback()
+		}
+	}()
+	sql := `UPDATE wx_user SET outbound_mobile=? ,outbound_country_code = ?, is_msg_outbound_mobile= 1 WHERE user_id=? `
+	_, err = o.Raw(sql, item.OutboundMobile, item.OutboundCountryCode, userId).Exec()
+	if err != nil {
+		return
+	}
+	//if item.ActivityId > 0 {
+	//	sql = `UPDATE cygx_activity_signup SET outbound_mobile=? ,country_code = ?  WHERE user_id=? AND  activity_id = ?`
+	//	_, err = o.Raw(sql, item.OutboundMobile, item.OutboundCountryCode, userId, item.ActivityId).Exec()
+	//}
+	return
+}
+
+type Headimgurl struct {
+	Headimgurl string `description:"用户头像"`
+}
+
+//更改用户头像
+func UpdateUserHeadimgurl(headimgurl string, userId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE wx_user SET headimgurl = ? WHERE user_id=? `
+	_, err = o.Raw(sql, headimgurl, userId).Exec()
+	return
+}
+
+func GetArticleUserCollectCount(userId int) (count int, err error) {
+	sql := `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  `
+	err = orm.NewOrm().Raw(sql, userId).QueryRow(&count)
+	return
+}
+
+func GetArticleUserCollectList(startSize, pageSize, userId int) (items []*ArticleReportBillboardResp, err error) {
+	sql := `SELECT a.* FROM cygx_article_collect AS a INNER JOIN cygx_article as art ON art.article_id = a.article_id
+			WHERE a.user_id=? 
+           ORDER BY a.create_time DESC LIMIT ?,? `
+	_, err = orm.NewOrm().Raw(sql, userId, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+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  `
+	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
+			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)
+	return
+}
+
+func GetUserMicroRoadshowCollectList(userId int) (items []*CygxArticleCollect, err error) {
+	sql := `SELECT a.* FROM cygx_article_collect AS a 
+			WHERE a.user_id=?  
+			AND a.article_id =0 
+           ORDER BY a.create_time DESC `
+	_, err = orm.NewOrm().Raw(sql, userId).QueryRows(&items)
+	return
+}
+

+ 90 - 0
routers/commentsRouter.go

@@ -97,6 +97,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ActivityController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ActivityController"],
+        beego.ControllerComments{
+            Method: "ScheduleList",
+            Router: `/scheduleList`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ActivityController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ActivityController"],
         beego.ControllerComments{
             Method: "SignupAdd",
@@ -169,6 +178,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:AdviceController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:AdviceController"],
+        beego.ControllerComments{
+            Method: "ApplyApprove",
+            Router: `/add`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ArticleController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ArticleController"],
         beego.ControllerComments{
             Method: "AskAdd",
@@ -457,6 +475,69 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "AskList",
+            Router: `/ask/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "BrowseHistoryList",
+            Router: `/browse/history/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "CheckLogin",
+            Router: `/check/status`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "CollectList",
+            Router: `/collect/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "Mycollect",
+            Router: `/collect/microRoadShow`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "CommnetList",
+            Router: `/comment/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "AddOutboundMobile",
+            Router: `/countryCcode/addOutboundMobile`,
+            AllowHTTPMethods: []string{"POST"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"],
         beego.ControllerComments{
             Method: "Detail",
@@ -466,6 +547,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:UserController"],
+        beego.ControllerComments{
+            Method: "HeadimgurlUpdate",
+            Router: `/headimgurl/update`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:WechatCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:WechatCommonController"],
         beego.ControllerComments{
             Method: "WechatLogin",

+ 6 - 0
routers/router.go

@@ -96,6 +96,12 @@ func init() {
 				&controllers.ActivitySpecialController{},
 			),
 		),
+		web.NSNamespace("/advice",
+			web.NSInclude(
+				&controllers.AdviceController{},
+			),
+		),
+
 	)
 	web.AddNamespace(ns)
 }

+ 56 - 2
services/activity.go

@@ -459,7 +459,11 @@ func ActivityButtonShow(item *models.ActivityDetail, user *models.WxUserItem) (i
 			}
 		}
 	}
-
+	authInfo, permissionArr, e := GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+	if e != nil {
+		e = errors.New("获取用户权限失败, Err: " + e.Error())
+		return
+	}
 	v := articleDetail
 	itemActivity = &models.ActivityListResp{
 		ActivityId:              v.ActivityId,
@@ -515,7 +519,57 @@ func ActivityButtonShow(item *models.ActivityDetail, user *models.WxUserItem) (i
 		SourceType:              v.SourceType,
 		SignupNum:               v.SignupNum,
 		YidongActivityUrl:       yidongActivityUrl,
-		AuthInfo:                v.AuthInfo,
+		Explain:                 utils.ACtIVITY_SPECIAL_EXPLAIN,
+		TripImgLink:             v.TripImgLink,
+		Days:                    v.Days,
+	}
+	au := new(models.UserPermissionAuthInfo)
+	au.SellerName = authInfo.SellerName
+	au.SellerMobile = authInfo.SellerMobile
+	au.HasPermission = authInfo.HasPermission
+	au.OperationMode = authInfo.OperationMode
+	if au.HasPermission == 1 {
+		// 非宏观权限进一步判断是否有权限
+		if v.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, v.ChartPermissionName) {
+			au.HasPermission = 2
+		}
+	}
+
+	// 无权限的弹框提示
+	if au.HasPermission != 1 {
+		if au.OperationMode == UserPermissionOperationModeCall {
+			if v.FileType == 1 {
+				au.PopupMsg = UserPermissionPopupMsgCallMicroVoice
+			} else {
+				au.PopupMsg = UserPermissionPopupMsgCallMicroVideo
+			}
+		} else {
+			if v.FileType == 1 {
+				au.PopupMsg = UserPermissionPopupMsgApplyMicroVoice
+			} else {
+				au.PopupMsg = UserPermissionPopupMsgApplyMicroVideo
+			}
+		}
+	}
+	itemActivity.AuthInfo = au
+	//处理用户已经报名了的行程
+	var activityIds []int
+	activityIds = append(activityIds, v.ActivityId)
+	UserMap, e := GetSpecialTripUserMap(activityIds, user.UserId)
+	if e != nil {
+		e = errors.New("GetSpecialTripUserMap, Err: " + e.Error())
+		return
+	}
+	if _, ok := UserMap[v.ActivityId]; ok {
+		itemActivity.IsTrip = 1
+	}
+	if itemActivity.Days == 0 {
+		itemActivity.TripStatus = 1
+		//activityDetail.Explain = utils.ACtIVITY_SPECIAL_EXPLAIN
+	} else {
+		itemActivity.TripStatus = 2
+		//itemActivity.TripImgLink = itemActivity.TripImgLinkFix
+		//activityDetail.Explain = utils.ACtIVITY_SPECIAL_TRIP_EXPLAIN
 	}
 	return
 }

+ 113 - 0
services/activity_my_schedule.go

@@ -0,0 +1,113 @@
+package services
+
+import (
+	"errors"
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/utils"
+	"strconv"
+	"time"
+)
+
+//我的日程 GetScheduleAndSpecilList
+func GetScheduleAndSpecilList(user *models.WxUserItem, condition string, startSize, pageSize int) (items []*models.ActivityDetail, err error) {
+	var conditionSpecil string
+	var pars, parsSpecil []interface{}
+	condition += ` AND my.user_id = ?`
+	pars = append(pars, user.UserId)
+	conditionSpecil += ` AND my.user_id = ? AND my.is_cancel = 0 `
+	parsSpecil = append(parsSpecil, user.UserId)
+	list, e := models.GetScheduleAndSpecilList(condition, pars, conditionSpecil, parsSpecil, startSize, pageSize)
+	if e != nil {
+		err = errors.New("GetScheduleAndSpecilList, Err: " + e.Error())
+		return
+	}
+	var activityIds []int
+	var activitySpecilalIds []int
+	for k, v := range list {
+		if v.SourceType == 2 {
+			activitySpecilalIds = append(activitySpecilalIds, v.ActivityId)
+			//把专项调研的线下改为活动的线下类型
+			if v.ActivityType == 2 {
+				list[k].ActivityType = 0
+			}
+			list[k].IsShowSignup = true
+		} else {
+			activityIds = append(activityIds, v.ActivityId)
+		}
+	}
+	//处理活动
+	if len(activityIds) > 0 {
+		//处理用户是否报名
+		mapSignUp, e := GetActivitySignUpUserMap(activityIds, user)
+		if e != nil {
+			err = errors.New("GetActivitySignUpUserMap, Err: " + e.Error())
+			return
+		}
+		for k, v := range list {
+			if v.SourceType != 2 {
+				if _, ok := mapSignUp[v.ActivityId]; ok {
+					list[k].IsSignup = 1
+				}
+			}
+		}
+		//处理用户是否预约纪要
+		mapAppointment, e := GetActivityAppointmentUserMap(activityIds, user)
+		if e != nil {
+			err = errors.New("GetActivityAppointmentUserMap, Err: " + e.Error())
+			return
+		}
+		for k, v := range list {
+			if v.SourceType != 2 {
+				if _, ok := mapAppointment[v.ActivityId]; ok {
+					list[k].IsAppointment = 1
+				}
+			}
+		}
+		//处理用户是否预约会议提醒
+		mapReminder, e := GetActivityReminderUserMasp(activityIds, user)
+		if e != nil {
+			err = errors.New("GetActivityReminderUserMasp, Err: " + e.Error())
+			return
+		}
+		for k, v := range list {
+			if v.SourceType != 2 {
+				if _, ok := mapReminder[v.ActivityId]; ok {
+					list[k].IsCancelMeetingReminder = 1
+				}
+			}
+		}
+	}
+
+	//处理专项产业调研
+	if len(activitySpecilalIds) > 0 {
+		//处理用户是否报名
+		UserMap, e := GetSpecialTripUserMap(activitySpecilalIds, user.UserId)
+		if e != nil {
+			err = errors.New("GetSpecialTripUserMap, Err: " + e.Error())
+			return
+		}
+		for k, v := range list {
+			if v.SourceType == 2 {
+				if _, ok := UserMap[v.ActivityId]; ok {
+					list[k].IsSignup = 1
+				}
+			}
+		}
+
+		for k, v := range list {
+			if v.SourceType == 2 {
+				resultTimeStart := utils.StrTimeToTime(v.ActivityTime)  //时间字符串格式转时间格式
+				resultTimeEnd := utils.StrTimeToTime(v.ActivityTimeEnd) //时间字符串格式转时间格式
+				if resultTimeStart.After(time.Now()) {
+					list[k].ActiveState = strconv.Itoa(1)
+				} else if time.Now().After(resultTimeEnd) {
+					list[k].ActiveState = strconv.Itoa(3)
+				} else {
+					list[k].ActiveState = strconv.Itoa(2)
+				}
+			}
+		}
+	}
+	items = list
+	return
+}

+ 62 - 0
services/user.go

@@ -337,3 +337,65 @@ func BindSession(mobile, countryCode string) (wxUser *models.WxUserItem, err err
 	}
 	return
 }
+
+// 我的收藏
+func GetMicroRoadShowMycollect(pageSize, currentIndex int, audioIds, videoIds, activityVideoIds string) (respList []*models.MicroRoadShowPageList, total int, err error) {
+	var e error
+	// 根据每页数据量获取音视频配比
+	startSize := utils.StartIndex(currentIndex, pageSize)
+	videoList := make([]*models.MicroRoadShowPageList, 0)
+
+	//音频的查询
+	var audioCond string
+	var audioPars []interface{}
+	// 如果筛选条件为指定视频ID或只看视频则不做音频查询
+	// 活动已发布且已结束
+	audioCond += ` AND b.publish_status = 1 AND b.active_state = 3`
+	if audioIds != "" {
+		sliceId := strings.Split(audioIds, ",")
+		var idSqlStr string
+		for _, v := range sliceId {
+			idSqlStr += "'" + v + "',"
+		}
+		idSqlStr = strings.TrimRight(idSqlStr, ",")
+		audioCond += ` AND a.activity_voice_id IN (` + idSqlStr + `)`
+	} else {
+		audioCond += ` AND a.activity_voice_id = 0 `
+	}
+	//视频的处理
+	var videoCond string
+	var videoCondAct string
+	if activityVideoIds != "" {
+		sliceId := strings.Split(activityVideoIds, ",")
+		var idSqlStr string
+		for _, v := range sliceId {
+			idSqlStr += "'" + v + "',"
+		}
+		idSqlStr = strings.TrimRight(idSqlStr, ",")
+		videoCondAct += ` AND v.video_id IN (` + idSqlStr + `)`
+	} else {
+		videoCondAct += ` AND v.video_id  = 0 `
+	}
+	var videoPars []interface{}
+	var videoParsAct []interface{}
+	if videoIds != "" {
+		sliceId := strings.Split(videoIds, ",")
+		var idSqlStr string
+		for _, v := range sliceId {
+			idSqlStr += "'" + v + "',"
+		}
+		idSqlStr = strings.TrimRight(idSqlStr, ",")
+		videoCond += ` AND video_id IN (` + idSqlStr + `)`
+	} else {
+		videoCond += ` AND video_id  = 0 `
+	}
+	videoCond += ` AND publish_status = 1`
+
+	total, videoList, e = models.GetMicroRoadShowVideoPageListV8(startSize, pageSize, videoCond, videoPars, videoCondAct, videoParsAct, audioCond, audioPars, 0, 0, 0, 0)
+	if e != nil {
+		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
+		return
+	}
+	respList = videoList
+	return
+}

+ 15 - 0
utils/common.go

@@ -731,3 +731,18 @@ func GetLastMonthLastDay() time.Time {
 	nowMonthLastDay = time.Date(nowMonthLastDay.Year(), nowMonthLastDay.Month(), nowMonthLastDay.Day(), 23, 59, 59, 0, nowMonthLastDay.Location())
 	return nowMonthLastDay
 }
+
+//时间格式去掉时分秒
+func TimeRemoveHms2(strTime string) string {
+	var Ymd string
+	var resultTime = StrTimeToTime(strTime)
+	year := resultTime.Year()
+	month := resultTime.Format("01")
+	day1 := resultTime.Day()
+	if day1 < 10 {
+		Ymd = strconv.Itoa(year) + "-" + month + "-0" + strconv.Itoa(day1)
+	} else {
+		Ymd = strconv.Itoa(year) + "-" + month + "-" + strconv.Itoa(day1)
+	}
+	return Ymd
+}

+ 1 - 0
utils/constants.go

@@ -148,3 +148,4 @@ const (
 const (
 	SendTemplateMsgAuthorization = "dc855fce962a639faa779cbdd4cd332f"
 )
+