feat: Establish core backend services including SQLite database, structured logging, and initial owner management capabilities.
This commit is contained in:
@@ -133,6 +133,7 @@ func startServer(cfg *config.Config) {
|
||||
mux.HandleFunc("/api/db/owners/clear-used", api.CORS(handleClearUsedOwners)) // 清理已使用
|
||||
mux.HandleFunc("/api/db/owners/delete/", api.CORS(handleDeleteOwner)) // DELETE /api/db/owners/delete/{id}
|
||||
mux.HandleFunc("/api/db/owners/batch-delete", api.CORS(handleBatchDeleteOwners)) // POST 批量删除
|
||||
mux.HandleFunc("/api/db/owners/ids", api.CORS(handleGetOwnerIDs)) // GET 获取所有ID(全选用)
|
||||
mux.HandleFunc("/api/db/owners/refetch-account-ids", api.CORS(api.HandleRefetchAccountIDs))
|
||||
mux.HandleFunc("/api/upload/validate", api.CORS(api.HandleUploadValidate))
|
||||
|
||||
@@ -977,6 +978,31 @@ func handleBatchDeleteOwners(w http.ResponseWriter, r *http.Request) {
|
||||
})
|
||||
}
|
||||
|
||||
// handleGetOwnerIDs GET /api/db/owners/ids?status=xxx - 获取所有符合条件的 owner ID(全选用)
|
||||
func handleGetOwnerIDs(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodGet {
|
||||
api.Error(w, http.StatusMethodNotAllowed, "仅支持 GET")
|
||||
return
|
||||
}
|
||||
|
||||
if database.Instance == nil {
|
||||
api.Error(w, http.StatusInternalServerError, "数据库未初始化")
|
||||
return
|
||||
}
|
||||
|
||||
status := r.URL.Query().Get("status")
|
||||
ids, err := database.Instance.GetTeamOwnerIDs(status)
|
||||
if err != nil {
|
||||
api.Error(w, http.StatusInternalServerError, fmt.Sprintf("查询失败: %v", err))
|
||||
return
|
||||
}
|
||||
|
||||
api.Success(w, map[string]interface{}{
|
||||
"ids": ids,
|
||||
"total": len(ids),
|
||||
})
|
||||
}
|
||||
|
||||
// handleRegisterTest POST /api/register/test - 测试注册流程
|
||||
func handleRegisterTest(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodPost {
|
||||
|
||||
Reference in New Issue
Block a user