xingzai %!s(int64=2) %!d(string=hai) anos
pai
achega
73f100143c

+ 98 - 0
controllers/config.go

@@ -0,0 +1,98 @@
+package controllers
+
+import (
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/services"
+	"hongze/hongze_clpt/utils"
+	"time"
+)
+
+type ConfigController struct {
+	BaseAuthController
+}
+
+// @Title 相关内容是否展示
+// @Description 相关内容是否展示接口
+// @Param	request	body models.IsShow true "type json string"
+// @Success 200
+// @router /isShow [get]
+func (this *ConfigController) IsShow() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	var resp models.IsShow
+	resp.IsBelongRai = services.GetBelongingRai(user.Mobile)
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}
+
+// @Title 关于我们
+// @Description 关于我们接口
+// @Param	request	body models.IsShow true "type json string"
+// @Success 200
+// @router /aboutUs [get]
+func (this *ConfigController) AboutUs() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	var aboutUs = new(models.AboutUs)
+	aboutUs.Title = utils.ABOUT_US_TITLE
+	aboutUs.Url = utils.ABOUT_US_URL
+	br.Ret = 200
+	br.Success = true
+	br.Data = aboutUs
+}
+
+// @Title 关于我们浏览记录
+// @Description 关于我们浏览记录接口
+// @Param	request	body models.IsShow true "type json string"
+// @Success 200
+// @router /aboutUs/addHistory [POST]
+func (this *ConfigController) AboutUsAdd() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	user := this.User
+	if user == nil {
+		br.Msg = "请重新登录"
+		br.Ret = 408
+		return
+	}
+	historyRecord := new(models.CygxAboutUsVideoHistory)
+	historyRecord.UserId = user.UserId
+	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.AddCygxAboutUsVideoHistory(historyRecord)
+	br.Ret = 200
+	br.Success = true
+}

+ 162 - 0
controllers/product_interior.go

@@ -0,0 +1,162 @@
+package controllers
+
+import (
+	"fmt"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/services"
+	"hongze/hongze_clpt/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
+}

+ 0 - 1
controllers/report_selection.go

@@ -36,7 +36,6 @@ func (this *ReportSelectionController) Detail() {
 	//uid := user.UserId
 	articleId, _ := this.GetInt("ArticleId")
 	isBestNew, _ := this.GetBool("IsBestNew")
-	isBestNew = true
 	if isBestNew {
 		tbdb := "cygx_report_selection"
 		condition := ` AND publish_status = 1  `

+ 27 - 0
models/about_us_video_history.go

@@ -0,0 +1,27 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxAboutUsVideoHistory struct {
+	Id          int `orm:"column(id);pk"`
+	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 AddCygxAboutUsVideoHistory(item *CygxAboutUsVideoHistory) (lastId int64, err error) {
+	o := orm.NewOrm()
+	item.ModifyTime = time.Now()
+	lastId, err = o.Insert(item)
+	return
+}

+ 18 - 0
models/admin.go

@@ -15,3 +15,21 @@ func GetAdminByRole() (items []*AdminMobileResp, err error) {
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+// 获取权益内部人员手机号
+func GetRaiAdmin() (items []*AdminMobileResp, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT
+			mobile
+		FROM
+			admin 
+		WHERE
+			role_type_code LIKE '%rai%' 
+			AND group_id NOT IN ( 19, 10 ) 
+			AND enabled = 1 
+			OR (
+			department_name = '产品技术部' 
+			AND enabled = 1) `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}

+ 12 - 2
models/config.go

@@ -30,7 +30,7 @@ func GetConfigByCode(configCode string) (item *CygxConfig, err error) {
 	return
 }
 
-//更改配置信息
+// 更改配置信息
 func UpdateConfigByCode(configValue, countryCode string) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE cygx_config SET  config_value= ? WHERE config_code=? `
@@ -44,7 +44,7 @@ type ConfigResp struct {
 	ListHistory   []*KeyWord `description:"关键词搜索记录"`
 }
 
-//获取是否展示限免标签
+// 获取是否展示限免标签
 func GetShowSustainable() (count int, err error) {
 	o := orm.NewOrm()
 	sqlCount := ` SELECT COUNT(1) FROM cygx_config WHERE config_code= 'is_show_sustainable' AND config_value = 1 `
@@ -84,3 +84,13 @@ type MicroRoadShowDefaultImg struct {
 	ImgUrl              string `description:"背景图"`
 	ShareImg            string `description:"分享图"`
 }
+
+type IsShow struct {
+	IsBelongRai bool `description:"是否属于权益内部人员"`
+}
+
+// 关于我们
+type AboutUs struct {
+	Title string `description:"标题"`
+	Url   string `description:"链接"`
+}

+ 1 - 0
models/db.go

@@ -65,6 +65,7 @@ func init() {
 		new(CygxReportSelectionSubjectHistory),
 		new(CygxMinutesSummaryVoiceHistory),
 		new(CygxResearchSummaryVoiceHistory),
+		new(CygxAboutUsVideoHistory),
 	)
 	// 记录ORM查询日志
 	orm.Debug = true

+ 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
+}

+ 45 - 0
routers/commentsRouter.go

@@ -259,6 +259,33 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ConfigController"],
+        beego.ControllerComments{
+            Method: "AboutUs",
+            Router: `/aboutUs`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ConfigController"],
+        beego.ControllerComments{
+            Method: "AboutUsAdd",
+            Router: `/aboutUs/addHistory`,
+            AllowHTTPMethods: []string{"POST"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ConfigController"],
+        beego.ControllerComments{
+            Method: "IsShow",
+            Router: `/isShow`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MicroRoadShowController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:MicroRoadShowController"],
         beego.ControllerComments{
             Method: "Collect",
@@ -529,6 +556,24 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ProductInteriorController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ProductInteriorController"],
+        beego.ControllerComments{
+            Method: "Detail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ProductInteriorController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ProductInteriorController"],
+        beego.ControllerComments{
+            Method: "List",
+            Router: `/list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ReportCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_clpt/controllers:ReportCommonController"],
         beego.ControllerComments{
             Method: "CompanyList",

+ 10 - 0
routers/router.go

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

+ 35 - 1
services/admin.go

@@ -1,6 +1,9 @@
 package services
 
-import "hongze/hongze_clpt/models"
+import (
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/utils"
+)
 
 func GetAdminMobileMap() (mapItem map[string]string, err error) {
 	adminList, e := models.GetAdminByRole()
@@ -30,3 +33,34 @@ func GetActivityCcustomerTypeList() (mapItem map[int]string, err error) {
 	mapItem = mapUserType
 	return
 }
+
+// GetRaiAdminMobileMap 获取权益内部人员手机号
+func GetRaiAdminMobileMap() (mapItem map[string]string) {
+	var err error
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("获取权益内部人员手机号失败 ErrMsg:"+err.Error(), 2)
+
+		}
+	}()
+	adminList, e := models.GetRaiAdmin()
+	if e != nil {
+		err = e
+		return
+	}
+	mapMobile := make(map[string]string)
+	for _, v := range adminList {
+		mapMobile[v.Mobile] = v.Mobile
+	}
+	mapItem = mapMobile
+	return
+}
+
+// 根据手机号判断是否属于权益
+func GetBelongingRai(mobile string) (isBelong bool) {
+	mapItem := GetRaiAdminMobileMap()
+	if mapItem[mobile] != "" {
+		isBelong = true
+	}
+	return
+}

+ 65 - 0
services/product_interior.go

@@ -0,0 +1,65 @@
+package services
+
+import (
+	"hongze/hongze_clpt/models"
+	"hongze/hongze_clpt/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
+}

+ 9 - 3
utils/constants.go

@@ -32,9 +32,10 @@ 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}$"                                              //手机号码
-	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}$"                                                            //手机号码
+	RegularEmail          = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*`                                                           //匹配电子邮箱
+	RegularUrl            = `(http|ftp|https):\/\/([\w\-_]+(?:(?:\.[\w\-_]+)+))([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?` //匹配网址链接
 )
 
 // 聚合短信
@@ -174,3 +175,8 @@ const (
 const (
 	TIME_LINE_ROUTE = "/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId="
 )
+
+const (
+	ABOUT_US_URL   = "https://hzstatic.hzinsights.com/static/yb/video/8617330c2a76e0c35999f6466b4470c4.mp4"
+	ABOUT_US_TITLE = "关于我们--三分钟了解弘则研究体系和方法论"
+)