Files

84 lines
1.8 KiB
Go

// Code generated by goctl. DO NOT EDIT.
// goctl 1.10.1
package handler
import (
"net/http"
auth "sundynix-micro-go/app/auth/api/internal/handler/auth"
user "sundynix-micro-go/app/auth/api/internal/handler/user"
"sundynix-micro-go/app/auth/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
// 获取图形验证码
Method: http.MethodGet,
Path: "/captcha",
Handler: auth.GetCaptchaHandler(serverCtx),
},
{
// 账号密码登录
Method: http.MethodPost,
Path: "/login",
Handler: auth.LoginHandler(serverCtx),
},
{
// 手机号登录
Method: http.MethodPost,
Path: "/loginByPhone",
Handler: auth.LoginByPhoneHandler(serverCtx),
},
{
// 微信小程序登录
Method: http.MethodPost,
Path: "/miniLogin",
Handler: auth.MiniLoginHandler(serverCtx),
},
},
rest.WithPrefix("/api/auth"),
)
server.AddRoutes(
[]rest.Route{
{
// 修改密码
Method: http.MethodPost,
Path: "/changePassword",
Handler: user.ChangePasswordHandler(serverCtx),
},
{
// 获取当前用户信息
Method: http.MethodGet,
Path: "/info",
Handler: user.GetUserInfoHandler(serverCtx),
},
{
// 获取位置信息
Method: http.MethodGet,
Path: "/location",
Handler: user.GetLocationHandler(serverCtx),
},
{
// 更新个人信息
Method: http.MethodPost,
Path: "/update",
Handler: user.UpdateUserHandler(serverCtx),
},
{
// 获取天气信息
Method: http.MethodGet,
Path: "/weather",
Handler: user.GetWeatherHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
rest.WithPrefix("/api/auth"),
)
}