From b0d4b57f8ad6edec003b6d0843b16065a00590c0 Mon Sep 17 00:00:00 2001 From: dark <255317@qq.com> Date: Thu, 14 Mar 2024 02:42:21 +0800 Subject: [PATCH] =?UTF-8?q?503=20=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/logic/test503logic.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/logic/test503logic.go b/internal/logic/test503logic.go index 4f70217..1008f21 100644 --- a/internal/logic/test503logic.go +++ b/internal/logic/test503logic.go @@ -5,6 +5,7 @@ import ( httpresult "demo/common" "demo/internal/svc" "demo/internal/types" + "math/rand" "github.com/zeromicro/go-zero/core/logx" ) @@ -24,6 +25,14 @@ func NewTest503Logic(ctx context.Context, svcCtx *svc.ServiceContext) *Test503Lo } func (l *Test503Logic) Test503() (resp *types.Response, err error) { - // todo: add your logic here and delete this line + // 生成随机数 范围0-2 + num := rand.Intn(2) + if num == 0 { + return &types.Response{ + Success: true, + Message: "ok", + }, nil + } + return nil, httpresult.ErrorResultDefault("5031") }