package auth import ( "net/http" "github.com/zeromicro/go-zero/rest/httpx" "wechat-api/internal/logic/auth" "wechat-api/internal/svc" "wechat-api/internal/types" ) // swagger:route post /user/login_by_sms auth LoginBySms // // Log in by SMS | 短信登录 // // Log in by SMS | 短信登录 // // Parameters: // + name: body // require: true // in: body // type: LoginBySmsReq // // Responses: // 200: LoginResp func LoginBySmsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.LoginBySmsReq if err := httpx.Parse(r, &req, true); err != nil { httpx.ErrorCtx(r.Context(), w, err) return } l := auth.NewLoginBySmsLogic(r.Context(), svcCtx, w) resp, err := l.LoginBySms(&req) if err != nil { httpx.ErrorCtx(r.Context(), w, err) } else { httpx.OkJsonCtx(r.Context(), w, resp) } } }