auto backup 2026-04-10 10:53:04

This commit is contained in:
xiaobian-bot 2026-04-10 10:53:04 +08:00
parent 47af8ffe03
commit 930e46ed98
2 changed files with 21 additions and 5 deletions

View File

@ -1310,3 +1310,4 @@ To https://git.valavala.com/ai_member_only/ai_member_xiaobian.git
[feishu/outbound/actions] feishu: handleAction failed: action=send, error=Request failed with status code 400 {} [feishu/outbound/actions] feishu: handleAction failed: action=send, error=Request failed with status code 400 {}
AxiosError: Request failed with status code 400 AxiosError: Request failed with status code 400
✅ 备份完成Fri Apr 10 08:10:07 AM CST 2026 ✅ 备份完成Fri Apr 10 08:10:07 AM CST 2026
{"code":230001,"msg":"Your request contains an invalid request parameter, ext=invalid message content, ext=content is not a string in json format.","error":{"log_id":"202604101050544752599BE097A83ABE70","troubleshooter":"排查建议查看(Troubleshooting suggestions): https://open.feishu.cn/search?from=openapi&log_id=202604101050544752599BE097A83ABE70&code=230001&method_id=6936075528891154460"}}

View File

@ -25,14 +25,29 @@ if [ $? -eq 0 ] || [ $? -eq 1 ]; then
-d "{\"app_id\":\"$APP_ID\",\"app_secret\":\"$APP_SECRET\"}" \ -d "{\"app_id\":\"$APP_ID\",\"app_secret\":\"$APP_SECRET\"}" \
| jq -r '.tenant_access_token') | jq -r '.tenant_access_token')
# 构造content JSON避免转义问题
CONTENT=$(printf '{"text":"✅ 小编Workspace每日自动备份完成%s\\n提交哈希%s\\n所有Workspace变更已同步到远程Git仓库"}' "$(date +'%Y-%m-%d %H:%M')" "$COMMIT_HASH")
# 使用jq生成正确的JSON格式避免转义错误
MESSAGE_TEXT="✅ 小编Workspace每日自动备份完成$(date +'%Y-%m-%d %H:%M')
提交哈希:$COMMIT_HASH
所有Workspace变更已同步到远程Git仓库"
# 构造请求体
REQUEST_BODY=$(jq -n \
--arg rid "4aagb443" \
--arg text "$MESSAGE_TEXT" \
'{
receive_id: $rid,
msg_type: "text",
content: "{\"text\":\($text | @json)}"
}')
# 发送请求
curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=user_id" \ curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=user_id" \
-H "Authorization: Bearer $TOKEN" \ -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{ -d "$REQUEST_BODY" >> "$WORKSPACE_DIR/logs/backup.log" 2>&1
\"receive_id\": \"4aagb443\",
\"msg_type\": \"text\",
\"content\": \"{\\\"text\\\":\\\"✅ 小编Workspace每日自动备份完成$(date +'%Y-%m-%d %H:%M')\\n提交哈希$COMMIT_HASH\\n所有Workspace变更已同步到远程Git仓库\\\"}\"
}" >> "$WORKSPACE_DIR/logs/backup.log" 2>&1
fi fi
echo "✅ 备份完成:$(date)" echo "✅ 备份完成:$(date)"