diff --git a/models/cloudbrain.go b/models/cloudbrain.go index 1d70397de..e0df17753 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -30,6 +30,7 @@ const ( TypeCDCenter //成都智算中心 TypeCloudBrainAll = -1 + AccCardsNumAll = -1 ) const ( diff --git a/models/user_analysis_for_activity.go b/models/user_analysis_for_activity.go index 6d8201e69..d872669e6 100644 --- a/models/user_analysis_for_activity.go +++ b/models/user_analysis_for_activity.go @@ -480,5 +480,13 @@ func QueryUserAnnualReport(userId int64) *UserSummaryCurrentYear { } else { log.Info("error:=" + err.Error()) } + dbuser, err := GetUserByID(userId) + if err == nil { + return &UserSummaryCurrentYear{ + ID: dbuser.ID, + Name: dbuser.Name, + RegistDate: dbuser.CreatedUnix, + } + } return nil } diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index c18e1f51a..ee1b17544 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -887,12 +887,19 @@ func getBonusWeekDataMap() map[int64][]int { if err == nil { filenames := strings.Split(content, "\n") for i := 0; i < len(filenames); i++ { + if strings.HasSuffix(filenames[i], "\r") { + filenames[i] = filenames[i][0 : len(filenames[i])-len("\r")] + } url = setting.RecommentRepoAddr + "bonus/weekdata/" + filenames[i] csvContent, err1 := GetContentFromPromote(url) if err1 == nil { //read csv lines := strings.Split(csvContent, "\n") for j := 1; j < len(lines); j++ { + if strings.HasSuffix(lines[j], "\r") { + lines[j] = lines[j][0 : len(lines[j])-len("\r")] + } + log.Info("aLine=" + lines[j]) aLine := strings.Split(lines[j], ",") if len(aLine) < 4 { continue @@ -901,6 +908,7 @@ func getBonusWeekDataMap() map[int64][]int { order := getIntValue(aLine[2]) money := getIntValue(aLine[3]) week, num := getWeekAndNum(filenames[i]) + //log.Info("userId=" + fmt.Sprint(userId) + " order=" + fmt.Sprint(order) + " money=" + fmt.Sprint(money) + " week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) //email := lines[2] record, ok := bonusMap[userId] if !ok { @@ -949,12 +957,18 @@ func getBonusMap() map[string]map[string]int { if err == nil { filenames := strings.Split(content, "\n") for i := 0; i < len(filenames); i++ { + if strings.HasSuffix(filenames[i], "\r") { + filenames[i] = filenames[i][0 : len(filenames[i])-len("\r")] + } url = setting.RecommentRepoAddr + "bonus/" + filenames[i] csvContent, err1 := GetContentFromPromote(url) if err1 == nil { //read csv lines := strings.Split(csvContent, "\n") for j := 1; j < len(lines); j++ { + if strings.HasSuffix(lines[j], "\r") { + lines[j] = lines[j][0 : len(lines[j])-len("\r")] + } aLine := strings.Split(lines[j], ",") if len(aLine) < 7 { continue @@ -1030,18 +1044,14 @@ func getCloudBrainInfo(dateRecordAll UserBusinessAnalysisAll, CloudBrainTaskItem } cloudBrainInfo["inference_task_num"] = fmt.Sprint(dateRecordAll.NpuInferenceJob + CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_GpuInferenceJob"]) cloudBrainInfo["card_runtime"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime) - if dateRecordAll.CloudBrainRunTime >= 100 { - runtime = float64(dateRecordAll.CloudBrainRunTime) / float64(100) - } cloudBrainInfo["card_runtime_money"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime * 5) cloudBrainInfo["CloudBrainOne"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_CloudBrainOne"]) cloudBrainInfo["CloudBrainTwo"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_CloudBrainTwo"]) cloudBrainInfo["C2Net"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_C2Net"]) - cloudBrainInfoJson, _ := json.Marshal(cloudBrainInfo) scoreMap["trainscore"] = trainscore scoreMap["debugscore"] = debugscore - scoreMap["runtime"] = runtime + return string(cloudBrainInfoJson) } else { scoreMap["trainscore"] = trainscore @@ -2486,7 +2496,7 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s var indexTotal int64 indexTotal = 0 for { - sess.Select("id,job_type,user_id,duration,train_job_duration,type").Table("cloudbrain").Unscoped().Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal)) + sess.Select("id,job_type,user_id,duration,train_job_duration,type,compute_resource").Table("cloudbrain").Unscoped().Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal)) cloudTaskList := make([]*Cloudbrain, 0) sess.Find(&cloudTaskList) log.Info("query cloudbrain size=" + fmt.Sprint(len(cloudTaskList))) @@ -2519,7 +2529,7 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s } else { setMapKey("GpuDebugJob", cloudTaskRecord.UserID, 1, resultItemMap) } - } else if cloudTaskRecord.Type == 2 { + } else if cloudTaskRecord.Type == 2 || cloudTaskRecord.Type == 3 { setMapKey("C2Net", cloudTaskRecord.UserID, 1, resultItemMap) if cloudTaskRecord.ComputeResource == NPUResource { if cloudTaskRecord.JobType == "TRAIN" { diff --git a/modules/context/auth.go b/modules/context/auth.go index efde3bc2e..c9af1456d 100755 --- a/modules/context/auth.go +++ b/modules/context/auth.go @@ -81,7 +81,12 @@ func Toggle(options *ToggleOptions) macaron.Handler { // Redirect to dashboard if user tries to visit any non-login page. if options.SignOutRequired && ctx.IsSigned && ctx.Req.URL.RequestURI() != "/" { - ctx.Redirect(setting.AppSubURL + "/") + redirectTo := ctx.Query("redirect_to") + if len(redirectTo) > 0 { + ctx.Redirect(redirectTo) + } else { + ctx.Redirect(setting.AppSubURL + "/") + } return } diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index bf07e0745..4dc2e4c89 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -73,7 +73,7 @@ your_starred=已点赞 your_settings=设置 invite_friends=邀请好友 your_friend=您的好友 -invite_you_to_join_the_OpenI_AI_Collaboration_Platform_and_enjoy_abundant_free_computing_resources=邀请您加入启智社区AI协作平台,畅享充沛的免费算力资源! +invite_you_to_join_the_OpenI_AI_Collaboration_Platform_and_enjoy_abundant_free_computing_resources=邀请您加入启智社区AI协作平台,畅享充沛的普惠算力资源! recommender=推荐人 all=所有 diff --git a/routers/api/v1/repo/cloudbrain_dashboard.go b/routers/api/v1/repo/cloudbrain_dashboard.go index 1fbef897b..b980c70b3 100755 --- a/routers/api/v1/repo/cloudbrain_dashboard.go +++ b/routers/api/v1/repo/cloudbrain_dashboard.go @@ -1260,8 +1260,8 @@ func DownloadCloudBrainBoard(ctx *context.Context) { Type: models.TypeCloudBrainAll, BeginTimeUnix: int64(recordBeginTime), EndTimeUnix: endTime.Unix(), + AccCardsNum: models.AccCardsNumAll, }) - log.Info("totalcountisis:", total) if err != nil { log.Warn("Can not get cloud brain info", err) @@ -1290,6 +1290,7 @@ func DownloadCloudBrainBoard(ctx *context.Context) { BeginTimeUnix: int64(recordBeginTime), EndTimeUnix: endTime.Unix(), NeedRepoInfo: true, + AccCardsNum: models.AccCardsNumAll, }) if err != nil { log.Warn("Can not get cloud brain info", err) diff --git a/routers/user/auth.go b/routers/user/auth.go index ae2c26f33..9620cb969 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -121,7 +121,6 @@ func checkAutoLogin(ctx *context.Context) bool { ctx.ServerError("AutoSignIn", err) return true } - redirectTo := ctx.Query("redirect_to") if len(redirectTo) > 0 { ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL, "", setting.SessionConfig.Secure, true) @@ -130,7 +129,6 @@ func checkAutoLogin(ctx *context.Context) bool { } if isSucceed { - isCourse := ctx.QueryBool("course") ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true) if redirectTo == "" && isCourse { @@ -138,7 +136,6 @@ func checkAutoLogin(ctx *context.Context) bool { ctx.RedirectToFirst(redirectToCourse) } else { ctx.RedirectToFirst(redirectTo, setting.AppSubURL+string(setting.LandingPageURL)) - } return true } @@ -154,7 +151,6 @@ func getActivityTpl() string { // SignIn render sign in page func SignIn(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("sign_in") - // Check auto-login. if checkAutoLogin(ctx) { return diff --git a/templates/user/auth/signup_inner.tmpl b/templates/user/auth/signup_inner.tmpl index 219d69408..080a97e40 100644 --- a/templates/user/auth/signup_inner.tmpl +++ b/templates/user/auth/signup_inner.tmpl @@ -163,11 +163,11 @@ return obj; }; var sharedUser = getUrlParams()['sharedUser']; - if (sharedUser) { - setTimeout(function() { - $('.invitation_tips').show().find('.__invitation_code__').text(sharedUser); - $('input#invitation_code').val(sharedUser).attr('readonly', true); - }, 20); + if (sharedUser) { + document.querySelector('.invitation_tips').style.display = "block"; + document.querySelector('.__invitation_code__').innerText = sharedUser; + document.querySelector('#invitation_code').value = sharedUser; + document.querySelector('#invitation_code').setAttribute("readonly", "true"); } })(); diff --git a/web_src/js/index.js b/web_src/js/index.js index 6c22201c0..62eeaebd8 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -5221,7 +5221,7 @@ function initTopToHome() { } }); topToHomeEl.on('click', function() { - $('html').animate({ scrollTop: 0 }, 'slow', 'swing'); + $('html,body').animate({ scrollTop: 0 }, 'slow', 'swing'); }); }