压测 dome
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

38 lines
703 B

package logic
import (
"context"
httpresult "demo/common"
"demo/internal/svc"
"demo/internal/types"
"math/rand"
"github.com/zeromicro/go-zero/core/logx"
)
type Test503Logic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewTest503Logic(ctx context.Context, svcCtx *svc.ServiceContext) *Test503Logic {
return &Test503Logic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *Test503Logic) Test503() (resp *types.Response, err error) {
// 生成随机数 范围0-2
num := rand.Intn(2)
if num == 0 {
return &types.Response{
Success: true,
Message: "ok",
}, nil
}
return nil, httpresult.ErrorResultDefault("5031")
}