优化
This commit is contained in:
parent
fa9b8df0c3
commit
41c4e3a432
@ -17,6 +17,7 @@ import (
|
||||
const (
|
||||
apkStorageRoot = "./runtime/apk"
|
||||
apkManifestName = "manifest.json"
|
||||
apkStaticURLPrefix = "/apk-static"
|
||||
defaultApkUploadToken = "apk-upload-token"
|
||||
apkUploadTokenHeader = "X-Apk-Upload-Token"
|
||||
apkUploadTokenEnvName = "APK_UPLOAD_TOKEN"
|
||||
@ -208,7 +209,7 @@ func apkManifestPath() string {
|
||||
}
|
||||
|
||||
func apkDownloadPath(env string, packageType string) string {
|
||||
return fmt.Sprintf("/api/apk/download/%s?packageType=%s", env, packageType)
|
||||
return fmt.Sprintf("%s/%s/%s/%s", apkStaticURLPrefix, env, packageType, defaultApkStorageName)
|
||||
}
|
||||
|
||||
func isValidApkEnv(env string) bool {
|
||||
|
||||
@ -16,18 +16,10 @@ import (
|
||||
func AppList(c *gin.Context) {
|
||||
Server := model.Server{}
|
||||
AppList, err := Server.AppList()
|
||||
Role, err := model.GetAdminRole(c)
|
||||
if err != nil {
|
||||
failed(c, err.Error())
|
||||
return
|
||||
}
|
||||
if Role != util.RoleSuper {
|
||||
for i := 0; i < len(AppList); i++ {
|
||||
if AppList[i].AppId == 0 {
|
||||
AppList = append(AppList[:i], AppList[i+1:]...)
|
||||
}
|
||||
}
|
||||
}
|
||||
success(c, AppList)
|
||||
}
|
||||
|
||||
|
||||
@ -52,9 +52,7 @@ func UserAliveMonitor(AppId int) {
|
||||
|
||||
func ServerInfoMonitor() {
|
||||
for {
|
||||
now := time.Now()
|
||||
next := now.Truncate(1 * time.Minute).Add(1 * time.Minute)
|
||||
time.Sleep(time.Until(next))
|
||||
time.Sleep(time.Second * 10)
|
||||
monitorServerInfo()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user