Bläddra i källkod

Merge branch 'cygx_10.3' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 2 år sedan
förälder
incheckning
2e59c8a0ab

+ 191 - 0
controllers/morning_meeting.go

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

+ 162 - 0
controllers/product_interior.go

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

+ 90 - 0
models/cygx_morning_meeting_gather.go

@@ -0,0 +1,90 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"time"
+)
+
+type CygxMorningMeetingGather struct {
+	Id          int       `orm:"column(id);pk"`
+	MeetingIds  string    `description:"主表ID多个用 , 隔开"`
+	PublishTime string    `description:"发布日期"`
+	CreateTime  time.Time `description:"创建时间"`
+	ModifyTime  time.Time `description:"更新时间"`
+	Title       string    `description:"标题"`
+	Status      int       `description:"0:未发布,1:已发布"`
+}
+
+// 添加
+func AddCygxMorningMeetingGather(item *CygxMorningMeetingGather) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+func GetCygxMorningMeetingGatherCount(condition string, pars []interface{}) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS count FROM cygx_morning_meeting_gather WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	err = o.Raw(sql, pars).QueryRow(&count)
+	return
+}
+
+type CygxMorningMeetingGatherResp struct {
+	Id           int    `description:"ID"`
+	Title        string `description:"标题"`
+	IndustryName string `description:"多个产业名称"`
+}
+
+type CygxMorningMeetingGatherListResp struct {
+	Paging *paging.PagingItem `description:"分页数据"`
+	List   []*CygxMorningMeetingGatherResp
+}
+
+// 列表
+func GetCygxMorningMeetingGatherList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxMorningMeetingGather, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_morning_meeting_gather WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+func GetCygxMorningMeetingGatherById(condition string, pars []interface{}) (item *CygxMorningMeetingGather, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_morning_meeting_gather WHERE  1= 1`
+	if condition != "" {
+		sql += condition
+	}
+	err = o.Raw(sql, pars).QueryRow(&item)
+	return
+}
+
+type CygxMorningMeetingGatherDetailListResp struct {
+	Id                  int    `description:"ID"`
+	IndustryId          int    `description:"产业id"` // 产业id
+	IndustryName        string `description:"产业名称"` // 产业名称
+	ChartPermissionName string `description:"行业名称"` // 行业名称
+	ChartPermissionId   int    `description:"行业id"` // 行业id
+	MeetingId           int    `description:"主表id"` // 主表id
+	Content             string `description:"内容"`   // 内容
+}
+
+type CygxMorningMeetingGatherDetailResp struct {
+	HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	Detail        *CygxMorningMeetingGatherDetail
+}
+
+type CygxMorningMeetingGatherDetail struct {
+	Id          int    `description:"ID"`
+	Title       string `description:"标题"`
+	PublishTime string `description:"发布日期"`
+	Department  string `description:"作者"`
+	List        []*CygxMorningMeetingGatherDetailListResp
+}

+ 10 - 57
models/cygx_morning_meeting_review_chapter.go

@@ -38,18 +38,14 @@ type AddMorningMeetingReviewsReq struct {
 	DoType      int `description:"操作类型 0,保存 、1,发布"`
 }
 
-//添加晨报点评章节
-func AddCygxMorningMeetingReviewChapter(item *CygxMorningMeetingReviewChapter) (err error) {
+// 列表
+func GetCygxMorningMeetingReviewChapterList(condition string, pars []interface{}) (items []*CygxMorningMeetingReviewChapter, err error) {
 	o := orm.NewOrm()
-	_, err = o.Insert(item)
-	return
-}
-
-//列表
-func GetCygxMorningMeetingReviewsListById(meetingId int) (items []*CygxMorningMeetingReviewChapter, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE meeting_id = ? `
-	_, err = o.Raw(sql, meetingId).QueryRows(&items)
+	sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE 1 = 1 `
+	if condition != "" {
+		sql += condition
+	}
+	_, err = o.Raw(sql, pars).QueryRows(&items)
 	return
 }
 
@@ -74,51 +70,8 @@ type CygxMorningMeetingReviewChapterRespItem struct {
 
 type CygxMorningMeetingReviewChapterResp struct {
 	MeetingTime string
-	Status int
-	List []*CygxMorningMeetingReviewChapterRespItem
-}
-
-//删除晨会点评章节
-func DeleteMorningMeetingChapter(reviewId int) (err error) {
-	o := orm.NewOrm()
-	sql := ` DELETE FROM cygx_morning_meeting_review_chapter WHERE meeting_id =? `
-	_, err = o.Raw(sql, reviewId).Exec()
-	return
-}
-
-//更新晨报点评章节
-func UpdateCygxMorningMeetingReviewChapter(item *CygxMorningMeetingReviewChapter) (err error) {
-	o := orm.NewOrm()
-	sql := `UPDATE cygx_morning_meeting_review_chapter
-			SET
-			  meeting_time =?,
-			  modify_time = ?,
-			  industry_id = ?,
-			  industry_name = ?,
-			  chart_permission_id = ?,
-			  chart_permission_name = ?,
-			  industrial_subject_ids = ?,
-			  content = ? 
-			WHERE id = ? `
-	_, err = o.Raw(sql, item.MeetingTime, item.ModifyTime, item.IndustryId, item.IndustryName,
-		item.ChartPermissionId, item.ChartPermissionName, item.IndustrialSubjectIds, item.Content, item.Id).Exec()
-
-	return
-}
-
-func GetCygxMorningMeetingReviewsListByIdAndIndustryId(meetingId,  industryId int) (item *CygxMorningMeetingReviewChapter, err error) {
-	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE meeting_id = ? AND industry_id = ? `
-	err = o.Raw(sql, meetingId, industryId).QueryRow(&item)
-	return
-}
-
-//删除晨会点评章节
-func DeleteMorningMeetingChapterById(chapterId int) (err error) {
-	o := orm.NewOrm()
-	sql := ` DELETE FROM cygx_morning_meeting_review_chapter WHERE id =? `
-	_, err = o.Raw(sql, chapterId).Exec()
-	return
+	Status      int
+	List        []*CygxMorningMeetingReviewChapterRespItem
 }
 
 func GetCygxMorningMeetingReviewsListByIndustrialIds(industrialIds string) (items []*CygxMorningMeetingReviewChapter, err error) {
@@ -126,4 +79,4 @@ func GetCygxMorningMeetingReviewsListByIndustrialIds(industrialIds string) (item
 	sql := `SELECT * FROM cygx_morning_meeting_review_chapter WHERE industry_id IN (` + industrialIds + `)  `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
-}
+}

+ 2 - 0
models/db.go

@@ -135,6 +135,8 @@ func init() {
 		new(CygxXzsChooseCategory),
 		new(CygxReportSelectionSubjectHistory),
 		new(CygxTacticsTimeLineHistory),
+		new(CygxProductInteriorHistory),
+		new(CygxMorningMeetingGather),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 4 - 0
models/industrial_management.go

@@ -220,6 +220,10 @@ type IndustrialManagementId struct {
 	IndustrialManagementId string `description:"产业Id"`
 }
 
+type IndustrialManagementName struct {
+	IndustryName string `description:"产业名称"`
+}
+
 // 获取归类产业报告数量大于10的
 func GetIndustrialMorethan10() (items []*IndustrialManagementId, err error) {
 	o := orm.NewOrm()

+ 156 - 0
models/product_interior.go

@@ -0,0 +1,156 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"time"
+)
+
+type CygxProductInterior struct {
+	ProductInteriorId int       `orm:"column(product_interior_id);pk"`
+	ColumnName        string    `description:"栏目名称"`
+	Title             string    `description:"标题"`
+	PublishTime       time.Time `description:"发布日期"`
+	CreateTime        time.Time `description:"创建时间"`
+	ModifyTime        time.Time `description:"更新时间"`
+	Status            int       `description:"0:未发布,1:已发布"`
+	Body              string    `description:"内容"`
+	IsCancel          int       `description:"是否取消,1是,0否"`
+	VisibleRange      int       `description:"设置可见范围1全部,0内部"`
+	Abstract          string    `description:"摘要"`
+	Department        string    `description:"作者"`
+	AdminId           int       `description:"管理员ID"`
+}
+
+type AddProductInteriorReq struct {
+	ProductInteriorId int    `description:"ID"`
+	DoType            int    `description:"操作类型 0,保存 、1,发布"`
+	ColumnName        string `description:"栏目名称"`
+	Title             string `description:"标题"`
+	Abstract          string `description:"摘要"`
+	Department        string `description:"作者"`
+	Body              string `description:"内容"`
+	PublishTime       string `description:"发布日期"`
+}
+type ProductInteriorIdReq struct {
+	ProductInteriorId int `description:"ID"`
+}
+
+// 添加
+func AddProductInterior(item *CygxProductInterior) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+// 修改
+func UpdateProductInterior(item *CygxProductInterior) (err error) {
+	to := orm.NewOrm()
+	updateParams := make(map[string]interface{})
+	updateParams["PublishTime"] = item.PublishTime
+	updateParams["ModifyTime"] = item.ModifyTime
+	updateParams["ColumnName"] = item.ColumnName
+	updateParams["Title"] = item.Title
+	updateParams["Status"] = item.Status
+	updateParams["Body"] = item.Body
+	updateParams["IsCancel"] = item.IsCancel
+	updateParams["VisibleRange"] = item.VisibleRange
+	updateParams["Abstract"] = item.Abstract
+	updateParams["Department"] = item.Department
+	ptrStructOrTableName := "cygx_product_interior"
+	whereParam := map[string]interface{}{"product_interior_id": item.ProductInteriorId}
+	qs := to.QueryTable(ptrStructOrTableName)
+	for expr, exprV := range whereParam {
+		qs = qs.Filter(expr, exprV)
+	}
+	_, err = qs.Update(updateParams)
+	return
+}
+
+type GetCygxProductInteriorResp struct {
+	Paging *paging.PagingItem `description:"分页数据"`
+	List   []*CygxProductInteriorResp
+}
+
+type CygxProductInteriorResp struct {
+	ProductInteriorId int                       `description:"ID"`
+	PublishTime       string                    `description:"发布日期"`
+	CreateTime        string                    `description:"创建时间"`
+	ModifyTime        string                    `description:"更新时间"`
+	Title             string                    `description:"标题"`
+	ColumnName        string                    `description:"栏目名称"`
+	Body              string                    `description:"内容"`
+	BodySlice         []*ProductInteriorUrlResp `description:"内容切片"`
+	IsCancel          int                       `description:"是否取消,1是,0否"`
+	VisibleRange      int                       `description:"设置可见范围1全部,0内部"`
+	Abstract          string                    `description:"摘要"`
+	Department        string                    `description:"作者"`
+}
+
+type ProductInteriorUrlResp struct {
+	ChartPermissionId int    `description:"行业id"`
+	SourceId          int    `description:"资源ID"`
+	Type              int    `description:"类型:1普通文本,2:文章、3:活动、4:产业"`
+	Body              string `description:"内容"`
+}
+
+// 获取数量
+func GetCygxProductInteriorCount(condition string, pars []interface{}) (count int, err error) {
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_product_interior as art WHERE 1= 1  `
+	if condition != "" {
+		sqlCount += condition
+	}
+	o := orm.NewOrm()
+	err = o.Raw(sqlCount, pars).QueryRow(&count)
+	return
+}
+
+// 列表
+func GetCygxProductInteriorList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxProductInteriorResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_product_interior as art WHERE 1= 1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` LIMIT ?,?  `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}
+
+type GetCygxProductInteriorDetailResp struct {
+	Detail        *CygxProductInteriorResp
+	HasPermission int  `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	IsShow        bool `description:"是否展示"`
+}
+
+// 通过ID获取详情
+func GetCygxProductInteriorDetail(productInteriorId int) (item *CygxProductInteriorResp, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT * FROM cygx_product_interior  WHERE product_interior_id=? AND status = 1  `
+	err = o.Raw(sql, productInteriorId).QueryRow(&item)
+	return
+}
+
+// 删除数据
+func DeleteProductInterior(productInteriorId int) (err error) {
+	o := orm.NewOrm()
+	sql := ` DELETE FROM cygx_product_interior WHERE product_interior_id = ?`
+	_, err = o.Raw(sql, productInteriorId).Exec()
+	return
+}
+
+// 修改是否展示
+func EditProductInteriorStatus(status, isCancel, productInteriorId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_product_interior SET status=?,is_cancel = ? , modify_time=NOW()   WHERE product_interior_id=? `
+	_, err = o.Raw(sql, status, isCancel, productInteriorId).Exec()
+	return
+}
+
+// 修改可见范围
+func ProductInteriorVisibleRange(visibleRange, productInteriorId int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE cygx_product_interior SET visible_range=?, modify_time=NOW()   WHERE product_interior_id=?  `
+	_, err = o.Raw(sql, visibleRange, productInteriorId).Exec()
+	return
+}

+ 28 - 0
models/product_interior_history.go

@@ -0,0 +1,28 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxProductInteriorHistory struct {
+	Id                int `orm:"column(id);pk"`
+	ProductInteriorId int
+	UserId            int
+	CreateTime        time.Time
+	Mobile            string    `description:"手机号"`
+	Email             string    `description:"邮箱"`
+	CompanyId         int       `description:"公司id"`
+	CompanyName       string    `description:"公司名称"`
+	ModifyTime        time.Time `description:"修改时间"`
+	RealName          string    `description:"用户实际名称"`
+	SellerName        string    `description:"所属销售"`
+}
+
+// 添加历史信息
+func AddCygxProductInteriorHistory(item *CygxProductInteriorHistory) (lastId int64, err error) {
+	o := orm.NewOrm()
+	item.ModifyTime = time.Now()
+	lastId, err = o.Insert(item)
+	return
+}

+ 36 - 0
routers/commentsRouter.go

@@ -700,6 +700,42 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"],
+        beego.ControllerComments{
+            Method: "GatherDetail",
+            Router: `/gather/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:MorningMeetingController"],
+        beego.ControllerComments{
+            Method: "GatherList",
+            Router: `/gather/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"],
+        beego.ControllerComments{
+            Method: "Detail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ProductInteriorController"],
+        beego.ControllerComments{
+            Method: "List",
+            Router: `/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportBillboardController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ReportBillboardController"],
         beego.ControllerComments{
             Method: "FllowList",

+ 10 - 0
routers/router.go

@@ -139,6 +139,16 @@ func init() {
 				&controllers.ReportSelectionController{},
 			),
 		),
+		web.NSNamespace("/product_interior",
+			web.NSInclude(
+				&controllers.ProductInteriorController{},
+			),
+		),
+		web.NSNamespace("/morning_meeting",
+			web.NSInclude(
+				&controllers.MorningMeetingController{},
+			),
+		),
 	)
 	web.AddNamespace(ns)
 }

+ 3 - 0
services/activity.go

@@ -416,6 +416,9 @@ func GetActivityDetailUserPower(user *models.WxUserItem, activityInfo *models.Ac
 		err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())
 		return
 	}
+	if permissionStr == "" {
+		return
+	}
 	if activityInfo.LimitPeopleNum > 0 {
 		mapUserType, e := GetActivityCcustomerTypeList()
 		if e != nil {

+ 6 - 6
services/article.go

@@ -716,12 +716,12 @@ func HandleArticleListByApi(artcleId int) (err error) {
 		fmt.Println("Getres.PublicGetDate Err:", err.Error())
 		return err
 	}
-	item := new(models.CygxShanghaiCompanyLog)
-	item.CreateTime = time.Now()
-	item.Url = clueApiUrl
-	item.Body = ""
-	item.Result = string(body)
-	go models.AddCygxShanghaiCompanyLog(item)
+	//item := new(models.CygxShanghaiCompanyLog)
+	//item.CreateTime = time.Now()
+	//item.Url = clueApiUrl
+	//item.Body = ""
+	//item.Result = string(body)
+	//go models.AddCygxShanghaiCompanyLog(item)
 	go models.UpdateCygxArticleCeluePush(artcleId)
 	articleResult := articleResultDate.Data
 

+ 8 - 0
services/company_permission.go

@@ -150,6 +150,14 @@ func GetUserHasPermissionActivity(user *models.WxUserItem, activityInfo *models.
 		return
 	}
 	popupMsg = "您暂无权限参加此活动,若想参加可以申请开通对应的试用权限"
+	if user.CompanyId == 1 {
+		if applyCount > 0 {
+			hasPermission = 4
+		} else {
+			hasPermission = 5
+		}
+		return
+	}
 	companyItem, err := models.GetCompanyDetailById(user.CompanyId)
 	if err != nil {
 		if err.Error() == utils.ErrNoRow() {

+ 69 - 0
services/morning_meeting.go

@@ -0,0 +1,69 @@
+package services
+
+import (
+	"fmt"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+func init12321() {
+
+	for i := 180; i > 0; i-- {
+		init12(i)
+	}
+
+}
+
+func init12(day int) (err error) {
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg("定时生成晨会精华汇总失败,err:"+err.Error(), 2)
+		}
+	}()
+	hourstr := " 10:30:00 "
+	DayTime := time.Now().AddDate(0, 0, -day)
+	startSize := 0
+	pageSize := 100
+	var condition string
+	var pars []interface{}
+	startDate := DayTime.AddDate(0, 0, -1).Format(utils.FormatDate) + hourstr
+	endDate := DayTime.Format(utils.FormatDate) + hourstr
+
+	condition = ` 	AND publish_time  = ? `
+	pars = append(pars, endDate)
+	total, err := models.GetCygxMorningMeetingGatherCount(condition, pars)
+	if err != nil {
+		return
+	}
+	if total > 0 {
+		return
+	}
+	pars = make([]interface{}, 0)
+	condition = ` 	AND publish_time  BETWEEN ?   AND  ? `
+	pars = append(pars, startDate, endDate)
+
+	list, err := models.GetCygxMorningMeetingReviewsList(condition, pars, startSize, pageSize)
+	if err != nil {
+		return
+	}
+	if len(list) == 0 {
+		return
+	}
+	item := new(models.CygxMorningMeetingGather)
+	for _, v := range list {
+		item.MeetingIds += strconv.Itoa(v.Id) + ","
+	}
+	item.MeetingIds = strings.TrimRight(item.MeetingIds, ",")
+	item.Title = utils.GetTimeDateHourAndDay(DayTime) + "(" + utils.StrDateTimeToWeek(DayTime.Format(utils.FormatDateTime)) + ")" + "|晨会精华"
+	item.CreateTime = time.Now()
+	item.ModifyTime = time.Now()
+	item.PublishTime = endDate
+	item.Status = 1
+	err = models.AddCygxMorningMeetingGather(item)
+	return
+
+}

+ 65 - 0
services/product_interior.go

@@ -0,0 +1,65 @@
+package services
+
+import (
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+// GetProductInteriorUrl 处理产品内测中的连接并做跳转处理
+func GetProductInteriorUrl(url string, urlMap map[string]string) (itemResp *models.ProductInteriorUrlResp) {
+	//2:文章详情  https://web.hzinsights.com/material/info/8436
+	//3:活动详情  https://web.hzinsights.com/activity/detail/2701
+	//4:产业详情  https://web.hzinsights.com/indepth/info/20/79
+	item := new(models.ProductInteriorUrlResp)
+	item.Body = url
+	if urlMap[url] == "" {
+		item.Type = 1
+	} else {
+		urlSlice := strings.Split(url, "/")
+		lenurlSlice := len(urlSlice)
+		sourceId, _ := strconv.Atoi(urlSlice[lenurlSlice-1])
+		item.SourceId = sourceId
+		if strings.Contains(url, "material/info") {
+			item.Type = 2
+		} else if strings.Contains(url, "activity/detail") {
+			item.Type = 3
+		} else if strings.Contains(url, "indepth/info") {
+			if lenurlSlice >= 2 {
+				chartPermissionId, _ := strconv.Atoi(urlSlice[lenurlSlice-2])
+				item.ChartPermissionId = chartPermissionId
+			}
+			item.Type = 4
+		}
+	}
+	itemResp = item
+	return
+}
+
+func AddCygxProductInteriorHistory(user *models.WxUserItem, articleId int) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("产品内测用户浏览信息记录失败"+err.Error(), 2)
+		}
+	}()
+	historyRecord := new(models.CygxProductInteriorHistory)
+	historyRecord.UserId = user.UserId
+	historyRecord.ProductInteriorId = articleId
+	historyRecord.CreateTime = time.Now()
+	historyRecord.Mobile = user.Mobile
+	historyRecord.Email = user.Email
+	historyRecord.CompanyId = user.CompanyId
+	historyRecord.CompanyName = user.CompanyName
+	sellerItem, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	historyRecord.RealName = user.RealName
+	if sellerItem != nil {
+		historyRecord.SellerName = sellerItem.RealName
+	}
+	_, err = models.AddCygxProductInteriorHistory(historyRecord)
+	return
+}

+ 32 - 0
services/user.go

@@ -791,6 +791,38 @@ func GetUserhasPermission(user *models.WxUserItem) (hasPermission int, err error
 	return
 }
 
+// 获取用户有没有开通任意一个行业权限
+func GetUserhasPermissionOne(user *models.WxUserItem) (hasPermission int, err error) {
+	//判断是否已经申请过
+	applyCount, err := models.GetApplyRecordCount(user.UserId)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		return
+	}
+	if applyCount > 0 {
+		hasPermission = 3
+	} else {
+		hasPermission = 4
+	}
+	//HasPermission int  `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	if user.CompanyId > 1 {
+		companyPermission, errPer := models.GetCompanyPermission(user.CompanyId)
+		if errPer != nil {
+			err = errPer
+			return
+		}
+		if companyPermission == "" {
+			if applyCount > 0 {
+				hasPermission = 3
+			} else {
+				hasPermission = 4
+			}
+		} else {
+			hasPermission = 1
+		}
+	}
+	return
+}
+
 // 每周五发送当前所有的权益用户
 func SendEmailAllUserWithRAI() (err error) {
 	defer func() {

+ 27 - 0
utils/common.go

@@ -727,6 +727,7 @@ func StrDateTimeToWeek(strTime string) string {
 		"Sunday":    "周日",
 	}
 	var ctime = StrTimeToTime(strTime).Format("2006-01-02")
+	fmt.Println(ctime)
 	startday, _ := time.Parse("2006-01-02", ctime)
 	staweek_int := startday.Weekday().String()
 	return WeekDayMap[staweek_int]
@@ -828,3 +829,29 @@ func StrDateToTime(strTime string) time.Time {
 	resultTime, _ := time.ParseInLocation(timeLayout, strTime, loc)
 	return resultTime
 }
+
+// 获取时间的月跟日
+func GetTimeDateHourAndDay(DayTime time.Time) (dataStr string) {
+	dataSlice := strings.Split(DayTime.Format(FormatDate), "-")
+	for k, v := range dataSlice {
+		if k == 0 {
+			continue
+		}
+		dataStr += v + "."
+	}
+	dataStr = strings.TrimRight(dataStr, ".")
+	return
+}
+
+// 时间格式去掉年
+func GetTimeDateRemoveYear(strTime string) (dataStr string) {
+	slicePublishTime := strings.Split(strTime, "-")
+	for k, v := range slicePublishTime {
+		if k == 0 {
+			continue
+		}
+		dataStr += v + "-"
+	}
+	dataStr = strings.TrimRight(dataStr, "-")
+	return dataStr
+}

+ 5 - 4
utils/constants.go

@@ -31,10 +31,11 @@ const (
 
 // 手机号,电子邮箱正则
 const (
-	RegularMobile             = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(16[0-9])|(19[0-9]))\\d{8}$" //手机号码
-	RegularFixedTelephone     = "^(\\(\\d{3,4}\\)|\\d{3,4}-|\\s)?\\d{7,14}$"                                              //手机号码
-	RegularFixedTelephoneEasy = "^[0-9\\-]+$"                                                                             //手机号码
-	RegularEmail              = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*`                                             //匹配电子邮箱
+	RegularMobile             = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(16[0-9])|(19[0-9]))\\d{8}$"               //手机号码
+	RegularFixedTelephone     = "^(\\(\\d{3,4}\\)|\\d{3,4}-|\\s)?\\d{7,14}$"                                                            //手机号码
+	RegularFixedTelephoneEasy = "^[0-9\\-]+$"                                                                                           //手机号码
+	RegularEmail              = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*`                                                           //匹配电子邮箱
+	RegularUrl                = `(http|ftp|https):\/\/([\w\-_]+(?:(?:\.[\w\-_]+)+))([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?` //匹配电子邮箱
 )
 
 // 聚合短信