Skip to content

Commit

Permalink
feat: plan优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Cbgogogog committed Dec 2, 2023
1 parent 1a22726 commit 3f0d231
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
16 changes: 7 additions & 9 deletions biz/application/service/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,19 +376,17 @@ func (s *PlanService) ListDonateByUser(ctx context.Context, req *content.ListDon
if p.LastToken != nil {
resp.Token = *p.LastToken
}
resp.PlanPreviews = make([]*content.PlanPreview, 0)
resp.Plans = make([]*content.Plan, 0)
for _, v := range data {
temp := &content.PlanPreview{}
temp.Id = v.ID.Hex()
temp.DonateNum = v.FishNum
temp.DonateTime = v.CreateAt.Unix()
temp := &content.Plan{}
temp.Id = v.PlanId
plan_, err := s.PlanMongoMapper.FindOne(ctx, v.PlanId)
if err == nil {
temp.CatId = plan_.CatId
temp.Name = plan_.Name
temp.CoverUrl = plan_.CoverUrl
temp = convertor.ConvertPlan(plan_)
}
resp.PlanPreviews = append(resp.PlanPreviews, temp)
temp.DonateNum = v.FishNum
temp.DonateTime = v.CreateAt.Unix()
resp.Plans = append(resp.Plans, temp)
}
return resp, nil
}
Expand Down
16 changes: 8 additions & 8 deletions biz/infrastructure/util/convertor/convertor.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ func ConvertMoment(data *moment.Moment) *content.Moment {
func ConvertPlan(data *plan.Plan) *content.Plan {
return &content.Plan{
Id: data.ID.Hex(),
CreateAt: data.CreateAt.Unix(),
PlanType: data.PlanType,
EndTime: data.EndTime.Unix(),
Name: data.Name,
CoverUrl: data.CoverUrl,
Description: data.Description,
PlanType: data.PlanType,
Instruction: data.Instruction,
StartTime: data.StartTime.Unix(),
InitiatorId: data.InitiatorId,
EndTime: data.EndTime.Unix(),
CatId: data.CatId,
CommunityId: data.CommunityId,
InitiatorId: data.InitiatorId,
ImageUrls: data.ImageUrls,
Name: data.Name,
Instruction: data.Instruction,
CoverUrl: data.CoverUrl,
Summary: data.Summary,
CreateAt: data.CreateAt.Unix(),
MaxFish: data.MaxFish,
NowFish: data.NowFish,
Summary: data.Summary,
PlanState: data.PlanState,
}
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/mitchellh/mapstructure v1.1.2
github.com/samber/lo v1.38.1
github.com/xh-polaris/gopkg v0.0.0-20231013165226-76f4d7108b9d
github.com/xh-polaris/service-idl-gen-go v0.0.0-20231126125904-a5482cc2302d
github.com/xh-polaris/service-idl-gen-go v0.0.0-20231202185651-ef33c5b2abe5
github.com/zeromicro/go-zero v1.6.0
go.mongodb.org/mongo-driver v1.12.1
google.golang.org/grpc v1.59.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/xh-polaris/gopkg v0.0.0-20231013165226-76f4d7108b9d h1:YnQOM/FdJQFfQ2aZyeeXyDvqQBm8eETXFiXWBhaaB10=
github.com/xh-polaris/gopkg v0.0.0-20231013165226-76f4d7108b9d/go.mod h1:eFkuwj6uq1k4hbDa66TijCWGL4PrNeWaNmAnxfWDeU0=
github.com/xh-polaris/service-idl-gen-go v0.0.0-20231126125904-a5482cc2302d h1:INHg1xS2Nc3/FcqMMDQTvVNgLr1erT3zEdvCuIZc6ZU=
github.com/xh-polaris/service-idl-gen-go v0.0.0-20231126125904-a5482cc2302d/go.mod h1:KjBt4ZOfugCsdAbFlrniKMDrpJAJobm8KEezTvKVnJM=
github.com/xh-polaris/service-idl-gen-go v0.0.0-20231202185651-ef33c5b2abe5 h1:R1cV669sOfg8E0JGnJk+7MObPkgmMEpu45ed6hyfrnI=
github.com/xh-polaris/service-idl-gen-go v0.0.0-20231202185651-ef33c5b2abe5/go.mod h1:KjBt4ZOfugCsdAbFlrniKMDrpJAJobm8KEezTvKVnJM=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk=
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/R083muKhosV54bj5niojjWZvU8xrevuH4=
Expand Down

0 comments on commit 3f0d231

Please sign in to comment.