feat: add team registration execution API endpoint.
This commit is contained in:
@@ -431,16 +431,21 @@ func findTeamRegExecutable() string {
|
||||
// 获取当前工作目录
|
||||
cwd, _ := os.Getwd()
|
||||
|
||||
// 获取可执行文件所在目录
|
||||
// 获取可执行文件的真实路径(解析符号链接)
|
||||
execPath, _ := os.Executable()
|
||||
realExecPath, err := filepath.EvalSymlinks(execPath)
|
||||
if err == nil {
|
||||
execPath = realExecPath
|
||||
}
|
||||
execDir := filepath.Dir(execPath)
|
||||
|
||||
// 可能的路径(按优先级排序)
|
||||
paths := []string{
|
||||
execDir, // 可执行文件所在目录(最可靠,team-reg 应与后端在同一目录)
|
||||
cwd, // 当前工作目录
|
||||
filepath.Join(cwd, "backend"), // cwd/backend
|
||||
execDir, // 可执行文件所在目录
|
||||
filepath.Join(execDir, ".."), // 可执行文件上级目录
|
||||
filepath.Join(execDir, "backend"), // execDir/backend
|
||||
".", // 相对当前目录
|
||||
"backend", // 相对 backend 目录
|
||||
"..", // 上级目录
|
||||
@@ -451,6 +456,7 @@ func findTeamRegExecutable() string {
|
||||
|
||||
// 记录搜索过程
|
||||
logger.Info(fmt.Sprintf("[TeamReg] 当前工作目录: %s", cwd), "", "team-reg")
|
||||
logger.Info(fmt.Sprintf("[TeamReg] 可执行文件路径: %s", execPath), "", "team-reg")
|
||||
logger.Info(fmt.Sprintf("[TeamReg] 可执行文件目录: %s", execDir), "", "team-reg")
|
||||
|
||||
for _, basePath := range paths {
|
||||
@@ -465,11 +471,15 @@ func findTeamRegExecutable() string {
|
||||
}
|
||||
}
|
||||
|
||||
// 未找到,输出所有搜索过的路径
|
||||
logger.Error("[TeamReg] team-reg 可执行文件未找到,已搜索以下路径:", "", "team-reg")
|
||||
// 未找到,输出所有搜索过的路径到前端日志,方便排查
|
||||
addTeamRegLog("[错误] 已搜索以下路径均未找到 team-reg:")
|
||||
addTeamRegLog(fmt.Sprintf(" 工作目录: %s", cwd))
|
||||
addTeamRegLog(fmt.Sprintf(" 可执行文件目录: %s", execDir))
|
||||
for _, basePath := range paths {
|
||||
absPath, _ := filepath.Abs(basePath)
|
||||
logger.Error(fmt.Sprintf(" - %s", absPath), "", "team-reg")
|
||||
for _, name := range names {
|
||||
addTeamRegLog(fmt.Sprintf(" - %s", filepath.Join(absPath, name)))
|
||||
}
|
||||
}
|
||||
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user