This commit is contained in:
@@ -156,6 +156,11 @@ func (r *Routes) Register(router fiber.Router) {
|
||||
r.smsCodeSends.List,
|
||||
Query[dto.SmsCodeSendListQuery]("query"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /admin/v1/sms-code-sends/manual-set -> smsCodeSends.ManualSet")
|
||||
router.Post("/admin/v1/sms-code-sends/manual-set"[len(r.Path()):], DataFunc1(
|
||||
r.smsCodeSends.ManualSet,
|
||||
Body[SmsCodeManualSetBody]("body"),
|
||||
))
|
||||
// Register routes for controller: statistics
|
||||
r.log.Debugf("Registering route: Get /admin/v1/statistics -> statistics.statistics")
|
||||
router.Get("/admin/v1/statistics"[len(r.Path()):], DataFunc0(
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"quyun/v2/app/services"
|
||||
"quyun/v2/database"
|
||||
"quyun/v2/database/models"
|
||||
"time"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
)
|
||||
@@ -13,6 +14,11 @@ import (
|
||||
// @provider
|
||||
type smsCodeSends struct{}
|
||||
|
||||
type SmsCodeManualSetBody struct {
|
||||
Phone string `json:"phone"`
|
||||
Code string `json:"code"`
|
||||
}
|
||||
|
||||
// List
|
||||
//
|
||||
// @Summary 短信验证码发送记录
|
||||
@@ -58,3 +64,17 @@ func (ctl *smsCodeSends) List(ctx fiber.Ctx, query *dto.SmsCodeSendListQuery) (*
|
||||
Items: items,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ManualSet
|
||||
//
|
||||
// @Summary 手动设置短信验证码(用于短信认证)
|
||||
// @Tags Admin SMS
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param body body SmsCodeManualSetBody true "请求体"
|
||||
// @Success 200 {object} models.SmsCodeSend "成功"
|
||||
// @Router /admin/v1/sms-code-sends/manual-set [post]
|
||||
// @Bind body body
|
||||
func (ctl *smsCodeSends) ManualSet(ctx fiber.Ctx, body *SmsCodeManualSetBody) (*models.SmsCodeSend, error) {
|
||||
return services.Users.SetPhoneCode(ctx.Context(), body.Phone, body.Code, 5*time.Minute)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user