-
Notifications
You must be signed in to change notification settings - Fork 1
/
analysis.go
30 lines (27 loc) · 1010 Bytes
/
analysis.go
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
package OrgUser
import (
CoreSQL "github.com/fotomxq/weeekj_core/v5/core/sql"
CoreSQLTime "github.com/fotomxq/weeekj_core/v5/core/sql/time"
Router2SystemConfig "github.com/fotomxq/weeekj_core/v5/router2/system_config"
)
// ArgsGetAnalysisActiveCount 获取活跃用户总数
type ArgsGetAnalysisActiveCount struct {
//组织ID
OrgID int64 `db:"org_id" json:"orgID" check:"id"`
//时间范围
// 部分统计支持
TimeBetween CoreSQLTime.DataCoreTime `json:"timeBetween"`
}
func GetAnalysisActiveCount(args *ArgsGetAnalysisActiveCount) (count int64, err error) {
var timeBetween CoreSQLTime.FieldsCoreTime
timeBetween, err = CoreSQLTime.GetBetweenByISO(args.TimeBetween)
if err != nil {
return
}
count, err = CoreSQL.GetAllCountMap(Router2SystemConfig.MainDB.DB, "org_user_data", "id", "org_id = :org_id AND update_at >= :start_at AND update_at <= :end_at", map[string]interface{}{
"org_id": args.OrgID,
"start_at": timeBetween.MinTime,
"end_at": timeBetween.MaxTime,
})
return
}