12345678910111213141516171819202122232425262728293031323334353637 |
- package logic
- import (
- "context"
- "points_service/rpc/model"
- "points_service/rpc/integral"
- "points_service/rpc/internal/svc"
- "github.com/tal-tech/go-zero/core/logx"
- )
- type AddLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AddLogic {
- return &AddLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- func (l *AddLogic) Add(in *integral.AddReq) (*integral.AddResp, error) {
- // todo: add your logic here and delete this line
- _, err := l.svcCtx.Model.Insert(model.Balance{
- UserId: in.UserId,
- CountPoints: in.CountPoints,
- })
- if err != nil {
- return nil, err
- }
- return &integral.AddResp{Status: true}, nil
- }
|