|
@@ -0,0 +1,32 @@
|
|
|
+package services
|
|
|
+
|
|
|
+import (
|
|
|
+ "fmt"
|
|
|
+ "github.com/beego/beego/v2/server/web/context"
|
|
|
+ "hongze/hongze_cygx/models"
|
|
|
+ "hongze/hongze_cygx/utils"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+func AddCygxPageHistoryRecord(user *models.WxUserItem, Ctx *context.Context) {
|
|
|
+ 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 = user.CompanyName
|
|
|
+ item.Router = Ctx.Request.RequestURI
|
|
|
+ item.PageRouter = Ctx.Input.Query("PageRouter")
|
|
|
+ index := strings.Index(item.Router, "?")
|
|
|
+ if index != -1 {
|
|
|
+ item.Parameter = item.Router[index+1:]
|
|
|
+ }
|
|
|
+ _, err := models.AddCygxPageHistoryRecord(item)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ utils.FileLog.Info(err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+}
|