From 556057a645874ccdd0903fce4d4e7de130da52c1 Mon Sep 17 00:00:00 2001 From: aarongao Date: Fri, 14 Feb 2020 13:42:01 +0800 Subject: [PATCH] . --- API/UserLog.go | 57 +++++++++++++++++++++++++++------------------------------ README.md | 4 ++-- main.go | 1 - 3 files changed, 29 insertions(+), 33 deletions(-) diff --git a/API/UserLog.go b/API/UserLog.go index 52c4744..10e5aea 100644 --- a/API/UserLog.go +++ b/API/UserLog.go @@ -12,8 +12,8 @@ import ( // @Description 增加访问日志 // @Accept json // @Produce json -// @Param Type 访问页面 string true "安装;卸载;访问页面;使用功能;缩放地图" -// @Param SubType 景区详情 string true "推荐;景区详情;登陆;商城;投诉建议;问券调查...." +// @Param Type 访问页面 string true "安装;卸载;访问页面;使用功能;缩放地图;进入景区" +// @Param SubType 景区详情 string true "推荐;景区详情;登陆;商城;投诉建议;问券调查....(app中能点的都加上)" // @Param ScenicId 5dfb03070a9ac17ac7a82054 string true "景区id" // @Param UserId 5dfb03070a9ac17ac7a82054 string true "用户ID" // @Param UserName Aaron string true "用户名称" @@ -32,35 +32,32 @@ func UserLog(c *gin.Context) { c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) c.Header("Access-Control-Allow-Credentials", "true") - if c.Request.Method == "post" { + var Location DB.SLocation + json.Unmarshal([]byte(c.PostForm("Location")), &Location) - var Location DB.SLocation - json.Unmarshal([]byte(c.PostForm("Location")), &Location) + DB.CUserLog.Insert(DB.SUserLog{ + c.PostForm("Type"), + c.PostForm("SubType"), + c.PostForm("ScenicId"), + c.PostForm("UserId"), + c.PostForm("UserName"), + time.Now().Unix(), + Location, + c.PostForm("Remarks"), + c.PostForm("Source"), + DB.SDevice{ + c.Request.Header.Get("DeviceId"), + c.Request.Host, + c.Request.Header.Get("Mac"), + c.Request.Header.Get("SystemType"), + c.Request.Header.Get("SystemVersion"), + c.Request.Header.Get("SystemModel"), + }, + }) - DB.CUserLog.Insert(DB.SUserLog{ - c.PostForm("Type"), - c.PostForm("SubType"), - c.PostForm("ScenicId"), - c.PostForm("UserId"), - c.PostForm("UserName"), - time.Now().Unix(), - Location, - c.PostForm("Remarks"), - c.PostForm("Source"), - DB.SDevice{ - c.Request.Header.Get("DeviceId"), - c.Request.Host, - c.Request.Header.Get("Mac"), - c.Request.Header.Get("SystemType"), - c.Request.Header.Get("SystemVersion"), - c.Request.Header.Get("SystemModel"), - }, - }) - - c.JSON(200, tools.ResponseSeccess{ - 0, - "ok", - }) - } + c.JSON(200, tools.ResponseSeccess{ + 0, + "ok", + }) } diff --git a/README.md b/README.md index 75a68b7..1aecf78 100644 --- a/README.md +++ b/README.md @@ -640,8 +640,8 @@ | Param Name | Example | Data Type | Description | Required? | |-----|-----|-----|-----|-----| -| Type | 访问页面 | string | 安装;卸载;访问页面;使用功能;缩放地图 | Yes | -| SubType | 景区详情 | string | 推荐;景区详情;登陆;商城;投诉建议;问券调查.... | Yes | +| Type | 访问页面 | string | 安装;卸载;访问页面;使用功能;缩放地图;进入景区 | Yes | +| SubType | 景区详情 | string | 推荐;景区详情;登陆;商城;投诉建议;问券调查....(app中能点的都加上) | Yes | | ScenicId | 5dfb03070a9ac17ac7a82054 | string | 景区id | Yes | | UserId | 5dfb03070a9ac17ac7a82054 | string | 用户ID | Yes | | UserName | Aaron | string | 用户名称 | Yes | diff --git a/main.go b/main.go index 7dcaab7..0eba7f1 100644 --- a/main.go +++ b/main.go @@ -92,7 +92,6 @@ func main() { r.POST("/UpdateItemTime", Api.UpdateItemTime) r.GET("/AllScenic", Api.AllScenic) r.POST("/UserLog", Api.UserLog) - r.GET("/UserLog", Api.UserLog) r.POST("/Sms/Send", Api.Send) r.POST("/Investigation/Save", Api.SaveInvestigation) r.GET("/Investigation/List", Api.AllInvestigation) -- libgit2 0.21.0