|
@ -5,6 +5,7 @@ import ( |
|
|
httpresult "demo/common" |
|
|
httpresult "demo/common" |
|
|
"demo/internal/svc" |
|
|
"demo/internal/svc" |
|
|
"demo/internal/types" |
|
|
"demo/internal/types" |
|
|
|
|
|
"math/rand" |
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx" |
|
|
"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) { |
|
|
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") |
|
|
return nil, httpresult.ErrorResultDefault("5031") |
|
|
} |
|
|
} |
|
|