|
@@ -978,8 +978,10 @@ func (this *ArticleController) Pdfwatermark() {
|
|
|
// @Title 获取报告详情(无需token)
|
|
|
// @Description 获取报告详情接口
|
|
|
// @Param ArticleId query int true "报告ID"
|
|
|
-// @Param UserName query string true "用户名称"
|
|
|
-// @Param Sign query string true "加密签名"
|
|
|
+// @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() {
|
|
@@ -990,14 +992,27 @@ func (this *ArticleCommonController) DetailPublic() {
|
|
|
}()
|
|
|
|
|
|
articleId, _ := this.GetInt("ArticleId")
|
|
|
- userName := this.GetString("UserName")
|
|
|
+ companyCode := this.GetString("CompanyCode")
|
|
|
+ companyNameHt := this.GetString("CompanyName")
|
|
|
+ email := this.GetString("Email")
|
|
|
sign := this.GetString("Sign")
|
|
|
- errMsg, err, wxUser, companyName := services.CheckHtgj(userName, 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
|
|
@@ -1051,7 +1066,7 @@ func (this *ArticleCommonController) DetailPublic() {
|
|
|
if strings.Contains(detail.CategoryName, "研选") {
|
|
|
detail.IsResearch = true
|
|
|
}
|
|
|
- resp := new(models.ArticleDetailHtgjResp)
|
|
|
+
|
|
|
resp.HasPermission = hasPermission
|
|
|
if hasPermission == 1 {
|
|
|
//获取销售手机号
|
|
@@ -1149,29 +1164,26 @@ func (this *ArticleCommonController) AddStopTimePublic() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
articleId := req.ArticleId
|
|
|
stopTime := req.StopTime
|
|
|
outType := req.OutType
|
|
|
source := req.Source
|
|
|
- userName := req.UserName
|
|
|
+ companyCode := req.CompanyCode
|
|
|
+ companyName := req.CompanyName
|
|
|
+ wxuUserName := req.Email
|
|
|
sign := req.Sign
|
|
|
-
|
|
|
- var companyName, wxuUserName string
|
|
|
- userNameList := strings.Split(userName, "-")
|
|
|
- if len(userNameList) != 2 {
|
|
|
- br.Msg = "用户信息格式错误"
|
|
|
- br.ErrMsg = "用户信息格式错误" + userName
|
|
|
+ if companyCode == "" || companyName == "" || wxuUserName == "" || sign == "" {
|
|
|
+ br.Msg = "上传失败"
|
|
|
+ br.ErrMsg = "必填参数不能为空"
|
|
|
return
|
|
|
}
|
|
|
- if sign == "" {
|
|
|
- br.Msg = "签名错误"
|
|
|
- br.ErrMsg = "签名错误" + sign
|
|
|
+ companyNameHt := companyCode[0:4] + "_" + companyName
|
|
|
+ errMsg := services.CheckSign(companyCode+companyName+wxuUserName, sign)
|
|
|
+ if errMsg != "" {
|
|
|
+ br.Msg = errMsg
|
|
|
return
|
|
|
}
|
|
|
- companyName = userNameList[0]
|
|
|
- wxuUserName = userNameList[1]
|
|
|
- companyInfo, err := models.GetCompanyByName(companyName)
|
|
|
+ companyInfo, err := models.GetCompanyByName(companyNameHt)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|
|
@@ -1185,7 +1197,7 @@ func (this *ArticleCommonController) AddStopTimePublic() {
|
|
|
}
|
|
|
uid := user.UserId
|
|
|
if articleId <= 0 {
|
|
|
- br.Msg = "参数错误"
|
|
|
+ br.Msg = "文章ID不存在"
|
|
|
br.ErrMsg = "参数错误"
|
|
|
return
|
|
|
}
|
|
@@ -1285,6 +1297,15 @@ func (this *ArticleCommonController) AddStopTimePublic() {
|
|
|
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)
|
|
|
}
|
|
@@ -1332,24 +1353,22 @@ func (this *ArticleCommonController) PageHistoryPublic() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- userName := req.UserName
|
|
|
+ companyCode := req.CompanyCode
|
|
|
+ companyName := req.CompanyName
|
|
|
+ wxuUserName := req.Email
|
|
|
sign := req.Sign
|
|
|
-
|
|
|
- var companyName, wxuUserName string
|
|
|
- userNameList := strings.Split(userName, "-")
|
|
|
- if len(userNameList) != 2 {
|
|
|
- br.Msg = "用户信息格式错误"
|
|
|
- br.ErrMsg = "用户信息格式错误" + userName
|
|
|
+ if companyCode == "" || companyName == "" || wxuUserName == "" || sign == "" {
|
|
|
+ br.Msg = "上传失败"
|
|
|
+ br.ErrMsg = "必填参数不能为空"
|
|
|
return
|
|
|
}
|
|
|
- if sign == "" {
|
|
|
- br.Msg = "签名错误"
|
|
|
- br.ErrMsg = "签名错误" + sign
|
|
|
+ companyNameHt := companyCode[0:4] + "_" + companyName
|
|
|
+ errMsg := services.CheckSign(companyCode+companyName+wxuUserName, sign)
|
|
|
+ if errMsg != "" {
|
|
|
+ br.Msg = errMsg
|
|
|
return
|
|
|
}
|
|
|
- companyName = userNameList[0]
|
|
|
- wxuUserName = userNameList[1]
|
|
|
- companyInfo, err := models.GetCompanyByName(companyName)
|
|
|
+ companyInfo, err := models.GetCompanyByName(companyNameHt)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取客户信息失败,Err:" + err.Error()
|