backend/internal/handler/user/submit_verification_code_ha...

31 lines
706 B
Go
Raw Permalink Normal View History

package user
import (
"net/http"
"backend/internal/logic/user"
"backend/internal/svc"
"backend/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
// 提交驗證碼以完成驗證
func SubmitVerificationCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SubmitVerificationCodeReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewSubmitVerificationCodeLogic(r.Context(), svcCtx)
resp, err := l.SubmitVerificationCode(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}