Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

把最后一个版本的项目提下pr #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions 2024-Insomnia-Backend/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions 2024-Insomnia-Backend/.idea/Insomnia.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions 2024-Insomnia-Backend/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions 2024-Insomnia-Backend/app/api/request/task.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package request

type UpdateTaskNumber struct {
Num uint `json:"num"`
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package routers

import (
"Insomnia/app/core/middlewares"
"Insomnia/app/infrastructure/middlewares"
)

func (r *router) useAuth() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package routers

import "Insomnia/app/core/middlewares"
import (
"Insomnia/app/infrastructure/middlewares"
)

// 通用的路由
func (r *router) useCommon() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@ func Load(e *gin.Engine) {
r.useCommon()
//启动消息的路由
r.useMyMessage()
//启用Tube
r.useTube()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package routers

import "Insomnia/app/core/middlewares"
import (
"Insomnia/app/infrastructure/middlewares"
)

func (r *router) useMyMessage() {
useMyMessage := r.Group("myMessage")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package routers

import "Insomnia/app/core/middlewares"
import (
"Insomnia/app/infrastructure/middlewares"
)

// usePost 回复的路由
func (r *router) usePost() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package routers

import "Insomnia/app/core/middlewares"
import (
"Insomnia/app/infrastructure/middlewares"
)

// useRePost re回复的路由
func (r *router) useRePost() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package routers

import "Insomnia/app/core/middlewares"
import (
"Insomnia/app/infrastructure/middlewares"
)

// useTask 获取当日数据的路由
func (r *router) useTask() {
taskRouter := r.Group("task1")
taskRouter.POST("/getTask", middlewares.UseJwt(), r.task.GetTask)
taskRouter := r.Group("task")
taskRouter.POST("/upTask", middlewares.UseJwt(), r.task.UpTask)
taskRouter.POST("/getAllTask", middlewares.UseJwt(), r.task.GetAllTask)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package routers

import "Insomnia/app/core/middlewares"
import (
"Insomnia/app/infrastructure/middlewares"
)

// useThread 帖子的路由
func (r *router) useThread() {
Expand Down
8 changes: 8 additions & 0 deletions 2024-Insomnia-Backend/app/api/routers/tube.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package routers

import "Insomnia/app/infrastructure/middlewares"

func (r *router) useTube() {
tubeRouter := r.Group("tube")
tubeRouter.POST("/getQNToken", middlewares.UseJwt(), r.tube.GetQNToken)
}
28 changes: 14 additions & 14 deletions 2024-Insomnia-Backend/app/controller/auth.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package controller

import (
"Insomnia/app/common/tool"
. "Insomnia/app/core/helper"
. "Insomnia/app/request"
. "Insomnia/app/response"
. "Insomnia/app/api/request"
. "Insomnia/app/api/response"
. "Insomnia/app/infrastructure/helper"
"Insomnia/app/service"
"Insomnia/app/utility/tool"
"fmt"
"github.com/gin-gonic/gin"
)
Expand All @@ -20,8 +20,8 @@ var authService *service.AuthService
// @Tags Auth
// @Accept json
// @Produce json
// @Param email body string true "邮箱"
// @Param password body string true "密码"
// @Param email query string true "邮箱"
// @Param password query string true "密码"
// @Success 200 {object} LoginResponse "登录成功"
// @Failure 400 {object} ErrorResponse "请求参数错误"
// @Failure 500 {object} ErrorResponse "内部错误"
Expand Down Expand Up @@ -55,10 +55,10 @@ func (a *Auth) Login(c *gin.Context) {
// @Tags Auth
// @Accept json
// @Produce json
// @Param email body string true "邮箱"
// @Param password body string true "密码"
// @Param verificationCode body string true "验证码"
// @Param avatar body string true "头像"
// @Param email query string true "邮箱"
// @Param password query string true "密码"
// @Param verificationCode query string true "验证码"
// @Param avatar query string false "头像"
// @Success 200 {object} LoginResponse "登录成功"
// @Failure 400 {object} ErrorResponse "请求参数错误"
// @Failure 500 {object} ErrorResponse "内部错误"
Expand Down Expand Up @@ -92,10 +92,10 @@ func (a *Auth) Signup(c *gin.Context) {
// @Tags Auth
// @Accept json
// @Produce json
// @Param email body string true "邮箱"
// @Param verificationCode body string true "验证码"
// @Param email query string true "邮箱"
// @Param verificationCode query string true "验证码"
// @Param Authorization header string true "jwt验证"
// @Param newPassword body string true "新密码"
// @Param newPassword query string true "新密码"
// @Success 200 {object} string "密码更改成功"
// @Failure 400 {object} ErrorResponse "请求参数错误"
// @Failure 500 {object} ErrorResponse "内部错误"
Expand Down Expand Up @@ -129,7 +129,7 @@ func (a *Auth) ChangePassword(c *gin.Context) {
// @Tags Auth
// @Accept json
// @Produce json
// @Param newAvatar body string true "新头像"
// @Param newAvatar query string true "新头像"
// @Param Authorization header string true "jwt验证"
// @Success 200 {object} string "头像更改成功"
// @Failure 400 {object} string "请求参数错误"
Expand Down
16 changes: 8 additions & 8 deletions 2024-Insomnia-Backend/app/controller/email.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package controller

import (
. "Insomnia/app/common/tool"
. "Insomnia/app/core/config"
. "Insomnia/app/core/helper"
"Insomnia/app/models"
. "Insomnia/app/request"
. "Insomnia/app/response"
. "Insomnia/app/api/request"
. "Insomnia/app/api/response"
. "Insomnia/app/infrastructure/Email"
. "Insomnia/app/infrastructure/config"
. "Insomnia/app/infrastructure/helper"
. "Insomnia/app/utility/tool"
"fmt"
"github.com/gin-gonic/gin"
"github.com/jordan-wright/email"
Expand All @@ -23,7 +23,7 @@ type SendEmail struct{}
// @Accept json
// @Produce json
// @version 1.0
// @Param email body SendEmailRequest true "邮箱"
// @Param email query SendEmailRequest true "邮箱"
// @Success 200 {string} string "发送邮件成功"
// @Failure 404 {string} string "邮箱服务器出错"
// @Failure 500 {string} string "发送邮件失败"
Expand Down Expand Up @@ -52,7 +52,7 @@ func (e *SendEmail) SendEmail(c *gin.Context) {
return
}
//创造一个临时的CheckEmail
Email := models.CheckEmail{
Email := CheckEmail{
Email: cp.Email,
VerificationCode: random,
}
Expand Down
52 changes: 49 additions & 3 deletions 2024-Insomnia-Backend/app/controller/myMessage.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package controller

import (
. "Insomnia/app/core/helper"
. "Insomnia/app/request"
. "Insomnia/app/response"
. "Insomnia/app/api/request"
. "Insomnia/app/api/response"
. "Insomnia/app/infrastructure/helper"
"Insomnia/app/service"
"fmt"
"github.com/gin-gonic/gin"
Expand All @@ -14,6 +14,17 @@ type MyMessage struct{}

var myMessageService *service.MyMessageService

// GetPostMessage 获取用户的评论消息
// @Summary 获取用户的评论消息接口
// @Description 获取用户的评论消息接口
// @Tags MyMessage
// @Accept json
// @Produce json
// @Param Authorization header string true "jwt验证"
// @Success 200 {object} MessageResponse "获取消息成功"
// @Failure 400 {object} ErrorResponse "请求参数错误"
// @Failure 500 {object} ErrorResponse "内部错误"
// @Router /api/v1/myMessage/getPostMessage [post]
func (m *MyMessage) GetPostMessage(c *gin.Context) {
Uuid, _ := c.Get("Uuid")
uuid := Uuid.(string)
Expand All @@ -36,6 +47,18 @@ func (m *MyMessage) GetPostMessage(c *gin.Context) {
OkMsgData(c, "获取评论信息成功", rsp)
}

// CheckPostMessage 查看用户的评论消息
// @Summary 查看用户的评论消息接口
// @Description 查看用户的评论消息接口
// @Tags MyMessage
// @Accept json
// @Produce json
// @Param id query string true "返回给你的post消息的id"
// @Param Authorization header string true "jwt验证"
// @Success 200 {object} MessageResponse "查看消息成功"
// @Failure 400 {object} ErrorResponse "请求参数错误"
// @Failure 500 {object} ErrorResponse "内部错误"
// @Router /api/v1/myMessage/checkPostMessage [post]
func (m *MyMessage) CheckPostMessage(c *gin.Context) {
//定义一个Login请求类型的结构体
req := &CheckPostMessageReq{}
Expand All @@ -53,6 +76,17 @@ func (m *MyMessage) CheckPostMessage(c *gin.Context) {
OkMsg(c, "检查消息成功")
}

// GetLikeMessage 获取用户的点赞消息
// @Summary 获取用户的点赞消息接口
// @Description 获取用户的点赞消息接口
// @Tags MyMessage
// @Accept json
// @Produce json
// @Param Authorization header string true "jwt验证"
// @Success 200 {object} MessageResponse "获取帖子成功"
// @Failure 400 {object} ErrorResponse "请求参数错误"
// @Failure 500 {object} ErrorResponse "内部错误"
// @Router /api/v1/myMessage/getLikeMessage [post]
func (m *MyMessage) GetLikeMessage(c *gin.Context) {
Uuid, _ := c.Get("Uuid")
uuid := Uuid.(string)
Expand All @@ -78,6 +112,18 @@ func (m *MyMessage) GetLikeMessage(c *gin.Context) {
OkMsgData(c, "获取点赞消息成功", rsp)
}

// CheckLikeMessage 查看用户的点赞消息
// @Summary 查看用户的点赞消息接口
// @Description 查看用户的点赞消息接口
// @Tags MyMessage
// @Accept json
// @Produce json
// @Param id query string true "返回给你的like消息的id"
// @Param Authorization header string true "jwt验证"
// @Success 200 {object} MessageResponse "查看消息成功"
// @Failure 400 {object} ErrorResponse "请求参数错误"
// @Failure 500 {object} ErrorResponse "内部错误"
// @Router /api/v1/myMessage/checkLikeMessage [post]
func (m *MyMessage) CheckLikeMessage(c *gin.Context) {
//定义一个Login请求类型的结构体
req := &CheckLikeMessageReq{}
Expand Down
Loading