init: init refactor

This commit is contained in:
Blizzard
2026-04-27 00:02:18 +08:00
commit e515f6a287
360 changed files with 30713 additions and 0 deletions
+89
View File
@@ -0,0 +1,89 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.10.1
package handler
import (
"net/http"
auth "sundynix-micro-go/app/user/api/internal/handler/auth"
user "sundynix-micro-go/app/user/api/internal/handler/user"
"sundynix-micro-go/app/user/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
// 账号密码登录
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/user"),
)
server.AddRoutes(
[]rest.Route{
{
// 修改密码
Method: http.MethodPut,
Path: "/changePassword",
Handler: user.ChangePasswordHandler(serverCtx),
},
{
// 删除用户
Method: http.MethodDelete,
Path: "/delete",
Handler: user.DeleteUserHandler(serverCtx),
},
{
// 获取当前用户信息
Method: http.MethodGet,
Path: "/info",
Handler: user.GetUserInfoHandler(serverCtx),
},
{
// 用户列表
Method: http.MethodPost,
Path: "/list",
Handler: user.GetUserListHandler(serverCtx),
},
{
// 获取位置信息
Method: http.MethodGet,
Path: "/location",
Handler: user.GetLocationHandler(serverCtx),
},
{
// 更新用户信息
Method: http.MethodPut,
Path: "/update",
Handler: user.UpdateUserHandler(serverCtx),
},
{
// 获取天气信息
Method: http.MethodGet,
Path: "/weather",
Handler: user.GetWeatherHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
rest.WithPrefix("/api/user"),
)
}