Sfoglia il codice sorgente

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into cygx_8.2

xingzai 2 anni fa
parent
commit
dd6a0647f9

+ 34 - 1
controllers/article.go

@@ -1223,7 +1223,7 @@ func (this *ArticleCommonController) DetailPublic() {
 		return
 	}
 	hasPermission := 0
-
+	uid := wxUser.UserId
 	detail, err := models.GetArticleDetailById(articleId)
 	if err != nil {
 		br.Msg = "获取信息失败"
@@ -1341,6 +1341,39 @@ func (this *ArticleCommonController) DetailPublic() {
 			detail.HttpUrl = utils.StrategyPlatform + strconv.Itoa(articleId) + "?token=" + chartUserTokenByMobile
 			detail.IsNeedJump = true
 		}
+		if detail.ArticleId < utils.SummaryArticleId {
+			chartUserTokenByMobile, _ := services.GetUserTokenByMobile(utils.HtgjPublicMobile)
+			detail.HttpUrl = utils.StrategyPlatform + strconv.Itoa(articleId) + "?token=" + chartUserTokenByMobile
+			detail.IsNeedJump = true
+		}
+		collectCount, err := models.GetArticleCollectCount(uid, articleId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已收藏失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if collectCount > 0 {
+			detail.IsCollect = true
+		}
+		interviewApplyItem, err := models.GetArticleInterviewApply(uid, articleId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if interviewApplyItem != nil && interviewApplyItem.InterviewApplyId > 0 {
+			detail.IsInterviewApply = true
+			detail.InterviewApplyStatus = interviewApplyItem.Status
+		}
+		articleFollowdetail, err := models.GetArticleFollowDetail(articleId, uid)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取关注信息失败,Err:" + err.Error()
+			return
+		}
+		detail.FollowNum = articleFollowdetail.DNum
+		detail.CollectionNum = articleFollowdetail.AcNum
+		resp.Detail = detail
 	}
 	resp.CompanyName = companyName
 	br.Ret = 200

+ 1084 - 0
controllers/htgj.go

@@ -0,0 +1,1084 @@
+package controllers
+
+import (
+	"encoding/json"
+	"github.com/medivhzhan/weapp/v2"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/services"
+	"hongze/hongze_cygx/utils"
+	"html"
+	"strconv"
+	"strings"
+	"time"
+)
+
+//type HtgjController struct {
+//	BaseAuthController
+//}
+
+type BaseHtgjController struct {
+	BaseCommonController
+}
+
+// @Title 首页列表接口(海通国际)
+// @Description 首页列表接口(海通国际)
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   ChartPermissionId   query   int  true       "品类id,最新传0"
+// @Param   CompanyCode     query string  false       "机构编号"
+// @Param   CompanyName     query string  false       "机构名称"
+// @Param   Email     query string  false       "邮箱"
+// @Param   Sign   query   string  false       "加密签名"
+// @Success 200 {object} models.HomeListResp
+// @router /home/listPublic [get]
+func (this *BaseHtgjController) ListHomePublic() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	companyCode := this.GetString("CompanyCode")
+	companyName := this.GetString("CompanyName")
+	email := this.GetString("Email")
+	sign := this.GetString("Sign")
+	var userType int
+	var err error
+	if companyCode != "" && companyName != "" && email != "" {
+		errMsg, errHt, wxUser, _ := services.CheckHtgj(companyCode, companyName, email, sign)
+		if errHt != nil {
+			br.Msg = "获取"
+			br.ErrMsg = "获取数据失败,Err:" + errHt.Error()
+			return
+		}
+		if errMsg != "" {
+			br.Msg = errMsg
+			return
+		}
+		user := wxUser
+		if user == nil {
+			br.Msg = "请登录"
+			br.ErrMsg = "请登录,用户信息为空"
+			br.Ret = 408
+			return
+		}
+		userType, _, err = services.GetUserType(user.CompanyId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+			return
+		}
+	}
+
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	chartPermissionId, _ := this.GetInt("ChartPermissionId")
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = paging.StartIndex(currentIndex, pageSize)
+	var condition string
+	var pars []interface{}
+	var total int
+	resp := new(models.HomeListResp)
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.HaveResearch = true
+	condition += ` AND is_summary = 1  `
+	if chartPermissionId > 0 {
+		categoryId, err := models.GetCategoryId(chartPermissionId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取分类权限信息失败,Err:" + err.Error()
+			return
+		}
+		categoryinfo, err := models.GetChartPermissionById(chartPermissionId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取信息失败,Err:" + err.Error()
+			return
+		}
+		if userType == 1 && strings.Contains(categoryinfo.PermissionName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+			resp.HaveResearch = false
+			resp.Paging = page
+			br.Ret = 200
+			br.Success = true
+			br.Msg = "获取成功"
+			br.Data = resp
+			return
+		}
+		page = paging.GetPaging(currentIndex, pageSize, total)
+		if categoryId != "" {
+			condition += ` AND category_id IN(` + categoryId + `)`
+			//condition += ` OR ( category_name  LIKE '%` + utils.CHART_PERMISSION_NAME_YANXUAN + `%' AND publish_status = 1 AND is_summary = 1 )`
+		} else {
+			condition += ` AND  category_name   LIKE '%` + utils.CHART_PERMISSION_NAME_YANXUAN + `%'`
+		}
+
+	}
+	//永续客户无法查看研选分类的内容
+	if userType == 1 {
+		condition += ` AND  category_name  NOT LIKE '%` + utils.CHART_PERMISSION_NAME_YANXUAN + `%'`
+	}
+	total, err = models.GetHomeCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.Msg = "获取帖子总数失败,Err:" + err.Error()
+		return
+	}
+	page = paging.GetPaging(currentIndex, pageSize, total)
+	list, err := models.GetHomeList(condition, pars, startSize, pageSize)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.Msg = "获取帖子数据失败,Err:" + err.Error()
+		return
+	}
+	for k, v := range list {
+		item := list[k]
+		//如果文章一开始的内容是图片,优先展示第一张图片
+		imgurl, _ := services.FixArticleImgUrl(html.UnescapeString(list[k].Body))
+		newBody, _ := services.GetReportContentTextSub(item.Body)
+		list[k].Body = newBody
+		if imgurl != "" {
+			list[k].BodyHtml = imgurl
+		}
+		list[k].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDateTimeNoSecond) //时间字符串格式转时间格式
+		if strings.Contains(item.CategoryName, utils.CHART_PERMISSION_NAME_YANXUAN) {
+			list[k].IsResearch = true
+		}
+		if list[k].ArticleId < utils.SummaryArticleId {
+			list[k].HttpUrl = utils.StrategyPlatform + strconv.Itoa(v.ArticleId)
+			list[k].IsNeedJump = true
+		}
+		if item.Pv > 999 {
+			list[k].Pv = 999
+		}
+	}
+	resp.List = list
+	resp.Paging = page
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 获取搜索推荐词
+// @Description 获取搜索推荐词
+// @Success 200 {object} models.ConfigResp
+// @router /home/detail [get]
+func (this *BaseHtgjController) BrowseHistoryList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	resp := new(models.ConfigResp)
+	detail := new(models.CygxConfig)
+	//configCode := "hot_search"
+	//detail, err := models.GetConfigByCode(configCode)
+	hotSearch, err := models.GetHotSearch()
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+
+	chartList, err := models.GetChartListConfig()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+		return
+	}
+	for _, v := range chartList {
+		item := new(models.KeyWord)
+		item.KeyWord = v.Title
+		resp.List = append(resp.List, item)
+	}
+
+	hotList, err := models.GetSearchKeyWordTop()
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+		return
+	}
+	for _, v := range hotList {
+		item := new(models.KeyWord)
+		item.KeyWord = v.KeyWord
+		resp.ListHot = append(resp.ListHot, item)
+	}
+	detail.ConfigValue = hotSearch
+	resp.Item = detail
+	br.Msg = "获取成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}
+
+// @Title 访谈申请(海通国际)
+// @Description 访谈申请(海通国际)
+// @Param	request	body models.ArticleInterviewApplyReqHtgj true "type json string"
+// @Success 200 {object} models.FontsCollectResp
+// @router /interview/apply [post]
+func (this *BaseHtgjController) InterviewApply() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	var req models.ArticleInterviewApplyReqHtgj
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	//articleId := req.ArticleId
+	companyCode := req.CompanyCode
+	companyName := req.CompanyName
+	wxuUserName := req.Email
+	sign := req.Sign
+	if companyCode == "" || companyName == "" || wxuUserName == "" || sign == "" {
+		br.Msg = "上传失败"
+		br.ErrMsg = "必填参数不能为空"
+		return
+	}
+	companyNameHt := companyCode + "_" + companyName
+	errMsg := services.CheckSign(companyCode+companyName+wxuUserName, sign)
+	if errMsg != "" {
+		br.Msg = errMsg
+		return
+	}
+	companyInfo, err := models.GetCompanyByThirdName(companyNameHt)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+		return
+	}
+	user, err := models.GetUserByThirdName(companyInfo.CompanyId, wxuUserName)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+		return
+	}
+	uid := user.UserId
+
+	article, err := models.GetArticleDetailById(req.ArticleId)
+	if err != nil {
+		br.Msg = "获取纪要失败!"
+		br.ErrMsg = "获取纪要失败,Err:" + err.Error()
+		return
+	}
+
+	count, err := models.GetArticleInterviewApplyCount(uid, req.ArticleId)
+	if err != nil {
+		br.Msg = "获取数据失败!"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	resp := new(models.ArticleInterviewApplyResp)
+	if count <= 0 {
+		item := new(models.CygxInterviewApply)
+		item.ArticleId = req.ArticleId
+		item.UserId = uid
+		item.CompanyId = user.CompanyId
+		item.Status = "待邀请"
+		item.Sort = 1
+		item.ArticleTitle = article.Title
+		item.CreateTime = time.Now()
+		item.ModifyTime = time.Now()
+		item.ArticleIdMd5 = article.ArticleIdMd5
+		_, err = models.AddCygxInterviewApply(item)
+		if err != nil {
+			br.Msg = "申请失败"
+			br.ErrMsg = "申请失败,Err:" + err.Error()
+			return
+		}
+		br.Msg = "申请成功"
+		resp.Status = 1
+		//发送模板消息
+		if user.CompanyId > 1 {
+			mobile := user.Mobile
+			if mobile == "" {
+				mobile = user.Email
+			}
+			sellerItem, _ := models.GetSellerByCompanyId(user.CompanyId)
+			if sellerItem != nil && sellerItem.AdminId > 0 && user.Mobile != "" {
+				openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
+				if openIpItem != nil && openIpItem.OpenId != "" {
+					go services.SendInterviewApplyTemplateMsg(user.RealName, sellerItem.CompanyName, mobile, article.Title, openIpItem)
+				}
+			}
+		}
+	} else {
+		err = models.RemoveArticleInterviewApply(uid, req.ArticleId)
+		if err != nil {
+			br.Msg = "取消申请失败"
+			br.ErrMsg = "取消申请失败,Err:" + err.Error()
+			return
+		}
+		br.Msg = "已取消申请"
+		resp.Status = 2
+		if user.CompanyId > 1 {
+			mobile := user.Mobile
+			if mobile == "" {
+				mobile = user.Email
+			}
+			sellerItem, _ := models.GetSellerByCompanyId(user.CompanyId)
+			if sellerItem != nil && sellerItem.AdminId > 0 && user.Mobile != "" {
+				openIpItem, _ := models.GetUserRecordByMobile(4, sellerItem.Mobile)
+				if openIpItem != nil && openIpItem.OpenId != "" {
+					go services.SendInterviewApplyCancelTemplateMsg(user.RealName, sellerItem.CompanyName, mobile, article.Title, openIpItem)
+				}
+			}
+		}
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}
+
+// @Title 收藏(海通国际)
+// @Description 收藏(海通国际)
+// @Param	request	body models.ArticleInterviewApplyReqHtgj true "type json string"
+// @Success 200 {object} models.FontsCollectResp
+// @router /collect [post]
+func (this *BaseHtgjController) ArticleCollect() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req models.ArticleInterviewApplyReqHtgj
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	articleId := req.ArticleId
+	companyCode := req.CompanyCode
+	companyName := req.CompanyName
+	wxuUserName := req.Email
+	sign := req.Sign
+	if companyCode == "" || companyName == "" || wxuUserName == "" || sign == "" {
+		br.Msg = "上传失败"
+		br.ErrMsg = "必填参数不能为空"
+		return
+	}
+	companyNameHt := companyCode + "_" + companyName
+	errMsg := services.CheckSign(companyCode+companyName+wxuUserName, sign)
+	if errMsg != "" {
+		br.Msg = errMsg
+		return
+	}
+	companyInfo, err := models.GetCompanyByThirdName(companyNameHt)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+		return
+	}
+	wxuser, err := models.GetUserByThirdName(companyInfo.CompanyId, wxuUserName)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+		return
+	}
+	uid := wxuser.UserId
+	user := new(models.WxUserItem)
+	user.Mobile = wxuser.Mobile
+	user.Email = wxuser.Email
+	user.CompanyId = wxuser.CompanyId
+	user.RealName = wxuser.RealName
+	user.CompanyName = companyInfo.CompanyName
+	detail, err := models.GetArticleDetailById(articleId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取信息失败,Err:" + err.Error()
+		return
+	}
+	count, err := models.GetArticleCollectCount(uid, articleId)
+	if err != nil {
+		br.Msg = "获取数据失败!"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	resp := new(models.ArticleCollectResp)
+	if count <= 0 {
+		item := new(models.CygxArticleCollect)
+		item.ArticleId = req.ArticleId
+		item.UserId = uid
+		item.CreateTime = time.Now()
+		item.Mobile = user.Mobile
+		item.Email = user.Email
+		item.CompanyId = user.CompanyId
+		item.CompanyName = user.CompanyName
+		item.RealName = user.RealName
+		_, err = models.AddCygxArticleCollect(item)
+		if err != nil {
+			br.Msg = "收藏失败"
+			br.ErrMsg = "收藏失败,Err:" + err.Error()
+			return
+		}
+		br.Msg = "收藏成功"
+		resp.Status = 1
+		// 文章收藏消息发送
+		go services.ArticleUserRemind(user, detail, 2)
+	} else {
+		err = models.RemoveArticleCollect(uid, articleId)
+		if err != nil {
+			br.Msg = "取消收藏失败"
+			br.ErrMsg = "取消收藏失败,Err:" + err.Error()
+			return
+		}
+		br.Msg = "已取消收藏"
+		resp.Status = 2
+	}
+	collectTotal, err := models.GetArticleCollectUsersCount(articleId)
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	resp.CollectCount = collectTotal
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}
+
+// @Title 文章带问(海通国际)
+// @Description 新增文章带问接口(海通国际)
+// @Param	request	body models.ArticleAskReqHtgj true "type json string"
+// @Success Ret=200 新增成功
+// @router /askAdd [post]
+func (this *BaseHtgjController) AskAdd() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req models.ArticleAskReqHtgj
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	articleId := req.ArticleId
+	companyCode := req.CompanyCode
+	companyName := req.CompanyName
+	wxuUserName := req.Email
+	content := req.Content
+	sign := req.Sign
+	if companyCode == "" || companyName == "" || wxuUserName == "" || sign == "" {
+		br.Msg = "上传失败"
+		br.ErrMsg = "必填参数不能为空"
+		return
+	}
+	companyNameHt := companyCode + "_" + companyName
+	errMsg := services.CheckSign(companyCode+companyName+wxuUserName, sign)
+	if errMsg != "" {
+		br.Msg = errMsg
+		return
+	}
+	companyInfo, err := models.GetCompanyByThirdName(companyNameHt)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+		return
+	}
+	wxuser, err := models.GetUserByThirdName(companyInfo.CompanyId, wxuUserName)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+		return
+	}
+
+	user := new(models.WxUserItem)
+	user.Mobile = wxuser.Mobile
+	user.Email = wxuser.Email
+	user.CompanyId = wxuser.CompanyId
+	user.RealName = wxuser.RealName
+	user.CompanyName = companyInfo.CompanyName
+
+	itemToken, err := services.WxGetToken()
+	if err != nil {
+		br.Msg = "GetWxAccessToken Err:" + err.Error()
+		return
+	}
+	if itemToken.AccessToken == "" {
+		br.Msg = "accessToken is empty"
+		return
+	}
+	commerr, err := weapp.MSGSecCheck(itemToken.AccessToken, content)
+	if err != nil {
+		br.Msg = "内容校验失败!"
+		br.ErrMsg = "内容校验失败,Err:" + err.Error()
+
+		return
+	}
+	if commerr.ErrCode != 0 {
+		br.Msg = "内容违规,请重新提交!"
+		br.ErrMsg = "颜文字内容违规,Err:" + commerr.ErrMSG
+		return
+	}
+	count, _ := models.GetArticleCountById(articleId)
+	if count == 0 {
+		br.Msg = "操作失败"
+		br.ErrMsg = "文章ID错误,不存在 articleId:" + strconv.Itoa(articleId)
+		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
+	}
+	item := new(models.CygxArticleAsk)
+	item.UserId = user.UserId
+	item.ArticleId = req.ArticleId
+	item.CompanyId = user.CompanyId
+	item.CompanyName = companyDetail.CompanyName
+	item.CreateTime = time.Now()
+	item.Mobile = user.Mobile
+	item.Email = user.Email
+	item.Content = content
+	_, err = models.AddArticleAsk(item)
+	if err != nil {
+		br.Msg = "提交失败"
+		br.ErrMsg = "提交失败,Err:" + err.Error()
+		return
+	}
+	companyItem, err := models.GetSellerDetailAllByCompanyId(user.CompanyId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取所属销售信息失败,Err:" + err.Error()
+		return
+	}
+	var mobile string
+	if utils.RunMode == "release" {
+		//mobile = utils.WxMsgTemplateIdAskMsgMobileAll + "," + companyItem.Mobile
+		mobile = utils.WxMsgTemplateIdAskMsgMobileAll
+	} else {
+		mobile = utils.WxMsgTemplateIdAskMsgMobile
+	}
+	openIdList, err := models.GetWxOpenIdByMobileList(mobile)
+	if err != nil {
+		br.Msg = "提交失败"
+		br.ErrMsg = "提交失败,Err:" + err.Error()
+		return
+	}
+	detail, err := models.GetArticleDetailById(articleId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取信息失败,Err:" + err.Error()
+		return
+	}
+	companyName = user.CompanyName + "-" + user.RealName + "(" + companyItem.SellerName + ")"
+	go services.SendWxMsgWithAsk(companyName, time.Now().Format(utils.FormatDateTime), content, detail.Title, openIdList, req.ArticleId)
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "提交成功"
+}
+
+// @Title 获取所有品种(无需token)
+// @Description 获取所有品种(无需token)
+// @Success 200 {object} models.ChartPermissionResp
+// @router /permission/allPublic [get]
+func (this *BaseHtgjController) PermissionPublic() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var condition string
+	list, err := models.GetChartPermissionAll(condition)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
+		return
+	}
+	resp := new(models.ChartPermissionResp)
+	for k, v := range list {
+		resp.List = append(resp.List, v)
+		if services.GetShowSustainable() && v.PermissionName == "研选" {
+			resp.List[k].IsShowSustainable = true
+		}
+	}
+	resp.List = list
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 上传文章阅读时间(无需token)
+// @Description 上传文章阅读时间接口(无需token)
+// @Param  request	body models.AddStopTimeHtgjRep true "type json string"
+// @Success 200 {object} models.ArticleDetailResp
+// @router /article/addStopTimePublic [post]
+func (this *BaseHtgjController) AddStopTimePublic() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	var req models.AddStopTimeHtgjRep
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	articleId := req.ArticleId
+	stopTime := req.StopTime
+	outType := req.OutType
+	source := req.Source
+	companyCode := req.CompanyCode
+	companyName := req.CompanyName
+	wxuUserName := req.Email
+	sign := req.Sign
+	if companyCode == "" || companyName == "" || wxuUserName == "" || sign == "" {
+		br.Msg = "上传失败"
+		br.ErrMsg = "必填参数不能为空"
+		return
+	}
+	companyNameHt := companyCode + "_" + companyName
+	errMsg := services.CheckSign(companyCode+companyName+wxuUserName, sign)
+	if errMsg != "" {
+		br.Msg = errMsg
+		return
+	}
+	companyInfo, err := models.GetCompanyByThirdName(companyNameHt)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+		return
+	}
+	user, err := models.GetUserByThirdName(companyInfo.CompanyId, wxuUserName)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+		return
+	}
+	uid := user.UserId
+	if articleId <= 0 {
+		br.Msg = "文章ID不存在"
+		br.ErrMsg = "参数错误"
+		return
+	}
+	if stopTime == 0 {
+		stopTime = 1
+	}
+	if outType != 2 {
+		outType = 1
+	}
+	if source != "PC" {
+		source = "MOBILE"
+	}
+	detail := new(models.ArticleDetail)
+	hasPermission := 0
+	hasFree := 0
+	//判断是否已经申请过
+	applyCount, err := models.GetApplyRecordCount(uid)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "判断是否已申请过试用失败,Err:" + err.Error()
+		return
+	}
+	//`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
+	if user.CompanyId > 1 {
+		companyPermission, err := models.GetCompanyPermission(user.CompanyId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		detail, err = models.GetArticleDetailById(articleId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取文章信息失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if companyPermission == "" {
+			if applyCount > 0 {
+				hasPermission = 5
+			} else {
+				hasPermission = 2
+			}
+			hasFree = 2
+			goto Loop
+		} else {
+			hasFree = 1
+			var articlePermissionPermissionName string
+			if detail.CategoryId > 0 {
+				articlePermission, err := models.GetArticlePermission(detail.CategoryId)
+				if err != nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+					return
+				}
+				if articlePermission == nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "报告权限不存在,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+					return
+				}
+				articlePermissionPermissionName = articlePermission.PermissionName
+			} else {
+				articlePermissionPermissionName = detail.CategoryName
+			}
+			var hasPersion bool
+			slice := strings.Split(articlePermissionPermissionName, ",")
+			for _, v := range slice {
+				if strings.Contains(companyPermission, v) {
+					hasPersion = true
+				}
+			}
+			if hasPersion {
+				detailNew, err := models.GetNewArticleHistoryRecord(uid, articleId)
+				if err == nil {
+					hasPermission = 1
+					historyRecord := new(models.AddStopTimeNewRep)
+					historyRecord.StopTime = detailNew.StopTime + stopTime
+					historyRecord.Id = detailNew.Id
+					historyRecord.OutType = outType
+					go models.UpdateArticleStopTime(historyRecord)
+				}
+
+				//不统计本公司的阅读记录、正常退出的不做时间差统计
+				if user.CompanyId != 16 && stopTime > 3 {
+					key := "CYGX_ARTICLE_PV" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid) + "_" + strconv.Itoa(user.CompanyId) + "_" + strconv.Itoa(outType)
+					record := new(models.CygxArticleHistoryRecordNewpv)
+					record.UserId = uid
+					record.ArticleId = articleId
+					record.CreateTime = time.Now().Add(-time.Second * time.Duration(stopTime))
+					record.ModifyTime = time.Now()
+					record.Mobile = user.Mobile
+					record.Email = user.Email
+					record.CompanyId = user.CompanyId
+					record.CompanyName = companyInfo.CompanyName
+					record.StopTime = stopTime
+					record.OutType = outType
+					record.Source = source
+					if !utils.Rc.IsExist(key) || outType != 2 {
+						//新增浏览记录
+						go models.AddCygxArticleViewRecordNewpv(record)
+						recordRedis := new(services.ReportViewRecord)
+						recordRedis.UserId = user.UserId
+						recordRedis.ReportId = articleId
+						recordRedis.Mobile = user.Mobile
+						recordRedis.Email = user.Email
+						recordRedis.RealName = user.RealName
+						recordRedis.CompanyName = companyName
+						recordRedis.CreateTime = time.Now().Add(-time.Second * time.Duration(stopTime))
+						go services.PushViewRecordNewRedisData(recordRedis, user.CompanyId)
+					} else {
+						go models.UpdateCygxArticleViewRecordNewpv(record, stopTime)
+					}
+					utils.Rc.Put(key, 1, 10*time.Minute)
+				}
+
+				models.ModifyReportLastViewTime(uid)
+			} else { //无该行业权限
+				hasPermission = 3
+			}
+		}
+	} else { //潜在客户
+		if applyCount > 0 {
+			hasPermission = 5
+		} else {
+			hasPermission = 4
+		}
+	}
+Loop:
+	resp := new(models.ArticleDetailAddStopTimeRep)
+	resp.HasPermission = hasPermission
+	resp.HasFree = hasFree
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "操作成功"
+	br.Data = resp
+}
+
+// @Title 获取报告详情(无需token)
+// @Description 获取报告详情接口
+// @Param   ArticleId   query   int  true       "报告ID"
+// @Param   CompanyCode     query string  false       "机构编号"
+// @Param   CompanyName     query string  false       "机构名称"
+// @Param   Email     query string  false       "邮箱"
+// @Param   Sign   query   string  false       "加密签名"
+// @Success 200 {object} models.ArticleDetailHtgjResp
+// @router /detailPublic [get]
+func (this *BaseHtgjController) DetailPublic() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	articleId, _ := this.GetInt("ArticleId")
+	companyCode := this.GetString("CompanyCode")
+	companyNameHt := this.GetString("CompanyName")
+	email := this.GetString("Email")
+	sign := this.GetString("Sign")
+	resp := new(models.ArticleDetailHtgjResp)
+	if companyCode == "" || email == "" {
+		resp.HasPermission = 2
+		br.Ret = 200
+		br.Success = true
+		br.Msg = "获取成功"
+		br.Data = resp
+		return
+	}
+	if articleId <= 0 {
+		br.Msg = "文章不存在"
+		br.ErrMsg = "文章不存在,文章ID错误"
+		return
+	}
+
+	errMsg, err, wxUser, companyName := services.CheckHtgj(companyCode, companyNameHt, email, sign)
+
+	if errMsg != "" {
+		br.Msg = errMsg
+		return
+	}
+	companyPermission, err := models.GetCompanyPermission(wxUser.CompanyId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户权限失败,Err:" + err.Error() + ";articleId" + strconv.Itoa(articleId)
+		return
+	}
+	hasPermission := 0
+	uid := wxUser.UserId
+	detail, err := models.GetArticleDetailById(articleId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取信息失败,Err:" + err.Error()
+		return
+	}
+	detail.Body = html.UnescapeString(detail.Body)
+	detail.Body = strings.Replace(detail.Body, "<p data-f-id=\"pbf\" style=\"text-align: center; font-size: 14px; margin-top: 30px; opacity: 0.65; font-family: sans-serif;\">Powered by <a href=\"https://www.froala.com/wysiwyg-editor?pb=1\" title=\"Froala Editor\">Froala Editor</a></p>", "", -1)
+	detail.Body = strings.Replace(detail.Body, "pre", "div", -1)
+	detail.Abstract, _ = services.GetReportContentTextSub(detail.Abstract)
+
+	var articlePermissionPermissionName string
+	if detail.CategoryId > 0 {
+		articlePermission, err := models.GetArticlePermission(detail.CategoryId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取报告权限失败,Err:" + err.Error() + strconv.Itoa(wxUser.UserId) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if articlePermission == nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "报告权限不存在,Err:" + strconv.Itoa(wxUser.UserId) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		articlePermissionPermissionName = articlePermission.PermissionName
+	} else {
+		articlePermissionPermissionName = detail.CategoryName
+	}
+	var hasPersion bool
+	slice := strings.Split(articlePermissionPermissionName, ",")
+	for _, v := range slice {
+		if strings.Contains(companyPermission, v) {
+			hasPersion = true
+		}
+	}
+	if hasPersion {
+		hasPermission = 1
+	}
+	if strings.Contains(detail.CategoryName, "研选") {
+		detail.IsResearch = true
+	}
+
+	resp.HasPermission = hasPermission
+	if hasPermission == 1 {
+		//获取销售手机号
+		sellerItem, err := models.GetSellerByCompanyId(wxUser.CompanyId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取销售数据失败2,Err:" + strconv.Itoa(wxUser.UserId) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if sellerItem != nil {
+			detail.SellerMobile = sellerItem.Mobile
+			detail.SellerName = sellerItem.RealName
+		}
+		sellerList, err := models.GetSellerList(articleId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取销售数据失败,Err:" + err.Error() + strconv.Itoa(wxUser.UserId) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if detail.ArticleId >= utils.SummaryArticleId && strings.Contains(detail.SellerAndMobile, "-") {
+			strnum := strings.Index(detail.SellerAndMobile, "-")
+			detail.SellerAndMobile = detail.SellerAndMobile[0:strnum]
+			if strnum > 0 {
+				nickName := detail.SellerAndMobile[0:strnum]
+				sellerAndMobile := &models.SellerRep{
+					SellerMobile: "",
+					SellerName:   nickName,
+				}
+				sellerList = append(sellerList, sellerAndMobile)
+			}
+		}
+		detail.SellerList = sellerList
+
+		historyRecord := new(models.CygxArticleHistoryRecord)
+		historyRecord.UserId = wxUser.UserId
+		historyRecord.ArticleId = articleId
+		historyRecord.CreateTime = time.Now()
+		historyRecord.Mobile = wxUser.Mobile
+		historyRecord.Email = wxUser.Email
+		historyRecord.CompanyId = wxUser.CompanyId
+		historyRecord.CompanyName = companyName
+		recordCount, _ := models.GetNoAddStoptimeArticleCount(wxUser.UserId, articleId)
+		if recordCount == 0 {
+			go models.AddCygxArticleHistoryRecord(historyRecord)
+		} else {
+			detailNew, err := models.GetNewArticleHistoryRecord(wxUser.UserId, articleId)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取信息失败,Err:" + err.Error()
+				return
+			}
+			if detailNew.StopTime > 0 {
+				go models.AddCygxArticleHistoryRecord(historyRecord)
+			}
+		}
+		key := "CYGX_ARTICLE_" + strconv.Itoa(articleId) + "_" + strconv.Itoa(wxUser.UserId)
+		if !utils.Rc.IsExist(key) {
+			//新增浏览记录
+			record := new(models.CygxArticleViewRecord)
+			record.UserId = wxUser.UserId
+			record.ArticleId = articleId
+			record.CreateTime = time.Now()
+			record.Mobile = wxUser.Mobile
+			record.Email = wxUser.Email
+			record.CompanyId = wxUser.CompanyId
+			record.CompanyName = companyName
+			go models.AddCygxArticleViewRecord(record)
+			utils.Rc.Put(key, 1, 5*time.Second)
+			models.ModifyReportLastViewTime(wxUser.UserId)
+		}
+		if detail.ArticleId < utils.SummaryArticleId {
+			chartUserTokenByMobile, _ := services.GetUserTokenByMobile(utils.HtgjPublicMobile)
+			detail.HttpUrl = utils.StrategyPlatform + strconv.Itoa(articleId) + "?token=" + chartUserTokenByMobile
+			detail.IsNeedJump = true
+		}
+		collectCount, err := models.GetArticleCollectCount(uid, articleId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已收藏失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if collectCount > 0 {
+			detail.IsCollect = true
+		}
+		interviewApplyItem, err := models.GetArticleInterviewApply(uid, articleId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "判断是否已申请访谈失败,Err:" + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
+			return
+		}
+		if interviewApplyItem != nil && interviewApplyItem.InterviewApplyId > 0 {
+			detail.IsInterviewApply = true
+			detail.InterviewApplyStatus = interviewApplyItem.Status
+		}
+		articleFollowdetail, err := models.GetArticleFollowDetail(articleId, uid)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取关注信息失败,Err:" + err.Error()
+			return
+		}
+		detail.FollowNum = articleFollowdetail.DNum
+		detail.CollectionNum = articleFollowdetail.AcNum
+		resp.Detail = detail
+		resp.Detail = detail
+	}
+	resp.CompanyName = companyName
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}
+
+// @Title 页面访问统计(无需token)
+// @Description 上传页面访问统计(无需token)
+// @Param	request	body models.CygxPageHistoryRecordHtgjRep true "type json string"
+// @Success Ret=200 新增成功
+// @router /pageHistoryPublic [post]
+func (this *BaseHtgjController) PageHistoryPublic() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	var req models.CygxPageHistoryRecordHtgjRep
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	companyCode := req.CompanyCode
+	companyName := req.CompanyName
+	wxuUserName := req.Email
+	sign := req.Sign
+	if companyCode == "" || companyName == "" || wxuUserName == "" || sign == "" {
+		br.Msg = "上传失败"
+		br.ErrMsg = "必填参数不能为空"
+		return
+	}
+	companyNameHt := companyCode + "_" + companyName
+	errMsg := services.CheckSign(companyCode+companyName+wxuUserName, sign)
+	if errMsg != "" {
+		br.Msg = errMsg
+		return
+	}
+	companyInfo, err := models.GetCompanyByThirdName(companyNameHt)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
+		return
+	}
+	user, err := models.GetUserByThirdName(companyInfo.CompanyId, wxuUserName)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "获取用户信息失败,Err:" + err.Error()
+		return
+	}
+	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 = companyName
+	item.DetailId = req.DetailId
+	item.ChartPermissionId = req.ChartPermissionId
+	item.IndustrialManagementId = req.IndustrialManagementId
+	item.PageType = "ArticleCopy"
+	_, err = models.AddCygxPageHistoryRecord(item)
+	if err != nil {
+		br.Msg = "记录信息失败"
+		br.ErrMsg = "新增访问记录失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "新增成功"
+}

+ 11 - 4
controllers/micro_roadshow.go

@@ -116,10 +116,17 @@ func (this *MicroRoadShowController) List() {
 			}
 		}
 		// 分享图
-		if list[i].Type == 1 {
-			list[i].ShareImg = audioShareMap[list[i].ChartPermissionId]
-		} else {
-			list[i].ShareImg = videoShareMap[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]
+			}
+		}
+
+		//修改产业视频的标题
+		if list[i].Type == 3 && list[i].IndustryName != ""{
+			list[i].Title = "5min"+"【"+ list[i].IndustryName +"】"+"逻辑解析"
 		}
 	}
 

+ 223 - 17
controllers/report.go

@@ -251,6 +251,55 @@ func (this *ReportController) IndustryList() {
 		topReadIndustryId = topReadIndustry.IndustrialManagementId
 	}
 
+	//查询产业视频
+	industrialVideoMap := make(map[int]*models.MicroVideoSimpleInfo)
+	var industrialManagementIds []int
+	for _, v := range list {
+		if v.IndustrialManagementId > 0 {
+			industrialManagementIds = append(industrialManagementIds, v.IndustrialManagementId)
+		}
+	}
+
+	// 用户权限
+	authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
+		return
+	}
+
+	if len(industrialManagementIds) > 0 {
+		// 获取默认图配置
+		_, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
+		if e != nil {
+			br.Msg = "获取视频默认配置图失败"
+			br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
+			return
+		}
+		videoList, err := models.GetMicroRoadshowVideoByIndustryIds(industrialManagementIds)
+		if err != nil {
+			br.Msg = "产业视频列表失败"
+			br.ErrMsg = "产业视频列表失败, Err: " + err.Error()
+			return
+		}
+		for _, v := range videoList {
+			tmp := &models.MicroVideoSimpleInfo{
+				Id:                  v.VideoId,
+				Title:               "5min逻辑【" + v.IndustryName + "】解析",
+				ResourceUrl:         v.VideoUrl,
+				BackgroundImg:       v.ImgUrl,
+				PlaySeconds:         v.VideoDuration,
+				DetailImgUrl:        v.DetailImgUrl,
+				ChartPermissionId:   v.ChartPermissionId,
+				ChartPermissionName: v.ChartPermissionName,
+			}
+			if tmp.BackgroundImg == "" {
+				tmp.BackgroundImg = videoMap[v.ChartPermissionId]
+			}
+			industrialVideoMap[v.IndustryId] = tmp
+		}
+	}
+
 	nowTime := time.Now().Local()
 	threeMonBefore := nowTime.AddDate(0, -3, 0)
 	for k, v := range list {
@@ -300,6 +349,35 @@ func (this *ReportController) IndustryList() {
 				list[k].IsNew = true
 			}
 		}
+
+		//展示产业视频
+		if video, ok := industrialVideoMap[v.IndustrialManagementId]; ok {
+			//控制用户权限
+			// 权限
+			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 video.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, video.ChartPermissionName) {
+					au.HasPermission = 2
+				}
+			}
+			// 无权限的弹框提示
+			if au.HasPermission != 1 {
+				if au.OperationMode == services.UserPermissionOperationModeCall {
+					au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
+				} else {
+					au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
+				}
+				video.ResourceUrl = ""
+			}
+			list[k].AuthInfo = au
+			list[k].IndustryVideo = video
+		}
+
 	}
 	//记录用户搜索的筛选条件
 	if orderColumnNew != "" {
@@ -381,17 +459,73 @@ func (this *ReportController) ArticleCategoryList() {
 			list[k].IsRed = true
 		}
 	}
-	//detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
-	//if err != nil {
-	//	br.Msg = "获取信息失败"
-	//	br.ErrMsg = "获取信息失败,Err:" + err.Error()
-	//	return
-	//}
+
+	// 用户权限
+	authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+	if e != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
+		return
+	}
+
+	videoSimple := new(models.MicroVideoSimpleInfo)
+	// 权限
+	var au *models.UserPermissionAuthInfo
+	video, err := models.GetMicroRoadshowVideoByIndustryId(industrialManagementId)
+	if err != nil {
+		if err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取产业视频失败"
+			br.ErrMsg = "获取产业视频失败,Err:" + err.Error()
+			return
+		}
+	} else {
+		videoSimple.Id = video.VideoId
+		videoSimple.Title = "5min逻辑【" + video.IndustryName + "】解析"
+		videoSimple.BackgroundImg = video.ImgUrl
+		videoSimple.DetailImgUrl = video.DetailImgUrl
+		if videoSimple.BackgroundImg == "" {
+			// 获取默认图配置
+			_, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
+			if e != nil {
+				br.Msg = "获取视频默认配置图失败"
+				br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
+				return
+			}
+			videoSimple.BackgroundImg = videoMap[video.ChartPermissionId]
+		}
+		videoSimple.PlaySeconds = video.VideoDuration
+		videoSimple.ResourceUrl = video.VideoUrl
+		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 video.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, video.ChartPermissionName) {
+				au.HasPermission = 2
+			}
+		}
+		// 无权限的弹框提示
+		if au.HasPermission != 1 {
+			if au.OperationMode == services.UserPermissionOperationModeCall {
+				au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
+			} else {
+				au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
+			}
+			videoSimple.ResourceUrl = ""
+		}
+	}
 	resp := new(models.IndustrialToArticleCategoryListRep)
 	resp.List = list
 	resp.LayoutTime = utils.TimeRemoveHms(detail.LayoutTime)
 	resp.IndustryName = detail.IndustryName
 	resp.IndustrialManagementId = industrialManagementId
+	resp.AuthInfo = au
+	if videoSimple.Id > 0 {
+		resp.IndustryVideo = videoSimple
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"
@@ -1223,17 +1357,18 @@ func (this *ReportController) IsShow() {
 	resp.ActivitySpecialExplain = utils.ACTIVITY_SPECIAL_EXPLAIN
 	//resp.YanXuan_Explain = true
 	resp.IsShowFreeButton = IsShowFreeButton
-	mobile := user.Mobile
-	if mobile == "" {
-		br.Ret = 200
-		br.Success = true
-		br.Data = resp
-		return
-	}
-	total, _ := models.GetUserIsAdminCount(mobile)
-	if total > 0 {
-		resp.IsShowList = true
-	}
+	//mobile := user.Mobile
+	//if mobile == "" {
+	//	br.Ret = 200
+	//	br.Success = true
+	//	br.Data = resp
+	//	return
+	//}
+	//total, _ := models.GetUserIsAdminCount(mobile)
+	//if total > 0 {
+	//	resp.IsShowList = true
+	//}
+	resp.IsShowList = true
 	resp.SearchTxtList.SummarySearch = "全局搜索"
 	resp.SearchTxtList.ReportSearch = "全局搜索"
 	resp.SearchTxtList.YanXuanSearch = "全局搜索"
@@ -2644,9 +2779,79 @@ func (this *ReportController) SearchReportAndResource() {
 			listYxResource[k].IsFollw = true
 		}
 		industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
+
 	}
 
 	if len(industrialIdArr) > 0 {
+		//查询产业视频
+		industrialVideoMap := make(map[int]*models.MicroVideoSimpleInfo)
+		// 获取默认图配置
+		_, videoMap, _, _, e := services.GetMicroRoadShowDefaultImgConfig()
+		if e != nil {
+			br.Msg = "获取视频默认配置图失败"
+			br.ErrMsg = "获取视频默认配置图失败, Err: " + e.Error()
+			return
+		}
+		videoList, err := models.GetMicroRoadshowVideoByIndustryIds(industrialIdArr)
+		if err != nil {
+			br.Msg = "产业视频列表失败"
+			br.ErrMsg = "产业视频列表失败, Err: " + err.Error()
+			return
+		}
+		for _, v := range videoList {
+			tmp := &models.MicroVideoSimpleInfo{
+				Id:                  v.VideoId,
+				Title:               "5min逻辑【" + v.IndustryName + "】解析",
+				ResourceUrl:         v.VideoUrl,
+				BackgroundImg:       v.ImgUrl,
+				PlaySeconds:         v.VideoDuration,
+				DetailImgUrl:        v.DetailImgUrl,
+				ChartPermissionName: v.ChartPermissionName,
+				ChartPermissionId:   v.ChartPermissionId,
+			}
+			if tmp.BackgroundImg == "" {
+				tmp.BackgroundImg = videoMap[v.ChartPermissionId]
+			}
+			industrialVideoMap[v.IndustryId] = tmp
+		}
+
+		//查询权限
+		// 用户权限
+		authInfo, permissionArr, e := services.GetUserRaiPermissionInfo(user.UserId, user.CompanyId)
+		if e != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取用户权限失败, Err: " + e.Error()
+			return
+		}
+
+		for k, v := range listHzResource {
+			//展示产业视频
+			if video, ok := industrialVideoMap[v.IndustrialManagementId]; ok {
+				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 video.ChartPermissionId != utils.HONG_GUAN_ID && !utils.InArrayByStr(permissionArr, video.ChartPermissionName) {
+						au.HasPermission = 2
+					}
+				}
+				// 无权限的弹框提示
+				if au.HasPermission != 1 {
+					if au.OperationMode == services.UserPermissionOperationModeCall {
+						au.PopupMsg = services.UserPermissionPopupMsgCallMicroVideo
+					} else {
+						au.PopupMsg = services.UserPermissionPopupMsgApplyMicroVideo
+					}
+					video.ResourceUrl = ""
+				}
+				listHzResource[k].AuthInfo = au
+				listHzResource[k].IndustryVideo = video
+			}
+		}
+
 		//合并产业关联的标的
 		listSubjcet, err = models.GetIndustrialSubjectAllByIndustrialId(industrialIdArr)
 		if err != nil {
@@ -2669,6 +2874,7 @@ func (this *ReportController) SearchReportAndResource() {
 				}
 			}
 		}
+
 	}
 
 	resp := new(models.SearchReportAndResourceResp)

+ 17 - 0
models/admin.go

@@ -0,0 +1,17 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+)
+
+type AdminMobileResp struct {
+	Mobile string `description:"手机号"`
+}
+
+// 获取销售所能查看到的手机号
+func GetAdminByRole() (items []*AdminMobileResp, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT mobile  FROM admin  WHERE role = 'admin' `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 3 - 3
models/article.go

@@ -44,6 +44,7 @@ type CygxArticle struct {
 	Stock            string `description:"个股标签"`
 	FieldName        string `description:"产业标签"`
 	Annotation       string `description:"核心观点"`
+	TypeName         string `description:"策略平台报告类型"`
 }
 
 type CygxArticleEs struct {
@@ -263,9 +264,8 @@ func GetArticleAll() (item []*ArticleDetail, err error) {
 }
 func GetArticleAllDate(endDate string) (item []*ArticleDetail, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_article WHERE is_summary=1 AND publish_date >= ? AND  article_id = 7297  `
-	sql = `SELECT * FROM cygx_article WHERE article_id = ?  `
-	_, err = o.Raw(sql, 7297).QueryRows(&item)
+	sql := `SELECT * FROM cygx_article WHERE is_summary=1 AND publish_date >= ?   `
+	_, err = o.Raw(sql, endDate).QueryRows(&item)
 	return
 }
 

+ 1 - 1
models/chart_permission.go

@@ -32,7 +32,7 @@ func GetChartPermissionAll(condition string) (items []*ChartPermission, err erro
 func GetCategoryId(chartPermissionId int) (category_id string, err error) {
 	o := orm.NewOrm()
 	sql := ` SELECT GROUP_CONCAT(a.category_id) AS category_id 
-			FROM cygx_permission_mapping AS a
+			FROM cygx_report_mapping AS a
 			WHERE a.chart_permission_id=? 
 			GROUP BY a.chart_permission_id `
 	err = o.Raw(sql, chartPermissionId).QueryRow(&category_id)

+ 18 - 0
models/htgj.go

@@ -0,0 +1,18 @@
+package models
+
+type ArticleInterviewApplyReqHtgj struct {
+	ArticleId   int    `description:"文章ID"`
+	CompanyCode string `description:"机构编码"`
+	CompanyName string `description:"机构名称"`
+	Email       string `description:"机构邮箱"`
+	Sign        string `description:"签名"`
+}
+
+type ArticleAskReqHtgj struct {
+	ArticleId   int    `description:"文章ID"`
+	Content     string `description:"内容"`
+	CompanyCode string `description:"机构编码"`
+	CompanyName string `description:"机构名称"`
+	Email       string `description:"机构邮箱"`
+	Sign        string `description:"签名"`
+}

+ 1 - 1
models/industrial_management.go

@@ -61,7 +61,7 @@ func GetIndustrialManagemenCountNoTop(sqlChartPermissionId string, uid int, cond
 func GetIndustrialManagementAll(uid int, condition, orderSrt string, startSize, pageSize int) (items []*IndustrialManagement, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-			man.*,
+			man.*,re.chart_permission_name as permission_name,
             MAX( art.publish_date ) AS update_time , MIN(art.publish_date) AS min_report_time,(
 			SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(uid) + ` AND rec.article_id = art.article_id ) AS readnum ,
 		    (SELECT COUNT( 1 )  FROM cygx_industry_fllow AS f WHERE f.user_id = ` + strconv.Itoa(uid) + ` AND f.industrial_management_id = man.industrial_management_id AND f.type = 1) AS is_follow

+ 25 - 152
models/micro_roadshow.go

@@ -3,6 +3,7 @@ package models
 import (
 	"github.com/beego/beego/v2/client/orm"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hongze_cygx/utils"
 	"time"
 )
 
@@ -17,122 +18,18 @@ type MicroRoadShowPageList struct {
 	Id                  int    `description:"音视频ID"`
 	Title               string `description:"标题"`
 	ResourceUrl         string `description:"链接"`
-	Type                int    `description:"类型: 1-音频; 2-视频"`
+	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"`
 	AuthInfo            *UserPermissionAuthInfo
 }
 
-// GetMicroRoadShowAudioPageList 获取微路演音频列表-分页
-func GetMicroRoadShowAudioPageList(startSize, pageSize int, condition string, pars []interface{}) (total int, list []*MicroRoadShowPageList, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-				a.activity_voice_id AS id,
-				a.voice_name AS title,
-				a.voice_url AS resource_url,
-				1 AS type,
-				b.activity_time AS publish_time,
-				b.chart_permission_id,
-				b.chart_permission_name,
-				a.voice_play_seconds AS play_seconds,
-				a.img_url AS background_img,
-				a.activity_id
-			FROM
-				cygx_activity_voice AS a
-			JOIN cygx_activity AS b ON a.activity_id = b.activity_id
-			WHERE 1 = 1 `
-	if condition != `` {
-		sql += condition
-	}
-	sql += ` ORDER BY publish_time DESC`
-
-	//totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
-	//err = o.Raw(totalSql, pars).QueryRow(&total)
-	//if err != nil {
-	//	return
-	//}
-
-	sql += ` LIMIT ?,?`
-	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
-	return
-}
-
-// GetMicroRoadShowAudioTotal 获取微路演音频数量
-func GetMicroRoadShowAudioTotal(condition string, pars []interface{}) (total int, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-				a.activity_id
-			FROM
-				cygx_activity_voice AS a
-			JOIN cygx_activity AS b ON a.activity_id = b.activity_id
-			WHERE 1 = 1 `
-	if condition != `` {
-		sql += condition
-	}
-	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
-	err = o.Raw(totalSql, pars).QueryRow(&total)
-	if err != nil {
-		return
-	}
-	return
-}
-
-// GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
-func GetMicroRoadShowVideoPageList(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}) (total int, list []*MicroRoadShowPageList, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-			video_id AS id,
-			video_name AS title,
-			video_url AS resource_url,
-			2 AS type,
-			publish_date AS publish_time,
-			chart_permission_id,
-			chart_permission_name,
-			video_duration AS play_seconds,
-			img_url AS background_img,
-			"" as  activity_id
-		FROM
-			cygx_micro_roadshow_video 
-		WHERE
-			publish_status = 1 `
-	if condition != `` {
-		sql += condition
-	}
-	sql += ` UNION ALL
-		SELECT
-			video_id AS id,
-			video_name AS title,
-			video_url AS resource_url,
-			2 AS type,
-		art.activity_time as publish_time,
-			art.chart_permission_id,
-			art.chart_permission_name,
-			"",
-			"",
-			v.activity_id
-		FROM
-			cygx_activity_video as v
-			INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1  `
-	if conditionAct != `` {
-		sql += conditionAct
-	}
-	sql += ` ORDER BY publish_time DESC`
-	//totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
-	//err = o.Raw(totalSql, pars, parsAct).QueryRow(&total)
-	//if err != nil {
-	//	return
-	//}
-
-	sql += ` LIMIT ?,?`
-	_, err = o.Raw(sql, pars, parsAct, startSize, pageSize).QueryRows(&list)
-	return
-}
-
 // GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
 func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId int) (total int, list []*MicroRoadShowPageList, err error) {
 	o := orm.NewOrm()
@@ -142,12 +39,14 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			video_id AS id,
 			video_name AS title,
 			video_url AS resource_url,
-			2 AS type,
+			3 AS type,
 			publish_date AS publish_time,
 			chart_permission_id,
 			chart_permission_name,
+            industry_name,
 			video_duration AS play_seconds,
 			img_url AS background_img,
+			share_img_url AS share_img,
 			"" as  activity_id
 		FROM
 			cygx_micro_roadshow_video 
@@ -173,6 +72,8 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			art.chart_permission_name,
 			"" AS play_seconds,
 			"" AS background_img,
+			"" AS share_img,
+			"" AS industry_name,
 			v.activity_id
 		FROM
 			cygx_activity_video as v
@@ -197,6 +98,8 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 			b.chart_permission_name,
 			a.voice_play_seconds AS play_seconds,
 			a.img_url AS background_img,
+			"" AS share_img,
+            "" AS industry_name,
 			a.activity_id 
 		FROM
 			cygx_activity_voice AS a
@@ -216,51 +119,6 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
 	return
 }
 
-// GetMicroRoadShowVideoTotal 获取微路演视频总量
-func GetMicroRoadShowVideoTotal(condition string, pars []interface{}, conditionAct string, parsAct []interface{}) (total int, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-			video_id AS id,
-			video_name AS title,
-			video_url AS resource_url,
-			2 AS type,
-			publish_date AS publish_time,
-			chart_permission_id,
-			chart_permission_name,
-			video_duration AS play_seconds,
-			img_url AS background_img,
-			"" as  activity_id
-		FROM
-			cygx_micro_roadshow_video 
-		WHERE
-			publish_status = 1 `
-	if condition != `` {
-		sql += condition
-	}
-	sql += ` UNION ALL
-		SELECT
-			video_id AS id,
-			video_name AS title,
-			video_url AS resource_url,
-			2 AS type,
-		art.activity_time as publish_time,
-			art.chart_permission_id,
-			art.chart_permission_name,
-			"",
-			"",
-			v.activity_id
-		FROM
-			cygx_activity_video as v
-			INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1  `
-	if conditionAct != `` {
-		sql += conditionAct
-	}
-	sql += ` ORDER BY publish_time DESC`
-	totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
-	err = o.Raw(totalSql, pars, parsAct).QueryRow(&total)
-	return
-}
-
 type AddVideoHistoryReq struct {
 	VideoId     int `description:"视频ID"`
 	PlaySeconds int `description:"播放时长"`
@@ -416,6 +274,7 @@ type MicroRoadshowVideo struct {
 	VideoUrl            string    `description:"视频地址"`
 	CreateTime          time.Time `description:"创建时间"`
 	ImgUrl              string    `description:"背景图链接"`
+	DetailImgUrl        string    `description:"产业详情页背景图"`
 }
 
 // GetMicroRoadshowVideoById 主键获取微路演视频
@@ -431,3 +290,17 @@ func UpdateCygxActivityVideoCounts(activityId int) (err error) {
 	_, err = o.Raw(sql, activityId).Exec()
 	return
 }
+
+// GetMicroRoadshowVideoByIndustryIds 根据行业ID查询产业视频列表
+func GetMicroRoadshowVideoByIndustryIds(industrialIdArr []int) (list []*MicroRoadshowVideo, err error) {
+	sql := `SELECT * FROM cygx_micro_roadshow_video WHERE industry_id in (` + utils.GetOrmInReplace(len(industrialIdArr)) + `)  and publish_status = 1 `
+	_, err = orm.NewOrm().Raw(sql, industrialIdArr).QueryRows(&list)
+	return
+}
+
+// GetMicroRoadshowVideoByIndustryId 根据行业ID查询产业视频列表
+func GetMicroRoadshowVideoByIndustryId(industryId int) (item *MicroRoadshowVideo, err error) {
+	sql := `SELECT * FROM cygx_micro_roadshow_video WHERE industry_id = ? and publish_status = 1`
+	err = orm.NewOrm().Raw(sql, industryId).QueryRow(&item)
+	return
+}

+ 26 - 10
models/report.go

@@ -10,6 +10,7 @@ import (
 type IndustrialManagementList struct {
 	Paging *paging.PagingItem
 	List   []*IndustrialManagement
+
 }
 
 type IndustrialManagement struct {
@@ -32,6 +33,19 @@ type IndustrialManagement struct {
 	IndustrialSubjectList  []*IndustrialSubject `description:"标的列表"`
 	ChartPermissionId      int                  `description:"行业ID"`
 	PermissionName         string               `description:"行业名称"`
+	IndustryVideo          *MicroVideoSimpleInfo
+	AuthInfo               *UserPermissionAuthInfo
+}
+
+type MicroVideoSimpleInfo struct {
+	Id                  int    `description:"视频ID"`
+	Title               string `description:"标题"`
+	ResourceUrl         string `description:"链接"`
+	BackgroundImg       string `description:"背景图"`
+	PlaySeconds         int    `description:"音视频时长"`
+	DetailImgUrl        string `description:"产业详情页背景图"`
+	ChartPermissionId   int    `description:"行业ID"`
+	ChartPermissionName string `description:"行业名称"`
 }
 
 type IndustrialAnalyst struct {
@@ -383,16 +397,18 @@ func GetArticleCollectionList(condition string, userId int) (items []*ArticleCol
 
 //用户收藏榜start
 type IndustrialManagementHotResp struct {
-	IndustrialManagementId int                  `orm:"column(industrial_management_id);pk" description:"产业id"`
-	IndustryName           string               `description:"产业名称"`
-	IsFollw                bool                 `description:"是否关注"`
-	FllowNum               int                  `description:"关注数量"`
-	IsNew                  bool                 `description:"是否新标签"`
-	IsHot                  bool                 `description:"是否新标签"`
-	PublishDate            string               `description:"发布时间"`
-	ArticleReadNum         int                  `description:"文章阅读数量"`
-	Source                 int                  `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
-	IndustrialSubjectList  []*IndustrialSubject `description:"标的列表"`
+	IndustrialManagementId int                   `orm:"column(industrial_management_id);pk" description:"产业id"`
+	IndustryName           string                `description:"产业名称"`
+	IsFollw                bool                  `description:"是否关注"`
+	FllowNum               int                   `description:"关注数量"`
+	IsNew                  bool                  `description:"是否新标签"`
+	IsHot                  bool                  `description:"是否新标签"`
+	PublishDate            string                `description:"发布时间"`
+	ArticleReadNum         int                   `description:"文章阅读数量"`
+	Source                 int                   `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	IndustrialSubjectList  []*IndustrialSubject  `description:"标的列表"`
+	IndustryVideo          *MicroVideoSimpleInfo `description:"产业视频"`
+	AuthInfo               *UserPermissionAuthInfo
 }
 
 type IndustrialManagementHotListResp struct {

+ 17 - 0
models/report_mapping.go

@@ -101,9 +101,11 @@ type IndustrialToArticleCategoryRep struct {
 }
 
 type IndustrialToArticleCategoryListRep struct {
+	AuthInfo               *UserPermissionAuthInfo
 	LayoutTime             string `description:"布局时间"`
 	IndustryName           string `description:"产业名称"`
 	IndustrialManagementId int    `description:"产业D"`
+	IndustryVideo          *MicroVideoSimpleInfo
 	List                   []*IndustrialToArticleCategoryRep
 }
 
@@ -224,3 +226,18 @@ func GetStatisticalReportArtilceExpert() (items []*ReportMappingStatistical, err
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+//通过分类ID获取详情 处理路演精华的映射
+func GetdetailByCategoryIdLyjh(categoryId int) (item *ReportMapping, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT
+	* 
+FROM
+	cygx_report_mapping 
+WHERE
+	sub_category_name = '路演精华' 
+	AND chart_permission_id = ( SELECT chart_permission_id FROM cygx_report_mapping WHERE category_id = ? ) 
+	LIMIT 1 `
+	err = o.Raw(sql, categoryId).QueryRow(&item)
+	return
+}

+ 0 - 1
models/seller.go

@@ -61,7 +61,6 @@ func GetSelleridWhichGroup(companyId, productId int) (adminId string, err error)
 			FROM
 			company_product AS a
 			INNER JOIN admin AS b ON a.seller_id = b.admin_id
-			INNER JOIN wx_user AS c ON b.mobile = c.mobile
 			WHERE
 			a.company_id = ?
 			AND a.product_id = ?

+ 2 - 0
models/tactics.go

@@ -72,6 +72,7 @@ type Tactics2 struct {
 	CategoryName    string    `description:"分类"`
 	SubCategoryName string    `description:"子级分类"`
 	CategoryId      int       `description:"分类id"`
+	CategoryIdTwo   int       `description:"分类id"`
 	CreateDate      string    `description:"创建日期"`
 	IsClass         int       `description:"是否归类,1是,0否"`
 	IsSummary       int       `description:"是否是纪要库,1是,0否"`
@@ -80,6 +81,7 @@ type Tactics2 struct {
 	Stock           string    `description:"个股标签"`
 	FieldName       string    `description:"产业标签"`
 	File            string    `description:"Pdf下载链接"`
+	TypeName        string    `description:"策略平台报告类型"`
 }
 
 func GetTacticsList2(endDate string) (list []*Tactics2, err error) {

+ 81 - 0
routers/commentsRouter.go

@@ -394,6 +394,87 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"],
+        beego.ControllerComments{
+            Method: "AddStopTimePublic",
+            Router: `/article/addStopTimePublic`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"],
+        beego.ControllerComments{
+            Method: "AskAdd",
+            Router: `/askAdd`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"],
+        beego.ControllerComments{
+            Method: "ArticleCollect",
+            Router: `/collect`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"],
+        beego.ControllerComments{
+            Method: "DetailPublic",
+            Router: `/detailPublic`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"],
+        beego.ControllerComments{
+            Method: "BrowseHistoryList",
+            Router: `/home/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"],
+        beego.ControllerComments{
+            Method: "ListHomePublic",
+            Router: `/home/listPublic`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"],
+        beego.ControllerComments{
+            Method: "InterviewApply",
+            Router: `/interview/apply`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"],
+        beego.ControllerComments{
+            Method: "PageHistoryPublic",
+            Router: `/pageHistoryPublic`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHtgjController"],
+        beego.ControllerComments{
+            Method: "PermissionPublic",
+            Router: `/permission/allPublic`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseSearchController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseSearchController"],
         beego.ControllerComments{
             Method: "SearchListPublic",

+ 5 - 0
routers/router.go

@@ -119,6 +119,11 @@ func init() {
 				&controllers.BaseYidongController{},
 			),
 		),
+		web.NSNamespace("/htgj",
+			web.NSInclude(
+				&controllers.BaseHtgjController{},
+			),
+		),
 		web.NSNamespace("/micro_roadshow",
 			web.NSInclude(
 				&controllers.MicroRoadShowController{},

+ 12 - 5
services/activity.go

@@ -683,9 +683,16 @@ func GetActivityonditionList(user *models.WxUserItem, activityTypeId, chartPermi
 		}
 	}
 
-	//弘则研究下的客户不做权限,限制
+	//弘则研究下的客户不做权限,限制,C类电话会,仅本组销售、部门管理员、admin、权益研究员账号能看到
 	if user.CompanyId == 16 {
-		conditionOr += ` OR (  art.publish_status = 1 ` + conditionHz + `) `
+		mapMobile, e := GetAdminMobileMap()
+		if e != nil {
+			err = e
+			return
+		}
+		if _, ok := mapMobile[user.Mobile]; ok {
+			conditionOr += ` OR (  art.publish_status = 1 ` + conditionHz + `) `
+		}
 	}
 
 	conditionActivity = condition + permissionSqlStr + sqlExport + conditionOr
@@ -1623,9 +1630,9 @@ func GetActivityVideoResp(mapActivityId []int) (mapItem map[int]*models.CygxActi
 	ativityVIdstr = strings.TrimRight(ativityVIdstr, ",")
 	condition += ` AND art.activity_id IN  (` + ativityVIdstr + `) `
 	var pars []interface{}
-	endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
-	condition += ` AND art.activity_time > ? `
-	pars = append(pars, endTime)
+	//endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
+	//condition += ` AND art.activity_time > ? `
+	//pars = append(pars, endTime)
 	videoList, e := models.GetActivityVideoListAll(condition, pars, 0, 1000)
 	if e != nil && e.Error() != utils.ErrNoRow() {
 		err = e

+ 17 - 0
services/admin.go

@@ -0,0 +1,17 @@
+package services
+
+import "hongze/hongze_cygx/models"
+
+func GetAdminMobileMap() (mapItem map[string]string, err error) {
+	adminList, e := models.GetAdminByRole()
+	if e != nil {
+		err = e
+		return
+	}
+	mapMobile := make(map[string]string)
+	for _, v := range adminList {
+		mapMobile[v.Mobile] = v.Mobile
+	}
+	mapItem = mapMobile
+	return
+}

+ 16 - 2
services/article.go

@@ -672,7 +672,7 @@ func GetArticleListByApi(cont context.Context) (err error) {
 }
 
 //func init() {
-//	HandleArticleListByApi(7507)
+//	HandleArticleListByApi(5978)
 //}
 
 //处理同步过来的文章
@@ -768,6 +768,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 		item.Annotation = articleResult.Content.Annotation
 		item.CategoryName = articleResult.Industry.Name
 		item.CategoryId = exitMap[articleResult.SeriesId]
+		item.CategoryIdTwo = exitMap[articleResult.SeriesId]
 		item.SubCategoryName = articleResult.Series.Name
 		if len(articleResult.Stock) > 0 {
 			var stock string
@@ -778,6 +779,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 			item.Stock = stock
 		}
 		item.FieldName = articleResult.Field.Name
+		item.TypeName = articleResult.Type.Name
 		list = append(list, item)
 		itemAuthor.ArticleId = articleResult.ArticleId
 		itemAuthor.Name = articleResult.Author.Name
@@ -894,6 +896,16 @@ func HandleArticleListByApi(artcleId int) (err error) {
 		if v.CategoryId == 80 {
 			titleNew = v.Title + utils.WeekByDate(v.PublishDate)
 		}
+
+		//类型是综述报告的,不区分是什么系列,统一归类到对应产业的路演精华
+		if articleResult.Type.Name == "综述报告" {
+			detailCategory, err := models.GetdetailByCategoryIdLyjh(v.CategoryIdTwo)
+			if err != nil && err.Error() != utils.ErrNoRow() {
+				return err
+			}
+			v.CategoryId = detailCategory.CategoryId
+		}
+
 		if count > 0 {
 			fmt.Println(k, v.ArticleId, "edit")
 			var isCustom bool
@@ -936,6 +948,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 			updateParams["Stock"] = v.Stock
 			updateParams["FieldName"] = v.FieldName
 			updateParams["Annotation"] = v.Annotation
+			updateParams["TypeName"] = v.TypeName
 			whereParam := map[string]interface{}{"article_id": v.ArticleId}
 			err = models.UpdateByExpr(models.CygxArticle{}, whereParam, updateParams)
 			if err != nil {
@@ -959,7 +972,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 			item.CategoryName = v.CategoryName
 			item.SubCategoryName = v.SubCategoryName
 			item.CategoryId = v.CategoryId
-			item.CategoryIdTwo = v.CategoryId
+			item.CategoryIdTwo = v.CategoryIdTwo
 			item.PublishStatus = 1
 			item.ExpertBackground = expertContentStr
 			item.ExpertNumber = expertNumStr
@@ -975,6 +988,7 @@ func HandleArticleListByApi(artcleId int) (err error) {
 			item.Stock = v.Stock
 			item.FieldName = v.FieldName
 			item.Annotation = v.Annotation
+			item.TypeName = v.TypeName
 			newId, err := models.AddCygxArticles(item)
 			if err != nil {
 				fmt.Println("AddCygxArticle Err:", err.Error())

+ 0 - 191
services/micro_roadshow.go

@@ -5,199 +5,8 @@ import (
 	"errors"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/utils"
-	"math"
-	"strconv"
-	"strings"
-	"sync"
-	"time"
 )
 
-// GetMicroRoadShowPageList 获取微路演列表
-func GetMicroRoadShowPageList(pageSize, currentIndex, audioId, videoId, activityVideoId int, keywords string) (respList []*models.MicroRoadShowPageList, total int, err error) {
-	var e error
-	// 根据每页数据量获取音视频配比
-	audioRatio, videoRatio, audioPageNum, videoPageNum, sliceNum, e := getMicroRoadShowDataRatio(pageSize)
-	if e != nil {
-		err = errors.New("获取微路演列表数据音视频配比失败, Err: " + e.Error())
-		return
-	}
-
-	audioTotal := 0
-	videoTotal := 0
-	audioList := make([]*models.MicroRoadShowPageList, 0)
-	videoList := make([]*models.MicroRoadShowPageList, 0)
-	if keywords != "" {
-		keywords = "%" + keywords + "%"
-	}
-	// 查询指定音频/视频时, 调整比例为1方便后面组合数据
-	if audioId > 0 || videoId > 0 || activityVideoId > 0 {
-		audioRatio = 1
-		videoRatio = 1
-	}
-
-	wg := sync.WaitGroup{}
-
-	wg.Add(2)
-
-	// 分页查询音频
-	go func() {
-		defer wg.Done()
-		// 如果筛选条件为指定视频ID则不做音频查询
-		if videoId > 0 || activityVideoId > 0 {
-			return
-		}
-		var audioCond string
-		var audioPars []interface{}
-		// 活动已发布且已结束
-		audioCond += ` AND b.publish_status = 1 AND b.active_state = 3`
-		//活动音频,设置有效时间为30天,失效后该活动就不再支持音频回放。有效期起始时间为活动的开始时间
-		endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
-		audioCond += ` AND b.activity_time > ? `
-		audioPars = append(audioPars, endTime)
-		if keywords != "" {
-			audioCond += ` AND a.voice_name LIKE ? OR b.label LIKE ?`
-			audioPars = append(audioPars, keywords, keywords)
-		}
-		if audioId > 0 {
-			audioCond += ` AND a.activity_voice_id = ?`
-			audioPars = append(audioPars, audioId)
-		}
-		audioStartSize := 0
-		if currentIndex > 1 {
-			audioStartSize = (currentIndex - 1) * audioPageNum
-		}
-		audioTotal, audioList, e = models.GetMicroRoadShowAudioPageList(audioStartSize, audioPageNum, audioCond, audioPars)
-	}()
-
-	// 分页查询视频
-	go func() {
-		defer wg.Done()
-		// 如果筛选条件为指定音频ID则不做视频查询
-		if audioId > 0 {
-			return
-		}
-
-		var videoCond string
-		var videoCondAct string
-		var videoPars []interface{}
-		var videoParsAct []interface{}
-		if keywords != "" {
-			videoCond += ` AND video_name LIKE ?`
-			videoPars = append(videoPars, keywords)
-
-			videoCondAct += ` AND video_name LIKE ?`
-			videoParsAct = append(videoParsAct, keywords)
-		}
-		if videoId > 0 {
-			videoCond += ` AND video_id = ?`
-			videoPars = append(videoPars, videoId)
-		}
-
-		if activityVideoId > 0 {
-			videoCondAct += ` AND video_id = ?`
-			videoParsAct = append(videoParsAct, activityVideoId)
-		}
-
-		//如果传了路演的或者活动的视频ID只查询一个
-		if videoId > 0 {
-			videoCondAct += ` AND video_id = 0 `
-		}
-		if activityVideoId > 0 {
-			videoCond += ` AND video_id = 0 `
-		}
-
-		endTime := time.Now().AddDate(0, 0, -30).Format("2006-01-02 15:04:05")
-		videoCondAct += ` AND art.activity_time > ? `
-		videoParsAct = append(videoParsAct, endTime)
-
-		videoCond += ` AND publish_status = 1`
-		videoStartSize := 0
-		if currentIndex > 1 {
-			videoStartSize = (currentIndex - 1) * videoPageNum
-		}
-		videoTotal, videoList, e = models.GetMicroRoadShowVideoPageList(videoStartSize, videoPageNum, videoCond, videoPars, videoCondAct, videoParsAct)
-	}()
-
-	wg.Wait()
-
-	if e != nil {
-		err = errors.New("获取微路演音视频列表失败, Err: " + e.Error())
-		return
-	}
-
-	// 按比例组合列表
-	audioNum := 0
-	videoNum := 0
-	audioLen := len(audioList)
-	videoLen := len(videoList)
-	for i := 0; i < sliceNum; i++ {
-		// 音频-每次取对应比例的数据直至取完
-		for a := 0; a < audioRatio; a++ {
-			if audioNum >= audioLen {
-				break
-			}
-			respList = append(respList, audioList[audioNum])
-			audioNum += 1
-		}
-		// 视频
-		for b := 0; b < videoRatio; b++ {
-			if videoNum >= videoLen {
-				break
-			}
-			respList = append(respList, videoList[videoNum])
-			videoNum += 1
-		}
-	}
-	total = audioTotal + videoTotal
-	return
-}
-
-// getMicroRoadShowDataRatio 获取微路演列表数据音视频配比
-func getMicroRoadShowDataRatio(pageSize int) (audioRatio, videoRatio, audioPageNum, videoPageNum, sliceNum int, err error) {
-	if pageSize <= 0 {
-		pageSize = utils.PageSize20
-	}
-	key := models.MicroRoadShowListDataRatioConfigKey
-	config, e := models.GetConfigByCode(key)
-	if e != nil && e.Error() != utils.ErrNoRow() {
-		err = errors.New("获取微路演列表数据量配置失败, Err: " + e.Error())
-		return
-	}
-
-	// 默认音频视频展示比例为4:1
-	ratio := "4:1"
-	if config != nil {
-		ratio = config.ConfigValue
-	}
-	ratioArr := strings.Split(ratio, ":")
-	if len(ratioArr) != 2 {
-		err = errors.New("微路演列表数据量配比有误")
-		return
-	}
-	audioRatio, e = strconv.Atoi(ratioArr[0])
-	if e != nil {
-		err = errors.New("微路演列表数据量配比有误")
-		return
-	}
-	videoRatio, e = strconv.Atoi(ratioArr[1])
-	if e != nil {
-		err = errors.New("微路演列表数据量配比有误")
-		return
-	}
-	totalRatio := audioRatio + videoRatio
-	if totalRatio == 0 {
-		err = errors.New("微路演列表数据量配比有误")
-		return
-	}
-
-	// 每比率对应数量(向上取整)
-	sliceNum = int(math.Ceil(float64(pageSize) / float64(totalRatio)))
-	audioPageNum = audioRatio * sliceNum
-	videoPageNum = videoRatio * sliceNum
-
-	return
-}
-
 // GetMicroRoadShowDefaultImgConfig 获取微路演默认图/分享图配置
 func GetMicroRoadShowDefaultImgConfig() (audioMap, videoMap, audioShareMap, videoShareMap map[int]string, err error) {
 	audioMap = make(map[int]string, 0)