校园地图项目是一款功能完善的后端服务器,现已上线并通过全面测试。该项目采用Go语言、Redis和MySQL数据库技术,确保普通用户能够快速获取数据,并允许管理员灵活地动态修改数据。项目代码结构分明,提供详尽的API文档,支持快速开发前端应用,包括小程序和APP等各种终端,助力服务快速上线。
go_version:1.19.6
redis_version:5.0.14.1
mysql_version:8.0.36
- 安装
- 修改/config.yaml文件中的内容
- 修改/utils/token.go文件下
var jwtKey = []byte("your_secret_key")
为你自己的key - 修改import路径中的
TGU-MAP
为你自己的项目根目录 - 在项目根目录下运行
go mod tidy
后运行go run main.go
POST /login
Body 请求参数
{
"mobile": "string",
"password": "string",
"captchaId": "string",
"captcha": "string"
}
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
body | body | object | 否 | none |
» mobile | body | string | 是 | none |
» password | body | string | 是 | none |
» captchaId | body | string | 是 | none |
» captcha | body | string | 是 | 与验证码ID相对应的验证码,验证成功后即删 |
返回示例
200 Response
{
"token": "string",
"username": "string",
"mobile": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» token | string | true | none | none | |
» username | string | true | none | none | |
» mobile | string | true | none | none |
GET /ca
返回示例
200 Response
{
"captchaId": "string",
"picPath": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» captchaId | string | true | none | none | |
» picPath | string | true | none | base64编码 |
GET /li/
返回树形结构数据的json序列化字符串
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
POST /li/item/{id}
在Id=id的父节点下插入节点,id为0的根节点已自动创建 返回所有marker树形结构数据的json序列化字符串 权限接口
Body 请求参数
{
"title": "string",
"desc": "string",
"contact": "string",
"latitude": 0,
"longitude": 0,
"iconName": "string"
}
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
id | path | string | 是 | none |
Authorization | header | string | 是 | none |
body | body | object | 否 | none |
» title | body | string | 是 | none |
» desc | body | string | 是 | none |
» contact | body | string | 否 | none |
» latitude | body | number | 否 | none |
» longitude | body | number | 否 | none |
» iconName | body | string | 否 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
PUT /li/item/{id}
返回所有marker树形结构数据的json序列化字符串 权限接口
Body 请求参数
{
"title": "string",
"desc": "string",
"contact": "string",
"latitude": 0,
"longitude": 0,
"iconName": "string"
}
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
id | path | string | 是 | none |
Authorization | header | string | 是 | none |
body | body | object | 否 | none |
» title | body | string | 是 | none |
» desc | body | string | 是 | none |
» contact | body | string | 否 | none |
» latitude | body | number | 否 | none |
» longitude | body | number | 否 | none |
» iconName | body | string | 否 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
DELETE /li/item/{id}
返回所有marker树形结构数据的json序列化字符串 权限接口
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
id | path | string | 是 | none |
Authorization | header | string | 是 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
GET /al/
返回树形结构数据的json序列化字符串
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
POST /al/item
返回所有alias树形结构数据的json序列化字符串 权限接口
Body 请求参数
{
"title": "string",
"markers": [
{
"id": 0
}
]
}
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
Authorization | header | string | 是 | none |
body | body | object | 否 | none |
» title | body | string | 是 | none |
» markers | body | [object] | 是 | none |
»» id | body | number | 是 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
DELETE /al/item/{id}
返回所有alias树形结构数据的json序列化字符串 权限接口
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
id | path | string | 是 | none |
Authorization | header | string | 是 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
GET /no/
返回所有数据的json序列化字符串
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
POST /no/item
返回所有notice树形结构数据的json序列化字符串 权限接口
Body 请求参数
{
"title": "string",
"publishTime": "string"
}
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
Authorization | header | string | 是 | none |
body | body | object | 否 | none |
» title | body | string | 是 | none |
» publishTime | body | string | 是 | 格式为“2024-5-24” |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
PUT /no/item/{id}
返回所有notice数据的json序列化字符串 权限接口
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
id | path | string | 是 | none |
Authorization | header | string | 是 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
DELETE /no/iten/{id}
返回所有notice树形结构数据的json序列化字符串 权限接口
Body 请求参数
{}
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
id | path | string | 是 | none |
Authorization | header | string | 是 | none |
body | body | object | 否 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
GET /fe/
返回所有feedback的json序列化字符串 权限接口
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
Authorization | header | string | 是 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |
POST /fe/item
用户反馈是给管理员看的,自然不需要返回所有数据给用户
Body 请求参数
{
"title": "string",
"category": 0,
"contact": "string",
"publishTime": "string",
"detail": "string"
}
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
body | body | object | 否 | none |
» title | body | string | 是 | none |
» category | body | integer | 是 | 0为信息维护,1为反馈建议 |
» contact | body | string | 否 | none |
» publishTime | body | string | 是 | 格式:“2024-5-23”,默认为今天 |
» detail | body | string | 是 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none |
DELETE /fe/item/{id}
返回所有feedback的json序列化字符串 权限接口
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
id | path | string | 是 | none |
Authorization | header | string | 是 | none |
返回示例
200 Response
{
"code": 0,
"msg": "string",
"data": "string"
}
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» code | integer | true | none | none | |
» msg | string | true | none | none | |
» data | string | true | none | none |