Skip to content

Commit

Permalink
fix: 判断捐献数量
Browse files Browse the repository at this point in the history
  • Loading branch information
Cbgogogog committed Dec 4, 2023
1 parent f0f8fe2 commit 74f40cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions biz/application/service/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ func (s *PlanService) DeletePlan(ctx context.Context, req *content.DeletePlanReq
}

func (s *PlanService) DonateFish(ctx context.Context, req *content.DonateFishReq) (*content.DonateFishResp, error) {
if req.GetFish() <= 0 {
return nil, consts.ErrDonate
}

dbClient, err := s.FishMongoMapper.StartClient(ctx)
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions biz/infrastructure/consts/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var (
ErrNoSuchPost = status.Error(10301, "no such post")
ErrPaginatorTokenExpired = status.Error(10303, "paginator token has been expired")
ErrDonateOverFlow = status.Error(10201, "donate too many fish")
ErrDonate = status.Error(10201, "donate less than 0")
)

var (
Expand Down

0 comments on commit 74f40cc

Please sign in to comment.