| @@ -81,6 +81,7 @@ func QueryDataForActivity(startTime time.Time, endTime time.Time) []*UserBusines | |||
| dateRecord.ID = userRecord.ID | |||
| log.Info("i=" + fmt.Sprint(i) + " userName=" + userRecord.Name) | |||
| dateRecord.Email = userRecord.Email | |||
| dateRecord.Phone = userRecord.PhoneNumber | |||
| dateRecord.RegistDate = userRecord.CreatedUnix | |||
| dateRecord.Name = userRecord.Name | |||
| @@ -105,6 +105,8 @@ type UserBusinessAnalysisAll struct { | |||
| CollectImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| CollectedImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| RecommendImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| Phone string `xorm:"NOT NULL"` | |||
| } | |||
| type UserBusinessAnalysis struct { | |||
| @@ -192,6 +194,8 @@ type UserBusinessAnalysis struct { | |||
| CollectImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| CollectedImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| RecommendImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| Phone string `xorm:"NOT NULL"` | |||
| } | |||
| type UserBusinessAnalysisQueryOptions struct { | |||
| @@ -475,6 +479,7 @@ func QueryUserStaticDataForUserDefine(opts *UserBusinessAnalysisQueryOptions, wi | |||
| dateRecord.CountDate = CountDate.Unix() | |||
| dateRecord.DataDate = DataDate | |||
| dateRecord.Email = userRecord.Email | |||
| dateRecord.Phone = userRecord.PhoneNumber | |||
| dateRecord.RegistDate = userRecord.CreatedUnix | |||
| dateRecord.Name = userRecord.Name | |||
| dateRecord.UserLocation = userRecord.Location | |||
| @@ -728,6 +733,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS | |||
| var dateRecordAll UserBusinessAnalysisAll | |||
| dateRecordAll.ID = userRecord.ID | |||
| dateRecordAll.Email = userRecord.Email | |||
| dateRecordAll.Phone = userRecord.PhoneNumber | |||
| dateRecordAll.RegistDate = userRecord.CreatedUnix | |||
| dateRecordAll.Name = userRecord.Name | |||
| dateRecordAll.GiteaAgeMonth = subMonth(currentTimeNow, userRecord.CreatedUnix.AsTime()) | |||
| @@ -839,7 +845,7 @@ func insertTable(dateRecords []UserBusinessAnalysisAll, tableName string, static | |||
| insertBatchSql := "INSERT INTO public." + tableName + | |||
| "(id, count_date, code_merge_count, commit_count, issue_count, comment_count, focus_repo_count, star_repo_count, watched_count, gitea_age_month, commit_code_size, commit_dataset_size, " + | |||
| "commit_model_count, solve_issue_count, encyclopedias_count, regist_date, create_repo_count, login_count, open_i_index, email, name, data_date,cloud_brain_task_num,gpu_debug_job,npu_debug_job,gpu_train_job,npu_train_job,npu_inference_job,gpu_bench_mark_job,cloud_brain_run_time,commit_dataset_num,user_index,user_location,focus_other_user,collect_dataset,collected_dataset,recommend_dataset,collect_image,collected_image,recommend_image,user_index_primitive) " + | |||
| "commit_model_count, solve_issue_count, encyclopedias_count, regist_date, create_repo_count, login_count, open_i_index, email, name, data_date,cloud_brain_task_num,gpu_debug_job,npu_debug_job,gpu_train_job,npu_train_job,npu_inference_job,gpu_bench_mark_job,cloud_brain_run_time,commit_dataset_num,user_index,user_location,focus_other_user,collect_dataset,collected_dataset,recommend_dataset,collect_image,collected_image,recommend_image,user_index_primitive,phone) " + | |||
| "VALUES" | |||
| for i, record := range dateRecords { | |||
| @@ -848,7 +854,7 @@ func insertTable(dateRecords []UserBusinessAnalysisAll, tableName string, static | |||
| ", " + fmt.Sprint(record.WatchedCount) + ", " + fmt.Sprint(record.GiteaAgeMonth) + ", " + fmt.Sprint(record.CommitCodeSize) + ", " + fmt.Sprint(record.CommitDatasetSize) + | |||
| ", " + fmt.Sprint(record.CommitModelCount) + ", " + fmt.Sprint(record.SolveIssueCount) + ", " + fmt.Sprint(record.EncyclopediasCount) + ", " + fmt.Sprint(record.RegistDate) + | |||
| ", " + fmt.Sprint(record.CreateRepoCount) + ", " + fmt.Sprint(record.LoginCount) + ", " + fmt.Sprint(record.OpenIIndex) + ", '" + record.Email + "', '" + record.Name + "', '" + record.DataDate + "'," + fmt.Sprint(record.CloudBrainTaskNum) + "," + fmt.Sprint(record.GpuDebugJob) + "," + fmt.Sprint(record.NpuDebugJob) + "," + fmt.Sprint(record.GpuTrainJob) + "," + fmt.Sprint(record.NpuTrainJob) + "," + fmt.Sprint(record.NpuInferenceJob) + "," + fmt.Sprint(record.GpuBenchMarkJob) + "," + fmt.Sprint(record.CloudBrainRunTime) + "," + fmt.Sprint(record.CommitDatasetNum) + "," + fmt.Sprint(record.UserIndex) + ",'" + record.UserLocation + "'," + | |||
| fmt.Sprint(record.FocusOtherUser) + "," + fmt.Sprint(record.CollectDataset) + "," + fmt.Sprint(record.CollectedDataset) + "," + fmt.Sprint(record.RecommendDataset) + "," + fmt.Sprint(record.CollectImage) + "," + fmt.Sprint(record.CollectedImage) + "," + fmt.Sprint(record.RecommendImage) + "," + fmt.Sprint(record.UserIndexPrimitive) + ")" | |||
| fmt.Sprint(record.FocusOtherUser) + "," + fmt.Sprint(record.CollectDataset) + "," + fmt.Sprint(record.CollectedDataset) + "," + fmt.Sprint(record.RecommendDataset) + "," + fmt.Sprint(record.CollectImage) + "," + fmt.Sprint(record.CollectedImage) + "," + fmt.Sprint(record.RecommendImage) + "," + fmt.Sprint(record.UserIndexPrimitive) + ",'" + record.Phone + "')" | |||
| if i < (len(dateRecords) - 1) { | |||
| insertBatchSql += "," | |||
| } | |||
| @@ -973,6 +979,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, | |||
| dateRecord.CountDate = CountDate.Unix() | |||
| dateRecord.Email = userRecord.Email | |||
| dateRecord.Phone = userRecord.PhoneNumber | |||
| dateRecord.RegistDate = userRecord.CreatedUnix | |||
| dateRecord.Name = userRecord.Name | |||
| dateRecord.GiteaAgeMonth = subMonth(currentTimeNow, userRecord.CreatedUnix.AsTime()) | |||
| @@ -65,6 +65,8 @@ type UserBusinessAnalysisCurrentYear struct { | |||
| CollectImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| CollectedImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| RecommendImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| Phone string `xorm:"NOT NULL"` | |||
| } | |||
| type UserBusinessAnalysisLast30Day struct { | |||
| @@ -130,6 +132,8 @@ type UserBusinessAnalysisLast30Day struct { | |||
| CollectImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| CollectedImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| RecommendImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| Phone string `xorm:"NOT NULL"` | |||
| } | |||
| type UserBusinessAnalysisLastMonth struct { | |||
| @@ -195,6 +199,8 @@ type UserBusinessAnalysisLastMonth struct { | |||
| CollectImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| CollectedImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| RecommendImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| Phone string `xorm:"NOT NULL"` | |||
| } | |||
| type UserBusinessAnalysisCurrentMonth struct { | |||
| @@ -260,6 +266,8 @@ type UserBusinessAnalysisCurrentMonth struct { | |||
| CollectImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| CollectedImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| RecommendImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| Phone string `xorm:"NOT NULL"` | |||
| } | |||
| type UserBusinessAnalysisCurrentWeek struct { | |||
| @@ -326,6 +334,8 @@ type UserBusinessAnalysisCurrentWeek struct { | |||
| CollectImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| CollectedImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| RecommendImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| Phone string `xorm:"NOT NULL"` | |||
| } | |||
| type UserBusinessAnalysisYesterday struct { | |||
| @@ -392,6 +402,8 @@ type UserBusinessAnalysisYesterday struct { | |||
| CollectImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| CollectedImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| RecommendImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| Phone string `xorm:"NOT NULL"` | |||
| } | |||
| type UserBusinessAnalysisLastWeek struct { | |||
| @@ -458,6 +470,8 @@ type UserBusinessAnalysisLastWeek struct { | |||
| CollectImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| CollectedImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| RecommendImage int `xorm:"NOT NULL DEFAULT 0"` | |||
| Phone string `xorm:"NOT NULL"` | |||
| } | |||
| type UserAnalysisPara struct { | |||
| @@ -559,6 +559,7 @@ static.CollectImage=Collect Image Count | |||
| static.CollectedImage=Collected Image Count | |||
| static.RecommendImage=Recommended Image Count | |||
| static.email=Email | |||
| static.phone=Phone | |||
| static.location=Location | |||
| static.all=All | |||
| static.public.user_business_analysis_current_month=Current_Month | |||
| @@ -564,6 +564,7 @@ static.CollectImage=收藏镜像数 | |||
| static.CollectedImage=被收藏镜像数 | |||
| static.RecommendImage=被推荐镜像数 | |||
| static.email=Email | |||
| static.phone=电话 | |||
| static.location=所在地区 | |||
| static.all=所有 | |||
| static.public.user_business_analysis_current_month=本月 | |||
| @@ -112,6 +112,7 @@ func getExcelHeader(ctx *context.Context) map[string]string { | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.RecommendImage")) | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.email")) | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.phone")) | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.location")) | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.registdate")) | |||
| @@ -193,6 +194,9 @@ func writeExcel(row int, xlsx *excelize.File, sheetName string, userRecord *mode | |||
| xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.Email) | |||
| tmp = tmp + 1 | |||
| xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.Phone) | |||
| tmp = tmp + 1 | |||
| xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.UserLocation) | |||
| tmp = tmp + 1 | |||
| @@ -268,6 +272,9 @@ func writeExcelPage(row int, xlsx *excelize.File, sheetName string, userRecord * | |||
| xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.Email) | |||
| tmp = tmp + 1 | |||
| xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.Phone) | |||
| tmp = tmp + 1 | |||
| xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.UserLocation) | |||
| tmp = tmp + 1 | |||
| @@ -723,8 +730,8 @@ func TimingCountData() { | |||
| } | |||
| func QueryUserActivity(ctx *context.Context) { | |||
| startDate := ctx.Query("startDate") | |||
| endDate := ctx.Query("endDate") | |||
| startDate := ctx.Query("beginTime") | |||
| endDate := ctx.Query("endTime") | |||
| t, _ := time.Parse("2006-01-02", startDate) | |||
| startTime := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location()) | |||
| @@ -768,6 +775,7 @@ func writeUserActivityToExcel(startTime time.Time, endTime time.Time, filePath s | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.CommitDatasetNum")) | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.CommitModelCount")) | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.email")) | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.phone")) | |||
| excelHeader = append(excelHeader, ctx.Tr("user.static.registdate")) | |||
| excelHeaderMap := make(map[string]string, 0) | |||
| @@ -814,6 +822,8 @@ func writeUserActivityToExcel(startTime time.Time, endTime time.Time, filePath s | |||
| tmp = tmp + 1 | |||
| xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.Email) | |||
| tmp = tmp + 1 | |||
| xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, userRecord.Phone) | |||
| tmp = tmp + 1 | |||
| formatTime := userRecord.RegistDate.Format("2006-01-02 15:04:05") | |||
| xlsx.SetCellValue(sheetName, getColumn(tmp)+rows, formatTime[0:len(formatTime)-3]) | |||
| tmp = tmp + 1 | |||