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 UpdatePayRechargeLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewUpdatePayRechargeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdatePayRechargeLogic {
- return &UpdatePayRechargeLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *UpdatePayRechargeLogic) UpdatePayRecharge(req *types.PayRechargeInfo) (*types.BaseMsgResp, error) {
- err := l.svcCtx.DB.PayRecharge.UpdateOneID(*req.Id).
- SetNotNilUserID(req.UserId).
- SetNotNilNumber(req.Number).
- SetNotNilStatus(req.Status).
- SetNotNilMoney(req.Money).
- SetNotNilOutTradeNo(req.OutTradeNo).
- SetNotNilOrganizationID(req.OrganizationId).
- Exec(l.ctx)
- if err != nil {
- return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
- }
- return &types.BaseMsgResp{Msg: errormsg.UpdateSuccess}, nil
- }
|