Commit 1fb183f63b7bf44ddfd889e185ff47e55e2f55d9
1 parent
8590e1be
Exists in
v1.2
and in
2 other branches
.
Showing
14 changed files
with
154 additions
and
151 deletions
Show diff stats
API/DealyMessage.go
| @@ -24,7 +24,7 @@ func DealyMessageInfo(c *gin.Context) { | @@ -24,7 +24,7 @@ func DealyMessageInfo(c *gin.Context) { | ||
| 24 | if c.Query("Token") == "" || bson.IsObjectIdHex(c.Query("UserId")) == false { | 24 | if c.Query("Token") == "" || bson.IsObjectIdHex(c.Query("UserId")) == false { |
| 25 | c.JSON(200, tools.ResponseError{ | 25 | c.JSON(200, tools.ResponseError{ |
| 26 | 1, | 26 | 1, |
| 27 | - "参数不正确", | 27 | + "Token或者用户id不正确", |
| 28 | }) | 28 | }) |
| 29 | return | 29 | return |
| 30 | } | 30 | } |
| @@ -69,7 +69,7 @@ func CreateDealyMessage(c *gin.Context) { | @@ -69,7 +69,7 @@ func CreateDealyMessage(c *gin.Context) { | ||
| 69 | if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("UserId")) == false { | 69 | if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("UserId")) == false { |
| 70 | c.JSON(200, tools.ResponseError{ | 70 | c.JSON(200, tools.ResponseError{ |
| 71 | 1, | 71 | 1, |
| 72 | - "参数不正确", | 72 | + "Token或者用户id不正确", |
| 73 | }) | 73 | }) |
| 74 | return | 74 | return |
| 75 | } | 75 | } |
| @@ -117,7 +117,7 @@ func RemoveDealyMessage(c *gin.Context) { | @@ -117,7 +117,7 @@ func RemoveDealyMessage(c *gin.Context) { | ||
| 117 | if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("UserId")) == false { | 117 | if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("UserId")) == false { |
| 118 | c.JSON(200, tools.ResponseError{ | 118 | c.JSON(200, tools.ResponseError{ |
| 119 | 1, | 119 | 1, |
| 120 | - "参数不正确", | 120 | + "Token或者用户id不正确", |
| 121 | }) | 121 | }) |
| 122 | return | 122 | return |
| 123 | } | 123 | } |
API/EventLog.go
| @@ -1,54 +0,0 @@ | @@ -1,54 +0,0 @@ | ||
| 1 | -package Api | ||
| 2 | - | ||
| 3 | -import ( | ||
| 4 | - "encoding/json" | ||
| 5 | - "github.com/aarongao/tools" | ||
| 6 | - "github.com/gin-gonic/gin" | ||
| 7 | - "letu/DB" | ||
| 8 | - "strconv" | ||
| 9 | -) | ||
| 10 | - | ||
| 11 | -// @Title 增加访问日志 | ||
| 12 | -// @Description 增加访问日志 | ||
| 13 | -// @Accept json | ||
| 14 | -// @Produce json | ||
| 15 | -// @Param UserId 5dfb03070a9ac17ac7a82054 string true "用户ID" | ||
| 16 | -// @Param UserName Aaron string true "用户名称" | ||
| 17 | -// @Param TypeNum 9 int true "类型编号" | ||
| 18 | -// @Param TypeName 点击个人中心 string true "类型名称" | ||
| 19 | -// @Param DateTime 1578556751220 int true "时间戳" | ||
| 20 | -// @Param Location {"Latitude": 119, "Longitude": 39} string true "位置" | ||
| 21 | -// @Param Remarks 备注 string true "备注" | ||
| 22 | -// @Success 200 {object} tools.ResponseSeccess "" | ||
| 23 | -// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | ||
| 24 | -// @Router /EventLog? [post] | ||
| 25 | -func EventLog(c *gin.Context) { | ||
| 26 | - c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | ||
| 27 | - c.Header("Access-Control-Allow-Credentials", "true") | ||
| 28 | - | ||
| 29 | - if c.Request.Method == "post" { | ||
| 30 | - | ||
| 31 | - var Location DB.SLocation | ||
| 32 | - json.Unmarshal([]byte(c.PostForm("Location")), &Location) | ||
| 33 | - | ||
| 34 | - DateTime, _ := strconv.ParseInt(c.PostForm("DateTime"), 0, 64) | ||
| 35 | - | ||
| 36 | - TypeNum, _ := strconv.ParseInt("TypeNum", 0, 64) | ||
| 37 | - | ||
| 38 | - DB.CEventLog.Insert(DB.SEventLog{ | ||
| 39 | - c.PostForm("UserId"), | ||
| 40 | - c.PostForm("UserName"), | ||
| 41 | - TypeNum, | ||
| 42 | - c.PostForm("TypeName"), | ||
| 43 | - DateTime, | ||
| 44 | - Location, | ||
| 45 | - c.PostForm("Remarks"), | ||
| 46 | - }) | ||
| 47 | - | ||
| 48 | - c.JSON(200, tools.ResponseSeccess{ | ||
| 49 | - 0, | ||
| 50 | - "ok", | ||
| 51 | - }) | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | -} |
API/Sms.go
| @@ -75,12 +75,12 @@ func Send(c *gin.Context) { | @@ -75,12 +75,12 @@ func Send(c *gin.Context) { | ||
| 75 | json.Unmarshal([]byte(c.PostForm("Location")), &Location) | 75 | json.Unmarshal([]byte(c.PostForm("Location")), &Location) |
| 76 | 76 | ||
| 77 | //go func(res *dysmsapi.SendSmsResponse) { | 77 | //go func(res *dysmsapi.SendSmsResponse) { |
| 78 | - DB.CActionLog.Insert(DB.SActionLog{ | 78 | + DB.CSystemLog.Insert(DB.SSystemLog{ |
| 79 | "", | 79 | "", |
| 80 | "", | 80 | "", |
| 81 | c.PostForm("Mobile"), | 81 | c.PostForm("Mobile"), |
| 82 | - 1, | ||
| 83 | - "注册验证码", | 82 | + 6001, |
| 83 | + "调用第三方发送短信接口", | ||
| 84 | time.Now().Unix(), | 84 | time.Now().Unix(), |
| 85 | Location, | 85 | Location, |
| 86 | string(code), | 86 | string(code), |
API/User.go
| @@ -69,6 +69,7 @@ func LoginUser(c *gin.Context) { | @@ -69,6 +69,7 @@ func LoginUser(c *gin.Context) { | ||
| 69 | c.PostForm("Mobile"), | 69 | c.PostForm("Mobile"), |
| 70 | "", | 70 | "", |
| 71 | "", | 71 | "", |
| 72 | + "", | ||
| 72 | } | 73 | } |
| 73 | DB.CMember.Insert(User) | 74 | DB.CMember.Insert(User) |
| 74 | } | 75 | } |
| @@ -90,6 +91,7 @@ func LoginUser(c *gin.Context) { | @@ -90,6 +91,7 @@ func LoginUser(c *gin.Context) { | ||
| 90 | // 更新token | 91 | // 更新token |
| 91 | Token.SaveToken(User.Id.Hex(), token) | 92 | Token.SaveToken(User.Id.Hex(), token) |
| 92 | 93 | ||
| 94 | + User.Token = token | ||
| 93 | c.JSON(200, tools.ResponseSeccess{ | 95 | c.JSON(200, tools.ResponseSeccess{ |
| 94 | 0, | 96 | 0, |
| 95 | User, | 97 | User, |
| @@ -114,7 +116,7 @@ func UserInfo(c *gin.Context) { | @@ -114,7 +116,7 @@ func UserInfo(c *gin.Context) { | ||
| 114 | if c.Query("Token") == "" || bson.IsObjectIdHex(c.Query("id")) == false{ | 116 | if c.Query("Token") == "" || bson.IsObjectIdHex(c.Query("id")) == false{ |
| 115 | c.JSON(200, tools.ResponseError{ | 117 | c.JSON(200, tools.ResponseError{ |
| 116 | 1, | 118 | 1, |
| 117 | - "参数不正确", | 119 | + "Token或者用户id不正确", |
| 118 | }) | 120 | }) |
| 119 | return | 121 | return |
| 120 | } | 122 | } |
| @@ -153,15 +155,15 @@ func CheckToken(c *gin.Context) { | @@ -153,15 +155,15 @@ func CheckToken(c *gin.Context) { | ||
| 153 | c.Header("Access-Control-Allow-Credentials", "true") | 155 | c.Header("Access-Control-Allow-Credentials", "true") |
| 154 | 156 | ||
| 155 | 157 | ||
| 156 | - if c.Query("Token") == "" || bson.IsObjectIdHex(c.Query("id")) == false{ | 158 | + if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("id")) == false{ |
| 157 | c.JSON(200, tools.ResponseError{ | 159 | c.JSON(200, tools.ResponseError{ |
| 158 | 1, | 160 | 1, |
| 159 | - "参数不正确", | 161 | + "Token或者用户id不正确", |
| 160 | }) | 162 | }) |
| 161 | return | 163 | return |
| 162 | } | 164 | } |
| 163 | 165 | ||
| 164 | - if Token.GetToken(c.Query("id")) != c.Query("Token"){ | 166 | + if Token.GetToken(c.PostForm("id")) != c.PostForm("Token"){ |
| 165 | c.JSON(200, tools.ResponseError{ | 167 | c.JSON(200, tools.ResponseError{ |
| 166 | 401, | 168 | 401, |
| 167 | "token过期", | 169 | "token过期", |
| @@ -200,7 +202,7 @@ func UpdateUser(c *gin.Context) { | @@ -200,7 +202,7 @@ func UpdateUser(c *gin.Context) { | ||
| 200 | if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("id")) == false{ | 202 | if c.PostForm("Token") == "" || bson.IsObjectIdHex(c.PostForm("id")) == false{ |
| 201 | c.JSON(200, tools.ResponseError{ | 203 | c.JSON(200, tools.ResponseError{ |
| 202 | 1, | 204 | 1, |
| 203 | - "参数不正确", | 205 | + "Token或者用户id不正确", |
| 204 | }) | 206 | }) |
| 205 | return | 207 | return |
| 206 | } | 208 | } |
| @@ -0,0 +1,66 @@ | @@ -0,0 +1,66 @@ | ||
| 1 | +package Api | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "encoding/json" | ||
| 5 | + "github.com/aarongao/tools" | ||
| 6 | + "github.com/gin-gonic/gin" | ||
| 7 | + "letu/DB" | ||
| 8 | + "time" | ||
| 9 | +) | ||
| 10 | + | ||
| 11 | +// @Title 增加访问日志 | ||
| 12 | +// @Description 增加访问日志 | ||
| 13 | +// @Accept json | ||
| 14 | +// @Produce json | ||
| 15 | +// @Param Type 安装app string true "安装;卸载;访问页面;使用功能;缩放地图" | ||
| 16 | +// @Param SubType 景区详情 string true "推荐;景区详情;登陆;商城;投诉建议;问券调查...." | ||
| 17 | +// @Param ScenicId 5dfb03070a9ac17ac7a82054 string true "景区id" | ||
| 18 | +// @Param UserId 5dfb03070a9ac17ac7a82054 string true "用户ID" | ||
| 19 | +// @Param UserName Aaron string true "用户名称" | ||
| 20 | +// @Param Location {"Latitude": 119, "Longitude": 39} string true "位置" | ||
| 21 | +// @Param Remarks 备注 string true "备注" | ||
| 22 | +// @Param Source 用户分享 string true "Source" | ||
| 23 | +// @Param DeviceId abc123 string true "手机唯一识别码,不重复(存放于http.header中)" | ||
| 24 | +// @Param Mac abc123 string true "网卡Mac地址(存放于http.header中)" | ||
| 25 | +// @Param SystemType ios string true "ios,android(存放于http.header中)" | ||
| 26 | +// @Param SystemVersion 13.01 string true "手机版本(存放于http.header中)" | ||
| 27 | +// @Param SystemModel iphone8 string true "手机型号(存放于http.header中)" | ||
| 28 | +// @Success 200 {object} tools.ResponseSeccess "" | ||
| 29 | +// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}" | ||
| 30 | +// @Router /UserLog? [post] | ||
| 31 | +func UserLog(c *gin.Context) { | ||
| 32 | + c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin")) | ||
| 33 | + c.Header("Access-Control-Allow-Credentials", "true") | ||
| 34 | + | ||
| 35 | + if c.Request.Method == "post" { | ||
| 36 | + | ||
| 37 | + var Location DB.SLocation | ||
| 38 | + json.Unmarshal([]byte(c.PostForm("Location")), &Location) | ||
| 39 | + | ||
| 40 | + DB.CUserLog.Insert(DB.SUserLog{ | ||
| 41 | + c.PostForm("Type"), | ||
| 42 | + c.PostForm("SubType"), | ||
| 43 | + c.PostForm("ScenicId"), | ||
| 44 | + c.PostForm("UserId"), | ||
| 45 | + c.PostForm("UserName"), | ||
| 46 | + time.Now().Unix(), | ||
| 47 | + Location, | ||
| 48 | + c.PostForm("Remarks"), | ||
| 49 | + c.PostForm("Source"), | ||
| 50 | + DB.SDevice{ | ||
| 51 | + c.Request.Header.Get("DeviceId"), | ||
| 52 | + c.Request.Host, | ||
| 53 | + c.Request.Header.Get("Mac"), | ||
| 54 | + c.Request.Header.Get("SystemType"), | ||
| 55 | + c.Request.Header.Get("SystemVersion"), | ||
| 56 | + c.Request.Header.Get("SystemModel"), | ||
| 57 | + }, | ||
| 58 | + }) | ||
| 59 | + | ||
| 60 | + c.JSON(200, tools.ResponseSeccess{ | ||
| 61 | + 0, | ||
| 62 | + "ok", | ||
| 63 | + }) | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | +} |
Config/AccessType/AccessType.go
| @@ -1,43 +0,0 @@ | @@ -1,43 +0,0 @@ | ||
| 1 | -package EventType | ||
| 2 | - | ||
| 3 | -type EventType int32 | ||
| 4 | - | ||
| 5 | -const ( | ||
| 6 | - PageForIndex EventType = 1 | ||
| 7 | - PageForRecommendMenu EventType = 2 | ||
| 8 | - PageForPlayItemMenu EventType = 3 | ||
| 9 | - PageForPerformMenu EventType = 4 | ||
| 10 | - PageForServiceMenu EventType = 5 | ||
| 11 | - PageForRestaurantMenu EventType = 6 | ||
| 12 | - TouchAnnotation EventType = 7 | ||
| 13 | - TouchShopMenu EventType = 8 | ||
| 14 | - TouchMyMenu EventType = 9 | ||
| 15 | - TouchComplaintMenu EventType = 10 | ||
| 16 | -) | ||
| 17 | - | ||
| 18 | -func (o EventType) String() string { | ||
| 19 | - switch (o) { | ||
| 20 | - case PageForIndex: | ||
| 21 | - return "首页" | ||
| 22 | - case PageForRecommendMenu: | ||
| 23 | - return "推荐" | ||
| 24 | - case PageForPlayItemMenu: | ||
| 25 | - return "游玩项目" | ||
| 26 | - case PageForPerformMenu: | ||
| 27 | - return "演出活动" | ||
| 28 | - case PageForServiceMenu: | ||
| 29 | - return "服务设施" | ||
| 30 | - case PageForRestaurantMenu: | ||
| 31 | - return "餐饮购物" | ||
| 32 | - case TouchAnnotation: | ||
| 33 | - return "点击建筑图标" | ||
| 34 | - case TouchShopMenu: | ||
| 35 | - return "点击商店" | ||
| 36 | - case TouchMyMenu: | ||
| 37 | - return "点击个人中心" | ||
| 38 | - case TouchComplaintMenu: | ||
| 39 | - return "点击投诉&意见" | ||
| 40 | - default: | ||
| 41 | - return "UNKNOWN" | ||
| 42 | - } | ||
| 43 | -} |
Config/config.go
Config/config.json
DB/db.go
| @@ -17,8 +17,8 @@ var CCommodity *mgo.Collection //商城 | @@ -17,8 +17,8 @@ var CCommodity *mgo.Collection //商城 | ||
| 17 | var CTags *mgo.Collection //标签 | 17 | var CTags *mgo.Collection //标签 |
| 18 | var CScenic *mgo.Collection //景区 | 18 | var CScenic *mgo.Collection //景区 |
| 19 | var CLine *mgo.Collection //推荐线路 | 19 | var CLine *mgo.Collection //推荐线路 |
| 20 | -var CEventLog *mgo.Collection //用户行为记录 | ||
| 21 | -var CActionLog *mgo.Collection //操作记录 | 20 | +var CUserLog *mgo.Collection //用户行为记录 |
| 21 | +var CSystemLog *mgo.Collection //操作记录 | ||
| 22 | var CTrajectory *mgo.Collection //移动轨迹 | 22 | var CTrajectory *mgo.Collection //移动轨迹 |
| 23 | var CIcons *mgo.Collection //图标信息 | 23 | var CIcons *mgo.Collection //图标信息 |
| 24 | var DB *mgo.Database | 24 | var DB *mgo.Database |
| @@ -59,16 +59,28 @@ type SLocation struct { | @@ -59,16 +59,28 @@ type SLocation struct { | ||
| 59 | Latitude float64 `bson:"Latitude" json:"Latitude"` //纬度 | 59 | Latitude float64 `bson:"Latitude" json:"Latitude"` //纬度 |
| 60 | Longitude float64 `bson:"Longitude" json:"Longitude"` //经度 | 60 | Longitude float64 `bson:"Longitude" json:"Longitude"` //经度 |
| 61 | } | 61 | } |
| 62 | -type SEventLog struct { | 62 | + |
| 63 | +type SDevice struct { | ||
| 64 | + DeviceId string `bson:"DeviceId" json:"DeviceId"` | ||
| 65 | + Ip string `bson:"Ip" json:"Ip"` | ||
| 66 | + Mac string `bson:"Mac" json:"Mac"` | ||
| 67 | + SystemType string `bson:"SystemType" json:"SystemType"` //ios,android | ||
| 68 | + SystemVersion string `bson:"SystemVersion" json:"SystemVersion"` //系统版本 | ||
| 69 | + SystemModel string `bson:"SystemModel" json:"SystemModel"` //机型 | ||
| 70 | +} | ||
| 71 | +type SUserLog struct { | ||
| 72 | + Type string `bson:"Type" json:"Type"` // Log(事件)类型 | ||
| 73 | + SubType string `bson:"SubType" json:"SubType"` // 分类 | ||
| 74 | + ScenicId string `bson:"ScenicId" json:"ScenicId"` | ||
| 63 | UserId string `bson:"UserId" json:"UserId"` // 用户ID | 75 | UserId string `bson:"UserId" json:"UserId"` // 用户ID |
| 64 | UserName string `bson:"UserName" json:"UserName"` //用户名称 | 76 | UserName string `bson:"UserName" json:"UserName"` //用户名称 |
| 65 | - TypeNum int64 `bson:"TypeNum" json:"TypeNum"` //类型编号 | ||
| 66 | - TypeName string `bson:"TypeName" json:"TypeName"` //类型名称 | ||
| 67 | DateTime int64 `bson:"DateTime" json:"DateTime"` //时间戳 | 77 | DateTime int64 `bson:"DateTime" json:"DateTime"` //时间戳 |
| 68 | Location SLocation `bson:"Location" json:"Location"` //位置 | 78 | Location SLocation `bson:"Location" json:"Location"` //位置 |
| 69 | Remarks string `bson:"Remarks" json:"Remarks"` //备注 | 79 | Remarks string `bson:"Remarks" json:"Remarks"` //备注 |
| 80 | + Source string `bson:"Source" json:"Source"` //来源 | ||
| 81 | + Device SDevice `bson:"Device" json:"Device"` //设备信息 | ||
| 70 | } | 82 | } |
| 71 | -type SActionLog struct { | 83 | +type SSystemLog struct { |
| 72 | UserId string `bson:"UserId" json:"UserId"` // 用户ID | 84 | UserId string `bson:"UserId" json:"UserId"` // 用户ID |
| 73 | UserName string `bson:"UserName" json:"UserName"` //用户名称 | 85 | UserName string `bson:"UserName" json:"UserName"` //用户名称 |
| 74 | Mobile string `bson:"Mobile" json:"Mobile"` //手机号 | 86 | Mobile string `bson:"Mobile" json:"Mobile"` //手机号 |
| @@ -123,6 +135,7 @@ type SMember struct { | @@ -123,6 +135,7 @@ type SMember struct { | ||
| 123 | FullName string `bson:"FullName" json:"FullName"` | 135 | FullName string `bson:"FullName" json:"FullName"` |
| 124 | Mobile string `bson:"Mobile" json:"Mobile"` | 136 | Mobile string `bson:"Mobile" json:"Mobile"` |
| 125 | Openid string `bson:"Openid" json:"Openid"` | 137 | Openid string `bson:"Openid" json:"Openid"` |
| 138 | + Token string `bson:"Token" json:"Token"` | ||
| 126 | Sex string `bson:"Sex" json:"Sex"` | 139 | Sex string `bson:"Sex" json:"Sex"` |
| 127 | } | 140 | } |
| 128 | 141 |
Lib/Token/token.go
| @@ -7,6 +7,9 @@ import ( | @@ -7,6 +7,9 @@ import ( | ||
| 7 | 7 | ||
| 8 | func GetToken(mobile string) string { | 8 | func GetToken(mobile string) string { |
| 9 | token := DB.Redis.Get("token_" + mobile) | 9 | token := DB.Redis.Get("token_" + mobile) |
| 10 | + if token == nil { | ||
| 11 | + return "" | ||
| 12 | + } | ||
| 10 | return token.(string) | 13 | return token.(string) |
| 11 | } | 14 | } |
| 12 | 15 |
README.md
| @@ -20,7 +20,6 @@ | @@ -20,7 +20,6 @@ | ||
| 20 | 1. [查询用户的定时提醒](#dealymessage-info-get) | 20 | 1. [查询用户的定时提醒](#dealymessage-info-get) |
| 21 | 1. [创建提醒](#dealymessage-create-post) | 21 | 1. [创建提醒](#dealymessage-create-post) |
| 22 | 1. [删除提醒](#dealymessage-remove-post) | 22 | 1. [删除提醒](#dealymessage-remove-post) |
| 23 | -1. [增加访问日志](#eventlog-post) | ||
| 24 | 1. [图标管理 - 返回图标基础信息](#icon-info-get) | 23 | 1. [图标管理 - 返回图标基础信息](#icon-info-get) |
| 25 | 1. [图标管理 - 增加或修改图标信息](#icon-update-post) | 24 | 1. [图标管理 - 增加或修改图标信息](#icon-update-post) |
| 26 | 1. [图标管理 - 所有图标](#icon-all-get) | 25 | 1. [图标管理 - 所有图标](#icon-all-get) |
| @@ -41,6 +40,7 @@ | @@ -41,6 +40,7 @@ | ||
| 41 | 1. [用户管理 - 修改用户信息](#updateuser-post) | 40 | 1. [用户管理 - 修改用户信息](#updateuser-post) |
| 42 | 1. [上传](#upload-post) | 41 | 1. [上传](#upload-post) |
| 43 | 1. [用户管理 - 获取用户信息](#userinfo-get) | 42 | 1. [用户管理 - 获取用户信息](#userinfo-get) |
| 43 | +1. [增加访问日志](#userlog-post) | ||
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | 46 | ||
| @@ -261,31 +261,6 @@ | @@ -261,31 +261,6 @@ | ||
| 261 | 261 | ||
| 262 | 262 | ||
| 263 | 263 | ||
| 264 | -<a name="eventlog-post"></a> | ||
| 265 | - | ||
| 266 | -#### /EventLog (POST) | ||
| 267 | - | ||
| 268 | - | ||
| 269 | -增加访问日志 | ||
| 270 | - | ||
| 271 | -| Param Name | Example | Data Type | Description | Required? | | ||
| 272 | -|-----|-----|-----|-----|-----| | ||
| 273 | -| UserId | 5dfb03070a9ac17ac7a82054 | string | 用户ID | Yes | | ||
| 274 | -| UserName | Aaron | string | 用户名称 | Yes | | ||
| 275 | -| TypeNum | 9 | int | 类型编号 | Yes | | ||
| 276 | -| TypeName | 点击个人中心 | string | 类型名称 | Yes | | ||
| 277 | -| DateTime | 1578556751220 | int | 时间戳 | Yes | | ||
| 278 | -| Location | {"Latitude": 119, "Longitude": 39} | string | 位置 | Yes | | ||
| 279 | -| Remarks | 备注 | string | 备注 | Yes | | ||
| 280 | - | ||
| 281 | - | ||
| 282 | -| Code | Type | Model | Message | | ||
| 283 | -|-----|-----|-----|-----| | ||
| 284 | -| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | | | ||
| 285 | -| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | ||
| 286 | - | ||
| 287 | - | ||
| 288 | - | ||
| 289 | <a name="icon-info-get"></a> | 264 | <a name="icon-info-get"></a> |
| 290 | 265 | ||
| 291 | #### /Icon/Info (GET) | 266 | #### /Icon/Info (GET) |
| @@ -655,3 +630,34 @@ | @@ -655,3 +630,34 @@ | ||
| 655 | | 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | 630 | | 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | |
| 656 | 631 | ||
| 657 | 632 | ||
| 633 | + | ||
| 634 | +<a name="userlog-post"></a> | ||
| 635 | + | ||
| 636 | +#### /UserLog (POST) | ||
| 637 | + | ||
| 638 | + | ||
| 639 | +增加访问日志 | ||
| 640 | + | ||
| 641 | +| Param Name | Example | Data Type | Description | Required? | | ||
| 642 | +|-----|-----|-----|-----|-----| | ||
| 643 | +| Type | 安装app | string | 安装;卸载;访问页面;使用功能;缩放地图 | Yes | | ||
| 644 | +| SubType | 景区详情 | string | 推荐;景区详情;登陆;商城;投诉建议;问券调查.... | Yes | | ||
| 645 | +| ScenicId | 5dfb03070a9ac17ac7a82054 | string | 景区id | Yes | | ||
| 646 | +| UserId | 5dfb03070a9ac17ac7a82054 | string | 用户ID | Yes | | ||
| 647 | +| UserName | Aaron | string | 用户名称 | Yes | | ||
| 648 | +| Location | {"Latitude": 119, "Longitude": 39} | string | 位置 | Yes | | ||
| 649 | +| Remarks | 备注 | string | 备注 | Yes | | ||
| 650 | +| Source | 用户分享 | string | Source | Yes | | ||
| 651 | +| DeviceId | abc123 | string | 手机唯一识别码,不重复(存放于http.header中) | Yes | | ||
| 652 | +| Mac | abc123 | string | 网卡Mac地址(存放于http.header中) | Yes | | ||
| 653 | +| SystemType | ios | string | ios,android(存放于http.header中) | Yes | | ||
| 654 | +| SystemVersion | 13.01 | string | 手机版本(存放于http.header中) | Yes | | ||
| 655 | +| SystemModel | iphone8 | string | 手机型号(存放于http.header中) | Yes | | ||
| 656 | + | ||
| 657 | + | ||
| 658 | +| Code | Type | Model | Message | | ||
| 659 | +|-----|-----|-----|-----| | ||
| 660 | +| 200 | object | [ResponseSeccess](#github.com.aarongao.tools.ResponseSeccess) | | | ||
| 661 | +| 500 | object | [ResponseError](#github.com.aarongao.tools.ResponseError) | {"errcode":1,"errmsg":"错误原因"} | | ||
| 662 | + | ||
| 663 | + |
main.go
| @@ -32,6 +32,7 @@ func main() { | @@ -32,6 +32,7 @@ func main() { | ||
| 32 | 32 | ||
| 33 | // 连接数据库 | 33 | // 连接数据库 |
| 34 | DB.DBSession, err = mgo.Dial(conf.DbPath) | 34 | DB.DBSession, err = mgo.Dial(conf.DbPath) |
| 35 | + | ||
| 35 | defer DB.DBSession.Close() | 36 | defer DB.DBSession.Close() |
| 36 | 37 | ||
| 37 | // 连接redis | 38 | // 连接redis |
| @@ -47,7 +48,9 @@ func main() { | @@ -47,7 +48,9 @@ func main() { | ||
| 47 | //设置模式 | 48 | //设置模式 |
| 48 | DB.DBSession.SetMode(mgo.Monotonic, true) | 49 | DB.DBSession.SetMode(mgo.Monotonic, true) |
| 49 | //获取文档集 | 50 | //获取文档集 |
| 50 | - DB.DB = DB.DBSession.DB("LeYouTu") | 51 | + DB.DB = DB.DBSession.DB(conf.DbName) |
| 52 | + DB.DB.Login(conf.DbUser, conf.DbPassword) | ||
| 53 | + | ||
| 51 | DB.CItem = DB.DB.C("Item") | 54 | DB.CItem = DB.DB.C("Item") |
| 52 | DB.CComplaint = DB.DB.C("Complaint") | 55 | DB.CComplaint = DB.DB.C("Complaint") |
| 53 | DB.CInvestigation = DB.DB.C("Investigation") | 56 | DB.CInvestigation = DB.DB.C("Investigation") |
| @@ -56,8 +59,8 @@ func main() { | @@ -56,8 +59,8 @@ func main() { | ||
| 56 | DB.CTags = DB.DB.C("Tags") | 59 | DB.CTags = DB.DB.C("Tags") |
| 57 | DB.CScenic = DB.DB.C("Scenic") | 60 | DB.CScenic = DB.DB.C("Scenic") |
| 58 | DB.CLine = DB.DB.C("Line") | 61 | DB.CLine = DB.DB.C("Line") |
| 59 | - DB.CEventLog = DB.DB.C("EventLog") | ||
| 60 | - DB.CActionLog = DB.DB.C("ActionLog") | 62 | + DB.CUserLog = DB.DB.C("UserLog") |
| 63 | + DB.CSystemLog = DB.DB.C("SystemLog") | ||
| 61 | DB.CInvestigation = DB.DB.C("Investigation") | 64 | DB.CInvestigation = DB.DB.C("Investigation") |
| 62 | DB.CTrajectory = DB.DB.C("Trajectory") | 65 | DB.CTrajectory = DB.DB.C("Trajectory") |
| 63 | DB.CIcons = DB.DB.C("Icons") | 66 | DB.CIcons = DB.DB.C("Icons") |
| @@ -66,8 +69,6 @@ func main() { | @@ -66,8 +69,6 @@ func main() { | ||
| 66 | 69 | ||
| 67 | r := gin.Default() | 70 | r := gin.Default() |
| 68 | //r.Static("/.well-known", "./.well-known/") | 71 | //r.Static("/.well-known", "./.well-known/") |
| 69 | - //r.Static("/tiles", dir+"/tiles") | ||
| 70 | - r.GET("/Tiles", Api.Tiles) | ||
| 71 | r.GET("/AllItems", Api.AllItems) | 72 | r.GET("/AllItems", Api.AllItems) |
| 72 | r.GET("/AllItemTime", Api.AllItemTime) | 73 | r.GET("/AllItemTime", Api.AllItemTime) |
| 73 | r.GET("/AllCommodity", Api.AllCommodity) | 74 | r.GET("/AllCommodity", Api.AllCommodity) |
| @@ -90,8 +91,8 @@ func main() { | @@ -90,8 +91,8 @@ func main() { | ||
| 90 | r.POST("/UpdateScenic", Api.UpdateScenic) | 91 | r.POST("/UpdateScenic", Api.UpdateScenic) |
| 91 | r.POST("/UpdateItemTime", Api.UpdateItemTime) | 92 | r.POST("/UpdateItemTime", Api.UpdateItemTime) |
| 92 | r.GET("/AllScenic", Api.AllScenic) | 93 | r.GET("/AllScenic", Api.AllScenic) |
| 93 | - r.POST("/EventLog", Api.EventLog) | ||
| 94 | - r.GET("/EventLog", Api.EventLog) | 94 | + r.POST("/UserLog", Api.UserLog) |
| 95 | + r.GET("/UserLog", Api.UserLog) | ||
| 95 | r.POST("/Sms/Send", Api.Send) | 96 | r.POST("/Sms/Send", Api.Send) |
| 96 | r.POST("/Investigation/Save", Api.SaveInvestigation) | 97 | r.POST("/Investigation/Save", Api.SaveInvestigation) |
| 97 | r.GET("/Investigation/List", Api.AllInvestigation) | 98 | r.GET("/Investigation/List", Api.AllInvestigation) |
| @@ -102,11 +103,14 @@ func main() { | @@ -102,11 +103,14 @@ func main() { | ||
| 102 | r.POST("/Icon/Update", Api.UpdateIcon) | 103 | r.POST("/Icon/Update", Api.UpdateIcon) |
| 103 | r.GET("/Icon/All", Api.AllIcons) | 104 | r.GET("/Icon/All", Api.AllIcons) |
| 104 | r.GET("/Icon/Info", Api.IconInfo) | 105 | r.GET("/Icon/Info", Api.IconInfo) |
| 105 | - r.GET("/CheckToken", Api.CheckToken) | 106 | + r.POST("/CheckToken", Api.CheckToken) |
| 107 | + r.GET("/Tiles", Api.Tiles) | ||
| 106 | //r.GET("/ws", Api.WsPage) | 108 | //r.GET("/ws", Api.WsPage) |
| 107 | 109 | ||
| 108 | r.Static("/Upload", "./Upload") | 110 | r.Static("/Upload", "./Upload") |
| 109 | r.Static("/Console", "./Console") | 111 | r.Static("/Console", "./Console") |
| 112 | + r.Static("/Policy", dir+"/Policy") | ||
| 113 | + r.Static("/tiles2", dir+"/tiles") | ||
| 110 | // go Ws.Manager.Start() | 114 | // go Ws.Manager.Start() |
| 111 | 115 | ||
| 112 | // 创建延迟消息 | 116 | // 创建延迟消息 |