diff --git a/app/user/cmd/api/etc/main.yaml b/app/user/cmd/api/etc/main.yaml index 25d85ea..5747e03 100644 --- a/app/user/cmd/api/etc/main.yaml +++ b/app/user/cmd/api/etc/main.yaml @@ -16,7 +16,7 @@ VerifyCode: AccessKeyID: "LTAI5tKGB3TVJbMHSoZN3yr9" AccessKeySecret: "OCQ30GWp4yENMjmfOAaagksE18bp65" EndpointURL: "dysmsapi.aliyuncs.com" - SignName: "全能查" + SignName: "海南省学宇思网络科技" TemplateCode: "SMS_302641455" ValidTime: 300 Encrypt: diff --git a/app/user/cmd/api/internal/logic/query/querylistlogic.go b/app/user/cmd/api/internal/logic/query/querylistlogic.go index 3d9d263..ec339d0 100644 --- a/app/user/cmd/api/internal/logic/query/querylistlogic.go +++ b/app/user/cmd/api/internal/logic/query/querylistlogic.go @@ -32,34 +32,31 @@ func (l *QueryListLogic) QueryList(req *types.QueryListReq) (resp *types.QueryLi if getUidErr != nil { return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "报告列表查询, 获取用户信息失败, %+v", getUidErr) } - build := l.svcCtx.OrderModel.SelectBuilder().Where(squirrel.Eq{ + + // 直接构建查询query表的条件 + build := l.svcCtx.QueryModel.SelectBuilder().Where(squirrel.Eq{ "user_id": userID, - }).Where(squirrel.NotEq{ - "status": []string{"pending", "closed"}, }) - orderList, total, err := l.svcCtx.OrderModel.FindPageListByPageWithTotal(l.ctx, build, req.Page, req.PageSize, "create_time DESC") + + // 直接从query表分页查询 + queryList, total, err := l.svcCtx.QueryModel.FindPageListByPageWithTotal(l.ctx, build, req.Page, req.PageSize, "create_time DESC") if err != nil { - return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "报告列表查询, 查找订单列表错误, %v", err) + return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "报告列表查询, 查找报告列表错误, %+v", err) } var list []types.Query - if len(orderList) > 0 { - for _, orderModel := range orderList { - queryModel, findQueryErr := l.svcCtx.QueryModel.FindOneByOrderId(l.ctx, orderModel.Id) - if findQueryErr != nil { - return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告列表查询, 查找报告错误, %+v", findQueryErr) - - } + if len(queryList) > 0 { + for _, queryModel := range queryList { var query types.Query query.CreateTime = queryModel.CreateTime.Format("2006-01-02 15:04:05") query.UpdateTime = queryModel.UpdateTime.Format("2006-01-02 15:04:05") copyErr := copier.Copy(&query, queryModel) if copyErr != nil { - return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告列表查询, 报告结构体复制失败, %v", err) + return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告列表查询, 报告结构体复制失败, %+v", err) } product, findProductErr := l.svcCtx.ProductModel.FindOne(l.ctx, queryModel.ProductId) if findProductErr != nil { - return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告列表查询, 获取商品信息失败, %v", err) + return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "报告列表查询, 获取商品信息失败, %+v", err) } query.ProductName = product.ProductName list = append(list, query)