七月迭代短暂完结,还有很多后端的关键东西没有弄,这是一版赶时间做的东西
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m26s

This commit is contained in:
2026-07-25 17:06:58 +08:00
parent ad9f613dd6
commit 73f5125d3d
249 changed files with 17137 additions and 877 deletions

80
internal/routes/wecom.go Normal file
View File

@@ -0,0 +1,80 @@
package routes
import (
"github.com/gofiber/fiber/v2"
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
"github.com/break/junhong_cmp_fiber/internal/model/dto"
"github.com/break/junhong_cmp_fiber/pkg/constants"
"github.com/break/junhong_cmp_fiber/pkg/errors"
"github.com/break/junhong_cmp_fiber/pkg/middleware"
"github.com/break/junhong_cmp_fiber/pkg/openapi"
)
func registerWeComRoutes(router fiber.Router, handler *admin.WeComHandler, doc *openapi.Generator, basePath string) {
group := router.Group("/wecom", func(c *fiber.Ctx) error {
userType := middleware.GetUserTypeFromContext(c.UserContext())
if userType != constants.UserTypeSuperAdmin && userType != constants.UserTypePlatform {
return errors.New(errors.CodeForbidden, "无权限访问企业微信审批配置")
}
return c.Next()
})
groupPath := basePath + "/wecom"
Register(group, doc, groupPath, "POST", "/applications", handler.Save, RouteSpec{
Summary: "创建或更新企业微信应用配置",
Tags: []string{"企业微信审批"},
Input: new(dto.SaveWeComApplicationRequest),
Output: new(dto.WeComApplicationResponse),
Auth: true,
})
Register(group, doc, groupPath, "GET", "/applications", handler.List, RouteSpec{
Summary: "查询企业微信应用配置",
Tags: []string{"企业微信审批"},
Input: new(dto.WeComApplicationListRequest),
Output: new(dto.WeComApplicationListResponse),
Auth: true,
})
Register(group, doc, groupPath, "POST", "/applications/:id/test", handler.Test, RouteSpec{
Summary: "测试企业微信应用连接",
Tags: []string{"企业微信审批"},
Input: new(dto.IDReq),
Output: new(dto.WeComConnectionTestResponse),
Auth: true,
})
Register(group, doc, groupPath, "PUT", "/applications/:id/default-creator", handler.SaveDefaultCreator, RouteSpec{
Summary: "保存企业微信应用默认审批发起人",
Tags: []string{"企业微信审批"},
Input: new(dto.SaveWeComDefaultCreatorParams),
Output: new(dto.WeComApplicationResponse),
Auth: true,
})
Register(group, doc, groupPath, "POST", "/applications/:id/members/sync", handler.SyncMembers, RouteSpec{
Summary: "同步企业微信应用可见成员",
Tags: []string{"企业微信审批"},
Input: new(dto.IDReq),
Output: new(dto.WeComMemberSyncResponse),
Auth: true,
})
Register(group, doc, groupPath, "GET", "/applications/:id/members", handler.ListMembers, RouteSpec{
Summary: "分页查询企业微信应用可见成员",
Tags: []string{"企业微信审批"},
Input: new(dto.WeComMemberListParams),
Output: new(dto.WeComMemberListResponse),
Auth: true,
})
Register(group, doc, groupPath, "PUT", "/scenes/:business_type", handler.SaveScene, RouteSpec{
Summary: "保存并校验企业微信审批场景模板映射",
Tags: []string{"企业微信审批"},
Input: new(dto.SaveWeComApprovalSceneParams),
Output: new(dto.WeComApprovalSceneResponse),
Auth: true,
})
Register(group, doc, groupPath, "GET", "/scenes", handler.ListScenes, RouteSpec{
Summary: "分页查询企业微信审批场景配置",
Tags: []string{"企业微信审批"},
Input: new(dto.WeComApprovalSceneListRequest),
Output: new(dto.WeComApprovalSceneListResponse),
Auth: true,
})
}