diff --git a/app/email/api/internal/logic/email/forgotPasswordLogic.go b/app/email/api/internal/logic/email/forgotPasswordLogic.go index 2bd1c8b..e8e46e2 100644 --- a/app/email/api/internal/logic/email/forgotPasswordLogic.go +++ b/app/email/api/internal/logic/email/forgotPasswordLogic.go @@ -27,8 +27,9 @@ func NewForgotPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Fo } } -func (l *ForgotPasswordLogic) ForgotPassword(req *types.ForgotPasswordReq) (resp *types.EmptyResp, err error) { - // todo: add your logic here and delete this line - - return +func (l *ForgotPasswordLogic) ForgotPassword(req *types.ForgotPasswordReq) (resp *types.SendVerificationCodeResp, err error) { + return NewSendVerificationCodeLogic(l.ctx, l.svcCtx).SendVerificationCode(&types.SendVerificationCodeReq{ + Email: req.Email, + Scene: "reset_password", + }) } diff --git a/app/shop/api/internal/handler/routes.go b/app/shop/api/internal/handler/routes.go index 760c6d9..71f0597 100644 --- a/app/shop/api/internal/handler/routes.go +++ b/app/shop/api/internal/handler/routes.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.9.2 +// goctl 1.10.1 package handler diff --git a/app/shop/api/internal/logic/shop/updateShopTemplateLogic.go b/app/shop/api/internal/logic/shop/updateShopTemplateLogic.go index 028cc30..be5198f 100644 --- a/app/shop/api/internal/logic/shop/updateShopTemplateLogic.go +++ b/app/shop/api/internal/logic/shop/updateShopTemplateLogic.go @@ -5,7 +5,6 @@ package shop import ( "context" - "encoding/json" "errors" "juwan-backend/app/shop/api/internal/svc" @@ -48,11 +47,6 @@ func (l *UpdateShopTemplateLogic) UpdateShopTemplate(req *types.UpdateTemplateRe return nil, contextj.ERRILLEGALUSER } - templateBytes, err := json.Marshal(map[string]any{"sections": req.Sections}) - if err != nil { - return nil, errors.New("invalid sections") - } - _, err = l.svcCtx.ShopRpc.UpdateShops(l.ctx, &pb.UpdateShopsReq{ Id: shop.Shops.Id, OwnerId: shop.Shops.OwnerId, @@ -68,7 +62,7 @@ func (l *UpdateShopTemplateLogic) UpdateShopTemplate(req *types.UpdateTemplateRe AllowIndependentOrders: shop.Shops.AllowIndependentOrders, DispatchMode: shop.Shops.DispatchMode, Announcements: shop.Shops.Announcements, - TemplateConfig: string(templateBytes), + TemplateConfig: req.Sections, }) if err != nil { return nil, err diff --git a/app/shop/api/internal/types/types.go b/app/shop/api/internal/types/types.go index e4d121f..8a48d4f 100644 --- a/app/shop/api/internal/types/types.go +++ b/app/shop/api/internal/types/types.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.9.2 +// goctl 1.10.1 package types @@ -93,8 +93,8 @@ type UpdateShopReq struct { } type UpdateTemplateReq struct { - Id int64 `path:"id"` - Sections interface{} `json:"sections"` + Id int64 `path:"id"` + Sections string `json:"sections"` } type UserIdReq struct { diff --git a/app/users/api/internal/handler/auth/forgotPasswordHandler.go b/app/users/api/internal/handler/auth/forgotPasswordHandler.go deleted file mode 100644 index 802b7e0..0000000 --- a/app/users/api/internal/handler/auth/forgotPasswordHandler.go +++ /dev/null @@ -1,32 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.9.2 - -package auth - -import ( - "net/http" - - "github.com/zeromicro/go-zero/rest/httpx" - "juwan-backend/app/users/api/internal/logic/auth" - "juwan-backend/app/users/api/internal/svc" - "juwan-backend/app/users/api/internal/types" -) - -// 忘记密码-发送验证码 -func ForgotPasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var req types.ForgotPasswordReq - if err := httpx.Parse(r, &req); err != nil { - httpx.ErrorCtx(r.Context(), w, err) - return - } - - l := auth.NewForgotPasswordLogic(r.Context(), svcCtx) - resp, err := l.ForgotPassword(&req) - if err != nil { - httpx.ErrorCtx(r.Context(), w, err) - } else { - httpx.OkJsonCtx(r.Context(), w, resp) - } - } -} diff --git a/app/users/api/internal/handler/routes.go b/app/users/api/internal/handler/routes.go index 9999ad1..39ebb1f 100644 --- a/app/users/api/internal/handler/routes.go +++ b/app/users/api/internal/handler/routes.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.9.2 +// goctl 1.10.1 package handler @@ -18,12 +18,6 @@ import ( func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { server.AddRoutes( []rest.Route{ - { - // 忘记密码-发送验证码 - Method: http.MethodPost, - Path: "/forgot-password", - Handler: auth.ForgotPasswordHandler(serverCtx), - }, { // 用户登录 Method: http.MethodPost, diff --git a/app/users/api/internal/logic/auth/forgotPasswordLogic.go b/app/users/api/internal/logic/auth/forgotPasswordLogic.go deleted file mode 100644 index 49ead4f..0000000 --- a/app/users/api/internal/logic/auth/forgotPasswordLogic.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code scaffolded by goctl. Safe to edit. -// goctl 1.9.2 - -package auth - -import ( - "context" - "juwan-backend/app/users/api/internal/svc" - "juwan-backend/app/users/api/internal/types" - - "github.com/zeromicro/go-zero/core/logx" -) - -type ForgotPasswordLogic struct { - logx.Logger - ctx context.Context - svcCtx *svc.ServiceContext -} - -// 忘记密码-发送验证码 -func NewForgotPasswordLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ForgotPasswordLogic { - return &ForgotPasswordLogic{ - Logger: logx.WithContext(ctx), - ctx: ctx, - svcCtx: svcCtx, - } -} - -func (l *ForgotPasswordLogic) ForgotPassword(req *types.ForgotPasswordReq) (resp *types.EmptyResp, err error) { - // todo: add your logic here and delete this line - - return -} diff --git a/app/users/api/internal/types/types.go b/app/users/api/internal/types/types.go index 59813fc..ea87a85 100644 --- a/app/users/api/internal/types/types.go +++ b/app/users/api/internal/types/types.go @@ -1,5 +1,5 @@ // Code generated by goctl. DO NOT EDIT. -// goctl 1.9.2 +// goctl 1.10.1 package types @@ -15,11 +15,6 @@ type FollowUserReq struct { Id int64 `path:"id"` } -type ForgotPasswordReq struct { - Phone string `json:"phone,omitempty"` - Email string `json:"email,omitempty"` -} - type GetMyVerificationsResp struct { List []VerificationItem `json:"list"` } @@ -55,10 +50,10 @@ type LogoutReq struct { } type MaterialJson struct { - IdCardFront string `json:"idCardFront"` // 身份证正面照片URL - IdCardBack string `json:"idCardBack"` // 身份证反面照片URL - GameScreenshots []string `json:"gameScreenshots"` // 游戏截图URL列表 - VoiceDemo string `json:"voiceDemo"` // 语音认证示例URL + IdCardFront string `json:"idCardFront"` // 身份证正面照片URL + IdCardBack string `json:"idCardBack"` // 身份证反面照片URL + GameScreenshots []*string `json:"gameScreenshots,optional"` // 游戏截图URL列表 + VoiceDemo *string `json:"voiceDemo,optional"` // 语音认证示例URL } type RegisterReq struct { @@ -79,7 +74,7 @@ type RejectVerificationReq struct { } type ResetPasswordReq struct { - Phone string `json:"phone,omitempty"` + Phone string `json:"phone,optional"` Email string `json:"email,omitempty"` Vcode string `json:"vcode"` NewPassword string `json:"newPassword"` diff --git a/desc/api/shop.api b/desc/api/shop.api index fdd0a3a..f623827 100644 --- a/desc/api/shop.api +++ b/desc/api/shop.api @@ -38,8 +38,8 @@ type ( DispatchMode string `json:"dispatchMode,optional"` } UpdateTemplateReq { - Id int64 `path:"id"` - Sections interface{} `json:"sections"` + Id int64 `path:"id"` + Sections string `json:"sections"` } AnnouncementReq { Id int64 `path:"id"` diff --git a/desc/api/users.api b/desc/api/users.api index 1874814..c8e41ac 100644 --- a/desc/api/users.api +++ b/desc/api/users.api @@ -10,8 +10,8 @@ info ( type ( // 认证材料结构体(示例,实际根据需求定义) MaterialJson { - IdCardFront string `json:"idCardFront"` // 身份证正面照片URL - IdCardBack string `json:"idCardBack"` // 身份证反面照片URL + IdCardFront string `json:"idCardFront"` // 身份证正面照片URL + IdCardBack string `json:"idCardBack"` // 身份证反面照片URL GameScreenshots []*string `json:"gameScreenshots,optional"` // 游戏截图URL列表 VoiceDemo *string `json:"voiceDemo,optional"` // 语音认证示例URL } @@ -107,12 +107,8 @@ type ( User User `json:"user"` } LogoutReq {} - ForgotPasswordReq { - Phone string `json:"phone,omitempty"` - Email string `json:"email,omitempty"` - } ResetPasswordReq { - Phone string `json:"phone,omitempty"` + Phone string `json:"phone,optional"` Email string `json:"email,omitempty"` Vcode string `json:"vcode"` NewPassword string `json:"newPassword"` @@ -172,10 +168,6 @@ service user-api { @handler Login post /login (LoginReq) returns (LoginResp) - @doc "忘记密码-发送验证码" - @handler ForgotPassword - post /forgot-password (ForgotPasswordReq) returns (EmptyResp) - @doc "重置密码" @handler ResetPassword post /reset-password (ResetPasswordReq) returns (EmptyResp)