temp
This commit is contained in:
parent
3f754d66e4
commit
21a88b42f8
@ -217,6 +217,7 @@ type (
|
||||
Id string `path:"id"`
|
||||
}
|
||||
QueryShareDetailResp {
|
||||
Status string `json:"status"`
|
||||
Query
|
||||
}
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"tydata-server/app/user/cmd/api/internal/svc"
|
||||
"tydata-server/app/user/cmd/api/internal/types"
|
||||
@ -12,6 +12,7 @@ import (
|
||||
"tydata-server/common/xerr"
|
||||
"tydata-server/pkg/lzkit/crypto"
|
||||
|
||||
"github.com/bytedance/sonic"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
@ -41,12 +42,23 @@ func (l *QueryShareDetailLogic) QueryShareDetail(req *types.QueryShareDetailReq)
|
||||
if decryptErr != nil {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告查询, 解密数据失败: %v", decryptErr)
|
||||
}
|
||||
// 获取订单信息
|
||||
orderID, err := strconv.ParseInt(string(decryptedID), 10, 64)
|
||||
|
||||
var payload types.QueryShareLinkPayload
|
||||
err = sonic.Unmarshal(decryptedID, &payload)
|
||||
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), "报告查询, 解密数据失败: %v", err)
|
||||
}
|
||||
order, err := l.svcCtx.OrderModel.FindOne(l.ctx, orderID)
|
||||
|
||||
// 检查分享链接是否过期
|
||||
now := time.Now().Unix()
|
||||
if now > payload.ExpireAt {
|
||||
return &types.QueryShareDetailResp{
|
||||
Status: "expired",
|
||||
}, nil
|
||||
}
|
||||
|
||||
// 获取订单信息
|
||||
order, err := l.svcCtx.OrderModel.FindOne(l.ctx, payload.OrderId)
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.LOGIC_QUERY_NOT_FOUND), "报告查询, 订单不存在: %v", err)
|
||||
@ -92,7 +104,8 @@ func (l *QueryShareDetailLogic) QueryShareDetail(req *types.QueryShareDetailReq)
|
||||
}
|
||||
query.ProductName = product.ProductName
|
||||
return &types.QueryShareDetailResp{
|
||||
Query: query,
|
||||
Status: "success",
|
||||
Query: query,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -441,6 +441,7 @@ type QueryShareDetailReq struct {
|
||||
}
|
||||
|
||||
type QueryShareDetailResp struct {
|
||||
Status string `json:"status"`
|
||||
Query
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user