Browse Source

提交用户运营统计相关代码Bug

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.21.12.1
zouap 3 years ago
parent
commit
93e51c25d0
2 changed files with 11 additions and 2 deletions
  1. +9
    -0
      models/custom_migrations.go
  2. +2
    -2
      models/user_business_analysis.go

+ 9
- 0
models/custom_migrations.go View File

@@ -22,6 +22,7 @@ var customMigrations = []CustomMigration{
}

var customMigrationsStatic = []CustomMigrationStatic{
{"Alter user static table field type ", alterUserStaticTable},
{"Delete zuzhi user history data ", deleteNotDisplayUser},
}

@@ -57,6 +58,14 @@ func syncTopicStruct(x *xorm.Engine) error {
return err
}

func alterUserStaticTable(x *xorm.Engine, static *xorm.Engine) error {
alterSql := "alter table public.user_business_analysis alter column open_i_index type double precision"

_, err := static.Exec(alterSql)
return err

}

func deleteNotDisplayUser(x *xorm.Engine, static *xorm.Engine) error {

querySQL := "select id,name from public.user where type=1"


+ 2
- 2
models/user_business_analysis.go View File

@@ -65,7 +65,7 @@ type UserBusinessAnalysis struct {
LoginCount int `xorm:"NOT NULL DEFAULT 0"`

//openi index
OpenIIndex int `xorm:"NOT NULL DEFAULT 0"`
OpenIIndex float64 `xorm:"NOT NULL DEFAULT 0"`

//user
Email string `xorm:"NOT NULL"`
@@ -366,7 +366,7 @@ func CounDataByDate(wikiCountMap map[string]int, startTime time.Time, endTime ti
if _, ok := OpenIIndexMap[dateRecord.ID]; !ok {
dateRecord.OpenIIndex = 0
} else {
dateRecord.OpenIIndex = int(OpenIIndexMap[dateRecord.ID] * 100)
dateRecord.OpenIIndex = OpenIIndexMap[dateRecord.ID]
}

dateRecord.CommitModelCount = 0


Loading…
Cancel
Save