add:添加短链接服务
Build docker and publish / build (20.15.1) (push) Has been cancelled

This commit is contained in:
2026-01-24 00:32:08 -08:00
parent a98fcbfe73
commit 1d81df6664
51 changed files with 2957 additions and 621 deletions
+34 -11
View File
@@ -2,7 +2,9 @@ package common
import (
"context"
"encoding/json"
"github.com/perfect-panel/server/internal/model/client"
"github.com/perfect-panel/server/internal/svc"
"github.com/perfect-panel/server/internal/types"
"github.com/perfect-panel/server/pkg/logger"
@@ -25,16 +27,37 @@ func NewGetAppVersionLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Get
// GetAppVersion 根据平台返回最新版本信息
func (l *GetAppVersionLogic) GetAppVersion(req *types.GetAppVersionRequest) (resp *types.ApplicationVersion, err error) {
// TODO: 后续对接数据库实现
resp = &types.ApplicationVersion{
Version: "1.0.0",
MinVersion: "1.0.0",
ForceUpdate: false,
Description: map[string]string{
"zh-CN": "初始版本",
"en-US": "Initial version",
},
IsDefault: true,
// Query the latest version for the platform
var version client.ApplicationVersion
err = l.svcCtx.DB.Model(&client.ApplicationVersion{}).
Where("platform = ? AND is_default = 1", req.Platform).
Order("id desc").First(&version).Error
if err != nil {
l.Errorf("[GetAppVersion] get version error: %v", err)
// Return empty or default if not found
return &types.ApplicationVersion{
Version: "unknown",
MinVersion: "unknown",
ForceUpdate: false,
Description: map[string]string{},
IsDefault: false,
}, nil
}
return
resp = &types.ApplicationVersion{
Id: version.Id,
Platform: version.Platform,
Version: version.Version,
MinVersion: version.MinVersion,
ForceUpdate: version.ForceUpdate,
Description: make(map[string]string),
Url: version.Url,
IsDefault: version.IsDefault,
IsInReview: version.IsInReview,
CreatedAt: version.CreatedAt.Unix(),
}
_ = json.Unmarshal(version.Description, &resp.Description)
return resp, nil
}