1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package pay_recharge
- import (
- "context"
- "wechat-api/internal/svc"
- "wechat-api/internal/types"
- "wechat-api/internal/utils/dberrorhandler"
- "github.com/suyuan32/simple-admin-common/msg/errormsg"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type CreatePayRechargeLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewCreatePayRechargeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreatePayRechargeLogic {
- return &CreatePayRechargeLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *CreatePayRechargeLogic) CreatePayRecharge(req *types.PayRechargeInfo) (*types.BaseMsgResp, error) {
- _, err := l.svcCtx.DB.PayRecharge.Create().
- SetNotNilUserID(req.UserId).
- SetNotNilNumber(req.Number).
- SetNotNilStatus(req.Status).
- SetNotNilMoney(req.Money).
- SetNotNilOutTradeNo(req.OutTradeNo).
- SetNotNilOrganizationID(req.OrganizationId).
- Save(l.ctx)
- if err != nil {
- return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
- }
- return &types.BaseMsgResp{Msg: errormsg.CreateSuccess}, nil
- }
|