A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
feat(badge): badge list earned return earned total
kumfo4f80f9e97b02
diff --git a/docs/docs.go b/docs/docs.goindex 389f3bdf..e5cc6f16 100644--- a/docs/docs.go+++ b/docs/docs.go@@ -7795,7 +7795,7 @@ const docTemplate = `{},"earned": {"description": "badge earned count",- "type": "boolean"+ "type": "integer"},"icon": {"description": "badge icon",@@ -11472,8 +11472,8 @@ var SwaggerInfo = &swag.Spec{Host: "",BasePath: "= \"/\"",Schemes: []string{},- Title: "\"answer\"",- Description: "= \"answer api\"",+ Title: "\"apache answer\"",+ Description: "= \"apache answer api\"",InfoInstanceName: "swagger",SwaggerTemplate: docTemplate,LeftDelim: "{{",diff --git a/docs/swagger.json b/docs/swagger.jsonindex 3d6f07c8..5fd36907 100644--- a/docs/swagger.json+++ b/docs/swagger.json@@ -1,8 +1,8 @@{"swagger": "2.0","info": {- "description": "= \"answer api\"",- "title": "\"answer\"",+ "description": "= \"apache answer api\"",+ "title": "\"apache answer\"","contact": {},"version": "= \"v0.0.1\""},@@ -7769,7 +7769,7 @@},"earned": {"description": "badge earned count",- "type": "boolean"+ "type": "integer"},"icon": {"description": "badge icon",diff --git a/docs/swagger.yaml b/docs/swagger.yamlindex d2d43504..72871edc 100644--- a/docs/swagger.yaml+++ b/docs/swagger.yaml@@ -372,7 +372,7 @@ definitions:type: integerearned:description: badge earned count- type: boolean+ type: integericon:description: badge icontype: string@@ -2909,8 +2909,8 @@ definitions:type: objectinfo:contact: {}- description: = "answer api"- title: '"answer"'+ description: = "apache answer api"+ title: '"apache answer"'version: = "v0.0.1"paths:/:diff --git a/internal/schema/badge_schema.go b/internal/schema/badge_schema.goindex efbcd37a..1dd2e76f 100644--- a/internal/schema/badge_schema.go+++ b/internal/schema/badge_schema.go@@ -49,7 +49,7 @@ type BadgeListInfo struct {// badge award countAwardCount int `json:"award_count" `// badge earned count- Earned bool `json:"earned" `+ Earned int64 `json:"earned" `// badge levelLevel entity.BadgeLevel `json:"level" `}diff --git a/internal/service/badge/badge_service.go b/internal/service/badge/badge_service.goindex 031f0f15..49591adc 100644--- a/internal/service/badge/badge_service.go+++ b/internal/service/badge/badge_service.go@@ -99,11 +99,11 @@ func (b *BadgeService) ListByGroup(ctx context.Context, userID string) (resp []*for _, badge := range badges {// check is earned- earned := false+ var earned int64 = 0if len(earnedCounts) > 0 {for _, earnedCount := range earnedCounts {if badge.ID == earnedCount.BadgeID && earnedCount.EarnedCount > 0 {- earned = true+ earned = earnedCount.EarnedCountbreak}}