boweniac 4 дней назад
Родитель
Сommit
99f4d127e2
3 измененных файлов с 22 добавлено и 13 удалено
  1. 10 1
      desc/wechat/dashboard.api
  2. 2 11
      internal/logic/dashboard/get_charts_logic.go
  3. 10 1
      internal/types/types.go

+ 10 - 1
desc/wechat/dashboard.api

@@ -31,7 +31,7 @@ type (
         ActiveUser *ChartsUint `json:"active_user"`
         NewUser *ChartsInt `json:"new_user"`
         LabelDist []LabelsData `json:"label_dist"`
-		ConsumeCoin *ChartsMix `json:"consume_coin"`
+		ConsumeCoin *ChartsStr `json:"consume_coin"`
     }
 
     ChartsUint {
@@ -60,6 +60,15 @@ type (
         Tip *string `json:"tip"`
     }
 
+    ChartsStr {
+        Count string `json:"count"`
+        Rate *float32 `json:"rate"`
+        Label []string `json:"label"`
+        Val []float64 `json:"val"`
+        LabelText string `json:"labelText"`
+        Tip *string `json:"tip"`
+    }
+
     ChartsInt {
         Count int64 `json:"count"`
         Rate *float32 `json:"rate"`

+ 2 - 11
internal/logic/dashboard/get_charts_logic.go

@@ -500,21 +500,12 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
 		}
 	}
 
-	consumeCoinInt := types.ChartsMix{}
+	consumeCoinInt := types.ChartsStr{}
+	consumeCoinInt.Count = fmt.Sprintf("%.6f", consumeCoin.Count)
 	consumeCoinInt.Val = consumeCoin.Val
 	consumeCoinInt.Label = consumeCoin.Label
 	consumeCoinInt.LabelText = consumeCoin.LabelText
 
-	if consumeCoin.Count == 0 {
-		consumeCoinInt.Count = 0
-	} else {
-		if consumeCoin.Count >= 0 {
-			consumeCoinInt.Count = int64(math.Ceil(consumeCoin.Count))
-		} else {
-			consumeCoinInt.Count = int64(-math.Ceil(-consumeCoin.Count))
-		}
-	}
-
 	chartsData := types.ChartsData{
 		AiResponse:     &aiResponse,
 		SopRun:         &sopRun,

+ 10 - 1
internal/types/types.go

@@ -3592,7 +3592,7 @@ type ChartsData struct {
 	ActiveUser     *ChartsUint  `json:"active_user"`
 	NewUser        *ChartsInt   `json:"new_user"`
 	LabelDist      []LabelsData `json:"label_dist"`
-	ConsumeCoin    *ChartsMix   `json:"consume_coin"`
+	ConsumeCoin    *ChartsStr   `json:"consume_coin"`
 }
 
 type ChartsUint struct {
@@ -3622,6 +3622,15 @@ type ChartsMix struct {
 	Tip       *string   `json:"tip"`
 }
 
+type ChartsStr struct {
+	Count     string    `json:"count"`
+	Rate      *float32  `json:"rate"`
+	Label     []string  `json:"label"`
+	Val       []float64 `json:"val"`
+	LabelText string    `json:"labelText"`
+	Tip       *string   `json:"tip"`
+}
+
 type ChartsInt struct {
 	Count     int64    `json:"count"`
 	Rate      *float32 `json:"rate"`