fix query
This commit is contained in:
parent
52e88b1cbf
commit
8af7189a5f
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"time"
|
"time"
|
||||||
"tyc-server/common/ctxdata"
|
|
||||||
"tyc-server/common/xerr"
|
"tyc-server/common/xerr"
|
||||||
"tyc-server/pkg/lzkit/crypto"
|
"tyc-server/pkg/lzkit/crypto"
|
||||||
"tyc-server/pkg/lzkit/delay"
|
"tyc-server/pkg/lzkit/delay"
|
||||||
@ -38,10 +37,10 @@ func NewQueryDetailByOrderIdLogic(ctx context.Context, svcCtx *svc.ServiceContex
|
|||||||
|
|
||||||
func (l *QueryDetailByOrderIdLogic) QueryDetailByOrderId(req *types.QueryDetailByOrderIdReq) (resp *types.QueryDetailByOrderIdResp, err error) {
|
func (l *QueryDetailByOrderIdLogic) QueryDetailByOrderId(req *types.QueryDetailByOrderIdReq) (resp *types.QueryDetailByOrderIdResp, err error) {
|
||||||
// 获取当前用户ID
|
// 获取当前用户ID
|
||||||
userId, err := ctxdata.GetUidFromCtx(l.ctx)
|
// userId, err := ctxdata.GetUidFromCtx(l.ctx)
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "获取用户ID失败: %v", err)
|
// return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "获取用户ID失败: %v", err)
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 获取订单信息
|
// 获取订单信息
|
||||||
order, err := l.svcCtx.OrderModel.FindOne(l.ctx, req.OrderId)
|
order, err := l.svcCtx.OrderModel.FindOne(l.ctx, req.OrderId)
|
||||||
@ -52,9 +51,9 @@ func (l *QueryDetailByOrderIdLogic) QueryDetailByOrderId(req *types.QueryDetailB
|
|||||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "报告查询, 查找报告错误: %+v", err)
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "报告查询, 查找报告错误: %+v", err)
|
||||||
}
|
}
|
||||||
// 安全验证:确保订单属于当前用户
|
// 安全验证:确保订单属于当前用户
|
||||||
if order.UserId != userId {
|
// if order.UserId != userId {
|
||||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.LOGIC_QUERY_NOT_FOUND), "无权查看此订单报告")
|
// return nil, errors.Wrapf(xerr.NewErrCode(xerr.LOGIC_QUERY_NOT_FOUND), "无权查看此订单报告")
|
||||||
}
|
// }
|
||||||
// 创建渐进式延迟策略实例
|
// 创建渐进式延迟策略实例
|
||||||
progressiveDelayOrder, err := delay.New(200*time.Millisecond, 3*time.Second, 10*time.Second, 1.5)
|
progressiveDelayOrder, err := delay.New(200*time.Millisecond, 3*time.Second, 10*time.Second, 1.5)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user