Browse Source

增加运营分析的数据

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.21.12.1
zouap 4 years ago
parent
commit
0e21580cdc
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      models/user_business_analysis.go

+ 6
- 2
models/user_business_analysis.go View File

@@ -57,6 +57,9 @@ type UserBusinessAnalysis struct {

//user
Email string `xorm:"NOT NULL"`

//user
Name string `xorm:"NOT NULL"`
}

func countData() {
@@ -92,6 +95,7 @@ func countData() {
dateRecord.CountDate = CountDate.Unix()
dateRecord.Email = userRecord.Email
dateRecord.RegistDate = userRecord.CreatedUnix
dateRecord.Name = userRecord.Name

if _, ok := CodeMergeCountMap[dateRecord.ID]; !ok {
dateRecord.CodeMergeCount = 0
@@ -119,11 +123,11 @@ func countData() {
func queryAction(start_unix int64, end_unix int64, actionType int64) map[int64]int {
sess := x.NewSession()
defer sess.Close()
sess.Select("id,user_id,op_type,act_user_id").Table("action").Where("op_type=" + fmt.Sprint(actionType) + " and create_unix>=" + fmt.Sprint(start_unix) + " and create_unix<=" + fmt.Sprint(end_unix))
sess.Select("id,user_id,op_type,act_user_id").Table("action").Where("op_type=" + fmt.Sprint(actionType) + " and created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix))
actionList := make([]*Action, 0)
sess.Find(&actionList)
resultMap := make(map[int64]int)
log.Info("query action size=" + fmt.Sprint(len(actionList)))
for _, actionRecord := range actionList {
if _, ok := resultMap[actionRecord.UserID]; !ok {
resultMap[actionRecord.UserID] = 1


Loading…
Cancel
Save