|
@@ -2,12 +2,13 @@ package pay_recharge
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
+ "github.com/suyuan32/simple-admin-core/rpc/types/core"
|
|
|
|
|
|
"wechat-api/internal/svc"
|
|
|
"wechat-api/internal/types"
|
|
|
"wechat-api/internal/utils/dberrorhandler"
|
|
|
|
|
|
- "github.com/suyuan32/simple-admin-common/msg/errormsg"
|
|
|
+ "github.com/suyuan32/simple-admin-common/msg/errormsg"
|
|
|
|
|
|
"github.com/suyuan32/simple-admin-common/utils/pointy"
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
@@ -33,24 +34,41 @@ func (l *GetPayRechargeByIdLogic) GetPayRechargeById(req *types.IDReq) (*types.P
|
|
|
return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
|
|
|
}
|
|
|
|
|
|
+ departmentInfo, err := l.svcCtx.CoreRpc.GetDepartmentById(l.ctx, &core.IDReq{Id: data.OrganizationID})
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
+ bUserInfo := types.UserInfo{}
|
|
|
+ if data.UserID != "" {
|
|
|
+ userInfo, _ := l.svcCtx.CoreRpc.GetUserById(l.ctx, &core.UUIDReq{Id: data.UserID})
|
|
|
+ if userInfo != nil {
|
|
|
+ bUserInfo.Id = userInfo.Id
|
|
|
+ bUserInfo.Username = userInfo.Username
|
|
|
+ bUserInfo.Nickname = userInfo.Nickname
|
|
|
+ bUserInfo.Avatar = userInfo.Avatar
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return &types.PayRechargeInfoResp{
|
|
|
- BaseDataInfo: types.BaseDataInfo{
|
|
|
- Code: 0,
|
|
|
- Msg: errormsg.Success,
|
|
|
- },
|
|
|
- Data: types.PayRechargeInfo{
|
|
|
- BaseIDInfo: types.BaseIDInfo{
|
|
|
- Id: &data.ID,
|
|
|
- CreatedAt: pointy.GetPointer(data.CreatedAt.UnixMilli()),
|
|
|
- UpdatedAt: pointy.GetPointer(data.UpdatedAt.UnixMilli()),
|
|
|
- },
|
|
|
- UserId: &data.UserID,
|
|
|
- Number: &data.Number,
|
|
|
- Status: &data.Status,
|
|
|
- Money: &data.Money,
|
|
|
- OutTradeNo: &data.OutTradeNo,
|
|
|
- OrganizationId: &data.OrganizationID,
|
|
|
- },
|
|
|
+ BaseDataInfo: types.BaseDataInfo{
|
|
|
+ Code: 0,
|
|
|
+ Msg: errormsg.Success,
|
|
|
+ },
|
|
|
+ Data: types.PayRechargeInfo{
|
|
|
+ BaseIDInfo: types.BaseIDInfo{
|
|
|
+ Id: &data.ID,
|
|
|
+ CreatedAt: pointy.GetPointer(data.CreatedAt.UnixMilli()),
|
|
|
+ UpdatedAt: pointy.GetPointer(data.UpdatedAt.UnixMilli()),
|
|
|
+ },
|
|
|
+ UserId: &data.UserID,
|
|
|
+ UserInfo: bUserInfo,
|
|
|
+ Number: &data.Number,
|
|
|
+ Status: &data.Status,
|
|
|
+ Money: &data.Money,
|
|
|
+ OutTradeNo: &data.OutTradeNo,
|
|
|
+ OrganizationId: &data.OrganizationID,
|
|
|
+ OrganizationName: departmentInfo.Name,
|
|
|
+ },
|
|
|
}, nil
|
|
|
}
|
|
|
-
|