Переглянути джерело

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into cygx_12.4

xingzai 1 рік тому
батько
коміт
2465c181b9

+ 2 - 1
controllers/banner.go

@@ -136,7 +136,8 @@ func (this *BannerController) ListYx() {
 			&models.BannerUrlYxResp{IndexImg: "https://hzstatic.hzinsights.com/banner/yx/2.png", Path: "pages-purchaser/survey/surveySubmit"},
 		}
 		listB = []*models.BannerUrlYxResp{
-			&models.BannerUrlYxResp{IndexImg: "https://hzstatic.hzinsights.com/banner/yx/3.png", Path: "pages-purchaser/researchList/researchList"},
+			&models.BannerUrlYxResp{IndexImg: "https://hzstatic.hzinsights.com/banner/yx/4_short.png", Path: "pages-purchaser/specialColumn/specialColumn"},
+			//&models.BannerUrlYxResp{IndexImg: "https://hzstatic.hzinsights.com/banner/yx/3.png", Path: "pages-purchaser/researchList/researchList"},
 		}
 	}
 

+ 6 - 0
controllers/report.go

@@ -283,6 +283,7 @@ func (this *ReportController) IndustryList() {
 // @Param   IndustrialManagementId   query   int  true       "产业ID"
 // @Param   ShowTimeLine   query   int  true       "是否展示时间线 0不展示,1展示"
 // @Param   IsSendWx   query   int  false       "是否是通过微信模版进来的 1是,其它否"
+// @Param   ChapterId   query   int  false       "晨会精华段落ID"
 // @Success 200 {object} models.IndustrialToArticleCategoryListRep
 // @router /toArticleCategoryList [get]
 func (this *ReportController) ArticleCategoryList() {
@@ -305,6 +306,7 @@ func (this *ReportController) ArticleCategoryList() {
 	}
 	showTimeLine, _ := this.GetInt("ShowTimeLine", 0)
 	isSendWx, _ := this.GetInt("IsSendWx")
+	chapterId, _ := this.GetInt("ChapterId")
 
 	detail, err := models.GetIndustrialManagementDetail(industrialManagementId)
 	if err != nil {
@@ -444,6 +446,10 @@ func (this *ReportController) ArticleCategoryList() {
 			timeLineItem.IsRed = true
 		}
 		list = append([]*models.IndustrialToArticleCategoryRep{&timeLineItem}, list...)
+
+		if chapterId > 0 && isSendWx == 1 {
+			go services.AddCygxMorningMeetingReviewChapterHistory(user, chapterId, "微信")
+		}
 	}
 
 	resp := new(models.IndustrialToArticleCategoryListRep)

+ 90 - 38
controllers/yanxuan_special.go

@@ -2,9 +2,11 @@ package controllers
 
 import (
 	"encoding/json"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/services"
 	"hongze/hongze_cygx/utils"
+	"strings"
 	"time"
 )
 
@@ -14,8 +16,10 @@ type YanxuanSpecialController struct {
 
 // @Title 专栏列表
 // @Description 专栏列表
-// @Param	request	body help_doc.AddHelpDocReq true "type json string"
-// @Success 200 {object} models.AddEnglishReportResp
+// @Param   UserId   query   int  true       "用户ID"
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.SpecialListResp
 // @router /list [get]
 func (this *YanxuanSpecialController) List() {
 	br := new(models.BaseResponse).Init()
@@ -30,33 +34,38 @@ func (this *YanxuanSpecialController) List() {
 		br.Ret = 408
 		return
 	}
-
 	userId, _ := this.GetInt("UserId", 0)
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	resp := new(models.SpecialListResp)
 	var condition string
 	var pars []interface{}
 
-	var specialUser *models.CygxYanxuanSpecialAuthorItem
-	var err error
 	if userId > 0 {
 		condition += ` AND a.user_id = ? `
 		pars = append(pars, userId)
 	}
-
-	cond := ``
-	cond += ` AND a.status = 1 `
-	specialUser, err = models.GetYanxuanSpecialAuthor(sysUser.UserId, sysUser.UserId, cond)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	condition += ` AND a.status = 3 `
+	total, err := models.GetCygxYanxuanSpecialCount(condition, pars)
+	if err != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败, Err:" + err.Error()
 		return
 	}
 
-	condition += ` AND a.status = 3 `
-
-	list, tmpErr := models.GetYanxuanSpecialList(sysUser.UserId, condition, pars)
-	if tmpErr != nil {
+	list, err := models.GetYanxuanSpecialList(sysUser.UserId, condition, pars, startSize, pageSize)
+	if err != nil {
 		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
+		br.ErrMsg = "获取失败, Err:" + err.Error()
 		return
 	}
 	for _, v := range list {
@@ -98,12 +107,13 @@ func (this *YanxuanSpecialController) List() {
 			v.Tags += v.IndustryTags
 		}
 	}
-	resp := new(models.SpecialListResp)
 
-	if specialUser != nil {
-		resp.IsAuthor = true
-	}
+	isAuthor, isImproveInformation := services.GetYanxuanSpecialAuthorInfo(sysUser) //用户是否没开通研选专栏以及,专栏信息是否完善
+	resp.IsAuthor = isAuthor
+	resp.IsImproveInformation = isImproveInformation
 	resp.List = list
+	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp.Paging = page
 
 	br.Data = resp
 	br.Ret = 200
@@ -113,7 +123,8 @@ func (this *YanxuanSpecialController) List() {
 
 // @Title 专栏详情
 // @Description 专栏详情
-// @Param	request	body help_doc.AddHelpDocReq true "type json string"
+// @Param   IsSendWx   query   int  false       "是否是通过微信模版进来的 1是,其它否"
+// @Param   Id   query   int  true       "详情ID"
 // @Success 200 {object} models.AddEnglishReportResp
 // @router /detail [get]
 func (this *YanxuanSpecialController) Detail() {
@@ -131,6 +142,7 @@ func (this *YanxuanSpecialController) Detail() {
 	}
 
 	specialId, _ := this.GetInt("Id", 0)
+	isSendWx, _ := this.GetInt("IsSendWx", 0)
 
 	if specialId <= 0 {
 		br.Msg = "参数错误"
@@ -149,6 +161,8 @@ func (this *YanxuanSpecialController) Detail() {
 	}
 
 	var resp models.CygxYanxuanSpecialResp
+
+	resp.HasPermission = 1
 	resp.CygxYanxuanSpecialItem = *item
 	if item.DocUrl != "" {
 		var docs []models.Doc
@@ -172,6 +186,26 @@ func (this *YanxuanSpecialController) Detail() {
 		resp.IndustryTags = append(resp.IndustryTags, item.IndustryTags)
 	}
 
+	//如果状态未审核通过,而且查看的不是本人,不是审核人员,就无法查看详情
+	var configCode string
+	configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
+	cnf, err := models.GetConfigByCode(configCode)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败, Err:" + err.Error()
+		return
+	}
+
+	if isSendWx == 1 && strings.Contains(cnf.ConfigValue, sysUser.Mobile) {
+		resp.IsShowExamine = true
+		resp.ExamineStatus = item.Status
+	}
+	resp.ExamineStatus = item.Status
+	if item.UserId != sysUser.UserId && item.Status != 3 && !strings.Contains(cnf.ConfigValue, sysUser.Mobile) {
+		resp.CygxYanxuanSpecialItem = *new(models.CygxYanxuanSpecialItem) // 如果内容不可见,就把内容置空
+		resp.HasPermission = 2
+	}
+
 	go services.AddSpecialRecord(this.User, specialId)
 
 	br.Data = resp
@@ -551,7 +585,7 @@ func (this *YanxuanSpecialController) Center() {
 	condition += ` AND a.status = ? `
 	pars = append(pars, status)
 
-	list, tmpErr := models.GetYanxuanSpecialList(sysUser.UserId, condition, pars)
+	list, tmpErr := models.GetYanxuanSpecialList(sysUser.UserId, condition, pars, 0, 0)
 	if tmpErr != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
@@ -559,17 +593,17 @@ func (this *YanxuanSpecialController) Center() {
 	}
 
 	for _, v := range list {
+		//如果在web端有样式或者上传了文件,小程序就禁止编辑修改内容
 		hasStyle, err := utils.ArticleHasStyle(v.Content)
 		if err != nil {
 			return
 		}
-		v.ContentHasStyle = hasStyle
 		hasImg, err := utils.ArticleHasImgUrl(v.Content)
 		if err != nil {
 			return
 		}
-		if hasImg {
-			v.ContentHasStyle = hasImg
+		if hasStyle || strings.Contains(v.DocUrl, "http") || hasImg {
+			v.ContentHasStyle = true
 		}
 	}
 
@@ -833,7 +867,8 @@ func (this *YanxuanSpecialController) Cancel() {
 
 // @Title 作者列表
 // @Description 作者列表
-// @Param	request	body help_doc.AddHelpDocReq true "type json string"
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Success 200 {object} models.AddEnglishReportResp
 // @router /author/list [get]
 func (this *YanxuanSpecialController) AuthorList() {
@@ -849,35 +884,52 @@ func (this *YanxuanSpecialController) AuthorList() {
 		br.Ret = 408
 		return
 	}
-	var specialUser *models.CygxYanxuanSpecialAuthorItem
-	var err error
 
-	cond := ``
-	cond += ` AND a.status = 1 `
-	specialUser, err = models.GetYanxuanSpecialAuthor(sysUser.UserId, sysUser.UserId, cond)
-	if err != nil && err.Error() != utils.ErrNoRow() {
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	var condition string
+	var pars []interface{}
+	condition += ` AND  a.nick_name <> ''   `
+
+	total, err := models.GetCygxYanxuanSpecialAuthorCount(condition, pars)
+	if err != nil {
 		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败, Err:" + err.Error()
+		br.ErrMsg = "获取失败Err:" + err.Error()
 		return
 	}
-
-	list, tmpErr := models.GetYanxuanSpecialAuthorList()
+	condition += `	ORDER BY latest_publish_time DESC`
+	list, tmpErr := models.GetYanxuanSpecialAuthorList(condition, pars, startSize, pageSize)
 	if tmpErr != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
 		return
 	}
 
+	var userIds []int
 	for _, v := range list {
 		v.LatestPublishDate = v.LatestPublishTime.Format(utils.FormatDate) + "更新"
+		userIds = append(userIds, v.UserId)
 	}
-	resp := new(models.SpecialAuthorListResp)
 
-	if specialUser != nil {
-		resp.IsAuthor = true
+	bestNew := services.GetBestNewYanxuanSpecialByUserId(userIds)
+	for _, v := range list {
+		v.YanxuanSpecialCenter = bestNew[v.UserId]
 	}
+	resp := new(models.SpecialAuthorListResp)
+	isAuthor, _ := services.GetYanxuanSpecialAuthorInfo(sysUser) //用户是否没开通研选专栏以及,专栏信息是否完善
+	resp.IsAuthor = isAuthor
+	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp.List = list
-
+	resp.Paging = page
 	br.Data = resp
 	br.Ret = 200
 	br.Success = true

+ 1 - 3
models/activity.go

@@ -879,11 +879,9 @@ GROUP BY
 func GetActivityMsgExport(activityId int) (item []*ActivityMsgExportRep, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
-			k.*,
-			u.real_name 
+			k.*
 			FROM
 			cygx_activity_help_ask AS k
-			LEFT JOIN wx_user AS u ON u.user_id = k.user_id 
 			WHERE
 			k.activity_id = ? 
 			GROUP BY

+ 2 - 1
models/activity_signup.go

@@ -147,8 +147,9 @@ func AddActivitySignupFromEmail(item *CygxActivitySignup) (lastId int64, err err
 	}()
 	var count int
 	var countMySchedule int
+	ow := orm.NewOrmUsingDB("weekly_report")
 	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.CountryCode, item.UserId).Exec()
+	_, err = ow.Raw(sql, item.OutboundMobile, item.CountryCode, item.UserId).Exec()
 	if err != nil {
 		return
 	}

+ 0 - 31
models/apply_record.go

@@ -41,37 +41,6 @@ type CygxApplyRecordResp struct {
 	ApplicationSource   string    `description:"申请来源"`
 }
 
-func AddApplyRecordold(item *ApplyTryReq, mobile, companyNamePay string, userId, companyIdPay, CompanyIdType int) (err error) {
-	o, err := orm.NewOrm().Begin()
-	if err != nil {
-		return
-	}
-	defer func() {
-		if err != nil {
-			o.Rollback()
-		} else {
-			o.Commit()
-		}
-	}()
-
-	sql := `INSERT INTO cygx_apply_record (user_id,business_card_url, real_name,company_name, mobile,create_time, apply_method,company_id_pay,company_name_pay,company_id_type)
-          VALUES(?,?,?,?,?,?,?,?,?,?) `
-	_, err = o.Raw(sql, userId, item.BusinessCardUrl, item.RealName, item.CompanyName, mobile, time.Now(), item.ApplyMethod, companyIdPay, companyNamePay, CompanyIdType).Exec()
-	if err != nil {
-		return
-	}
-	msql := `UPDATE  wx_user
-		SET
-		  note = ?,
-		  is_note = 1,
-		  apply_method = ?,
-          real_name=?,
-		  mobile=?
-		WHERE user_id = ? `
-	_, err = o.Raw(msql, item.CompanyName, item.ApplyMethod, item.RealName, mobile, userId).Exec()
-	return
-}
-
 func AddApplyRecord(item *CygxApplyRecord) (err error) {
 	o, err := orm.NewOrm().Begin()
 	if err != nil {

+ 34 - 8
models/cygx_yanxuan_special.go

@@ -2,6 +2,7 @@ package models
 
 import (
 	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"time"
 )
 
@@ -56,9 +57,12 @@ type CygxYanxuanSpecialItem struct {
 
 type CygxYanxuanSpecialResp struct {
 	CygxYanxuanSpecialItem
-	Docs         []Doc
-	CompanyTags  []string
-	IndustryTags []string
+	Docs          []Doc
+	CompanyTags   []string
+	IndustryTags  []string
+	HasPermission int  `description:"1:正常展示,2:不展示"`
+	ExamineStatus int  `description:"1:未发布,2:审核中 3:已发布 4:驳回"`
+	IsShowExamine bool `description:"是否展示审核状态按钮"`
 }
 
 type CygxYanxuanSpecialCenterResp struct {
@@ -103,7 +107,7 @@ type Doc struct {
 	DocIcon   string
 }
 
-func GetYanxuanSpecialList(userId int, condition string, pars []interface{}) (items []*CygxYanxuanSpecialCenterResp, err error) {
+func GetYanxuanSpecialList(userId int, condition string, pars []interface{}, startSize, pageSize int) (items []*CygxYanxuanSpecialCenterResp, err error) {
 	o := orm.NewOrm()
 	sql := ``
 	sql = `SELECT a.*,b.bg_img,b.head_img,b.introduction,b.label,b.mobile,b.nick_name,b.real_name,b.special_name,
@@ -116,7 +120,27 @@ JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id
 		sql += condition
 	}
 	sql += `ORDER BY a.publish_time DESC `
-	_, err = o.Raw(sql, userId, pars).QueryRows(&items)
+	if startSize+pageSize > 0 {
+		sql += ` LIMIT ?,? `
+		_, err = o.Raw(sql, userId, pars, startSize, pageSize).QueryRows(&items)
+	} else {
+		_, err = o.Raw(sql, userId, pars).QueryRows(&items)
+	}
+	return
+}
+
+func GetYanxuanSpecialListBycondition(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxYanxuanSpecialCenterResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT a.* FROM cygx_yanxuan_special AS a WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	if startSize+pageSize > 0 {
+		sql += ` LIMIT ?,? `
+		_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	} else {
+		_, err = o.Raw(sql, pars).QueryRows(&items)
+	}
 	return
 }
 
@@ -135,8 +159,10 @@ func EnableYanxuanSpecial(id, status int, reason string) (err error) {
 }
 
 type SpecialListResp struct {
-	List     []*CygxYanxuanSpecialCenterResp
-	IsAuthor bool
+	IsAuthor             bool               `description:"是否开通了研选专栏"`
+	IsImproveInformation bool               `description:"作者信息是否完善"`
+	Paging               *paging.PagingItem `description:"分页数据"`
+	List                 []*CygxYanxuanSpecialCenterResp
 }
 
 func GetYanxuanSpecialById(specialId, userId int) (item *CygxYanxuanSpecialItem, err error) {
@@ -257,7 +283,7 @@ JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id
 
 // 获取数量
 func GetCygxYanxuanSpecialCount(condition string, pars []interface{}) (count int, err error) {
-	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_yanxuan_special WHERE 1= 1  `
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_yanxuan_special as a  WHERE 1= 1  `
 	if condition != "" {
 		sqlCount += condition
 	}

+ 50 - 28
models/cygx_yanxuan_special_user.go

@@ -2,6 +2,7 @@ package models
 
 import (
 	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
 	"time"
 )
 
@@ -23,28 +24,36 @@ type CygxYanxuanSpecialAuthor struct {
 }
 
 type CygxYanxuanSpecialAuthorItem struct {
-	Id                int       `orm:"column(id);pk"`
-	UserId            int       // 用户ID
-	SpecialName       string    // 专栏名称
-	Introduction      string    // 介绍
-	Label             string    // 标签
-	NickName          string    // 昵称
-	RealName          string    // 姓名
-	CompanyName       string    // 公司名
-	Mobile            string    // 手机号
-	CreateTime        string    // 创建时间
-	ModifyTime        time.Time // 修改时间
-	HeadImg           string    // 头像
-	BgImg             string    // 背景图
-	BgImgDown         string    // 背景图下半部分
-	Status            int       // 1启用2禁用
-	CollectNum        int       // 被收藏数
-	FollowNum         int       // 被关注数
-	SpecialArticleNum int       // 文章数
-	LatestPublishTime time.Time // 最近更新时间
-	LatestPublishDate string    // 最近更新时间
-	IsFollow          int       // 是否已关注 1已关注 0 未关注
-	HasChangeHeadImg  int       // 是否更换过默认头像 1是,0否
+	Id                   int                                 `orm:"column(id);pk"`
+	UserId               int                                 // 用户ID
+	SpecialName          string                              // 专栏名称
+	Introduction         string                              // 介绍
+	Label                string                              // 标签
+	NickName             string                              // 昵称
+	RealName             string                              // 姓名
+	CompanyName          string                              // 公司名
+	Mobile               string                              // 手机号
+	CreateTime           string                              // 创建时间
+	ModifyTime           time.Time                           // 修改时间
+	HeadImg              string                              // 头像
+	BgImg                string                              // 背景图
+	BgImgDown            string                              // 背景图下半部分
+	Status               int                                 // 1启用2禁用
+	CollectNum           int                                 // 被收藏数
+	FollowNum            int                                 // 被关注数
+	SpecialArticleNum    int                                 // 文章数
+	LatestPublishTime    time.Time                           // 最近更新时间
+	LatestPublishDate    string                              // 最近更新时间
+	IsFollow             int                                 // 是否已关注 1已关注 0 未关注
+	HasChangeHeadImg     int                                 // 是否更换过默认头像 1是,0否
+	YanxuanSpecialCenter *CygxYanxuanSpecialCenterAuthorResp // 研选专栏文章内容
+}
+
+type CygxYanxuanSpecialCenterAuthorResp struct {
+	Id          int    //研选专栏ID
+	UserId      int    // 用户ID
+	PublishTime string // 提审过审或驳回时间
+	Title       string // 标题
 }
 
 func AddCygxYanxuanSpecialAuthor(item *CygxYanxuanSpecialAuthor) (lastId int64, err error) {
@@ -103,7 +112,18 @@ func UpdateYanxuanSpecialAuthor(item *CygxYanxuanSpecialAuthor) (err error) {
 	return
 }
 
-func GetYanxuanSpecialAuthorList() (items []*CygxYanxuanSpecialAuthorItem, err error) {
+// 获取数量
+func GetCygxYanxuanSpecialAuthorCount(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_yanxuan_special_author as  a  WHERE 1= 1  `
+	if condition != "" {
+		sqlCount += condition
+	}
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+func GetYanxuanSpecialAuthorList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxYanxuanSpecialAuthorItem, err error) {
 	o := orm.NewOrm()
 	sql := ``
 	sql = `SELECT
@@ -111,15 +131,17 @@ func GetYanxuanSpecialAuthorList() (items []*CygxYanxuanSpecialAuthorItem, err e
 	IFNULL(( SELECT publish_time FROM cygx_yanxuan_special WHERE user_id = a.user_id AND STATUS = 3 ORDER BY publish_time DESC LIMIT 1 ), a.modify_time) AS latest_publish_time
 FROM
 	cygx_yanxuan_special_author AS a
-WHERE
-	a.nick_name <> ''
-ORDER BY
-	latest_publish_time DESC `
-	_, err = o.Raw(sql).QueryRows(&items)
+WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
 	return
 }
 
 type SpecialAuthorListResp struct {
+	Paging   *paging.PagingItem `description:"分页数据"`
 	List     []*CygxYanxuanSpecialAuthorItem
 	IsAuthor bool
 }

+ 0 - 18
models/wx_user.go

@@ -390,24 +390,6 @@ type UserLabel struct {
 	Label string `description:"标签 多个用  , 隔开"`
 }
 
-// 对获取关注的产业
-func GetCygxCompanyUserListSplit(userIds string) (labels string, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT
-			(
-			SELECT
-				GROUP_CONCAT( DISTINCT man.industry_name SEPARATOR ',' ) 
-			FROM
-				cygx_industrial_management AS man 
-			WHERE
-				man.industrial_management_id IN ( SELECT industrial_management_id FROM cygx_industry_fllow AS f WHERE f.user_id = u.user_id  AND f.type = 1 ) 
-			) AS labels
-		FROM
-			wx_user AS u WHERE  u.user_id  = ? `
-	err = o.Raw(sql, userIds).QueryRow(&labels)
-	return
-}
-
 // 阅读记录
 type ArticlePvCountResp struct {
 	ArticleId int `description:"文章ID"`

+ 1 - 1
models/wx_user_white.go

@@ -60,6 +60,7 @@ func GetWxUserWhiteMobile() (mobileStr string, err error) {
 
 // 获取用户外呼手机号白名单
 func GetWxUserWhiteOutboundMobile() (mobileStr string, err error) {
+	o := orm.NewOrmUsingDB("weekly_report")
 	sql := ` SELECT
 			GROUP_CONCAT( DISTINCT u.outbound_mobile SEPARATOR ',' ) AS outboundmobileStr 
 			FROM
@@ -76,7 +77,6 @@ func GetWxUserWhiteOutboundMobile() (mobileStr string, err error) {
 				AND cp.status IN ( '正式', '试用' )
 				AND u.mobile != ''
 				AND u.mobile !=  u.outbound_mobile `
-	o := orm.NewOrmUsingDB("weekly_report")
 	err = o.Raw(sql).QueryRow(&mobileStr)
 	return
 }

+ 0 - 109
services/activity.go

@@ -1851,115 +1851,6 @@ func ActivityAttendanceDetail(cont context.Context) (err error) {
 	return
 }
 
-// 判断是否加入黑名单
-func AddCygxActivityRestrictSignupByAdmin111(activityId int) (err error) {
-	defer func() {
-		if err != nil {
-			fmt.Println(err)
-			go utils.SendAlarmMsg("判断是否加入黑名单记录失败"+err.Error(), 2)
-		}
-	}()
-	total, err := models.GetActivitySignupNomeetingCount(activityId)
-	if err != nil {
-		err = errors.New("GetActivitySignupNomeetingCount" + err.Error())
-		return err
-	}
-	if total == 0 {
-		return err
-	}
-	mobileList, _ := models.GetUserMeetingMobile(activityId)
-	if len(mobileList) >= 0 {
-		for _, v := range mobileList {
-			totalRestrict, err := models.GetRestrictSignupCountByUid(v.UserId)
-			if err != nil {
-				err = errors.New("GetRestrictSignupCountByUid" + err.Error())
-				return err
-			}
-			totalNomeet, err := models.GetActivitySignupNomeetingCountByUid(v.UserId)
-			if err != nil {
-				err = errors.New("GetActivitySignupNomeetingCountByUid" + err.Error())
-				return err
-			}
-			if totalRestrict > 0 && totalNomeet < 3 {
-				err = models.DeleteCygxActivityRestrictSignup(v.UserId)
-				if err != nil {
-					err = errors.New("DeleteCygxActivityRestrictSignup" + err.Error())
-					return err
-				}
-			}
-		}
-	}
-
-	list, err := models.GetActivitySignupNomeetingCountList(activityId)
-	if err != nil {
-		err = errors.New("GetActivitySignupNomeetingCountList" + err.Error())
-		return err
-	}
-	var items []*models.CygxActivitySignupBreak
-	for _, v := range list {
-		totalRestrict, err := models.GetRestrictSignupCountByUid(v.UserId)
-		if err != nil {
-			err = errors.New("GetRestrictSignupCountByUid" + err.Error())
-			return err
-		}
-		totalNomeet, err := models.GetActivitySignupNomeetingCountByUid(v.UserId)
-		if err != nil {
-			err = errors.New("GetActivitySignupNomeetingCountByUid" + err.Error())
-			return err
-		}
-		if totalNomeet >= 3 {
-			if totalRestrict == 0 {
-				infoUser, err := models.GetUserAndCompanyNameList(v.UserId)
-				//if err != nil && err.Error() != utils.ErrNoRow() {
-				if err != nil {
-					err = errors.New("GetUserAndCompanyNameList" + err.Error())
-					return err
-				}
-				if infoUser != nil {
-					item := new(models.CygxActivityRestrictSignup)
-					item.UserId = infoUser.UserId
-					item.CreateTime = time.Now()
-					item.Mobile = infoUser.Mobile
-					item.Email = infoUser.Email
-					item.CompanyId = infoUser.CompanyId
-					item.CompanyName = infoUser.CompanyName
-					item.IsRestrict = 1
-					err = models.AddCygxActivityRestrictSignup(item)
-					if err != nil {
-						err = errors.New("AddCygxActivityRestrictSignup" + err.Error())
-						return err
-					}
-				}
-			}
-		}
-
-		//处理未到会
-		item := new(models.CygxActivitySignupBreak)
-		item.UserId = v.UserId
-		item.ActivityId = v.ActivityId
-		item.CreateTime = time.Now()
-		item.Mobile = v.Mobile
-		item.Email = v.Email
-		item.CompanyId = v.CompanyId
-		item.CompanyName = v.CompanyName
-		item.RealName = v.RealName
-		item.SellerName = v.SellerName
-		items = append(items, item)
-	}
-
-	err = models.DeleteCygxActivitySignupBreakById(activityId)
-	if err != nil {
-		err = errors.New("DeleteCygxActivitySignupBreakById" + err.Error())
-		return
-	}
-	_, err = models.AddCygxActivitySignupBreakList(items)
-	if err != nil {
-		err = errors.New("AddCygxActivitySignupBreakList, Err: " + err.Error())
-		return
-	}
-	return
-}
-
 // 查研观向处理活动用户限制报名
 func AddCygxActivityRestrictSignupByAdmin(activityId int) (err error) {
 	defer func() {

+ 59 - 0
services/cygx_yanxuan_special.go

@@ -302,3 +302,62 @@ func UpdateYanxuanSpecialResourceData(sourceId int) {
 	}
 	return
 }
+
+// 获取研选专栏用户信息
+func GetYanxuanSpecialAuthorInfo(user *models.WxUserItem) (isAuthor, isImproveInformation bool) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg(fmt.Sprint("获取研选专栏用户信息失败,GetYanxuanSpecialAuthorInfo Err ", err, "userId", user.UserId), 2)
+		}
+	}()
+	var condition string
+	condition += ` AND a.status = 1 `
+	specialUser, e := models.GetYanxuanSpecialAuthor(user.UserId, user.UserId, condition)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetYanxuanSpecialAuthor, Err: " + e.Error())
+		return
+	}
+	if specialUser != nil {
+		isAuthor = true
+		//如果昵称 、专栏名称、简介 都不为空就表示信息完善
+		if specialUser.SpecialName != "" && specialUser.Introduction != "" && specialUser.NickName != "" {
+			isImproveInformation = true
+		}
+	}
+	return
+}
+
+// 获取专栏用户最新的一篇文章信息
+func GetBestNewYanxuanSpecialByUserId(userIds []int) (mapResp map[int]*models.CygxYanxuanSpecialCenterAuthorResp) {
+	lenArr := len(userIds)
+	if lenArr == 0 {
+		return
+	}
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg(fmt.Sprint("获取研选专栏用户信息失败,GetBestNewYanxuanSpecialByUserId Err ", err, "userIds", userIds), 2)
+		}
+	}()
+	var condition string
+	var pars []interface{}
+	condition += `  AND  a.publish_time = ( SELECT max( b.publish_time ) FROM cygx_yanxuan_special b WHERE a.user_id = b.user_id  AND b.STATUS = 3 )  AND user_id  IN (` + utils.GetOrmInReplace(lenArr) + `) AND a.status = 3  GROUP BY user_id ORDER BY publish_time DESC`
+	pars = append(pars, userIds)
+	list, e := models.GetYanxuanSpecialListBycondition(condition, pars, 0, lenArr)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetYanxuanSpecialListBycondition, Err: " + e.Error())
+		return
+	}
+	mapResp = make(map[int]*models.CygxYanxuanSpecialCenterAuthorResp, 0)
+	for _, v := range list {
+		item := new(models.CygxYanxuanSpecialCenterAuthorResp)
+		item.UserId = v.UserId
+		item.Id = v.Id
+		item.Title = v.Title
+		item.PublishTime = v.PublishTime
+		mapResp[v.UserId] = item
+	}
+	return
+}

+ 1 - 1
services/es_comprehensive.go

@@ -1437,7 +1437,7 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 		pars = make([]interface{}, 0)
 		condition = ` AND a.id IN (` + utils.GetOrmInReplace(lenyanxuanSpecialIds) + `) `
 		pars = append(pars, yanxuanSpecialIds)
-		listyanxuanSpecial, e := models.GetYanxuanSpecialList(user.UserId, condition, pars)
+		listyanxuanSpecial, e := models.GetYanxuanSpecialList(user.UserId, condition, pars, 0, 0)
 		if e != nil {
 			err = errors.New("GetYanxuanSpecialList, Err: " + e.Error())
 			return

+ 5 - 0
services/industrial_management.go

@@ -558,8 +558,13 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 		}
 	}
 
+	hotMapindustrial, err := IndustrialManagementHotMapGropuPermission()
+	if err != nil {
+		return
+	}
 	for k, v := range list {
 		list[k].UpdateTime = utils.TimeRemoveHms(mapUPdateTime[v.IndustrialManagementId])
+		list[k].IsHot = hotMapindustrial[v.IndustrialManagementId]
 		if userId > 0 {
 			//如果文章没有阅读,而且,文章的发布时间晚于项目的上线时间,而且文章的发布时间晚于用户的注册时间,就进行标红处理
 			if mapHistroyindustrialId[v.IndustrialManagementId] == 0 || timeLineRedMap[v.IndustrialManagementId] {

+ 1 - 1
services/resource_data.go

@@ -430,7 +430,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 		pars = make([]interface{}, 0)
 		condition = ` AND a.id IN (` + utils.GetOrmInReplace(lenyanxuanSpecialIds) + `) `
 		pars = append(pars, yanxuanSpecialIds)
-		listyanxuanSpecial, e := models.GetYanxuanSpecialList(user.UserId, condition, pars)
+		listyanxuanSpecial, e := models.GetYanxuanSpecialList(user.UserId, condition, pars, 0, 0)
 		if e != nil {
 			err = errors.New("GetYanxuanSpecialList, Err: " + e.Error())
 			return