Parcourir la source

合并海通国际,避免今后代码冲突

xingzai il y a 2 ans
Parent
commit
b48190eac3

+ 13 - 0
controllers/activity.go

@@ -2085,6 +2085,19 @@ func (this *ActivityCoAntroller) AskAdd() {
 		br.ErrMsg = "操作失败,Err:" + errInfo.Error()
 		return
 	}
+	//resultTime := utils.StrTimeToTime(activityInfo.ActivityTime) //时间字符串格式转时间格式
+	//if activityInfo.ActivityTypeId == 1 && activityInfo.ChartPermissionId != 31 {
+	//	if time.Now().After(resultTime.Add(-time.Minute * 15)) {
+	//		br.Msg = "活动开始前15分钟内无法提交问题"
+	//		return
+	//	}
+	//} else {
+	//	if time.Now().After(resultTime.Add(-time.Minute * 60)) {
+	//		br.Msg = "活动开始前1小时内无法提交问题"
+	//		return
+	//	}
+	//}
+
 	companyDetail, err := models.GetCompanyDetailById(user.CompanyId)
 	if err != nil {
 		br.Msg = "提交失败!"

+ 427 - 0
controllers/article.go

@@ -984,3 +984,430 @@ func (this *ArticleController) Pdfwatermark() {
 	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 *ArticleCommonController) 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
+
+	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
+		resp.Detail = detail
+		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)
+		}
+	}
+	resp.CompanyName = companyName
+	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 /addStopTimePublic [post]
+func (this *ArticleCommonController) 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 上传页面访问统计(无需token)
+// @Param	request	body models.CygxPageHistoryRecordHtgjRep true "type json string"
+// @Success Ret=200 新增成功
+// @router /pageHistoryPublic [post]
+func (this *ArticleCommonController) 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 = "新增成功"
+}

+ 31 - 0
controllers/chart_permission.go

@@ -198,3 +198,34 @@ func (this *ChartPermissionAuthController) StrategyDetail() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 获取所有品种(无需token)
+// @Description 获取所有品种(无需token)
+// @Success 200 {object} models.ChartPermissionResp
+// @router /allPublic [get]
+func (this *ChartPermissionController) DetailPublic() {
+	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
+}

+ 30 - 0
controllers/config.go

@@ -10,6 +10,10 @@ type ConfigController struct {
 	BaseAuthController
 }
 
+type BaseConfigController struct {
+	BaseCommonController
+}
+
 // @Title 获取搜索推荐词
 // @Description 获取搜索推荐词
 // @Success 200 {object} models.ConfigResp
@@ -122,3 +126,29 @@ func (this *ConfigController) DescriptionOfResearch() {
 	br.Success = true
 	br.Data = resp
 }
+
+// @Title 获取搜索推荐词(无需token)
+// @Description 获取搜索推荐词(无需token)
+// @Success 200 {object} models.ConfigResp
+// @router /detailPublic [get]
+func (this *BaseConfigController) HotDetail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	detail := new(models.CygxConfig)
+	hotSearch, err := models.GetHotSearch()
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	detail.ConfigValue = hotSearch
+	resp := new(models.ConfigResp)
+	resp.Item = detail
+	br.Msg = "获取成功!"
+	br.Ret = 200
+	br.Success = true
+	br.Data = resp
+}

+ 145 - 0
controllers/home.go

@@ -14,6 +14,10 @@ type HomeController struct {
 	BaseAuthController
 }
 
+type BaseHomeController struct {
+	BaseCommonController
+}
+
 // @Title 首页列表接口
 // @Description 首页列表接口
 // @Param   PageSize   query   int  true       "每页数据条数"
@@ -168,3 +172,144 @@ func (this *HomeController) ListHome() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 首页列表接口(无需token)
+// @Description 首页列表接口(无需token)
+// @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 /listPublic [get]
+func (this *BaseHomeController) 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 && categoryinfo.PermissionName == "研选" {
+			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 '%` + categoryinfo.PermissionName + `%' AND publish_status = 1 AND is_summary = 1 )`
+		} else {
+			condition += ` AND  category_name   LIKE '%` + categoryinfo.PermissionName + `%'`
+		}
+	}
+	//永续客户无法查看研选分类的内容
+	if userType == 1 {
+		condition += ` AND  category_name  NOT LIKE '%研选` + `%'`
+	}
+	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, _ := 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, "研选") {
+			list[k].IsResearch = 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
+}

+ 109 - 0
controllers/search.go

@@ -13,6 +13,10 @@ type SearchController struct {
 	BaseAuthController
 }
 
+type BaseSearchController struct {
+	BaseCommonController
+}
+
 // @Title 搜索接口
 // @Description 搜索接口
 // @Param   PageSize   query   int  true       "每页数据条数"
@@ -217,3 +221,108 @@ func (this *SearchController) SearchReport() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// @Title 搜索接口(无需token)
+// @Description 搜索接口(无需token)
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Param   KeyWord   query   string  true       "搜索关键词"
+// @Param   OrderColumn   query   int  true       "排序字段 ,Comprehensive综合 ,Matching匹配度 ,PublishDate 发布时间 "
+// @Param   CompanyCode     query string  false       "机构编号"
+// @Param   CompanyName     query string  false       "机构名称"
+// @Param   Email     query string  false       "邮箱"
+// @Param   Sign   query   string  false       "加密签名"
+// @Success 200 {object} models.SearchItem
+// @router /listPublic [get]
+func (this *BaseSearchController) SearchListPublic() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = paging.StartIndex(currentIndex, pageSize)
+	keyWord := this.GetString("KeyWord")
+	orderColumn := this.GetString("OrderColumn")
+	if keyWord == "" {
+		br.Msg = "请输入搜索词"
+		br.ErrMsg = "请输入搜索词"
+		return
+	}
+	companyCode := this.GetString("CompanyCode")
+	companyNameHt := this.GetString("CompanyName")
+	email := this.GetString("Email")
+	sign := this.GetString("Sign")
+
+	if orderColumn == "" {
+		orderColumn = "Matching"
+	}
+	indexName := utils.IndexName
+	pageSize = 20
+	var result []*models.SearchItem
+	var total int64
+	var err error
+	if orderColumn == "PublishDate" {
+		tmpResult, tmpTotal, tmpErr := services.EsMultiMatchFunctionScoreQueryTimeSort(indexName, keyWord, startSize, 100, 0)
+		result = tmpResult
+		total = tmpTotal
+		err = tmpErr
+	} else {
+		tmpResult, tmpTotal, tmpErr := services.EsMultiMatchFunctionScoreQuerySort(indexName, keyWord, startSize, pageSize, 0, orderColumn)
+		result = tmpResult
+		total = tmpTotal
+		err = tmpErr
+	}
+	if err != nil {
+		br.Msg = "检索失败"
+		br.ErrMsg = "检索失败,Err:" + err.Error()
+		return
+	}
+	if len(result) == 0 {
+		result = make([]*models.SearchItem, 0)
+	}
+
+	if companyCode != "" && companyNameHt != "" && email != "" {
+		errMsg, errHt, wxUser, _ := services.CheckHtgj(companyCode, companyNameHt, email, sign)
+		if errHt != nil {
+			br.Msg = "获取"
+			br.ErrMsg = "获取数据失败,Err:" + errHt.Error()
+			return
+		}
+		if errMsg != "" {
+			br.Msg = errMsg
+			return
+		}
+		user := wxUser
+		detail, errKey := models.GetNewSearchKeyWordByThisUser(user.UserId, keyWord)
+		if errKey != nil && errKey.Error() != utils.ErrNoRow() {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取信息失败,Err:" + errKey.Error()
+			return
+		}
+		//同一个用户一分钟之内搜索的词不重复记录
+		if detail == nil || time.Now().After(detail.CreateTime.Add(+time.Minute*1)) {
+			keyWordItem := new(models.CygxSearchKeyWord)
+			keyWordItem.UserId = user.UserId
+			keyWordItem.KeyWord = keyWord
+			keyWordItem.CreateTime = time.Now()
+			go models.AddSearchKeyWord(keyWordItem)
+		}
+	}
+	resp := new(models.SearchResp)
+	page := paging.GetPaging(currentIndex, pageSize, int(total))
+	resp.Paging = page
+	resp.List = result
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 6 - 0
models/article.go

@@ -227,6 +227,12 @@ type ArticleDetailResp struct {
 	Mobile        string `description:"用户手机号"`
 }
 
+type ArticleDetailHtgjResp struct {
+	HasPermission int    `description:"1:有该行业权限,正常展示,0:试用期已过期"`
+	CompanyName   string `description:"公司名称"`
+	Detail        *ArticleDetail
+}
+
 func ModifyArticleExpert(articleId int, expertNumStr, expertContentStr, interviewDateStr, bodyText string) (err error) {
 	o := orm.NewOrm()
 	sql := `UPDATE cygx_article SET expert_background=?,expert_number=?,interview_date=?,body_text=? WHERE article_id=? `

+ 11 - 1
models/article_history_record.go

@@ -71,6 +71,17 @@ type AddStopTimeRep struct {
 	Source    string `description:"来源,MOBILE:手机端,PC:电脑端"`
 }
 
+type AddStopTimeHtgjRep struct {
+	ArticleId   int    `description:"文章ID"`
+	StopTime    int    `description:"停留时间"`
+	OutType     int    `description:"退出方式,1正常退出,2强制关闭"`
+	Source      string `description:"来源,MOBILE:手机端,PC:电脑端"`
+	CompanyCode string `description:"机构编码"`
+	CompanyName string `description:"机构名称"`
+	Email       string `description:"机构邮箱"`
+	Sign        string `description:"签名"`
+}
+
 type AddStopTimeNewRep struct {
 	Id        int `description:"ID"`
 	ArticleId int `description:"文章ID"`
@@ -101,7 +112,6 @@ func GetNewArticleHistoryRecord(uid, articleId int) (item *AddStopTimeNewRep, er
 //获取用户阅读记录
 func GetNoAddStoptimeArticleCount(uid, articleId int) (count int, err error) {
 	sqlCount := `SELECT COUNT(1) AS count FROM cygx_article_history_record WHERE user_id=? AND article_id=? AND create_time > '` + utils.OnlineTime + `' AND stop_time = 0 `
-	//sqlCount := `SELECT COUNT(1) AS count FROM cygx_article_history_record WHERE id = ? AND stop_time = 0 `
 	o := orm.NewOrm()
 	err = o.Raw(sqlCount, uid, articleId).QueryRow(&count)
 	return

+ 10 - 0
models/chart_permission.go

@@ -141,3 +141,13 @@ func AddChartPersion(item *CompanyReportPermission) (newId int64, err error) {
 	newId, err = o.Insert(item)
 	return
 }
+
+//获取海通国际开通的默认权限
+func GetCompanyPermissionIdWithHtgj() (chartpermissionids string, err error) {
+	sql := ` SELECT GROUP_CONCAT(DISTINCT chart_permission_id  ORDER BY b.sort ASC  SEPARATOR ',') AS chartpermissionids
+			FROM chart_permission as  b 
+			WHERE chart_permission_name IN ('医药','消费','科技','智造','研选')`
+	o := orm.NewOrm()
+	err = o.Raw(sql).QueryRow(&chartpermissionids)
+	return
+}

+ 20 - 0
models/company.go

@@ -177,6 +177,10 @@ func GetCompanySellerName(companyId int) (sellerName string, err error) {
 	return
 }
 
+type CompanyProductStatus struct {
+	IsSuspend int `description:"1:暂停,0:启用"`
+}
+
 type CompanyProductDetial struct {
 	IsSuspend int    `description:"1:暂停,0:启用"`
 	Scale     string `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
@@ -189,3 +193,19 @@ func GetCompanyProductDetail(companyId, productId int) (item *CompanyProductDeti
 	err = o.Raw(sql, companyId, productId).QueryRow(&item)
 	return
 }
+
+//获取公司详情详情
+func GetCompanyByName(companyName string) (item *Company, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM company WHERE company_name = ? LIMIT 1`
+	err = o.Raw(sql, companyName).QueryRow(&item)
+	return
+}
+
+//获取公司详情详情
+func GetCompanyByThirdName(tripartiteCompanyCode string) (item *Company, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM company WHERE tripartite_company_code = ? LIMIT 1`
+	err = o.Raw(sql, tripartiteCompanyCode).QueryRow(&item)
+	return
+}

+ 320 - 0
models/crm_company.go

@@ -0,0 +1,320 @@
+package models
+
+import (
+	"fmt"
+	"github.com/beego/beego/v2/client/orm"
+	"hongze/hongze_cygx/utils"
+	"time"
+)
+
+type Company struct {
+	CompanyId             int       `orm:"column(company_id);pk"`
+	CompanyName           string    `description:"客户名称"`
+	CompanyType           int       `orm:"column(type)"`
+	CreditCode            string    `description:"社会统一信用码"`
+	CompanyCode           string    `description:"客户编码"`
+	Sort                  int       `description:"优先级"`
+	IsFeeCustomer         int       `description:"是否付费用户"`
+	Country               string    `description:"国家编码"`
+	Province              string    `description:"省"`
+	City                  string    `description:"市"`
+	Address               string    `description:"详细地址"`
+	Enabled               int       `description:"用户状态"`
+	CreatedTime           time.Time `description:"创建时间"`
+	LastUpdatedTime       time.Time `description:"最后一次阅读时间"`
+	Seller                string    `description:"销售员"`
+	SellsId               int       `description:"销售员id"`
+	CompanyBelong         string    `description:"客户所属,ficc:ficc客户,public_offering:公募客户,partner:合作伙伴"`
+	StartDate             string    `description:"合同开始日期"`
+	EndDate               string    `description:"合同结束日期"`
+	LastType              int       `description:"原客户标签"`
+	IsVip                 int       `description:"0:普通用户,1:大客户"`
+	FirstStartDate        string    `description:"首次设置为试用客户开始时间"`
+	FirstEndDate          string    `description:"首次设置为试用客户结束时间"`
+	DateType              int       `description:"设置流失类型,1:1个月,2:2个月,3:3个月"`
+	Remark                string    `description:"备注信息"`
+	RegionType            string    `description:"地区类型,国内,国外"`
+	OpenCompanyCode       string    `description:"开放给第三方的客户编码,不让第三方定位我们的客户信息"`
+	TripartiteCompanyCode string    `description:"第三方给过来的客户编码,判断客户是否存在"`
+}
+
+type CompanyLog struct {
+	Id              int       `orm:"column(id);pk"`
+	CompanyId       int       `description:"客户id"`
+	CompanyName     string    `description:"客户名称"`
+	CreditCode      string    `description:"统一社会信用码"`
+	CompanyCode     string    `description:"客户编码"`
+	Sort            int       `description:"优先级"`
+	IsFeeCustomer   int       `description:"是否付费用户"`
+	Country         string    `description:"国家编码"`
+	ProvinceId      int       `description:"省id"`
+	CityId          int       `description:"市id"`
+	Address         string    `description:"详细地址"`
+	Ctype           int       `orm:"column(type)" description:"客户标签,1:付费客户,2:试用客户,3:流失客户,4:潜在客户" `
+	Enabled         int       `description:"用户状态"`
+	CreatedTime     time.Time `description:"创建时间"`
+	LastUpdatedTime time.Time `description:"最后修改时间"`
+	Seller          string    `description:"销售员"`
+	SellsId         int       `description:"销售员ID"`
+	CompanyBelong   string    `description:"客户所属,ficc:ficc客户,public_offering:公募客户,partner:合作伙伴"`
+	StartDate       string    `description:"合同开始日期"`
+	EndDate         string    `description:"合同结束日期"`
+	LoseReason      string    `description:"流失原因"`
+	LastType        int       `description:"原客户标签"`
+	FirstStartDate  string    `description:"首次设置为试用客户开始时间"`
+	FirstEndDate    string    `description:"首次设置为试用客户结束时间"`
+	DateType        int       `description:"日期类型"`
+	AdminId         int       `description:"操作人id"`
+	LogType         string    `description:"日志类型"`
+	LogCreateTime   time.Time `description:"日志创建时间"`
+	Province        string    `description:"省"`
+	City            string    `description:"市"`
+}
+
+type CompanyOperationRecord struct {
+	Id              int       `orm:"column(id);pk"`
+	CompanyId       int       `description:"客户id"`
+	CompanyName     string    `description:"客户名称"`
+	SellerId        int       `description:"销售员id"`
+	SysUserId       int       `description:"操作者id"`
+	SysRealName     string    `description:"操作者名称"`
+	Remark          string    `description:"备注"`
+	Operation       string    `description:"操作"`
+	CreateTime      time.Time `description:"操作时间"`
+	ProductId       int       `description:"产品id"`
+	ProductName     string    `description:"产品名称"`
+	ApproveUserId   int       `description:"审批人id"`
+	ApproveRealName string    `description:"审批人姓名"`
+	ApproveContent  string    `description:"审批人内容"`
+	ApproveRemark   string    `description:"审批人内容"`
+	Status          string    `description:"状态"`
+}
+
+type CompanyPermissionLog struct {
+	Id                int `orm:"column(id);pk"`
+	CompanyId         int
+	ChartPermissionId int
+	CreateTime        time.Time
+	SysUserId         int
+	SysUserName       string
+	StartDate         string
+	EndDate           string
+	ProductId         int
+	ProductName       string
+}
+
+type CompanyProduct struct {
+	CompanyProductId    int       `orm:"column(company_product_id);pk" description:"客户产品id"`
+	CompanyId           int       `description:"客户id"`
+	ProductId           int       `description:"产品id"`
+	ProductName         string    `description:"产品名称"`
+	CompanyName         string    `description:"客户名称"`
+	Source              string    `description:"来源"`
+	Reasons             string    `description:"新增理由"`
+	Status              string    `description:"客户状态"`
+	IndustryId          int       `description:"行业id"`
+	IndustryName        string    `description:"行业名称"`
+	SellerId            int       `description:"销售id"`
+	SellerName          string    `description:"销售名称"`
+	GroupId             int       `description:"销售分组id"`
+	DepartmentId        int       `description:"销售部门id"`
+	IsSuspend           int       `description:"1:暂停,0:启用"`
+	SuspendTime         time.Time `description:"暂停启用时间"`
+	TryOutTime          time.Time `description:"正式转试用时间"`
+	RenewalReason       string    `description:"正式转试用后的续约情况说明"`
+	LastDescriptionTime time.Time `description:"上次添加说明时间"`
+	RenewalIntention    int       `description:"是否勾选无续约意向,1:确认,0:未确认"`
+	ApproveStatus       string    `description:"审批状态:'审批中','通过','驳回'"`
+	FreezeTime          time.Time `description:"冻结时间"`
+	FreezeReason        time.Time `description:"冻结理由"`
+	Remark              string    `description:"备注信息"`
+	CreateTime          time.Time `description:"创建时间"`
+	ModifyTime          time.Time `description:"修改时间"`
+	StartDate           string    `description:"开始日期"`
+	EndDate             string    `description:"结束日期"`
+	ContractEndDate     time.Time `description:"合同结束日期"`
+	LoseReason          string    `description:"流失原因"`
+	LossTime            time.Time `description:"流失时间"`
+	CompanyType         string    `description:"客户类型"`
+	OpenCode            string    `description:"开放给第三方的编码,不让第三方定位我们的客户信息"`
+}
+
+type CompanyProductLog struct {
+	Id               int       `orm:"column(id);pk"`
+	CompanyProductId int       `description:"产品id"`
+	CompanyId        int       `description:"客户id"`
+	ProductId        int       `description:"产品id"`
+	ProductName      string    `description:"产品名称"`
+	CompanyName      string    `description:"客户名称"`
+	Source           string    `description:"来源"`
+	Reasons          string    `description:"新增理由"`
+	Status           string    `description:"客户状态"`
+	IndustryId       int       `description:"行业id"`
+	IndustryName     string    `description:"行业名称"`
+	SellerId         int       `description:"所属销售id"`
+	SellerName       string    `description:"所属销售名称"`
+	GroupId          int       `description:"所属销售分组id"`
+	DepartmentId     int       `description:"所属销售部门id"`
+	IsSuspend        int       `description:"1:暂停,0:启用"`
+	SuspendTime      time.Time `description:"暂停时间"`
+	FreezeTime       time.Time `description:"冻结时间"`
+	Remark           string    `description:"备注信息"`
+	StartDate        string    `description:"开始日期"`
+	EndDate          string    `description:"结束日期"`
+	CreateTime       time.Time `description:"创建时间"`
+	ModifyTime       time.Time `description:"修改时间"`
+	LoseReason       string    `description:"流失原因"`
+	LossTime         time.Time `description:"流失时间"`
+	LogType          string    `description:"日志类型"`
+	LogCreateTime    time.Time `description:"日志创建时间"`
+	AdminId          int       `description:"操作人id"`
+	ApproveStatus    string    `description:"审批状态:'审批中','通过','驳回'"`
+	FreezeStartDate  string    `description:"冻结开始日期"`
+	FreezeEndDate    string    `description:"冻结结束日期"`
+}
+
+//type CompanyReportPermission struct {
+//之前的结构体已存在
+//}
+
+type CompanySource struct {
+	SourceId   int    `orm:"column(source_id);pk"`
+	SourceName string `description:"来源名称"`
+}
+
+//判断公司名称是否存在
+func GetCompanyCountByName(companyName string) (count int, err error) {
+	sql := `SELECT  COUNT(1) AS count FROM company WHERE company_name = ?`
+	err = orm.NewOrm().Raw(sql, companyName).QueryRow(&count)
+	return
+}
+
+//判断三方公司公司名称是否存在
+func GetCompanyCountByThirdName(tripartiteCompanyCode string) (count int, err error) {
+	sql := `SELECT  COUNT(1) AS count FROM company WHERE tripartite_company_code = ?`
+	err = orm.NewOrm().Raw(sql, tripartiteCompanyCode).QueryRow(&count)
+	return
+}
+
+//获取来源详情
+func GetCompanySourceByName(companyName string) (item *CompanySource, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM company_source WHERE source_name = ?`
+	err = o.Raw(sql, companyName).QueryRow(&item)
+	return
+}
+
+func GetCompanyCode() (companyCode string, err error) {
+	var num int
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS num FROM company WHERE created_time >=? `
+	err = o.Raw(sql, time.Now().Format(utils.FormatDate)).QueryRow(&num)
+	if err != nil {
+		return
+	}
+	companyCode = "KH" + time.Now().Format("20060102") + fmt.Sprintf("%03d", num)
+	return
+}
+
+//新增客户
+func AddCompany(item *Company) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+//更新客户基础信息
+func (company *Company) Update(cols []string) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Update(company, cols...)
+	fmt.Println(company)
+	fmt.Println(err)
+	return
+}
+
+//新增客户产品
+func AddCompanyProduct(item *CompanyProduct) (newId int64, err error) {
+	o := orm.NewOrm()
+	newId, err = o.Insert(item)
+	return
+}
+
+//新增客户产品
+func AddCompanyProductLog(item *CompanyProductLog) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+func GetCompanyReportPermissionCount(companyId, productId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS count FROM company_report_permission WHERE company_id=? AND product_id=? `
+	err = o.Raw(sql, companyId, productId).QueryRow(&count)
+	return
+}
+
+func DeleteCompanyReportPermission(companyId, productId int) (err error) {
+	o := orm.NewOrm()
+	sql := ` DELETE FROM company_report_permission WHERE company_id=? AND product_id=? `
+	_, err = o.Raw(sql, companyId, productId).Exec()
+	return
+}
+
+//新增客户权限
+func AddCompanyReportPermission(item *CompanyReportPermission) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+//新增客户权限日志
+func AddCompanyPermissionLog(item *CompanyPermissionLog) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+//新增客户操作记录
+func AddCompanyOperationRecord(item *CompanyOperationRecord) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}
+
+//新增客户产品
+func AddCompanyLog(item *CompanyLog) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}
+
+type UserSellerRelation struct {
+	RelationId int64     `orm:"column(relation_id);pk"`
+	UserId     int       `description:"用户id"`
+	CompanyId  int       `description:"企业用户id"`
+	SellerId   int       `description:"销售id"`
+	Seller     string    `description:"销售员名称"`
+	ProductId  int       `description:"产品id"`
+	Mobile     string    `description:"手机号"`
+	Email      string    `description:"邮箱"`
+	ModifyTime time.Time `description:"修改时间"`
+	CreateTime time.Time `description:"创建时间"`
+}
+
+//添加销售员与员工的关系
+func AddUserSellerRelation(userId int64, companyId, sellerId, productId int, seller, mobile, email string) (lastId int64, err error) {
+	o := orm.NewOrm()
+	relation := UserSellerRelation{
+		UserId:     int(userId),
+		SellerId:   sellerId,
+		CompanyId:  companyId,
+		Seller:     seller,
+		ProductId:  productId,
+		Mobile:     mobile,
+		Email:      email,
+		CreateTime: time.Now(),
+		ModifyTime: time.Now(),
+	}
+	lastId, err = o.Insert(&relation)
+	return
+}

+ 7 - 0
models/db.go

@@ -86,6 +86,13 @@ func init() {
 		new(CygxActivityMeetDetailLog),
 		new(CygxUserSearchKeyWord),
 		new(CompanyReportPermission),
+		new(Company),
+		new(CompanyLog),
+		new(CompanyOperationRecord),
+		new(CompanyPermissionLog),
+		new(CompanyProduct),
+		new(CompanyProductLog),
+		new(UserSellerRelation),
 		new(CygxShanghaiCompanyLog),
 		new(CygxShanghaiErrLog),
 		new(CygxUserFreeeButton),

+ 10 - 0
models/page_history_record.go

@@ -26,6 +26,16 @@ type CygxPageHistoryRecordRep struct {
 	PageType               string `description:"页面类型,纪要:Summary,纪要搜索:SummarySearch,报告:Report,报告搜索:ReportSearch,产业列表:IndustryList,活动:Activit,活动搜索:ActivitSearch,活动详情:ActivitParticulars,报告详情:ReportParticulars , 我的日程:MySchedule, 更多标签:LabelMore , 文章复制:ArticleCopy"`
 }
 
+type CygxPageHistoryRecordHtgjRep struct {
+	DetailId               string `description:"详情ID"`
+	ChartPermissionId      int    `description:"行业ID"`
+	IndustrialManagementId string `description:"产业ID"`
+	CompanyCode            string `description:"机构编码"`
+	CompanyName            string `description:"机构名称"`
+	Email                  string `description:"机构邮箱"`
+	Sign                   string `description:"签名"`
+}
+
 //添加
 func AddCygxPageHistoryRecord(item *CygxPageHistoryRecord) (lastId int64, err error) {
 	o := orm.NewOrm()

+ 1 - 1
models/seller.go

@@ -42,7 +42,7 @@ func GetSellerByCompanyIdCheckFicc(companyId, productId int) (item *AdminItem, e
 
 func GetSellerByName(userName string) (item *AdminItem, err error) {
 	o := orm.NewOrm()
-	sql := ` SELECT * FROM admin WHERE admin_name=? `
+	sql := ` SELECT * FROM admin WHERE real_name=? `
 	err = o.Raw(sql, userName).QueryRow(&item)
 	return
 }

+ 38 - 0
models/wx_user.go

@@ -48,6 +48,7 @@ type WxUser struct {
 	CountryCode         string    `description:"区号"`
 	OutboundMobile      string    `description:"外呼手机号"`
 	OutboundCountryCode string    `description:"外呼手机号区号"`
+	TripartiteCode      string    `description:"第三方给过来的用户编码,判断用户是否存在"`
 }
 
 //添加用户信息
@@ -250,3 +251,40 @@ func UPdateUserCountryCode(item *WxUserItem) (err error) {
 
 	return
 }
+
+//判断公司下用户名称是否存在
+func GetUserCountByName(companyId int, name string) (count int, err error) {
+	sql := `SELECT  COUNT(1) AS count FROM wx_user WHERE company_id = ? AND real_name = ?`
+	err = orm.NewOrm().Raw(sql, companyId, name).QueryRow(&count)
+	return
+}
+
+//判断公司下用户名称是否存在
+func GetUserCountByThirdName(companyId int, name string) (count int, err error) {
+	sql := `SELECT  COUNT(1) AS count FROM wx_user WHERE company_id = ? AND tripartite_code = ?`
+	err = orm.NewOrm().Raw(sql, companyId, name).QueryRow(&count)
+	return
+}
+
+func UpdateUserMobile(uid int, mobile string) (err error) {
+	sql := ` UPDATE wx_user SET mobile=?
+			WHERE user_id=? `
+	_, err = orm.NewOrm().Raw(sql, mobile, uid).Exec()
+	return
+}
+
+//获取公司下用户详情详情详情
+func GetUserByName(companyId int, name string) (item *WxUser, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM wx_user WHERE company_id = ? AND real_name = ? `
+	err = o.Raw(sql, companyId, name).QueryRow(&item)
+	return
+}
+
+//获取公司下用户详情详情详情
+func GetUserByThirdName(companyId int, name string) (item *WxUser, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT *  FROM wx_user WHERE company_id = ? AND tripartite_code = ? `
+	err = o.Raw(sql, companyId, name).QueryRow(&item)
+	return
+}

+ 63 - 0
routers/commentsRouter_controllers.go

@@ -214,6 +214,24 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"],
+        beego.ControllerComments{
+            Method: "AddStopTimePublic",
+            Router: "/addStopTimePublic",
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"],
+        beego.ControllerComments{
+            Method: "DetailPublic",
+            Router: "/detailPublic",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"],
         beego.ControllerComments{
             Method: "Detail",
@@ -223,6 +241,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleCommonController"],
+        beego.ControllerComments{
+            Method: "PageHistoryPublic",
+            Router: "/pageHistoryPublic",
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ArticleController"],
         beego.ControllerComments{
             Method: "AddStopTime",
@@ -277,6 +304,33 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseConfigController"],
+        beego.ControllerComments{
+            Method: "HotDetail",
+            Router: "/detailPublic",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHomeController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:BaseHomeController"],
+        beego.ControllerComments{
+            Method: "ListHomePublic",
+            Router: "/listPublic",
+            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",
+            Router: "/listPublic",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartPermissionAuthController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartPermissionAuthController"],
         beego.ControllerComments{
             Method: "Detail",
@@ -304,6 +358,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartPermissionController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ChartPermissionController"],
+        beego.ControllerComments{
+            Method: "DetailPublic",
+            Router: "/allPublic",
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ConfigController"] = append(beego.GlobalControllerRouter["hongze/hongze_cygx/controllers:ConfigController"],
         beego.ControllerComments{
             Method: "DescriptionOfResearch",

+ 9 - 0
routers/router.go

@@ -27,6 +27,9 @@ func init() {
 			web.NSInclude(
 				&controllers.HomeController{},
 			),
+			web.NSInclude(
+				&controllers.BaseHomeController{},
+			),
 		),
 		web.NSNamespace("/wechat",
 			web.NSInclude(
@@ -55,11 +58,17 @@ func init() {
 			web.NSInclude(
 				&controllers.ConfigController{},
 			),
+			web.NSInclude(
+				&controllers.BaseConfigController{},
+			),
 		),
 		web.NSNamespace("/search",
 			web.NSInclude(
 				&controllers.SearchController{},
 			),
+			web.NSInclude(
+				&controllers.BaseSearchController{},
+			),
 		),
 		web.NSNamespace("/resource",
 			web.NSInclude(

+ 0 - 4
services/elastic.go

@@ -707,9 +707,6 @@ func EsMultiMatchFunctionScoreQuerySort(indexName, keyWord string, startSize, pa
 		keyWordArr = append(keyWordArr, keyWord)
 		keyWordLen = len(keyWordArr)
 	}
-	for _, v := range keyWordArr {
-		fmt.Println(v)
-	}
 
 	// @Param   OrderColumn   query   int  true       "排序字段 ,Comprehensive综合 ,Matching匹配度 ,PublishDate 发布时间 "
 	utils.FileLog.Info("SearchKeyWord:%s, userId:%s", keyWordArr, strconv.Itoa(userId))
@@ -823,7 +820,6 @@ func EsMultiMatchFunctionScoreQueryTimeSort(indexName, keyWord string, startSize
 		keyWordArr = append(keyWordArr, keyWord)
 		keyWordLen = len(keyWordArr)
 	}
-	fmt.Println(keyWordArr)
 	utils.FileLog.Info("SearchKeyWord:%s, userId:%s", keyWordArr, strconv.Itoa(userId))
 	for _, v := range keyWordArr {
 		if v != "" {

+ 310 - 0
services/htgj.go

@@ -0,0 +1,310 @@
+package services
+
+import (
+	"fmt"
+	"hongze/hongze_cygx/models"
+	"hongze/hongze_cygx/utils"
+	"strconv"
+	"strings"
+	"time"
+)
+
+func CheckHtgj(companyCodeHt, companyNameHt, email, sign string) (errMsg string, errHt error, user *models.WxUser, companyName string) {
+	errMsg = CheckSign(companyCodeHt+companyNameHt+email, sign)
+	if errMsg != "" {
+		errMsg = "签名方式错误!"
+		return
+	}
+	var wxuUserName, tripartiteCompanyCode string
+	var startDate, endDate string
+	var companyId int64
+
+	companyName = companyCodeHt[0:4] + "_" + companyNameHt
+	tripartiteCompanyCode = companyCodeHt + "_" + companyNameHt
+	wxUser := new(models.WxUser)
+	productId := 2
+	productName := "权益"
+	itemCompany := new(models.Company)
+	sellerInfo, err := models.GetSellerByName(utils.HtgjDefaultSaleName)
+	if err != nil {
+		errHt = err
+		return
+	}
+	wxuUserName = email
+	countCompay, err := models.GetCompanyCountByThirdName(tripartiteCompanyCode)
+	if err != nil {
+		errHt = err
+		return
+	}
+	if countCompay == 0 {
+		defaultPermissionIds, err := models.GetCompanyPermissionIdWithHtgj()
+		if err != nil {
+			errHt = err
+			return
+		}
+		companySourceInfo, err := models.GetCompanySourceByName(utils.HtgjName)
+		if err != nil {
+			errHt = err
+			return
+		}
+
+		companyCode, err := models.GetCompanyCode()
+		if err != nil {
+			errHt = err
+			return
+		}
+		startDate = time.Now().Format(utils.FormatDate)
+		endDate = time.Now().AddDate(0, 2, 0).Format(utils.FormatDate)
+		itemCompany.TripartiteCompanyCode = tripartiteCompanyCode
+		itemCompany.CompanyName = companyName
+		itemCompany.CreditCode = "HZ" + strconv.FormatInt(time.Now().UnixNano()/1e6, 10)
+		itemCompany.CompanyCode = companyCode
+		itemCompany.StartDate = startDate
+		itemCompany.EndDate = endDate
+		itemCompany.CreatedTime = time.Now()
+		itemCompany.LastUpdatedTime = time.Now()
+		itemCompany.Enabled = 1
+		itemCompany.CompanyType = 2
+		itemCompany.RegionType = "海外"
+		companyId, err = models.AddCompany(itemCompany)
+		if err != nil {
+			errHt = err
+			return
+		}
+		//更新三方Code
+		itemCompany.OpenCompanyCode = GenerateOpenCompanyCode(int(companyId))
+		itemCompany.CompanyId = int(companyId)
+		itemCompany.Update([]string{"OpenCompanyCode"})
+
+		companyProduct := new(models.CompanyProduct)
+		companyProduct.CompanyId = int(companyId)
+		companyProduct.ProductId = productId
+		companyProduct.ProductName = productName
+		companyProduct.CompanyName = companyName
+		companyProduct.Source = companySourceInfo.SourceName
+		companyProduct.Reasons = ""
+		companyProduct.Status = "试用"
+		companyProduct.StartDate = startDate
+		companyProduct.EndDate = endDate
+		companyProduct.IndustryId = 11 //11是海通国际的ID
+		companyProduct.IndustryName = "其他类型"
+		companyProduct.SellerId = sellerInfo.AdminId
+		companyProduct.SellerName = sellerInfo.RealName
+		companyProduct.GroupId = sellerInfo.GroupId
+		companyProduct.DepartmentId = sellerInfo.DepartmentId
+		companyProduct.IsSuspend = 0
+		companyProduct.CreateTime = time.Now()
+		companyProduct.ModifyTime = time.Now()
+		companyProduct.CompanyType = "权益"
+		companyProduct.OpenCode = GenerateOpenCompanyProductCode(int(companyId), productId)
+		companyProductId, err := models.AddCompanyProduct(companyProduct)
+		if err != nil {
+			errHt = err
+			return
+		}
+		err = AddCompanyPermission(int(companyId), sellerInfo.AdminId, productId, productName, sellerInfo.RealName, defaultPermissionIds, startDate, endDate)
+		if err != nil {
+			errHt = err
+			return
+		}
+
+		{
+			record := new(models.CompanyOperationRecord)
+			record.CompanyId = int(companyId)
+			record.CompanyName = companyName
+			record.SellerId = sellerInfo.AdminId
+			record.SysUserId = sellerInfo.AdminId
+			record.SysRealName = sellerInfo.RealName
+			record.Remark = "新增客户"
+			record.Operation = "add"
+			record.CreateTime = time.Now()
+			record.ProductId = productId
+			record.ProductName = productName
+			record.Status = "试用"
+			_, err = models.AddCompanyOperationRecord(record)
+			if err != nil {
+				errHt = err
+				go utils.SendEmail(utils.APPNAME+"失败提醒"+utils.RunMode, "海通国际添加客户失败"+err.Error(), utils.EmailSendToUsers)
+			}
+		}
+		//新增客户日志
+		{
+			companyLog := new(models.CompanyLog)
+			companyLog.CompanyId = int(companyId)
+			companyLog.CompanyName = companyName
+			companyLog.CreditCode = ""
+			companyLog.CompanyCode = companyCode
+			companyLog.Sort = itemCompany.Sort
+			companyLog.IsFeeCustomer = itemCompany.IsFeeCustomer
+			companyLog.Country = itemCompany.Country
+			companyLog.Address = itemCompany.Address
+			companyLog.City = itemCompany.City
+			companyLog.Province = itemCompany.Province
+			companyLog.Enabled = itemCompany.Enabled
+			companyLog.CreatedTime = itemCompany.CreatedTime
+			companyLog.LastUpdatedTime = itemCompany.LastUpdatedTime
+			companyLog.Seller = itemCompany.Seller
+			companyLog.SellsId = itemCompany.SellsId
+			companyLog.CompanyBelong = itemCompany.CompanyBelong
+			companyLog.StartDate = itemCompany.StartDate
+			companyLog.EndDate = itemCompany.EndDate
+			companyLog.FirstStartDate = itemCompany.FirstStartDate
+			companyLog.FirstEndDate = itemCompany.FirstEndDate
+			companyLog.DateType = itemCompany.DateType
+			companyLog.AdminId = sellerInfo.AdminId
+			companyLog.LogType = "add"
+			companyLog.LogCreateTime = time.Now()
+			go models.AddCompanyLog(companyLog)
+		}
+
+		//新增客户产品日志
+		{
+			productLog := new(models.CompanyProductLog)
+			productLog.CompanyProductId = int(companyProductId)
+			productLog.CompanyId = companyProduct.CompanyId
+			productLog.ProductId = companyProduct.ProductId
+			productLog.ProductName = companyProduct.ProductName
+			productLog.CompanyName = companyProduct.CompanyName
+			productLog.CompanyName = companyProduct.CompanyName
+			productLog.Source = companyProduct.Source
+			productLog.Reasons = companyProduct.Reasons
+			productLog.Status = companyProduct.Status
+			productLog.IndustryId = companyProduct.IndustryId
+			productLog.IndustryName = companyProduct.IndustryName
+			productLog.SellerId = companyProduct.SellerId
+			productLog.SellerName = companyProduct.SellerName
+			productLog.GroupId = companyProduct.GroupId
+			productLog.DepartmentId = companyProduct.DepartmentId
+			productLog.IsSuspend = companyProduct.IsSuspend
+			productLog.SuspendTime = companyProduct.SuspendTime
+			productLog.ApproveStatus = companyProduct.ApproveStatus
+			productLog.FreezeTime = companyProduct.FreezeTime
+			productLog.Remark = companyProduct.Remark
+			productLog.StartDate = companyProduct.StartDate
+			productLog.EndDate = companyProduct.EndDate
+			productLog.CreateTime = companyProduct.CreateTime
+			productLog.ModifyTime = companyProduct.ModifyTime
+			productLog.LoseReason = companyProduct.LoseReason
+			productLog.LossTime = companyProduct.LossTime
+			productLog.LogType = "add"
+			productLog.LogCreateTime = time.Now()
+			productLog.AdminId = sellerInfo.AdminId
+			go models.AddCompanyProductLog(productLog)
+		}
+
+	} else {
+		companyInfo, err := models.GetCompanyByThirdName(tripartiteCompanyCode)
+		if err != nil {
+			errHt = err
+			return
+		}
+		companyId = int64(companyInfo.CompanyId)
+	}
+	countUser, err := models.GetUserCountByThirdName(int(companyId), wxuUserName)
+	if countUser == 0 {
+		wxUser.CompanyId = int(companyId)
+		wxUser.RealName = wxuUserName
+		wxUser.Email = wxuUserName
+		wxUser.TripartiteCode = wxuUserName
+		wxUser.Source = 7
+		wxUser.CreatedTime = time.Now()
+		newUserId, err := models.AddWxUser(wxUser)
+		if err != nil {
+			errHt = err
+			return
+		}
+		md5Mobile := utils.Get16MD5Encode(strconv.Itoa(int(newUserId)))
+		wxUser.Mobile = md5Mobile
+		wxUser.UserId = int(newUserId)
+		err = models.UpdateUserMobile(int(newUserId), md5Mobile)
+		if err != nil {
+			errHt = err
+			return
+		}
+		models.AddUserSellerRelation(newUserId, int(companyId), sellerInfo.AdminId, productId, sellerInfo.RealName, wxUser.Mobile, wxuUserName)
+	} else {
+		wxUser, err = models.GetUserByThirdName(int(companyId), wxuUserName)
+		if err != nil {
+			errHt = err
+			return
+		}
+	}
+	user = wxUser
+	return
+}
+
+// GenerateOpenCompanyCode 生成第三方code编号
+func GenerateOpenCompanyCode(companyId int) (openCode string) {
+	openCode = utils.MD5(fmt.Sprint(companyId, "hzyj20210902"))
+	return
+}
+
+// GenerateOpenCompanyProductCode 生成客户产品第三方code编号
+func GenerateOpenCompanyProductCode(companyId, productId int) (openCode string) {
+	openCode = utils.MD5(fmt.Sprint(companyId, "_", productId, "hzyj20210902"))
+	return
+}
+
+//新增客户权限
+func AddCompanyPermission(companyId, sysUserId, productId int, productName, sysUserName, permissionStr, startDate, endDate string) (err error) {
+	if permissionStr == "" {
+		return
+	}
+	permissionArr := strings.Split(permissionStr, ",")
+	count, _ := models.GetCompanyReportPermissionCount(companyId, productId)
+
+	//删除权限
+	if count > 0 {
+		err = models.DeleteCompanyReportPermission(companyId, productId)
+		if err != nil {
+			return
+		}
+	}
+	for _, pv := range permissionArr {
+		permissionId, err := strconv.Atoi(pv)
+		if err != nil {
+			return err
+		}
+		permission := new(models.CompanyReportPermission)
+		permission.CompanyId = companyId
+		permission.ReportPermissionId = permissionId
+		permission.CreatedTime = time.Now()
+		permission.LastUpdatedTime = time.Now()
+		permission.ChartPermissionId = permissionId
+		permission.StartDate = startDate
+		permission.EndDate = endDate
+		permission.ProductId = productId
+		permission.ProductName = productName
+		permission.ModifyTime = time.Now().Format(utils.FormatDateTime)
+		permission.Status = "试用"
+		err = models.AddCompanyReportPermission(permission)
+		if err != nil {
+			return err
+		}
+
+		cpLog := new(models.CompanyPermissionLog)
+		cpLog.CompanyId = companyId
+		cpLog.ChartPermissionId = permissionId
+		cpLog.CreateTime = time.Now()
+		cpLog.SysUserId = sysUserId
+		cpLog.SysUserName = sysUserName
+		cpLog.StartDate = startDate
+		cpLog.EndDate = endDate
+		cpLog.ProductId = productId
+		cpLog.ProductName = productName
+		go models.AddCompanyPermissionLog(cpLog)
+	}
+	return
+}
+
+func CheckSign(userName, sign string) (errMsg string) {
+	var pwdSign string
+	pwdSign = userName + utils.HtgjSalt
+	fmt.Println("pwdSign", pwdSign)
+	pwdSign = strings.ToUpper(utils.MD5(pwdSign))
+	fmt.Println(pwdSign)
+	if sign != pwdSign {
+		errMsg = "签名错误"
+	}
+	return
+}

+ 1 - 1
services/user.go

@@ -222,7 +222,7 @@ func BindWxUser(openid, mobile, email, countryCode string) (wxUser *models.WxUse
 			OutboundCountryCode: countryCode,
 		}
 		tmpUserId, addUserErr := models.AddWxUser(user)
-		if err != nil {
+		if addUserErr != nil {
 			err = addUserErr
 			return
 		}

+ 7 - 0
utils/common.go

@@ -68,6 +68,13 @@ func MD5(data string) string {
 	return hex.EncodeToString(m[:])
 }
 
+//md5加密
+func Get16MD5Encode(data string) string {
+	m := md5.Sum([]byte(data))
+	encodehex := hex.EncodeToString(m[:])
+	return encodehex[8:24]
+}
+
 // 获取数字随机字符
 func GetRandDigit(n int) string {
 	return fmt.Sprintf("%0"+strconv.Itoa(n)+"d", rnd.Intn(int(math.Pow10(n))))

+ 6 - 0
utils/config.go

@@ -63,6 +63,9 @@ var (
 	EmailExpert               string //研选行业专家邮箱
 	EmaiWhiteUserList         string //白名单邮箱
 	IsTask                    bool   //是否执行定时任务
+	HtgjDefaultSaleName       string //海通默认销售名称
+	HtgjSalt                  string //海通加密使用的盐
+	HtgjName                  string //海通国际名称
 	ActSendMsgMobile          string //活动带问发送模板消息接收者的手机号
 	StrategyPlatform          string //策略品台跳转链接地址
 )
@@ -110,6 +113,9 @@ func init() {
 	YanxSummaryPermissionId = 1001     //研选纪要分类ID
 	YanxViewpointPermissionId = 1002   //研选观点分类ID
 	WxMsgTemplateIdAskMsgMobileAll = "15557270714,18767183922,18621268829"
+	HtgjDefaultSaleName = "王芳"
+	HtgjSalt = "HTGJ&HZ"
+	HtgjName = "海通国际"
 	StrategyPlatform = "https://vmp.hzinsights.com/v2/articles/"
 	if RunMode == "release" {
 		WxAppId = "wxcc32b61f96720d2f"