瀏覽代碼

no message

xingzai 2 年之前
父節點
當前提交
cf19224395
共有 7 個文件被更改,包括 78 次插入41 次删除
  1. 4 19
      controllers/config.go
  2. 11 10
      models/about_us_video_history.go
  3. 1 0
      models/db.go
  4. 1 0
      models/resource_data.go
  5. 1 1
      routers/commentsRouter.go
  6. 29 0
      services/config.go
  7. 31 11
      services/resource_data.go

+ 4 - 19
controllers/config.go

@@ -4,7 +4,6 @@ import (
 	"hongze/hongze_clpt/models"
 	"hongze/hongze_clpt/services"
 	"hongze/hongze_clpt/utils"
-	"time"
 )
 
 type ConfigController struct {
@@ -62,9 +61,8 @@ func (this *ConfigController) AboutUs() {
 
 // @Title 关于我们浏览记录
 // @Description 关于我们浏览记录接口
-// @Param	request	body models.IsShow true "type json string"
 // @Success 200
-// @router /aboutUs/addHistory [POST]
+// @router /aboutUs/addHistory [post]
 func (this *ConfigController) AboutUsAdd() {
 	br := new(models.BaseResponse).Init()
 	defer func() {
@@ -77,22 +75,9 @@ func (this *ConfigController) AboutUsAdd() {
 		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)
+	go services.AddCygxAboutUsVideoHistory(user)
+
 	br.Ret = 200
 	br.Success = true
+	br.Msg = "操作成功!"
 }

+ 11 - 10
models/about_us_video_history.go

@@ -6,16 +6,17 @@ import (
 )
 
 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:"所属销售"`
+	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:"所属销售"`
+	RegisterPlatform int       `description:"来源 1小程序,2:网页"`
 }
 
 // 添加历史信息

+ 1 - 0
models/db.go

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

+ 1 - 0
models/resource_data.go

@@ -95,6 +95,7 @@ type CygxResourceDataNewResp struct {
 	Researchsummary    *CygxReportSelectionRep                 `description:"本周研究汇总"`
 	Minutessummary     *CygxReportSelectionRep                 `description:"上周纪要汇总"`
 	Meetingreviewchapt *CygxMorningMeetingGatherDetailListResp `description:"晨会精华"`
+	ProductInterior    *CygxProductInteriorResp                `description:"产品内测"`
 }
 
 // 列表

+ 1 - 1
routers/commentsRouter.go

@@ -272,7 +272,7 @@ func init() {
         beego.ControllerComments{
             Method: "AboutUsAdd",
             Router: `/aboutUs/addHistory`,
-            AllowHTTPMethods: []string{"POST"},
+            AllowHTTPMethods: []string{"post"},
             MethodParams: param.Make(),
             Filters: nil,
             Params: nil})

+ 29 - 0
services/config.go

@@ -7,6 +7,7 @@ import (
 	"hongze/hongze_clpt/utils"
 	"strconv"
 	"strings"
+	"time"
 )
 
 // 是否展示限免标签
@@ -78,3 +79,31 @@ func GetActivityReportLinkToArticleList(item *models.ActivityListResp) (items []
 	}
 	return
 }
+
+// 添加关于我们浏览记录
+func AddCygxAboutUsVideoHistory(user *models.WxUserItem) (err error) {
+	defer func() {
+		if err != nil {
+			go utils.SendAlarmMsg("产品内测用户浏览信息记录失败"+err.Error(), 2)
+		}
+	}()
+	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
+	historyRecord.RegisterPlatform = utils.REGISTER_PLATFORM
+	if sellerItem != nil {
+		historyRecord.SellerName = sellerItem.RealName
+	}
+
+	_, err = models.AddCygxAboutUsVideoHistory(historyRecord)
+	return
+}

+ 31 - 11
services/resource_data.go

@@ -32,17 +32,18 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 		mapItems[fmt.Sprint(v.Source, v.SourceId)] = item
 	}
 
-	var articleIds []int
-	var newchartIds []int
-	var roadshowIds []string
-	var activityIds []int
-	var activityvideoIds []string
-	var activityvoiceIds []string
-	var activityspecialIds []int
-	var researchsummaryIds []int
-	var minutessummaryIds []int
-	var meetingreviewchaptIds []int
-	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt "`
+	var articleIds []int            //报告
+	var newchartIds []int           //图表
+	var roadshowIds []string        //微路演
+	var activityIds []int           //活动
+	var activityvideoIds []string   // 活动视频
+	var activityvoiceIds []string   //活动音频
+	var activityspecialIds []int    //专项调研活动
+	var researchsummaryIds []int    //本周研究汇总
+	var minutessummaryIds []int     //上周纪要汇总
+	var meetingreviewchaptIds []int //晨会精华
+	var productinteriorIds []int    //产品内测
+	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt  、 产品内测:productinterior
 	for _, v := range list {
 		if v.Source == "article" {
 			articleIds = append(articleIds, v.SourceId)
@@ -64,6 +65,8 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 			minutessummaryIds = append(minutessummaryIds, v.SourceId)
 		} else if v.Source == "meetingreviewchapt" {
 			meetingreviewchaptIds = append(meetingreviewchaptIds, v.SourceId)
+		} else if v.Source == "productinterior" {
+			productinteriorIds = append(productinteriorIds, v.SourceId)
 		}
 	}
 	detail, e := models.GetConfigByCode("city_img_url")
@@ -171,6 +174,23 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 		}
 	}
 
+	//处理产品内测
+	if len(productinteriorIds) > 0 {
+		pars = make([]interface{}, 0)
+		condition = `  AND art.status = 1 AND art.product_interior_id  IN (` + utils.GetOrmInReplace(len(productinteriorIds)) + `)`
+		pars = append(pars, productinteriorIds)
+		listProductInterior, e := models.GetCygxProductInteriorList(condition, pars, 0, len(productinteriorIds))
+		if e != nil {
+			err = errors.New("GetCygxProductInteriorList, Err: " + e.Error())
+			return
+		}
+		for _, v := range listProductInterior {
+			v.Body, _ = GetReportContentTextSub(v.Body)
+			v.PublishTime = utils.TimeRemoveHms2(v.PublishTime)
+			mapItems[fmt.Sprint("productinterior", v.ProductInteriorId)].ProductInterior = v
+		}
+	}
+
 	//处理活动
 	if len(activityIds) > 0 {
 		for _, vss := range activityIds {