|
@@ -2,11 +2,11 @@ package controllers
|
|
|
|
|
|
import (
|
|
import (
|
|
"encoding/json"
|
|
"encoding/json"
|
|
- "fmt"
|
|
|
|
"hongze/hongze_cygx/models"
|
|
"hongze/hongze_cygx/models"
|
|
"hongze/hongze_cygx/services"
|
|
"hongze/hongze_cygx/services"
|
|
"hongze/hongze_cygx/utils"
|
|
"hongze/hongze_cygx/utils"
|
|
"html"
|
|
"html"
|
|
|
|
+ "regexp"
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
"time"
|
|
"time"
|
|
@@ -132,25 +132,23 @@ func (this *ArticleController) Detail() {
|
|
articlePermissionPermissionName = detail.CategoryName
|
|
articlePermissionPermissionName = detail.CategoryName
|
|
}
|
|
}
|
|
|
|
|
|
- var detailNew *models.AddStopTimeNewRep
|
|
|
|
- detailNew, _ = models.GetNewArticleHistoryRecord(uid, articleId)
|
|
|
|
- if detailNew != nil {
|
|
|
|
- if detailNew.StopTime != 0 {
|
|
|
|
- if strings.Contains(companyPermission, articlePermissionPermissionName) {
|
|
|
|
- hasPermission = 1
|
|
|
|
- historyRecord := new(models.CygxArticleHistoryRecord)
|
|
|
|
- historyRecord.UserId = uid
|
|
|
|
- historyRecord.ArticleId = articleId
|
|
|
|
- historyRecord.CreateTime = time.Now()
|
|
|
|
- historyRecord.Mobile = user.Mobile
|
|
|
|
- historyRecord.Email = user.Email
|
|
|
|
- historyRecord.CompanyId = user.CompanyId
|
|
|
|
- historyRecord.CompanyName = user.CompanyName
|
|
|
|
- go models.AddCygxArticleHistoryRecord(historyRecord)
|
|
|
|
- } else { //无该行业权限
|
|
|
|
- hasPermission = 3
|
|
|
|
- }
|
|
|
|
|
|
+ if strings.Contains(companyPermission, articlePermissionPermissionName) {
|
|
|
|
+ hasPermission = 1
|
|
|
|
+ var detailNew *models.AddStopTimeNewRep
|
|
|
|
+ detailNew, _ = models.GetNewArticleHistoryRecord(uid, articleId)
|
|
|
|
+ if detailNew == nil || detailNew.StopTime != 0 {
|
|
|
|
+ historyRecord := new(models.CygxArticleHistoryRecord)
|
|
|
|
+ historyRecord.UserId = uid
|
|
|
|
+ historyRecord.ArticleId = articleId
|
|
|
|
+ historyRecord.CreateTime = time.Now()
|
|
|
|
+ historyRecord.Mobile = user.Mobile
|
|
|
|
+ historyRecord.Email = user.Email
|
|
|
|
+ historyRecord.CompanyId = user.CompanyId
|
|
|
|
+ historyRecord.CompanyName = user.CompanyName
|
|
|
|
+ go models.AddCygxArticleHistoryRecord(historyRecord)
|
|
}
|
|
}
|
|
|
|
+ } else { //无该行业权限
|
|
|
|
+ hasPermission = 3
|
|
}
|
|
}
|
|
|
|
|
|
if hasPermission == 1 {
|
|
if hasPermission == 1 {
|
|
@@ -202,14 +200,23 @@ func (this *ArticleController) Detail() {
|
|
detail.SellerName = sellerItem.RealName
|
|
detail.SellerName = sellerItem.RealName
|
|
}
|
|
}
|
|
sellerList, err := models.GetSellerList(articleId)
|
|
sellerList, err := models.GetSellerList(articleId)
|
|
- fmt.Println(sellerList)
|
|
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取信息失败"
|
|
br.Msg = "获取信息失败"
|
|
br.ErrMsg = "获取销售数据失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
|
|
br.ErrMsg = "获取销售数据失败,Err:" + err.Error() + strconv.Itoa(uid) + ";articleId" + strconv.Itoa(articleId)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
if detail.ArticleId > 1000000 {
|
|
if detail.ArticleId > 1000000 {
|
|
- fmt.Println(detail.SellerAndMobile)
|
|
|
|
|
|
+ var hrefRegexp = regexp.MustCompile("[0-9]\\d*")
|
|
|
|
+ match := hrefRegexp.FindAllString(detail.SellerAndMobile, -1)
|
|
|
|
+ if match != nil {
|
|
|
|
+ for _, v := range match {
|
|
|
|
+ sellerAndMobile := &models.SellerRep{
|
|
|
|
+ SellerMobile: v,
|
|
|
|
+ SellerName: strings.Replace(detail.SellerAndMobile, v, "", -1),
|
|
|
|
+ }
|
|
|
|
+ sellerList = append(sellerList, sellerAndMobile)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
detail.SellerList = sellerList
|
|
detail.SellerList = sellerList
|
|
} else { //潜在客户
|
|
} else { //潜在客户
|
|
@@ -442,6 +449,19 @@ func (this *ArticleCommonController) Detail() {
|
|
br.ErrMsg = "获取销售数据失败,Err:" + err.Error() + ";articleId" + strconv.Itoa(detail.ArticleId)
|
|
br.ErrMsg = "获取销售数据失败,Err:" + err.Error() + ";articleId" + strconv.Itoa(detail.ArticleId)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if detail.ArticleId > 1000000 {
|
|
|
|
+ var hrefRegexp = regexp.MustCompile("[0-9]\\d*")
|
|
|
|
+ match := hrefRegexp.FindAllString(detail.SellerAndMobile, -1)
|
|
|
|
+ if match != nil {
|
|
|
|
+ for _, v := range match {
|
|
|
|
+ sellerAndMobile := &models.SellerRep{
|
|
|
|
+ SellerMobile: v,
|
|
|
|
+ SellerName: strings.Replace(detail.SellerAndMobile, v, "", -1),
|
|
|
|
+ }
|
|
|
|
+ sellerList = append(sellerList, sellerAndMobile)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
detail.SellerList = sellerList
|
|
detail.SellerList = sellerList
|
|
resp.Detail = detail
|
|
resp.Detail = detail
|
|
br.Ret = 200
|
|
br.Ret = 200
|