Skip to content

校园地图项目是一款功能完善的后端服务器,现已上线并通过全面测试。该项目采用Gin, GORM框架、Redis和MySQL数据库技术,确保普通用户能够快速获取数据,并允许管理员灵活地动态修改数据。项目代码结构分明,提供详尽的API文档,支持快速开发前端应用,包括小程序和APP等各种终端,助力服务快速上线。

Notifications You must be signed in to change notification settings

Infinite-Unexpired-Love/SchoolMap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

简介

校园地图项目是一款功能完善的后端服务器,现已上线并通过全面测试。该项目采用Go语言、Redis和MySQL数据库技术,确保普通用户能够快速获取数据,并允许管理员灵活地动态修改数据。项目代码结构分明,提供详尽的API文档,支持快速开发前端应用,包括小程序和APP等各种终端,助力服务快速上线。

目录

项目环境

go_version:1.19.6

redis_version:5.0.14.1

mysql_version:8.0.36

快速启动

  1. 安装
  2. 修改/config.yaml文件中的内容
  3. 修改/utils/token.go文件下var jwtKey = []byte("your_secret_key")为你自己的key
  4. 修改import路径中的TGU-MAP为你自己的项目根目录
  5. 在项目根目录下运行go mod tidy后运行go run main.go

API文档

POST 登录

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 获取图形验证码

GET /ca

返回示例

200 Response

{
  "captchaId": "string",
  "picPath": "string"
}

返回结果

状态码 状态码含义 说明 数据模型
200 OK 成功 Inline

返回数据结构

状态码 200

名称 类型 必选 约束 中文名 说明
» captchaId string true none none
» picPath string true none base64编码

地标

GET 获取所有地标

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 新建地标

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 更新地标

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 删除地标

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 获取所有筛选

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 新建筛选

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 删除筛选

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 获取所有通知

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 新建通知

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 更新通知

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 删除通知

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 获取所有反馈

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 新建反馈

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 删除feedback

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

About

校园地图项目是一款功能完善的后端服务器,现已上线并通过全面测试。该项目采用Gin, GORM框架、Redis和MySQL数据库技术,确保普通用户能够快速获取数据,并允许管理员灵活地动态修改数据。项目代码结构分明,提供详尽的API文档,支持快速开发前端应用,包括小程序和APP等各种终端,助力服务快速上线。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages