483ade81
aarongao
v1.1
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package Api
import (
"github.com/aarongao/tools"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"letu/DB"
)
func Analysls(c *gin.Context) {
c.Header("Access-Control-Allow-Origin", c.Request.Header.Get("Origin"))
c.Header("Access-Control-Allow-Credentials", "true")
_map := make(map[string]int64)
_map["registerTotal"], _ = DB.CMember.CountDocuments(tools.GetContext(), bson.M{})
_map["userTotal"], _ = DB.CDevice.CountDocuments(tools.GetContext(), bson.M{})
_map["nonRegisterTotal"] = _map["userTotal"] - _map["registerTotal"]
c.JSON(200, tools.ResponseSeccess{
0,
_map,
})
}
|