Browse Source

模型公有私有

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.12.1^2
zouap 3 years ago
parent
commit
3c60550adb
5 changed files with 21 additions and 1 deletions
  1. +1
    -0
      models/ai_model_manage.go
  2. +9
    -0
      models/user_analysis_for_activity.go
  3. +1
    -0
      routers/api/v1/api.go
  4. +4
    -1
      routers/repo/ai_model_manage.go
  5. +6
    -0
      routers/repo/user_data_analysis.go

+ 1
- 0
models/ai_model_manage.go View File

@@ -33,6 +33,7 @@ type AiModelManage struct {
CodeBranch string `xorm:"varchar(400) NULL" json:"codeBranch"`
CodeCommitID string `xorm:"NULL" json:"codeCommitID"`
UserId int64 `xorm:"NOT NULL" json:"userId"`
IsPrivate bool `xorm:"DEFAULT false" json:"isPrivate"`
UserName string `json:"userName"`
UserRelAvatarLink string `json:"userRelAvatarLink"`
TrainTaskInfo string `xorm:"text NULL" json:"trainTaskInfo"`


+ 9
- 0
models/user_analysis_for_activity.go View File

@@ -449,3 +449,12 @@ func QueryUserLoginInfo(userIds []int64) []*UserLoginLog {

return loginList
}

func QueryUserAnnualReport(userId int64) *UserSummaryCurrentYear {
statictisSess := xStatistic.NewSession()
defer statictisSess.Close()
var re *UserSummaryCurrentYear
statictisSess.ID(userId).Get(re)

return re
}

+ 1
- 0
routers/api/v1/api.go View File

@@ -610,6 +610,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Get("/query_invitation_yesterday", operationReq, repo_ext.QueryInvitationYesterday)
m.Get("/query_invitation_all", operationReq, repo_ext.QueryInvitationAll)
m.Get("/query_invitation_userdefine", operationReq, repo_ext.QueryUserDefineInvitationPage)
m.Get("/query_user_annual_report", repo_ext.QueryUserAnnualReport)

m.Get("/download_invitation_detail", operationReq, repo_ext.DownloadInvitationDetail)



+ 4
- 1
routers/repo/ai_model_manage.go View File

@@ -93,7 +93,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio
log.Info("accuracyJson=" + string(accuracyJson))
aiTask.ContainerIp = ""
aiTaskJson, _ := json.Marshal(aiTask)
isPrivate := ctx.QueryBool("isPrivate")
model := &models.AiModelManage{
ID: id,
Version: version,
@@ -114,6 +114,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio
TrainTaskInfo: string(aiTaskJson),
Accuracy: string(accuracyJson),
Status: STATUS_COPY_MODEL,
IsPrivate: isPrivate,
}

err = models.SaveModelToDb(model)
@@ -216,6 +217,7 @@ func SaveLocalModel(ctx *context.Context) {
description := ctx.Query("description")
engine := ctx.QueryInt("engine")
taskType := ctx.QueryInt("type")
isPrivate := ctx.QueryBool("isPrivate")
modelActualPath := ""
if taskType == models.TypeCloudBrainOne {
destKeyNamePrefix := Model_prefix + models.AttachmentRelativePath(id) + "/"
@@ -262,6 +264,7 @@ func SaveLocalModel(ctx *context.Context) {
TrainTaskInfo: "",
Accuracy: "",
Status: STATUS_FINISHED,
IsPrivate: isPrivate,
}

err := models.SaveModelToDb(model)


+ 6
- 0
routers/repo/user_data_analysis.go View File

@@ -907,3 +907,9 @@ func QueryUserLoginInfo(ctx *context.Context) {
log.Info("writer exel error." + err.Error())
}
}

func QueryUserAnnualReport(ctx *context.Context) {
log.Info("start to QueryUserAnnualReport ")
result := models.QueryUserAnnualReport(ctx.User.ID)
ctx.JSON(http.StatusOK, result)
}

Loading…
Cancel
Save