Browse Source

#2225

update
tags/v1.22.9.2^2
chenyifan01 3 years ago
parent
commit
34967d7bec
13 changed files with 30 additions and 28 deletions
  1. +3
    -3
      models/limit_config.go
  2. +2
    -2
      models/reward_operate_record.go
  3. +1
    -1
      models/reward_periodic_task.go
  4. +6
    -6
      models/task_config.go
  5. +2
    -1
      options/locale/locale_en-US.ini
  6. +2
    -1
      options/locale/locale_zh-CN.ini
  7. +4
    -4
      routers/repo/cloudbrain.go
  8. +4
    -4
      routers/repo/modelarts.go
  9. +1
    -1
      services/reward/admin_operate.go
  10. +1
    -1
      services/reward/cloudbrain_deduct.go
  11. +1
    -1
      services/reward/limiter/config.go
  12. +2
    -2
      services/reward/operator.go
  13. +1
    -1
      services/task/task.go

+ 3
- 3
models/limit_config.go View File

@@ -51,7 +51,7 @@ const (


type LimitConfig struct { type LimitConfig struct {
ID int64 `xorm:"pk autoincr"` ID int64 `xorm:"pk autoincr"`
Tittle string
Title string
RefreshRate string `xorm:"NOT NULL"` RefreshRate string `xorm:"NOT NULL"`
Scope string `xorm:"NOT NULL"` Scope string `xorm:"NOT NULL"`
LimitNum int64 `xorm:"NOT NULL"` LimitNum int64 `xorm:"NOT NULL"`
@@ -75,7 +75,7 @@ type LimitConfigQueryOpts struct {


type LimitConfigVO struct { type LimitConfigVO struct {
ID int64 ID int64
Tittle string
Title string
RefreshRate string RefreshRate string
Scope string Scope string
LimitNum int64 LimitNum int64
@@ -88,7 +88,7 @@ type LimitConfigVO struct {
func (l *LimitConfig) ToLimitConfigVO() *LimitConfigVO { func (l *LimitConfig) ToLimitConfigVO() *LimitConfigVO {
return &LimitConfigVO{ return &LimitConfigVO{
ID: l.ID, ID: l.ID,
Tittle: l.Tittle,
Title: l.Title,
RefreshRate: l.RefreshRate, RefreshRate: l.RefreshRate,
Scope: l.Scope, Scope: l.Scope,
LimitNum: l.LimitNum, LimitNum: l.LimitNum,


+ 2
- 2
models/reward_operate_record.go View File

@@ -215,7 +215,7 @@ type RewardOperateRecord struct {
UserId int64 `xorm:"INDEX NOT NULL"` UserId int64 `xorm:"INDEX NOT NULL"`
Amount int64 `xorm:"NOT NULL"` Amount int64 `xorm:"NOT NULL"`
LossAmount int64 LossAmount int64
Tittle string
Title string
RewardType string `xorm:"NOT NULL"` RewardType string `xorm:"NOT NULL"`
SourceType string `xorm:"NOT NULL"` SourceType string `xorm:"NOT NULL"`
SourceId string `xorm:"INDEX NOT NULL"` SourceId string `xorm:"INDEX NOT NULL"`
@@ -312,7 +312,7 @@ type RewardOperateContext struct {
SourceType SourceType SourceType SourceType
SourceId string SourceId string
SourceTemplateId string SourceTemplateId string
Tittle string
Title string
Remark string Remark string
Reward Reward Reward Reward
TargetUserId int64 TargetUserId int64


+ 1
- 1
models/reward_periodic_task.go View File

@@ -45,7 +45,7 @@ type StartPeriodicTaskOpts struct {
SourceType SourceType SourceType SourceType
SourceId string SourceId string
Remark string Remark string
Tittle string
Title string
TargetUserId int64 TargetUserId int64
RequestId string RequestId string
OperateType RewardOperateType OperateType RewardOperateType


+ 6
- 6
models/task_config.go View File

@@ -16,7 +16,7 @@ const (
type TaskConfig struct { type TaskConfig struct {
ID int64 `xorm:"pk autoincr"` ID int64 `xorm:"pk autoincr"`
TaskCode string `xorm:"NOT NULL"` TaskCode string `xorm:"NOT NULL"`
Tittle string
Title string
AwardType string `xorm:"NOT NULL"` AwardType string `xorm:"NOT NULL"`
AwardAmount int64 `xorm:"NOT NULL"` AwardAmount int64 `xorm:"NOT NULL"`
CreatorId int64 `xorm:"NOT NULL"` CreatorId int64 `xorm:"NOT NULL"`
@@ -30,7 +30,7 @@ type TaskConfig struct {
type TaskConfigWithLimit struct { type TaskConfigWithLimit struct {
ID int64 ID int64
TaskCode string TaskCode string
Tittle string
Title string
AwardType string AwardType string
AwardAmount int64 AwardAmount int64
Creator string Creator string
@@ -170,7 +170,7 @@ func EditTaskConfig(config TaskConfigWithLimit, doer *User) error {
//add new config //add new config
t := &TaskConfig{ t := &TaskConfig{
TaskCode: config.TaskCode, TaskCode: config.TaskCode,
Tittle: config.Tittle,
Title: config.Title,
AwardType: config.AwardType, AwardType: config.AwardType,
AwardAmount: config.AwardAmount, AwardAmount: config.AwardAmount,
CreatorId: doer.ID, CreatorId: doer.ID,
@@ -201,7 +201,7 @@ func EditTaskConfig(config TaskConfigWithLimit, doer *User) error {
for _, v := range config.Limiters { for _, v := range config.Limiters {
//add new config //add new config
l := &LimitConfig{ l := &LimitConfig{
Tittle: v.Tittle,
Title: v.Title,
RefreshRate: v.RefreshRate, RefreshRate: v.RefreshRate,
Scope: v.Scope, Scope: v.Scope,
LimitNum: v.LimitNum, LimitNum: v.LimitNum,
@@ -229,7 +229,7 @@ func NewTaskConfig(config TaskConfigWithLimit, doer *User) error {
//add new config //add new config
t := &TaskConfig{ t := &TaskConfig{
TaskCode: config.TaskCode, TaskCode: config.TaskCode,
Tittle: config.Tittle,
Title: config.Title,
AwardType: config.AwardType, AwardType: config.AwardType,
AwardAmount: config.AwardAmount, AwardAmount: config.AwardAmount,
CreatorId: doer.ID, CreatorId: doer.ID,
@@ -247,7 +247,7 @@ func NewTaskConfig(config TaskConfigWithLimit, doer *User) error {
//add new config //add new config
l := &LimitConfig{ l := &LimitConfig{
RelatedId: t.ID, RelatedId: t.ID,
Tittle: v.Tittle,
Title: v.Title,
RefreshRate: v.RefreshRate, RefreshRate: v.RefreshRate,
Scope: v.Scope, Scope: v.Scope,
LimitNum: v.LimitNum, LimitNum: v.LimitNum,


+ 2
- 1
options/locale/locale_en-US.ini View File

@@ -3130,5 +3130,6 @@ free = Free
points_hour = Points/hour points_hour = Points/hour
balance_of_points = Balance of Points: balance_of_points = Balance of Points:
hours = Hours hours = Hours
expected_time = , expected to be available for
expected_time = , expected to be available for
points_acquisition_instructions = Points Acquisition Instructions points_acquisition_instructions = Points Acquisition Instructions
insufficient_points_balance = Insufficient points balance

+ 2
- 1
options/locale/locale_zh-CN.ini View File

@@ -3144,5 +3144,6 @@ free = 免费
points_hour = 积分/每小时 points_hour = 积分/每小时
balance_of_points = 积分余额: balance_of_points = 积分余额:
hours = 小时 hours = 小时
expected_time = ,预计可用
expected_time = ,预计可用
points_acquisition_instructions = 积分获取说明 points_acquisition_instructions = 积分获取说明
insufficient_points_balance = 积分余额不足

+ 4
- 4
routers/repo/cloudbrain.go View File

@@ -263,7 +263,7 @@ func CloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
if !account.IsPointBalanceEnough(ctx.User.ID, jobType, models.TypeCloudBrainOne, resourceSpecId, "") { if !account.IsPointBalanceEnough(ctx.User.ID, jobType, models.TypeCloudBrainOne, resourceSpecId, "") {
log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, jobType, resourceSpecId) log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, jobType, resourceSpecId)
cloudBrainNewDataPrepare(ctx) cloudBrainNewDataPrepare(ctx)
ctx.RenderWithErr(models.ErrInsufficientPointsBalance{}.Error(), tpl, &form)
ctx.RenderWithErr(ctx.Tr("points.insufficient_points_balance"), tpl, &form)
return return
} }


@@ -442,7 +442,7 @@ func CloudBrainRestart(ctx *context.Context) {
if !account.IsPointBalanceEnough(ctx.User.ID, task.JobType, models.TypeCloudBrainOne, task.ResourceSpecId, "") { if !account.IsPointBalanceEnough(ctx.User.ID, task.JobType, models.TypeCloudBrainOne, task.ResourceSpecId, "") {
log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, task.JobType, task.ResourceSpecId) log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, task.JobType, task.ResourceSpecId)
resultCode = "-1" resultCode = "-1"
errorMsg = models.ErrInsufficientPointsBalance{}.Error()
errorMsg = ctx.Tr("points.insufficient_points_balance")
break break
} }


@@ -2017,7 +2017,7 @@ func BenchMarkAlgorithmCreate(ctx *context.Context, form auth.CreateCloudBrainFo
if !account.IsPointBalanceEnough(ctx.User.ID, string(models.JobTypeBenchmark), models.TypeCloudBrainOne, cloudbrain.BenchMarkResourceID, "") { if !account.IsPointBalanceEnough(ctx.User.ID, string(models.JobTypeBenchmark), models.TypeCloudBrainOne, cloudbrain.BenchMarkResourceID, "") {
log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, string(models.JobTypeBenchmark), resourceSpecId) log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, string(models.JobTypeBenchmark), resourceSpecId)
cloudBrainNewDataPrepare(ctx) cloudBrainNewDataPrepare(ctx)
ctx.RenderWithErr(models.ErrInsufficientPointsBalance{}.Error(), tplCloudBrainBenchmarkNew, &form)
ctx.RenderWithErr(ctx.Tr("points.insufficient_points_balance"), tplCloudBrainBenchmarkNew, &form)
return return
} }


@@ -2210,7 +2210,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
if !account.IsPointBalanceEnough(ctx.User.ID, jobType, models.TypeCloudBrainOne, resourceSpecId, "") { if !account.IsPointBalanceEnough(ctx.User.ID, jobType, models.TypeCloudBrainOne, resourceSpecId, "") {
log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, jobType, resourceSpecId) log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, jobType, resourceSpecId)
cloudBrainNewDataPrepare(ctx) cloudBrainNewDataPrepare(ctx)
ctx.RenderWithErr(models.ErrInsufficientPointsBalance{}.Error(), tpl, &form)
ctx.RenderWithErr(ctx.Tr("points.insufficient_points_balance"), tpl, &form)
return return
} }




+ 4
- 4
routers/repo/modelarts.go View File

@@ -209,7 +209,7 @@ func Notebook2Create(ctx *context.Context, form auth.CreateModelArtsNotebookForm
if !account.IsPointBalanceEnough(ctx.User.ID, string(models.JobTypeDebug), models.TypeCloudBrainTwo, 0, flavor) { if !account.IsPointBalanceEnough(ctx.User.ID, string(models.JobTypeDebug), models.TypeCloudBrainTwo, 0, flavor) {
log.Error("point balance is not enough,userId=%d jobType=%s ", ctx.User.ID, string(models.JobTypeBenchmark)) log.Error("point balance is not enough,userId=%d jobType=%s ", ctx.User.ID, string(models.JobTypeBenchmark))
cloudBrainNewDataPrepare(ctx) cloudBrainNewDataPrepare(ctx)
ctx.RenderWithErr(models.ErrInsufficientPointsBalance{}.Error(), tplModelArtsNotebookNew, &form)
ctx.RenderWithErr(ctx.Tr("points.insufficient_points_balance"), tplModelArtsNotebookNew, &form)
return return
} }
count, err := models.GetCloudbrainNotebookCountByUserID(ctx.User.ID) count, err := models.GetCloudbrainNotebookCountByUserID(ctx.User.ID)
@@ -451,7 +451,7 @@ func NotebookManage(ctx *context.Context) {
if !account.IsPointBalanceEnough(ctx.User.ID, task.JobType, task.Type, task.ResourceSpecId, task.FlavorCode) { if !account.IsPointBalanceEnough(ctx.User.ID, task.JobType, task.Type, task.ResourceSpecId, task.FlavorCode) {
log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, task.JobType, task.ResourceSpecId) log.Error("point balance is not enough,userId=%d jobType=%s resourceSpecId=%d", ctx.User.ID, task.JobType, task.ResourceSpecId)
resultCode = "-1" resultCode = "-1"
errorMsg = models.ErrInsufficientPointsBalance{}.Error()
errorMsg = ctx.Tr("points.insufficient_points_balance")
break break
return return
} }
@@ -1009,7 +1009,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm)
if !account.IsPointBalanceEnough(ctx.User.ID, string(models.JobTypeTrain), models.TypeCloudBrainTwo, 0, flavorCode) { if !account.IsPointBalanceEnough(ctx.User.ID, string(models.JobTypeTrain), models.TypeCloudBrainTwo, 0, flavorCode) {
log.Error("point balance is not enough,userId=%d jobType=%s", ctx.User.ID, string(models.JobTypeBenchmark)) log.Error("point balance is not enough,userId=%d jobType=%s", ctx.User.ID, string(models.JobTypeBenchmark))
cloudBrainNewDataPrepare(ctx) cloudBrainNewDataPrepare(ctx)
ctx.RenderWithErr(models.ErrInsufficientPointsBalance{}.Error(), tplModelArtsTrainJobNew, &form)
ctx.RenderWithErr(ctx.Tr("points.insufficient_points_balance"), tplModelArtsTrainJobNew, &form)
return return
} }
count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID) count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID)
@@ -1901,7 +1901,7 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference
if !account.IsPointBalanceEnough(ctx.User.ID, string(models.JobTypeInference), models.TypeCloudBrainTwo, 0, flavorCode) { if !account.IsPointBalanceEnough(ctx.User.ID, string(models.JobTypeInference), models.TypeCloudBrainTwo, 0, flavorCode) {
log.Error("point balance is not enough,userId=%d jobType=%s ", ctx.User.ID, string(models.JobTypeBenchmark)) log.Error("point balance is not enough,userId=%d jobType=%s ", ctx.User.ID, string(models.JobTypeBenchmark))
inferenceJobErrorNewDataPrepare(ctx, form) inferenceJobErrorNewDataPrepare(ctx, form)
ctx.RenderWithErr(models.ErrInsufficientPointsBalance{}.Error(), tplModelArtsInferenceJobNew, &form)
ctx.RenderWithErr(ctx.Tr("points.insufficient_points_balance"), tplModelArtsInferenceJobNew, &form)
return return
} }
count, err := models.GetCloudbrainInferenceJobCountByUserID(ctx.User.ID) count, err := models.GetCloudbrainInferenceJobCountByUserID(ctx.User.ID)


+ 1
- 1
services/reward/admin_operate.go View File

@@ -27,7 +27,7 @@ func AdminBalanceOperate(req models.AdminRewardOperateReq, doer *models.User) er
err = Operate(&models.RewardOperateContext{ err = Operate(&models.RewardOperateContext{
SourceType: models.SourceTypeAdminOperate, SourceType: models.SourceTypeAdminOperate,
SourceId: logId, SourceId: logId,
Tittle: "管理员操作",
Title: "管理员操作",
Reward: models.Reward{ Reward: models.Reward{
Amount: req.Amount, Amount: req.Amount,
Type: req.RewardType, Type: req.RewardType,


+ 1
- 1
services/reward/cloudbrain_deduct.go View File

@@ -37,7 +37,7 @@ func StartAndGetCloudBrainPointDeductTask(task models.Cloudbrain) (*models.Rewar
UnitAmount: unitPrice, UnitAmount: unitPrice,
RewardType: models.RewardTypePoint, RewardType: models.RewardTypePoint,
StartTime: time.Unix(int64(task.StartTime), 0), StartTime: time.Unix(int64(task.StartTime), 0),
Tittle: RUN_CLOUDBRAIN_TASK_TITTLE,
Title: RUN_CLOUDBRAIN_TASK_TITTLE,
}) })
} }




+ 1
- 1
services/reward/limiter/config.go View File

@@ -64,7 +64,7 @@ func GetLimitConfigById(id int64) (*models.LimitConfig, error) {


func AddLimitConfig(config *models.LimitConfigVO, doer *models.User) error { func AddLimitConfig(config *models.LimitConfigVO, doer *models.User) error {
r := &models.LimitConfig{ r := &models.LimitConfig{
Tittle: config.Tittle,
Title: config.Title,
RefreshRate: config.RefreshRate, RefreshRate: config.RefreshRate,
Scope: config.Scope, Scope: config.Scope,
LimitNum: config.LimitNum, LimitNum: config.LimitNum,


+ 2
- 2
services/reward/operator.go View File

@@ -133,7 +133,7 @@ func initRewardOperateRecord(ctx *models.RewardOperateContext) (string, error) {
OperateType: ctx.OperateType.Name(), OperateType: ctx.OperateType.Name(),
Status: models.OperateStatusOperating, Status: models.OperateStatusOperating,
Remark: ctx.Remark, Remark: ctx.Remark,
Tittle: ctx.Tittle,
Title: ctx.Title,
SerialNo: sn, SerialNo: sn,
} }
_, err = models.InsertRewardOperateRecord(record) _, err = models.InsertRewardOperateRecord(record)
@@ -160,7 +160,7 @@ func createPeriodicRewardOperateRecord(ctx *models.StartPeriodicTaskOpts) (strin
OperateType: ctx.OperateType.Name(), OperateType: ctx.OperateType.Name(),
Status: models.OperateStatusOperating, Status: models.OperateStatusOperating,
Remark: ctx.Remark, Remark: ctx.Remark,
Tittle: ctx.Tittle,
Title: ctx.Title,
SerialNo: sn, SerialNo: sn,
} }
_, err = models.InsertRewardOperateRecord(record) _, err = models.InsertRewardOperateRecord(record)


+ 1
- 1
services/task/task.go View File

@@ -87,7 +87,7 @@ func accomplish(action models.Action) error {
SourceType: models.SourceTypeAccomplishTask, SourceType: models.SourceTypeAccomplishTask,
SourceId: fmt.Sprint(action.ID), SourceId: fmt.Sprint(action.ID),
SourceTemplateId: fmt.Sprint(action.OpType), SourceTemplateId: fmt.Sprint(action.OpType),
Tittle: config.Tittle,
Title: config.Title,
Reward: models.Reward{ Reward: models.Reward{
Amount: config.AwardAmount, Amount: config.AwardAmount,
Type: models.GetRewardTypeInstance(config.AwardType), Type: models.GetRewardTypeInstance(config.AwardType),


Loading…
Cancel
Save