Browse Source

Merge branch 'cygx_10.5.3' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 year ago
parent
commit
8a4cdae328
2 changed files with 9 additions and 4 deletions
  1. 5 4
      models/page_history_record.go
  2. 4 0
      services/page_history_record.go

+ 5 - 4
models/page_history_record.go

@@ -21,6 +21,7 @@ type CygxPageHistoryRecord struct {
 	Router                 string    `description:"路由"`
 	PageRouter             string    `description:"前端页面路径"`
 	Parameter              string    `description:"参数"`
+	RegisterPlatform       int       `description:"来源 1小程序,2:网页"`
 }
 
 type CygxPageHistoryRecordRep struct {
@@ -40,7 +41,7 @@ type CygxPageHistoryRecordHtgjRep struct {
 	Sign                   string `description:"签名"`
 }
 
-//添加
+// 添加
 func AddCygxPageHistoryRecord(item *CygxPageHistoryRecord) (lastId int64, err error) {
 	o := orm.NewOrm()
 	lastId, err = o.Insert(item)
@@ -53,14 +54,14 @@ type PageRouter struct {
 
 func GetTimeLineRecordCount(userId, industrialManagementId int) (count int, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT COUNT(1) AS count FROM cygx_page_history_record WHERE user_id=? AND router = '/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=`+strconv.Itoa(industrialManagementId)+`'`
+	sql := `SELECT COUNT(1) AS count FROM cygx_page_history_record WHERE user_id=? AND router = '/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=` + strconv.Itoa(industrialManagementId) + `'`
 	err = o.Raw(sql, userId).QueryRow(&count)
 	return
 }
 
 func GetTimeLineRecordItem(userId, industrialManagementId int) (item *CygxPageHistoryRecord, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM cygx_page_history_record WHERE user_id=? AND router = '/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=`+strconv.Itoa(industrialManagementId)+ `' ORDER BY create_time DESC LIMIT 1,1 `
+	sql := `SELECT * FROM cygx_page_history_record WHERE user_id=? AND router = '/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=` + strconv.Itoa(industrialManagementId) + `' ORDER BY create_time DESC LIMIT 1,1 `
 	err = o.Raw(sql, userId).QueryRow(&item)
 	return
 }
@@ -70,4 +71,4 @@ func GetTimeLineRecordAllCount(userId int, date string) (items []*CygxPageHistor
 	sql := `SELECT * FROM cygx_page_history_record WHERE user_id=? AND router LIKE '%/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=%' AND create_time > ? `
 	_, err = o.Raw(sql, userId, date).QueryRows(&items)
 	return
-}
+}

+ 4 - 0
services/page_history_record.go

@@ -20,6 +20,10 @@ func AddCygxPageHistoryRecord(user *models.WxUserItem, Ctx *context.Context) {
 	item.CompanyName = user.CompanyName
 	item.Router = Ctx.Request.RequestURI
 	item.PageRouter = Ctx.Input.Query("PageRouter")
+	if user.InviteCompany != "" {
+		item.Router += "&From=" + user.InviteCompany
+	}
+	item.RegisterPlatform = utils.REGISTER_PLATFORM
 	index := strings.Index(item.Router, "?")
 	if index != -1 {
 		item.Parameter = item.Router[index+1:]