This commit is contained in:
2026-08-25 16:52:55 +08:00
parent d3ba1c7e48
commit e8812a0a73
34 changed files with 1072 additions and 45 deletions
+24
View File
@@ -0,0 +1,24 @@
package common
import (
"context"
"path/filepath"
"github.com/gogf/gf/v2/frame/g"
)
// APK 存储约定:Android 版本下发上传的 APK 存固定文件名(上传即覆盖,原子重命名),
// 目录下永远只保留最新一个文件;下载由 main.go 静态托管 /download/<ApkFilename>
// URL 固定,客户端拼 apiBaseUrl 访问。
const ApkFilename = "observer-latest.apk"
// ApkDir APK 上传目录:config.yml app.apkDir(默认 ./workspace,与 ./data 平级,
// docker-compose 挂载持久化)
func ApkDir(ctx context.Context) string {
return g.Cfg().MustGet(ctx, "app.apkDir", "./workspace").String()
}
// ApkFilePath 最新 APK 完整路径
func ApkFilePath(ctx context.Context) string {
return filepath.Join(ApkDir(ctx), ApkFilename)
}
+2
View File
@@ -11,4 +11,6 @@ var (
CodeOrderClosed = gcode.New(1004, "订单已关闭,需重新下单", nil)
CodeCallbackVerifyFailed = gcode.New(1005, "回调验签失败", nil)
CodeCallbackMismatch = gcode.New(1006, "回调商户/金额不匹配", nil)
CodeVersionDuplicate = gcode.New(1007, "该版本号已存在,请勿重复下发", nil)
CodeApkInvalid = gcode.New(1008, "请上传 APK 文件(.apk 后缀)", nil)
)