统一单入口 Go 工程与前端依赖目录,增加后台供应商配置、候选审核、计划预算、成交冲正、持仓复盘和站内通知。接入策略版本、Python 回测、可配置 A 股公开行情及 zap 文件轮转日志,补充迁移、契约与验证。
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"git.sundynix.cn/Blizzard/Veyra/internal/apperror"
|
||||
"git.sundynix.cn/Blizzard/Veyra/internal/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func bindProviders(r *gin.Engine, options IdentityOptions) {
|
||||
admin := r.Group("/api/admin/v1", func(c *gin.Context) { authenticate(c, options, "admin") })
|
||||
admin.Use(func(c *gin.Context) {
|
||||
if options.Providers == nil {
|
||||
fail(c, apperror.ErrUnavailable)
|
||||
return
|
||||
}
|
||||
c.Next()
|
||||
})
|
||||
admin.GET("/providers", func(c *gin.Context) {
|
||||
list, err := options.Providers.List(c.Request.Context(), currentUser(c))
|
||||
if err != nil {
|
||||
fail(c, err)
|
||||
return
|
||||
}
|
||||
success(c, http.StatusOK, list)
|
||||
})
|
||||
admin.PUT("/providers/:key", func(c *gin.Context) {
|
||||
if !sameOrigin(c.Request) {
|
||||
fail(c, apperror.ErrForbidden)
|
||||
return
|
||||
}
|
||||
var input service.ProviderInput
|
||||
if !decode(c, &input) {
|
||||
return
|
||||
}
|
||||
config, err := options.Providers.Save(c.Request.Context(), currentUser(c), c.Param("key"), c.Writer.Header().Get("X-Request-ID"), input)
|
||||
if err != nil {
|
||||
fail(c, err)
|
||||
return
|
||||
}
|
||||
success(c, http.StatusOK, config)
|
||||
})
|
||||
admin.GET("/audit-events", func(c *gin.Context) {
|
||||
list, err := options.Providers.Audit(c.Request.Context(), currentUser(c))
|
||||
if err != nil {
|
||||
fail(c, err)
|
||||
return
|
||||
}
|
||||
success(c, http.StatusOK, list)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user