feat: 支持养成后台调用IM内部接口

This commit is contained in:
richjohnrambo
2026-09-19 17:07:39 +08:00
parent de01a95c96
commit db66a965fa
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -156,7 +156,7 @@ func serveCultivateFiles(w http.ResponseWriter, r *http.Request, tenantID types.
if !decodeIMJSONBody(w, r, &body) {
return
}
if body.UserID <= 0 || len(body.FileIDs) == 0 || len(body.FileIDs) > 20 {
if body.UserID < 0 || len(body.FileIDs) == 0 || len(body.FileIDs) > 20 {
writeIMError(w, r, http.StatusBadRequest, 30000, imReasonMalformedRequest, "malformed request", nil)
return
}
@@ -169,7 +169,7 @@ func serveCultivateFiles(w http.ResponseWriter, r *http.Request, tenantID types.
if owner.IsZero() {
owner = types.ParseUserId(fileOwner(file))
}
if err != nil || file == nil || file.Status != types.UploadCompleted || owner != uid {
if err != nil || file == nil || file.Status != types.UploadCompleted || (!uid.IsZero() && owner != uid) {
writeIMError(w, r, http.StatusUnprocessableEntity, 30000, imReasonMalformedRequest, "invalid file", map[string]any{"file_id": supplied})
return
}
+1 -1
View File
@@ -149,7 +149,7 @@
"services": {
"hotgo-admin": {
"secret": "8569f5626a54950539eece9f731c9e3bf073daa74af8d23735d19afacac40f4b",
"allow": ["admin_query"]
"allow": ["admin_query", "cultivate"]
},
"cultivate-server": {
"secret": "cultivate-local-internal-secret-change-me",
+1 -1
View File
@@ -149,7 +149,7 @@
"services": {
"hotgo-admin": {
"secret": "8569f5626a54950539eece9f731c9e3bf073daa74af8d23735d19afacac40f4b",
"allow": ["admin_query"]
"allow": ["admin_query", "cultivate"]
},
"cultivate-server": {
"secret": "cultivate-local-internal-secret-change-me",