feat: 支持养成后台调用IM内部接口
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user