Commit 2cc6d20e authored by brent's avatar brent

add sort max_exec_time

parent 3b53bc4b
......@@ -1490,6 +1490,13 @@ func (server *TaskController) AddTasktype() {
// apiPath = fmt.Sprintf("/%s/%s", apiPath, appRequest.Type.Version)
//}
price := int64(appRequest.TaskTypeIn.Price * 1000000)
if appRequest.TaskTypeIn.MaxExecTime == 0 {
appRequest.TaskTypeIn.MaxExecTime = 300
}
if appRequest.TaskTypeIn.EstimatExeTime == 0 {
appRequest.TaskTypeIn.EstimatExeTime = 60
}
dbType := models.TaskType{
Name: appRequest.TaskTypeIn.Name,
BaseModel: appRequest.TaskTypeIn.BaseModel,
......@@ -1515,6 +1522,8 @@ func (server *TaskController) AddTasktype() {
Category: appRequest.TaskTypeIn.Category,
PublishStatus: appRequest.TaskTypeIn.PublishStatus,
AccessStatus: appRequest.TaskTypeIn.AccessStatus,
MaxExecTime: appRequest.TaskTypeIn.MaxExecTime,
EstimatExeTime: appRequest.TaskTypeIn.EstimatExeTime,
CreatedTime: timestamp,
UpdatedTime: timestamp,
}
......@@ -1662,6 +1671,12 @@ func (server *TaskController) UpdateTaskType() {
// apiPath = fmt.Sprintf("/%s/%s", apiPath, appRequest.Type.Version)
//}
price := int64(appRequest.TaskTypeIn.Price * 1000000)
if appRequest.TaskTypeIn.MaxExecTime == 0 {
appRequest.TaskTypeIn.MaxExecTime = 300
}
if appRequest.TaskTypeIn.EstimatExeTime == 0 {
appRequest.TaskTypeIn.EstimatExeTime = 60
}
dbType := models.TaskType{
Id: appRequest.TaskTypeIn.Id,
Name: appRequest.TaskTypeIn.Name,
......@@ -1688,6 +1703,8 @@ func (server *TaskController) UpdateTaskType() {
ResultFileExpires: appRequest.TaskTypeIn.ResultFileExpires,
PublishStatus: appRequest.TaskTypeIn.PublishStatus,
AccessStatus: appRequest.TaskTypeIn.AccessStatus,
MaxExecTime: appRequest.TaskTypeIn.MaxExecTime,
EstimatExeTime: appRequest.TaskTypeIn.EstimatExeTime,
UpdatedTime: timestamp,
}
......@@ -1715,7 +1732,9 @@ func (server *TaskController) UpdateTaskType() {
"result_file_expires",
"updated_time",
"publish_status",
"access_status")
"access_status",
"estimat_exe_time",
"max_exec_time")
if err != nil {
//ormer.Rollback()
server.respond(models.BusinessFailed, "failed")
......@@ -1798,6 +1817,8 @@ func (server *TaskController) UpdateTaskType() {
SignUrl: dbType.SignUrl,
Username: dbType.Username,
Password: dbType.Password,
MaxExecTime: dbType.MaxExecTime,
EstimateExecTime: dbType.EstimatExeTime,
CreatedTime: appRequest.TaskTypeIn.CreatedTime,
UpdatedTime: dbType.UpdatedTime,
}
......@@ -2151,7 +2172,7 @@ func (server *TaskController) Examples() {
return
}
sql = fmt.Sprintf("SELECT id, `name` AS tit,type,`desc` AS content, tags ,estimat_exe_time,price,unit,examples,codes,base_model,model,api_path,version,category,form,access_status,publish_status FROM task_type WHERE deleted = 0 %s order by codes desc LIMIT %d,%d;", where, offset, size)
sql = fmt.Sprintf("SELECT id, `name` AS tit,type,`desc` AS content, sort,tags ,estimat_exe_time,price,unit,examples,codes,base_model,model,api_path,version,category,form,access_status,publish_status FROM task_type WHERE deleted = 0 %s order by sort LIMIT %d,%d;", where, offset, size)
mysql.GetMysqlInstace().Ormer.Raw(sql).QueryRows(&types)
var remodels []*models.ResonseModel
for _, data := range types {
......@@ -2199,6 +2220,7 @@ func (server *TaskController) Examples() {
PublishStatus: data.PublishStatus,
Price: float64(data.Price / 1000000),
Unit: data.Unit,
Sort: data.Sort,
EstimatExeTime: data.EstimatExeTime,
}
remodels = append(remodels, &remodel)
......
......@@ -89,6 +89,9 @@ type TaskType struct {
AccessStatus int `json:"access_status,omitempty"`
PublishStatus int `json:"publish_status,omitempty"`
Unit string `json:"unit";orm:"column(unit)"`
Sort int `json:"sort";orm:"column(sort)"`
EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"`
MaxExecTime int `json:"max_exec_time";orm:"column(max_exec_time)"`
CreatedTime time.Time `json:"created_time";orm:"column(created_time);type(datetime)"`
UpdatedTime time.Time `json:"updated_time";orm:"column(updated_time);type(datetime)"`
Deleted int `json:"deleted";orm:"column(deleted);size(1)"`
......@@ -130,6 +133,9 @@ type NewTaskType struct {
AccessStatus int `json:"access_status,omitempty"`
PublishStatus int `json:"publish_status,omitempty"`
Unit string `json:"unit";orm:"column(unit)"`
Sort int `json:"sort";orm:"column(sort)"`
EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"`
MaxExecTime int `json:"max_exec_time";orm:"column(max_exec_time)"`
CreatedTime time.Time `json:"created_time";orm:"column(created_time);type(datetime)"`
UpdatedTime time.Time `json:"updated_time";orm:"column(updated_time);type(datetime)"`
Deleted int `json:"deleted";orm:"column(deleted);size(1)"`
......@@ -156,6 +162,7 @@ type Model struct {
PublishStatus int `json:"publish_status,omitempty"`
Price int64 `json:"price";orm:"column(price)"`
Unit string `json:"unit";orm:"column(unit)"`
Sort int `json:"sort";orm:"column(sort)"`
EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"`
}
......@@ -180,6 +187,7 @@ type ResonseModel struct {
PublishStatus int `json:"publish_status,omitempty"`
Price float64 `json:"price";orm:"column(price)"`
Unit string `json:"unit";orm:"column(unit)"`
Sort int `json:"sort";orm:"column(sort)"`
EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"`
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment