feat: 迁移商务登录品牌和三步找回密码
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-kratos/kratos/v3/errors"
|
||||
"kra/internal/service/business"
|
||||
"kra/internal/service/dto"
|
||||
)
|
||||
|
||||
type BusinessPassword struct {
|
||||
service *business.PasswordResetService
|
||||
}
|
||||
|
||||
func NewBusinessPassword(service *business.PasswordResetService) *BusinessPassword {
|
||||
return &BusinessPassword{service: service}
|
||||
}
|
||||
func (h *BusinessPassword) Check(c *gin.Context) {
|
||||
var req dto.PasswordResetRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
Fail(c, "参数格式错误")
|
||||
return
|
||||
}
|
||||
value, err := h.service.Check(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, value)
|
||||
}
|
||||
func (h *BusinessPassword) SendCode(c *gin.Context) {
|
||||
var req dto.PasswordResetRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
Fail(c, "参数格式错误")
|
||||
return
|
||||
}
|
||||
value, err := h.service.SendCode(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, value)
|
||||
}
|
||||
func (h *BusinessPassword) VerifyCode(c *gin.Context) {
|
||||
var req dto.PasswordResetRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
Fail(c, "参数格式错误")
|
||||
return
|
||||
}
|
||||
value, err := h.service.VerifyCode(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, value)
|
||||
}
|
||||
func (h *BusinessPassword) Reset(c *gin.Context) {
|
||||
var req dto.PasswordResetRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
Fail(c, "参数格式错误")
|
||||
return
|
||||
}
|
||||
if err := h.service.Reset(c.Request.Context(), &req); err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OK(c)
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import "github.com/google/wire"
|
||||
// field so adding a handler only means adding its constructor here.
|
||||
var ProviderSet = wire.NewSet(
|
||||
NewBusiness,
|
||||
NewBusinessPassword,
|
||||
NewAuthority, NewMenu, NewAPI, NewPermission, NewOrganization,
|
||||
NewAnnouncement, NewEmail, NewPayment, NewTask, NewMedia, NewAudit,
|
||||
NewExport, NewVersion, NewDictionary, NewParameter, NewAPIToken,
|
||||
|
||||
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
type Set struct {
|
||||
Business *Business
|
||||
BusinessPassword *BusinessPassword
|
||||
SMS *SMS
|
||||
Authority *Authority
|
||||
Menu *Menu
|
||||
|
||||
Reference in New Issue
Block a user