Commit
This commit is contained in:
42
service/statistics/statistics.go
Normal file
42
service/statistics/statistics.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package statistics
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"nCovTrack-Backend/global"
|
||||
"nCovTrack-Backend/utils"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func GetChinaNCovStatistics() func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
resp := utils.GetWhioutHeader(global.CHINA_NCOV_STATISTIC_URL)
|
||||
var nCovRes map[string]string
|
||||
json.Unmarshal([]byte(resp), &nCovRes)
|
||||
fmt.Println(nCovRes)
|
||||
var nCovResData interface{}
|
||||
json.Unmarshal([]byte(nCovRes["data"]), &nCovResData)
|
||||
c.JSON(http.StatusOK, nCovResData)
|
||||
}
|
||||
}
|
||||
|
||||
func GetChinaNCovStatistic() func(c *gin.Context) {
|
||||
return func(c *gin.Context) {
|
||||
//resp := utils.GetWhioutHeader(global.CHINA_NCOV_STATISTIC_URL)
|
||||
var nCovRes map[string]string
|
||||
//err := json.Unmarshal([]byte(resp), &nCovRes)
|
||||
//fmt.Println(nCovRes)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//var nCovResData interface{}
|
||||
//err := json.Unmarshal([]byte(nCovRes["data"]), &nCovResData)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
nCovRes["1"] = "1"
|
||||
c.JSON(http.StatusOK, nCovRes)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user