Some checks failed
Build docker and publish / linux (1.24.5) (push) Failing after 25s
feat(admin): 新增工会管理功能 feat(activity): 添加活动管理相关服务 feat(user): 实现用户道具卡和积分管理 feat(guild): 新增工会成员管理功能 fix: 修复数据库连接配置 fix: 修正jwtoken导入路径 fix: 解决端口冲突问题 style: 统一代码格式和注释风格 style: 更新项目常量命名 docs: 添加项目框架和开发规范文档 docs: 更新接口文档注释 chore: 移除无用代码和文件 chore: 更新Makefile和配置文件 chore: 清理日志文件 test: 添加道具卡测试脚本
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package configs
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
// ProjectName 项目名称
|
|
ProjectName = "mini-chat"
|
|
|
|
// ProjectPort 项目端口
|
|
ProjectPort = ":9991"
|
|
|
|
// ProjectAccessLogFile 项目访问日志存放文件
|
|
ProjectAccessLogFile = "./logs/" + ProjectName + "-access.log"
|
|
|
|
// ZhCN 简体中文 - 中国
|
|
ZhCN = "zh-cn"
|
|
|
|
// EnUS 英文 - 美国
|
|
EnUS = "en-us"
|
|
|
|
// CustomerProjectNameZh 客户项目中文名称
|
|
CustomerProjectNameZh = "盲盒游戏"
|
|
|
|
// CustomerProjectNameEn 客户项目英文名称
|
|
CustomerProjectNameEn = "Bindbox Game"
|
|
|
|
// CustomerProjectVersion 客户项目版本
|
|
CustomerProjectVersion = "Release-2025111111"
|
|
)
|
|
|
|
// GetResourcesFilePath 获取资源文件路径
|
|
func GetResourcesFilePath() string {
|
|
return filepath.Join(getProjectPath(), "resources")
|
|
}
|
|
|
|
// getProjectPath 获取项目路径
|
|
func getProjectPath() string {
|
|
executablePath, err := os.Executable()
|
|
if err != nil {
|
|
log.Println("Error getting executable path:", err)
|
|
return ""
|
|
}
|
|
|
|
// 检查路径是否含有临时目录特征,这里仅为示例,实际情况可能需要更复杂的判断
|
|
if strings.Contains(executablePath, "/tmp/") || strings.Contains(executablePath, "var/folders/") {
|
|
return ""
|
|
} else {
|
|
return filepath.Dir(executablePath)
|
|
}
|
|
}
|