fix: align admin behavior and Kratos integrations

This commit is contained in:
2026-08-14 14:14:51 +08:00
parent 8c4c6ba661
commit e0b0e1d8c8
123 changed files with 4334 additions and 1877 deletions
+4 -4
View File
@@ -14,7 +14,7 @@ func NewEmail(service *service.EmailService) *Email { return &Email{service: ser
func (h *Email) Test(c *gin.Context) {
if err := h.service.Test(c.Request.Context()); err != nil {
httpx.Fail(c, "发送失败:"+err.Error())
httpx.Fail(c, "发送失败")
return
}
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "发送成功")
@@ -22,12 +22,12 @@ func (h *Email) Test(c *gin.Context) {
func (h *Email) Send(c *gin.Context) {
var req dto.SendEmailRequest
if c.ShouldBindJSON(&req) != nil {
httpx.Fail(c, "参数错误")
if err := c.ShouldBindJSON(&req); err != nil {
httpx.Fail(c, err.Error())
return
}
if err := h.service.Send(c.Request.Context(), req.To, req.Subject, req.Body); err != nil {
httpx.Fail(c, "发送失败:"+err.Error())
httpx.Fail(c, "发送失败")
return
}
httpx.Write(c, httpx.CodeSuccess, gin.H{}, "发送成功")