package member import ( "app-cloudep-portal-api-gateway/internal/logic/member" "app-cloudep-portal-api-gateway/internal/svc" "app-cloudep-portal-api-gateway/internal/types" "net/http" ers "code.30cm.net/digimon/library-go/errors" "github.com/zeromicro/go-zero/rest/httpx" ) func CreateAccountHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.CreateAccountRequest if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return } l := member.NewCreateAccountLogic(r.Context(), svcCtx) resp, err := l.CreateAccount(&req) if err != nil { e := ers.FromGRPCError(err) httpx.WriteJsonCtx(r.Context(), w, e.HTTPStatus(), types.BaseResponse{ Status: types.Status{ Code: int64(e.FullCode()), Message: e.Error(), }, }) return } else { httpx.OkJsonCtx(r.Context(), w, resp) } } }