routes.go 3.5 KB
// Code generated by goctl. DO NOT EDIT.
package handler

import (
	"net/http"

	activity "gitlab.fjmaimaimai.com/allied-creation/sumifcc/cmd/bsi/api/internal/handler/activity"
	common "gitlab.fjmaimaimai.com/allied-creation/sumifcc/cmd/bsi/api/internal/handler/common"
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc/cmd/bsi/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:    "/log/:module",
				Handler: common.CommonGetLogHandler(serverCtx),
			},
			{
				Method:  http.MethodGet,
				Path:    "/file/:module",
				Handler: common.CommonGetFileHandler(serverCtx),
			},
		},
		rest.WithPrefix("/v1"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.LogRequest},
			[]rest.Route{
				{
					Method:  http.MethodPost,
					Path:    "/common/sms/code",
					Handler: common.CommonSmsCodeHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/common/tts",
					Handler: common.CommonTextToSpeechHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/mini/qrcode",
					Handler: common.MiniQrcodeInviteHandler(serverCtx),
				},
				{
					Method:  http.MethodGet,
					Path:    "/clear",
					Handler: common.CommonGetClearCacheHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/v1"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/activity/:id",
					Handler: activity.SystemActivityGetHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/activity",
					Handler: activity.SystemActivitySaveHandler(serverCtx),
				},
				{
					Method:  http.MethodDelete,
					Path:    "/activity/:id",
					Handler: activity.SystemActivityDeleteHandler(serverCtx),
				},
				{
					Method:  http.MethodPut,
					Path:    "/activity/:id",
					Handler: activity.SystemActivityUpdateHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/activity/search",
					Handler: activity.SystemActivitySearchHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/activity/open",
					Handler: activity.SystemActivityOpenHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/activity/close",
					Handler: activity.SystemActivityCloseHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/activity/submition-data-search",
					Handler: activity.SystemActivitySubmissionDataSearchHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/activity/submition-data-export",
					Handler: activity.SystemActivitySubmissionDataExportHandler(serverCtx),
				},
			}...,
		),
		rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
		rest.WithPrefix("/v1/system"),
	)

	server.AddRoutes(
		rest.WithMiddlewares(
			[]rest.Middleware{serverCtx.LogRequest},
			[]rest.Route{
				{
					Method:  http.MethodGet,
					Path:    "/activity/:id",
					Handler: activity.H5ActivityGetHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/activity/questionnaire-Submit",
					Handler: activity.H5ActivityQuestionnaireSubmitHandler(serverCtx),
				},
				{
					Method:  http.MethodPost,
					Path:    "/activity/pull-submission",
					Handler: activity.H5ActivityQuestionnairePullSubmissionHandler(serverCtx),
				},
			}...,
		),
		rest.WithPrefix("/v1/h5"),
	)
}