1234567891011121314151617181920212223242526272829303132333435363738 |
- package service
- import (
- "git.sxidc.com/go-framework/baize/framework/binding"
- "git.sxidc.com/go-framework/baize/framework/core/api"
- "git.sxidc.com/go-framework/baize/framework/core/api/request"
- "git.sxidc.com/go-framework/baize/framework/core/api/response"
- "git.sxidc.com/go-framework/baize/framework/core/application"
- "git.sxidc.com/go-framework/baize/framework/core/domain"
- "git.sxidc.com/go-framework/baize/framework/core/infrastructure"
- )
- var versionService = &VersionService{}
- type VersionService struct{}
- func (svc *VersionService) Init(appInstance *application.App) error {
- svc.prefixRoot(appInstance)
- return nil
- }
- func (svc *VersionService) Destroy() error {
- return nil
- }
- func (svc *VersionService) prefixRoot(appInstance *application.App) {
- prefixRootBinder := binding.NewBinder(appInstance.ChooseRouter(api.RouterPrefix, ""), appInstance.Infrastructure())
- binding.GetBind(prefixRootBinder, &binding.SimpleBindItem[map[string]any]{
- Path: "/version",
- SendResponseFunc: response.SendMapResponse,
- ServiceFunc: func(c *api.Context, params request.Params, objects []domain.Object, i *infrastructure.Infrastructure) (map[string]any, error) {
- return map[string]any{
- "version": "v1.0.0",
- }, nil
- },
- })
- }
|