package auth

import (
	"net/http"

	"sundynix-micro-go/app/auth/api/internal/logic/auth"
	"sundynix-micro-go/app/auth/api/internal/svc"
	"sundynix-micro-go/common/response"
)

// 获取图形验证码
func GetCaptchaHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := auth.NewGetCaptchaLogic(r.Context(), svcCtx)
		resp, err := l.GetCaptcha()
		if err != nil {
			response.Fail(w, err.Error())
		} else {
			response.OkWithData(w, resp)
		}
	}
}
