Commit 11e92e6c authored by brent's avatar brent

add client and explorer

parent 10a396d2
...@@ -22,3 +22,4 @@ include "mysql.conf" ...@@ -22,3 +22,4 @@ include "mysql.conf"
include "kong.conf" include "kong.conf"
include "redis.conf" include "redis.conf"
include "postgres.conf" include "postgres.conf"
include "weixin.conf"
\ No newline at end of file
[dev] [dev]
kongadminurl = "http://192.168.1.10:8001" kongadminurl = "http://43.198.252.255:8001"
[test] [test]
kongadminurl = "http://18.167.203.17:8001" kongadminurl = "http://18.167.203.17:8001"
......
[dev] [dev]
mysqluser = "root" mysqluser = "ai"
mysqlpass = "12345678" mysqlpass = "RFnnKHRar5xk7TEF"
mysqlhost = "192.168.1.211" mysqlhost = "43.198.252.255"
mysqlport = 3306 mysqlport = 3306
mysqldb = "liuxuzhong" mysqldb = "ai"
[test] [test]
mysqluser = "ai" mysqluser = "ai"
......
[dev] [dev]
postgresuser = "admin" postgresuser = "admin"
postgrespass = "quest" postgrespass = "quest"
postgreshost = "192.168.1.10" postgreshost = "43.198.252.255"
postgresport = 8812 postgresport = 8812
postgresdb = "qdb" postgresdb = "qdb"
senderport = 9009 senderport = 9009
......
[dev] [dev]
tokenhost = "192.168.1.10:6379" tokenhost = "43.198.252.255:6379"
tokendb = 0 tokendb = 0
tokenpass = "" tokenpass = ""
balancehost = "192.168.1.10:6379" balancehost = "43.198.252.255:6379"
balancedb = 0 balancedb = 0
balancepass = "" balancepass = ""
......
[dev]
merchantid = ""
serialNo = ""
apiKey = ""
privateKey = ""
[test]
merchantid = ""
serialNo = ""
apiKey = ""
privateKey = ""
[prod]
merchantid = ""
serialNo = ""
apiKey = ""
privateKey = ""
\ No newline at end of file
This diff is collapsed.
package controllers
import (
"ai_developer_admin/libs/odysseus"
"ai_developer_admin/libs/postgres"
"ai_developer_admin/libs/registry"
"ai_developer_admin/models"
"encoding/json"
"fmt"
"github.com/beego/beego/orm"
"github.com/beego/beego/v2/core/logs"
"net/http"
"strconv"
)
type ExplorerController struct {
MainController
}
func (server *ExplorerController) Statistics() {
body := server.Ctx.Input.RequestBody
appRequest := models.AppRequest{}
err := json.Unmarshal(body, &appRequest) //解析body中数据
logs.Debug("appRequest", appRequest)
if err != nil {
server.respond(models.NoRequestBody, err.Error())
return
}
//if appRequest.WorkerAcc == "" {
// server.respond(models.MissingParameter, "Missing worker_acc parameter")
// return
//}
countQB, _ := orm.NewQueryBuilder("mysql")
countQB.Select("count(*),sum(workload) AS workload").
From("bills")
sql := countQB.String()
taskCount, err := postgres.QueryBills(sql)
if err != nil {
server.respond(models.BusinessFailed, err.Error())
return
}
count := int64(0)
workload := int64(0)
if len(taskCount) > 0 {
task := taskCount[0]
count, _ = strconv.ParseInt(task.Count, 10, 64)
workload, _ = strconv.ParseInt(task.Workload, 10, 64)
}
_, total, _ := registry.NodeManagersByPage(0, 10)
responseData := struct {
TotalWorkload int64 `json:"total_workload"`
TotalTask int64 `json:"total_task"`
TotalCalls int64 `json:"total_calls"`
NodeNums int `json:"node_nums"`
}{
TotalWorkload: workload,
TotalTask: count,
TotalCalls: count,
NodeNums: total,
}
server.respond(http.StatusOK, "", responseData)
}
func (server *ExplorerController) AddressByIP() {
body := server.Ctx.Input.RequestBody
appRequest := models.AppRequest{}
_ = json.Unmarshal(body, &appRequest) //解析body中数据
logs.Debug("appRequest", appRequest, string(body))
if appRequest.Ips == nil || (appRequest.Ips != nil && len(appRequest.Ips) <= 0) {
server.respond(models.MissingParameter, "Missing ips parameter")
return
}
}
func (server *ExplorerController) AllNode() {
data, err := registry.NodeManagers()
if err != nil {
server.respond(models.BusinessFailed, err.Error())
return
}
server.respond(http.StatusOK, "", data)
}
func (server *ExplorerController) NodeByPage() {
body := server.Ctx.Input.RequestBody
appRequest := models.AppRequest{}
err := json.Unmarshal(body, &appRequest) //解析body中数据
logs.Debug("appRequest", appRequest, string(body))
if appRequest.Page > 0 {
appRequest.Page = appRequest.Page - 1
}
if appRequest.Size == 0 {
appRequest.Size = 10
}
data, total, err := registry.NodeManagersByPage(int(appRequest.Size), int(appRequest.Page))
if err != nil {
server.respond(models.BusinessFailed, err.Error())
return
}
responseData := struct {
Total int64 `json:"total"`
Data interface{} `json:"data,omitempty"`
}{
Total: int64(total),
Data: data,
}
server.respond(http.StatusOK, "", responseData)
}
func (server *ExplorerController) Tasks() {
body := server.Ctx.Input.RequestBody
appRequest := models.AppRequest{}
err := json.Unmarshal(body, &appRequest) //解析body中数据
logs.Debug("appRequest", appRequest, string(body))
if appRequest.Page == 0 {
appRequest.Page = 1
}
if appRequest.Size == 0 {
appRequest.Size = 10
}
offset := (appRequest.Page - 1) * appRequest.Size
size := appRequest.Page * appRequest.Size
if appRequest.WorkerAcc == "" {
server.respond(models.MissingParameter, "Missing worker_acc parameter")
return
}
countQB, _ := orm.NewQueryBuilder("mysql")
countQB.Select("count(*)").
From("bills").Where(fmt.Sprintf("worker_acc = '%s'", appRequest.WorkerAcc))
queryQB, _ := orm.NewQueryBuilder("mysql")
queryQB.Select("id", "fee", "type", "time", "exec_duration", "workload", "profit_acc", "worker_acc", "result").
From("bills").Where(fmt.Sprintf("worker_acc = '%s'", appRequest.WorkerAcc))
sql := countQB.String()
total, err := postgres.QueryTotal(sql)
if err != nil {
server.respond(models.BusinessFailed, err.Error())
return
}
logs.Debug("total = %d", total)
var responseTasks []models.Bills
if total == 0 {
responseData := struct {
Total int64 `json:"total"`
Data interface{} `json:"data,omitempty"`
}{
Total: total,
Data: responseTasks,
}
server.respond(http.StatusOK, "", responseData)
return
}
queryQB.OrderBy("time").Desc()
sql = fmt.Sprintf("%s LIMIT %d,%d;", queryQB.String(), offset, size)
data, err := postgres.QueryBills(sql)
if err != nil {
server.respond(models.BusinessFailed, err.Error())
return
}
for _, task := range data {
//apiPath := ""
//model := ""
baseModel := ""
//kind := 1
typeDe := 1
taskId, err := strconv.Atoi(task.Type)
if err == nil {
taskType, _ := odysseus.GetTaskType(int64(taskId))
if taskType != nil {
//apiPath = taskType.ApiPath
//model = taskType.Model
baseModel = taskType.BaseModel
//kind = taskType.Kind
typeDe = taskType.Type
}
}
reTask := models.Bills{
Id: task.Id,
Type: models.ModelType(typeDe).String(),
Time: task.Time,
Result: task.Result,
//ApiPath: apiPath,
//Model: model,
BaseModel: baseModel,
//Kind: models.TaskKind(kind).EnString(),
//Desc: desc,
Workload: task.Workload,
ProfitAcc: task.ProfitAcc,
//WorkerAcc: task.WorkerAcc,
}
responseTasks = append(responseTasks, reTask)
}
responseData := struct {
Total int64 `json:"total"`
Data interface{} `json:"data,omitempty"`
}{
Total: total,
Data: responseTasks,
}
server.respond(http.StatusOK, "", responseData)
}
...@@ -11,6 +11,9 @@ import ( ...@@ -11,6 +11,9 @@ import (
"fmt" "fmt"
"github.com/beego/beego/orm" "github.com/beego/beego/orm"
"github.com/beego/beego/v2/core/logs" "github.com/beego/beego/v2/core/logs"
beego "github.com/beego/beego/v2/server/web"
"github.com/go-pay/gopay"
"github.com/go-pay/gopay/wechat/v3"
"net/http" "net/http"
"strconv" "strconv"
"time" "time"
...@@ -20,6 +23,37 @@ type FundsController struct { ...@@ -20,6 +23,37 @@ type FundsController struct {
MainController MainController
} }
func createWinxinPay() (*wechat.ClientV3, error) {
merchantid, _ := beego.AppConfig.String("merchantid")
serialNo, _ := beego.AppConfig.String("serialNo")
apiKey, _ := beego.AppConfig.String("apiKey")
privateKey, _ := beego.AppConfig.String("privateKey")
client, err := wechat.NewClientV3(merchantid, serialNo, apiKey, privateKey)
if err != nil {
logs.Debug("weixinRecharge", err)
return nil, err
}
err = client.AutoVerifySign()
if err != nil {
logs.Debug("weixinRecharge", err)
return nil, err
}
client.DebugSwitch = gopay.DebugOn
return client, nil
}
func weixinRecharge(chargeRequest *models.ChargeRequest) error {
//client, err := createWinxinPay()
//if err != nil {
// logs.Debug("weixinRecharge", err)
// return err
//}
return nil
}
func (server *FundsController) Recharge() { func (server *FundsController) Recharge() {
info, err := server.Check() info, err := server.Check()
if err != nil { if err != nil {
...@@ -41,6 +75,26 @@ func (server *FundsController) Recharge() { ...@@ -41,6 +75,26 @@ func (server *FundsController) Recharge() {
return return
} }
if chargeRequest.PaymentMethod == models.WeixinPay {
server.respond(models.BusinessFailed, "This payment method is not open yet")
return
} else if chargeRequest.PaymentMethod == models.AliPay {
server.respond(models.BusinessFailed, "This payment method is not open yet")
return
} else if chargeRequest.PaymentMethod == models.UnionPay {
server.respond(models.BusinessFailed, "This payment method is not open yet")
return
} else if chargeRequest.PaymentMethod == models.PayPal {
server.respond(models.BusinessFailed, "This payment method is not open yet")
return
} else if chargeRequest.PaymentMethod == models.ApplePay {
server.respond(models.BusinessFailed, "This payment method is not open yet")
return
} else {
server.respond(models.BusinessFailed, "Unknown payment method")
return
}
checkUser := &models.User{Id: info.UserID} checkUser := &models.User{Id: info.UserID}
cond := "id" cond := "id"
if chargeRequest.Mail != "" { if chargeRequest.Mail != "" {
......
...@@ -1526,6 +1526,7 @@ func (server *TaskController) AddTasktype() { ...@@ -1526,6 +1526,7 @@ func (server *TaskController) AddTasktype() {
AccessStatus: appRequest.TaskTypeIn.AccessStatus, AccessStatus: appRequest.TaskTypeIn.AccessStatus,
MaxExecTime: appRequest.TaskTypeIn.MaxExecTime, MaxExecTime: appRequest.TaskTypeIn.MaxExecTime,
EstimatExeTime: appRequest.TaskTypeIn.EstimatExeTime, EstimatExeTime: appRequest.TaskTypeIn.EstimatExeTime,
RunningMem: appRequest.TaskTypeIn.RunningMem,
CreatedTime: timestamp, CreatedTime: timestamp,
UpdatedTime: timestamp, UpdatedTime: timestamp,
} }
...@@ -1560,6 +1561,7 @@ func (server *TaskController) AddTasktype() { ...@@ -1560,6 +1561,7 @@ func (server *TaskController) AddTasktype() {
FileExpiresTime: strconv.Itoa(dbType.ResultFileExpires), FileExpiresTime: strconv.Itoa(dbType.ResultFileExpires),
AccessStatus: dbType.AccessStatus, AccessStatus: dbType.AccessStatus,
PublishStatus: dbType.PublishStatus, PublishStatus: dbType.PublishStatus,
RunningMem: dbType.RunningMem,
} }
response = append(response, retask) response = append(response, retask)
data, err := json.Marshal(response) data, err := json.Marshal(response)
...@@ -1707,6 +1709,7 @@ func (server *TaskController) UpdateTaskType() { ...@@ -1707,6 +1709,7 @@ func (server *TaskController) UpdateTaskType() {
AccessStatus: appRequest.TaskTypeIn.AccessStatus, AccessStatus: appRequest.TaskTypeIn.AccessStatus,
MaxExecTime: appRequest.TaskTypeIn.MaxExecTime, MaxExecTime: appRequest.TaskTypeIn.MaxExecTime,
EstimatExeTime: appRequest.TaskTypeIn.EstimatExeTime, EstimatExeTime: appRequest.TaskTypeIn.EstimatExeTime,
RunningMem: appRequest.TaskTypeIn.RunningMem,
UpdatedTime: timestamp, UpdatedTime: timestamp,
} }
...@@ -1736,7 +1739,8 @@ func (server *TaskController) UpdateTaskType() { ...@@ -1736,7 +1739,8 @@ func (server *TaskController) UpdateTaskType() {
"publish_status", "publish_status",
"access_status", "access_status",
"estimat_exe_time", "estimat_exe_time",
"max_exec_time") "max_exec_time",
"running_mem")
if err != nil { if err != nil {
//ormer.Rollback() //ormer.Rollback()
server.respond(models.BusinessFailed, "failed") server.respond(models.BusinessFailed, "failed")
...@@ -1774,6 +1778,7 @@ func (server *TaskController) UpdateTaskType() { ...@@ -1774,6 +1778,7 @@ func (server *TaskController) UpdateTaskType() {
task.OutPutJson = output task.OutPutJson = output
task.AccessStatus = dbType.AccessStatus task.AccessStatus = dbType.AccessStatus
task.PublishStatus = dbType.PublishStatus task.PublishStatus = dbType.PublishStatus
task.RunningMem = dbType.RunningMem
} }
} }
data, err := json.Marshal(response) data, err := json.Marshal(response)
...@@ -1923,6 +1928,7 @@ func (server *TaskController) GetTaskTypes() { ...@@ -1923,6 +1928,7 @@ func (server *TaskController) GetTaskTypes() {
PublishStatus: data.PublishStatus, PublishStatus: data.PublishStatus,
AccessStatus: data.AccessStatus, AccessStatus: data.AccessStatus,
ResultFileExpires: data.ResultFileExpires, ResultFileExpires: data.ResultFileExpires,
RunningMem: data.RunningMem,
} }
remodels = append(remodels, &remodel) remodels = append(remodels, &remodel)
} }
...@@ -2159,6 +2165,7 @@ func (server *TaskController) Lists() { ...@@ -2159,6 +2165,7 @@ func (server *TaskController) Lists() {
PublishStatus: data.PublishStatus, PublishStatus: data.PublishStatus,
AccessStatus: data.AccessStatus, AccessStatus: data.AccessStatus,
ResultFileExpires: data.ResultFileExpires, ResultFileExpires: data.ResultFileExpires,
RunningMem: data.RunningMem,
} }
remodels = append(remodels, &remodel) remodels = append(remodels, &remodel)
} }
...@@ -2924,6 +2931,7 @@ func initTypeInRedis() []models.TaskHeat { ...@@ -2924,6 +2931,7 @@ func initTypeInRedis() []models.TaskHeat {
PublishStatus: dbType.PublishStatus, PublishStatus: dbType.PublishStatus,
EstimatExeTime: dbType.EstimatExeTime, EstimatExeTime: dbType.EstimatExeTime,
StartUpTime: dbType.StartUpTime, StartUpTime: dbType.StartUpTime,
RunningMem: dbType.RunningMem,
} }
response = append(response, retask) response = append(response, retask)
} }
......
...@@ -166,10 +166,15 @@ func (server *UserController) Regisger() { ...@@ -166,10 +166,15 @@ func (server *UserController) Regisger() {
server.respond(models.NoRequestBody, err.Error()) server.respond(models.NoRequestBody, err.Error())
return return
} }
//if len(user.Username) == 0 {
// server.respond(models.MissingParameter, "Missing username parameter")
// return
//}
//}
if len(user.Username) == 0 { if len(user.Username) == 0 {
server.respond(models.MissingParameter, "Missing username parameter") user.Username = "ai_" + generatorMD5(user.Mail)[0:8]
return
} }
user.VerifierId = user.Username
_, err = regisgerUser(user) _, err = regisgerUser(user)
if err != nil { if err != nil {
......
...@@ -7,6 +7,7 @@ require github.com/beego/beego/v2 v2.0.1 ...@@ -7,6 +7,7 @@ require github.com/beego/beego/v2 v2.0.1
require ( require (
github.com/beego/beego v1.12.12 github.com/beego/beego v1.12.12
github.com/go-jose/go-jose/v3 v3.0.1 github.com/go-jose/go-jose/v3 v3.0.1
github.com/go-pay/gopay v1.5.100
github.com/go-sql-driver/mysql v1.7.1 github.com/go-sql-driver/mysql v1.7.1
github.com/golang-jwt/jwt v3.2.2+incompatible github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/google/uuid v1.5.0 github.com/google/uuid v1.5.0
...@@ -16,7 +17,8 @@ require ( ...@@ -16,7 +17,8 @@ require (
github.com/questdb/go-questdb-client/v2 v2.0.0 github.com/questdb/go-questdb-client/v2 v2.0.0
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/smartystreets/goconvey v1.6.4 github.com/smartystreets/goconvey v1.6.4
golang.org/x/crypto v0.17.0 github.com/sony/sonyflake v1.2.0
golang.org/x/crypto v0.18.0
gopkg.in/redis.v5 v5.2.9 gopkg.in/redis.v5 v5.2.9
) )
...@@ -25,6 +27,13 @@ require ( ...@@ -25,6 +27,13 @@ require (
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/go-pay/bm v0.0.1 // indirect
github.com/go-pay/crypto v0.0.1 // indirect
github.com/go-pay/errgroup v0.0.2 // indirect
github.com/go-pay/util v0.0.2 // indirect
github.com/go-pay/xhttp v0.0.2 // indirect
github.com/go-pay/xlog v0.0.2 // indirect
github.com/go-pay/xtime v0.0.2 // indirect
github.com/go-redis/redis/v7 v7.4.0 // indirect github.com/go-redis/redis/v7 v7.4.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect github.com/golang/protobuf v1.5.3 // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect github.com/gomodule/redigo v2.0.0+incompatible // indirect
...@@ -42,7 +51,6 @@ require ( ...@@ -42,7 +51,6 @@ require (
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect github.com/sirupsen/logrus v1.9.3 // indirect
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
github.com/sony/sonyflake v1.2.0 // indirect
golang.org/x/mod v0.13.0 // indirect golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.16.0 // indirect golang.org/x/net v0.16.0 // indirect
golang.org/x/sys v0.16.0 // indirect golang.org/x/sys v0.16.0 // indirect
......
...@@ -72,6 +72,22 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 ...@@ -72,6 +72,22 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-pay/bm v0.0.1 h1:F2d1KhrupJr7yGPCQTVeYjeOJwN35WhoofopSm6undY=
github.com/go-pay/bm v0.0.1/go.mod h1:/6bIb0yBj8JbATmE+ib41me4RikMGN3f/XSDF5FjsPQ=
github.com/go-pay/crypto v0.0.1 h1:B6InT8CLfSLc6nGRVx9VMJRBBazFMjr293+jl0lLXUY=
github.com/go-pay/crypto v0.0.1/go.mod h1:41oEIvHMKbNcYlWUlRWtsnC6+ASgh7u29z0gJXe5bes=
github.com/go-pay/errgroup v0.0.2 h1:5mZMdm0TDClDm2S3G0/sm0f8AuQRtz0dOrTHDR9R8Cc=
github.com/go-pay/errgroup v0.0.2/go.mod h1:0+4b8mvFMS71MIzsaC+gVvB4x37I93lRb2dqrwuU8x8=
github.com/go-pay/gopay v1.5.100 h1:jFpyLA/flrSigY0WFpNaSuQcMFn0yjFpObBnlTzqO9Y=
github.com/go-pay/gopay v1.5.100/go.mod h1:3z9xfh7w3x5rJzH9qFb3oxPOeaBrFP4kB3LNVXbziHM=
github.com/go-pay/util v0.0.2 h1:goJ4f6kNY5zzdtg1Cj8oWC+Cw7bfg/qq2rJangMAb9U=
github.com/go-pay/util v0.0.2/go.mod h1:qM8VbyF1n7YAPZBSJONSPMPsPedhUTktewUAdf1AjPg=
github.com/go-pay/xhttp v0.0.2 h1:O8rnd/d03WsboFtUthwFMg61ikHRfYHyD1m0JiUx60g=
github.com/go-pay/xhttp v0.0.2/go.mod h1:BnuvXpLKkXTFMOBc5MTb0hxdrstwunbzQPJUZOsNbt4=
github.com/go-pay/xlog v0.0.2 h1:kUg5X8/5VZAPDg1J5eGjA3MG0/H5kK6Ew0dW/Bycsws=
github.com/go-pay/xlog v0.0.2/go.mod h1:DbjMADPK4+Sjxj28ekK9goqn4zmyY4hql/zRiab+S9E=
github.com/go-pay/xtime v0.0.2 h1:7YR4/iuELsEHpJ6LUO0SVK80hQxDO9MLCfuVYIiTCRM=
github.com/go-pay/xtime v0.0.2/go.mod h1:W1yRbJaSt4CSBcdAtLBQ8xajiN/Pl5hquGczUcUE9xE=
github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4=
github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
...@@ -251,8 +267,8 @@ golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8U ...@@ -251,8 +267,8 @@ golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20231005195138-3e424a577f31 h1:9k5exFQKQglLo+RoP+4zMjOFE14P6+vyR0baDAi0Rcs= golang.org/x/exp v0.0.0-20231005195138-3e424a577f31 h1:9k5exFQKQglLo+RoP+4zMjOFE14P6+vyR0baDAi0Rcs=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
......
...@@ -107,6 +107,7 @@ func startHeatKey() { ...@@ -107,6 +107,7 @@ func startHeatKey() {
PublishStatus: dbType.PublishStatus, PublishStatus: dbType.PublishStatus,
EstimatExeTime: dbType.EstimatExeTime, EstimatExeTime: dbType.EstimatExeTime,
StartUpTime: dbType.StartUpTime, StartUpTime: dbType.StartUpTime,
RunningMem: dbType.RunningMem,
} }
response = append(response, &retask) response = append(response, &retask)
} }
......
...@@ -67,6 +67,9 @@ type AppRequest struct { ...@@ -67,6 +67,9 @@ type AppRequest struct {
//任务柱状图 //任务柱状图
Period int `json:"period,omitempty"` Period int `json:"period,omitempty"`
//浏览器
Ips []string `json:"ips,omitempty"`
} }
type EnumType struct { type EnumType struct {
......
...@@ -106,6 +106,7 @@ type TaskType struct { ...@@ -106,6 +106,7 @@ type TaskType struct {
EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"` EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"`
StartUpTime int `json:"start_up_time";orm:"column(start_up_time)"` StartUpTime int `json:"start_up_time";orm:"column(start_up_time)"`
MaxExecTime int `json:"max_exec_time";orm:"column(max_exec_time)"` MaxExecTime int `json:"max_exec_time";orm:"column(max_exec_time)"`
RunningMem int `json:"running_mem";orm:"column(running_mem)"`
CreatedTime time.Time `json:"created_time";orm:"column(created_time);type(datetime)"` CreatedTime time.Time `json:"created_time";orm:"column(created_time);type(datetime)"`
UpdatedTime time.Time `json:"updated_time";orm:"column(updated_time);type(datetime)"` UpdatedTime time.Time `json:"updated_time";orm:"column(updated_time);type(datetime)"`
Deleted int `json:"deleted";orm:"column(deleted);size(1)"` Deleted int `json:"deleted";orm:"column(deleted);size(1)"`
...@@ -151,6 +152,7 @@ type NewTaskType struct { ...@@ -151,6 +152,7 @@ type NewTaskType struct {
StartUpTime int `json:"start_up_time";orm:"column(start_up_time)"` StartUpTime int `json:"start_up_time";orm:"column(start_up_time)"`
EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"` EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"`
MaxExecTime int `json:"max_exec_time";orm:"column(max_exec_time)"` MaxExecTime int `json:"max_exec_time";orm:"column(max_exec_time)"`
RunningMem int `json:"running_mem";orm:"column(running_mem)"`
CreatedTime time.Time `json:"created_time";orm:"column(created_time);type(datetime)"` CreatedTime time.Time `json:"created_time";orm:"column(created_time);type(datetime)"`
UpdatedTime time.Time `json:"updated_time";orm:"column(updated_time);type(datetime)"` UpdatedTime time.Time `json:"updated_time";orm:"column(updated_time);type(datetime)"`
Deleted int `json:"deleted";orm:"column(deleted);size(1)"` Deleted int `json:"deleted";orm:"column(deleted);size(1)"`
...@@ -180,6 +182,7 @@ type Model struct { ...@@ -180,6 +182,7 @@ type Model struct {
Sort int `json:"sort";orm:"column(sort)"` Sort int `json:"sort";orm:"column(sort)"`
EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"` EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"`
StartUpTime int `json:"start_up_time";orm:"column(start_up_time)"` StartUpTime int `json:"start_up_time";orm:"column(start_up_time)"`
RunningMem int `json:"running_mem";orm:"column(running_mem)"`
IsFavorite int `json:"is_favorite"` IsFavorite int `json:"is_favorite"`
} }
...@@ -207,31 +210,34 @@ type ResonseModel struct { ...@@ -207,31 +210,34 @@ type ResonseModel struct {
Sort int `json:"sort";orm:"column(sort)"` Sort int `json:"sort";orm:"column(sort)"`
EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"` EstimatExeTime int `json:"estimat_exe_time";orm:"column(estimat_exe_time)"`
StartUpTime int `json:"start_up_time";orm:"column(start_up_time)"` StartUpTime int `json:"start_up_time";orm:"column(start_up_time)"`
RunningMem int `json:"running_mem";orm:"column(running_mem)"`
IsFavorite int `json:"is_favorite"` IsFavorite int `json:"is_favorite"`
} }
type Bills struct { type Bills struct {
//Key int `orm:"column(key);auto"` //Key int `orm:"column(key);auto"`
Id string `json:"id";orm:"column(id)"` Id string `json:"id,omitempty";orm:"column(id)"`
Type string `json:"type";orm:"column(type)"` Type string `json:"type,omitempty";orm:"column(type)"`
Kind string `json:"kind,omitempty"` Kind string `json:"kind,omitempty"`
Uid string `json:"uid";orm:"column(uid)"` Uid string `json:"uid,omitempty";orm:"column(uid)"`
ProfitAcc string `json:"profit_acc";orm:"column(profit_acc)"` ProfitAcc string `json:"profit_acc,omitempty";orm:"column(profit_acc)"`
Fee string `json:"fee";orm:"column(fee)"` Fee string `json:"fee,omitempty";orm:"column(fee)"`
WorkerAcc string `json:"worker_acc";orm:"column(worker_acc)"` WorkerAcc string `json:"worker_acc,omitempty";orm:"column(worker_acc)"`
Result string `json:"result";orm:"column(result)"` Result string `json:"result,omitempty";orm:"column(result)"`
Workload string `json:"workload";orm:"column(workload)"` Workload string `json:"workload,omitempty";orm:"column(workload)"`
//ApiPath string `json:"api_path";orm:"column(api_path)"` //ApiPath string `json:"api_path";orm:"column(api_path)"`
Time time.Time `json:"time";orm:"column(time);type(datetime)"` Time time.Time `json:"time,omitempty";orm:"column(time);type(datetime)"`
TaskDuration string `json:"task_duration";orm:"column(task_duration)"` TaskDuration string `json:"task_duration,omitempty";orm:"column(task_duration)"`
OutLen string `json:"out_len";orm:"column(out_len)"` ExecDuration string `json:"exec_duration,omitempty";orm:"column(exec_duration)"`
InLen string `json:"in_len";orm:"column(in_len)"` OutLen string `json:"out_len,omitempty";orm:"column(out_len)"`
InLen string `json:"in_len,omitempty";orm:"column(in_len)"`
ApiPath string `json:"api_path,omitempty"` ApiPath string `json:"api_path,omitempty"`
Desc string `json:"desc,omitempty"` Desc string `json:"desc,omitempty"`
TaskType string `json:"task_type,omitempty"` TaskType string `json:"task_type,omitempty"`
Balance int64 `json:"balance,omitempty"` Balance int64 `json:"balance,omitempty"`
BaseModel string `json:"base_model,omitempty"` BaseModel string `json:"base_model,omitempty"`
Model string `json:"model,omitempty"` Model string `json:"model,omitempty"`
Count string `json:"count,omitempty"`
} }
type TotalType struct { type TotalType struct {
...@@ -273,6 +279,7 @@ type TaskHeat struct { ...@@ -273,6 +279,7 @@ type TaskHeat struct {
PublishStatus int `json:"publish_status,omitempty"` PublishStatus int `json:"publish_status,omitempty"`
EstimatExeTime int `json:"estimat_exe_time"` EstimatExeTime int `json:"estimat_exe_time"`
StartUpTime int `json:"start_up_time"` StartUpTime int `json:"start_up_time"`
RunningMem int `json:"running_mem";orm:"column(running_mem)"`
} }
type AddTaskType struct { type AddTaskType struct {
......
...@@ -17,4 +17,6 @@ func init() { ...@@ -17,4 +17,6 @@ func init() {
beego.AutoPrefix("admin/api", &controllers.FileController{}) beego.AutoPrefix("admin/api", &controllers.FileController{})
beego.AutoPrefix("admin/api", &controllers.FavoriteController{}) beego.AutoPrefix("admin/api", &controllers.FavoriteController{})
beego.AutoPrefix("admin/api/task", &controllers.VersionController{}) beego.AutoPrefix("admin/api/task", &controllers.VersionController{})
beego.AutoPrefix("public/api", &controllers.ClientController{})
beego.AutoPrefix("public/api", &controllers.ExplorerController{})
} }
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