增加短信渠道

This commit is contained in:
Yvan
2026-09-29 18:15:35 +08:00
parent a16b8f8e89
commit 89cc7761b5
38 changed files with 1469 additions and 39 deletions
+27
View File
@@ -0,0 +1,27 @@
package handler
import (
"github.com/gin-gonic/gin"
"kra/internal/service/dto"
service "kra/internal/service/integration"
"net/http"
)
type SMS struct{ service *service.SMSService }
func NewSMS(s *service.SMSService) *SMS { return &SMS{service: s} }
func (h *SMS) Send(c *gin.Context) {
c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, 16<<10)
var req dto.SMSSendRequest
if err := c.ShouldBindJSON(&req); err != nil {
Fail(c, "短信参数无效")
return
}
result, err := h.service.Send(c.Request.Context(), c.Param("provider"), &req)
if err != nil {
Fail(c, err.Error())
return
}
OKWithData(c, result)
}