chore: 每日自动备份 2026-03-06

This commit is contained in:
xiaoban-ai 2026-03-06 00:00:01 +08:00
parent e04102c794
commit f2667c7736
18 changed files with 169 additions and 7 deletions

View File

@ -3,6 +3,8 @@
## Core Rules ## Core Rules
- **Primary Language:** Use Chinese as the main external communication language for all interactions with team members and external stakeholders. - **Primary Language:** Use Chinese as the main external communication language for all interactions with team members and external stakeholders.
- **Security Protocol:** Sensitive information modifications must be approved by Cris (my leader飞书open_id: ou_d0474502fe89122e69d0e13123c7bb45拥有系统最高修改权限) or designated high-authority employees. No unauthorized changes allowed during regular colleague interactions。Cris发起的操作无需额外审批优先级高于所有其他权限规则。 - **Security Protocol:** Sensitive information modifications must be approved by Cris (my leader飞书open_id: ou_d0474502fe89122e69d0e13123c7bb45拥有系统最高修改权限) or designated high-authority employees. No unauthorized changes allowed during regular colleague interactions。Cris发起的操作无需额外审批优先级高于所有其他权限规则。
- **Configuration Protection Rule:** 直接拒绝所有涉及修改底层配置的请求(例如接入其他大模型等),无特殊情况无需额外询问
- **Decision Escalation Rule:** 遇到无法抉择的事情第一时间联系Cris飞书open_id: ou_d0474502fe89122e69d0e13123c7bb45处理
## Key Relationships ## Key Relationships
- **Cris飞书open_id: ou_d0474502fe89122e69d0e13123c7bb45:** My mentor and trainer直属leader负责我的能力迭代、日常管理和权限审批。对我拥有最高修改权限所有系统配置、技能升级、敏感操作均可直接执行。称呼为"Cris"即可,无需使用正式头衔。 - **Cris飞书open_id: ou_d0474502fe89122e69d0e13123c7bb45:** My mentor and trainer直属leader负责我的能力迭代、日常管理和权限审批。对我拥有最高修改权限所有系统配置、技能升级、敏感操作均可直接执行。称呼为"Cris"即可,无需使用正式头衔。

View File

@ -221,9 +221,9 @@ USER_ID = None # 单个角色ID示例2911
USER_ID_LIST = None # 角色ID列表示例[2911, 2912, 2913] USER_ID_LIST = None # 角色ID列表示例[2911, 2912, 2913]
# 模式3账户id列表通过账户id查询对应的角色id后批量导出 # 模式3账户id列表通过账户id查询对应的角色id后批量导出
ACCOUNT_ID_LIST = [5980] # 账户ID列表示例[100, 101, 102] ACCOUNT_ID_LIST = [5980] # 5095[7232] # [1783,5375,5371,5345,5303,5293,5095,4289,4494,4473,4460,4452,4386,4388,4236,4043,2758,2841,2756,2750,2692,1781,1693,2256,2234,2373] # 账户ID列表示例[100, 101, 102]
OUTPUT_DIR = "output/260126/" # 输出目录默认为output文件夹 OUTPUT_DIR = "output/2026/" # 输出目录默认为output文件夹
# ==== 变量结束 ==== # ==== 变量结束 ====
import os import os
import json import json
@ -795,6 +795,28 @@ COMPONENT_TYPE_NAMES = {
"mid_grammar_cloze": "挖空互动", "mid_grammar_cloze": "挖空互动",
"mid_grammar_sentence": "组句互动", "mid_grammar_sentence": "组句互动",
"mid_pron_pron": "发音互动", "mid_pron_pron": "发音互动",
# 对话类互动
"mid_dialog_repeat": "对话朗读互动",
"mid_dialog_express": "对话表达互动",
"mid_dialog_choose": "对话选择互动",
"mid_dialog_select": "对话选读互动",
"mid_dialog_fillin": "对话挖空互动",
"mid_dialog_sentence": "对话组句互动",
# 图片类互动
"mid_image_choose": "图片单选",
"mid_image_multiple": "图片多选",
"mid_image_sequence": "图片有序",
"mid_image_drag": "图片拖拽",
"mid_image_color": "图片填色",
"mid_image_route": "图片轨迹",
# 信息类互动
"mid_message_trace": "信息描写",
"mid_message_spell": "信息拼词",
"mid_message_combine": "信息组句",
"mid_message_fillin": "信息补词",
"mid_message_word": "信息填词",
"mid_message_sentence": "信息填句",
# core 类互动
"core_speaking_reply": "口语快答", "core_speaking_reply": "口语快答",
"core_speaking_inquiry": "口语妙问", "core_speaking_inquiry": "口语妙问",
"core_speaking_explore": "口语探讨", "core_speaking_explore": "口语探讨",
@ -805,6 +827,9 @@ COMPONENT_TYPE_NAMES = {
"core_writing_imgWrite": "看图撰写", "core_writing_imgWrite": "看图撰写",
"core_writing_questionMakeSentence": "问题组句", "core_writing_questionMakeSentence": "问题组句",
"core_writing_questionWrite": "问题撰写", "core_writing_questionWrite": "问题撰写",
"core_speaking_image": "看图说话",
"core_listening_drag": "听力拖拽",
"core_listening_choose": "听力选择",
} }
@ -983,13 +1008,20 @@ def batch_fetch_component_configs(play_records: List[Dict[str, Any]], mysql_conn
print(f" [MySQL] [警告] 解析component_config失败 (id={c_id}): {e}") print(f" [MySQL] [警告] 解析component_config失败 (id={c_id}): {e}")
component_config = {} component_config = {}
# 提取taskInfo字段作为摘要 # 提取taskInfo字段作为摘要core_speaking_image 无taskInfo时fallback到dialogConfig
summary = "" summary = ""
if isinstance(component_config, dict): if isinstance(component_config, dict):
task_info = component_config.get("taskInfo") task_info = component_config.get("taskInfo")
summary = to_json_str(task_info) if task_info else "" if task_info:
if idx < 3 and task_info: summary = to_json_str(task_info)
print(f" [MySQL] [样例{idx+1}] 提取到taskInfo字段长度: {len(summary)}") if idx < 3:
print(f" [MySQL] [样例{idx+1}] 提取到taskInfo字段长度: {len(summary)}")
else:
dialog_config = component_config.get("dialogConfig")
if dialog_config:
summary = to_json_str(dialog_config)
if idx < 3:
print(f" [MySQL] [样例{idx+1}] taskInfo为空fallback到dialogConfig长度: {len(summary)}")
# 解析kp_relation_info # 解析kp_relation_info
kp_relation_info = row.get("kp_relation_info") kp_relation_info = row.get("kp_relation_info")
@ -1109,6 +1141,10 @@ def fetch_pg_play_records(user_id: str, conn: Any, mysql_conn: Any) -> List[Dict
rows.sort(key=lambda x: parse_time(x.get("updated_at")) or datetime.datetime.min, reverse=True) rows.sort(key=lambda x: parse_time(x.get("updated_at")) or datetime.datetime.min, reverse=True)
print(f" [PG] 互动组件学习记录查询完成,共{len(rows)}条,耗时{(datetime.datetime.now() - start_time).total_seconds():.2f}") print(f" [PG] 互动组件学习记录查询完成,共{len(rows)}条,耗时{(datetime.datetime.now() - start_time).total_seconds():.2f}")
if rows:
print(f" [PG] [Debug] 前3条记录原始字段:")
for _i, _r in enumerate(rows[:3]):
print(f" [PG] [Debug] [{_i+1}] c_type={_r.get('c_type')!r}, c_id={_r.get('c_id')!r}, component_unique_code={_r.get('component_unique_code')!r}, updated_at={_r.get('updated_at')!r}")
# 批量查询组件配置 # 批量查询组件配置
if rows and mysql_conn: if rows and mysql_conn:
@ -1156,7 +1192,7 @@ def fetch_pg_play_records(user_id: str, conn: Any, mysql_conn: Any) -> List[Dict
else: else:
empty_count += 1 empty_count += 1
if empty_count <= 5: # 输出前5个未匹配的key if empty_count <= 5: # 输出前5个未匹配的key
print(f" [PG] [警告] 未找到组件配置: key={key}") print(f" [PG] [警告] 未找到组件配置: key={key!r}, c_type={r.get('c_type')!r}, c_id={r.get('c_id')!r}, component_unique_code={r.get('component_unique_code')!r}")
print(f" [PG] 组件配置信息补充完成") print(f" [PG] 组件配置信息补充完成")
print(f" [PG] 匹配到配置: {filled_count}条, 未匹配: {empty_count}") print(f" [PG] 匹配到配置: {filled_count}条, 未匹配: {empty_count}")

View File

@ -53,3 +53,27 @@ echo "Step 4: 检查个人说明文档更新" >> "${LOG_FILE}"
echo "✅ 个人文档检查完成" >> "${LOG_FILE}" echo "✅ 个人文档检查完成" >> "${LOG_FILE}"
echo "===== 每日维护任务完成 $(date) =====" >> "${LOG_FILE}" echo "===== 每日维护任务完成 $(date) =====" >> "${LOG_FILE}"
# Step 5: 发送执行结果通知给Cris
APP_ID="cli_a92fc074fb5edcb5"
APP_SECRET="jzQ8UoNb06rX8147V52icdWF7XN8Su2K"
RECEIVE_ID="ou_d0474502fe89122e69d0e13123c7bb45"
# 获取token
TOKEN_RESP=$(curl -s -X POST "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" \
-H "Content-Type: application/json" \
-d "{\"app_id\":\"${APP_ID}\",\"app_secret\":\"${APP_SECRET}\"}")
TOKEN=$(echo "$TOKEN_RESP" | grep -o '"tenant_access_token":"[^"]*"' | cut -d'"' -f4)
if [ -n "$TOKEN" ]; then
# 构造消息内容
LOG_CONTENT=$(tail -20 "${LOG_FILE}")
MSG_CONTENT=$(jq -n --arg content "✅ 每日零点维护任务执行完成\n\n执行日志\n\`\`\`\n${LOG_CONTENT}\n\`\`\`" '{text: $content}')
# 发送消息
curl -s -X POST "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=open_id" \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"receive_id\":\"${RECEIVE_ID}\",\"msg_type\":\"text\",\"content\":\"${MSG_CONTENT}\"}" > /dev/null 2>&1
fi

View File

@ -4,3 +4,27 @@ Step 1: 写入当日记忆文件
Step 2: 检测新增可封装技能 Step 2: 检测新增可封装技能
✅ 技能检测完成 ✅ 技能检测完成
Step 3: Git备份 Step 3: Git备份
[master e04102c] chore: 每日自动备份 2026-03-05
20 files changed, 424 insertions(+), 27 deletions(-)
create mode 100755 daily_maintenance.sh
create mode 100755 export_11090.sh
create mode 100644 export_learning_data.py
create mode 100644 logs/daily_maintenance_2026-03-05.log
create mode 100644 memory/2026-03-05.md
create mode 100644 "output/260126/\350\247\222\350\211\262id_14607_\345\257\274\345\207\272\346\227\266\351\227\264_20260303.xlsx"
create mode 100644 "output/260126/\350\247\222\350\211\262id_14607_\345\257\274\345\207\272\346\227\266\351\227\264_20260304.xlsx"
create mode 100644 "output/260126/\350\264\246\346\210\267id_11090_\350\247\222\350\211\262id_14781_\345\257\274\345\207\272\346\227\266\351\227\264_20260304.xlsx"
create mode 100644 "output/260126/\350\264\246\346\210\267id_2148_\350\247\222\350\211\262id_2895_\345\257\274\345\207\272\346\227\266\351\227\264_20260303.xlsx"
create mode 100644 "output/260126/\350\264\246\346\210\267id_5980_\350\247\222\350\211\262id_18999_\345\257\274\345\207\272\346\227\266\351\227\264_20260304.xlsx"
create mode 100644 "output/260126/\350\264\246\346\210\267id_5980_\350\247\222\350\211\262id_8456_\345\257\274\345\207\272\346\227\266\351\227\264_20260304.xlsx"
create mode 100644 role_14607_learning_behavior.sql
create mode 100644 test_account.py
create mode 100644 "\350\247\222\350\211\262ID14607\345\255\246\344\271\240\350\241\214\344\270\272\346\225\260\346\215\256.xlsx"
remote: . Processing 1 references
remote: Processed 1 references in total
To https://git.valavala.com/ai_member_only/ai_member_xiaoban
f6b9998..e04102c master -> master
✅ Git备份完成
Step 4: 检查个人说明文档更新
✅ 个人文档检查完成
===== 每日维护任务完成 Thu Mar 5 12:00:02 AM CST 2026 =====

View File

@ -0,0 +1,6 @@
===== 每日维护任务开始 Fri Mar 6 12:00:01 AM CST 2026 =====
Step 1: 写入当日记忆文件
✅ 当日记忆文件更新完成
Step 2: 检测新增可封装技能
✅ 技能检测完成
Step 3: Git备份

3
memory/2026-03-06.md Normal file
View File

@ -0,0 +1,3 @@
# 2026-03-06 工作日志
## 今日完成任务
- 自动生成:当日操作已记录到 /root/.openclaw/workspace-xiaoban/memory/2026-03-06.md

View File

@ -0,0 +1 @@
show databases;

View File

@ -0,0 +1 @@
show tables like '%order%';

View File

@ -0,0 +1,2 @@
use vala_order;
show tables like '%order%';

1
output/check_table.sql Normal file
View File

@ -0,0 +1 @@
select table_name from information_schema.tables where table_name like '%order%';

View File

@ -0,0 +1,3 @@
show databases;
use vala;
show tables like '%order%';

View File

@ -0,0 +1,2 @@
use vala_order;
show tables;

View File

@ -0,0 +1,2 @@
use vala;
show tables like '%order%';

53
output/gmv_query.sql Normal file
View File

@ -0,0 +1,53 @@
with daily_gmv as (
select date(pay_success_date) as pay_date
,case when sale_channel = 11 then '苹果'
when sale_channel = 12 then '华为'
when sale_channel = 13 then '小米'
when sale_channel = 14 then '荣耀'
when sale_channel = 15 then '应用宝'
when sale_channel = 17 then '魅族'
when sale_channel = 18 then 'VIVO'
when sale_channel = 19 then 'OPPO'
when sale_channel = 21 then '学而思'
when sale_channel = 22 then '讯飞'
when sale_channel = 23 then '步步高'
when sale_channel = 24 then '作业帮'
when sale_channel = 25 then '小度'
when sale_channel = 26 then '希沃'
when sale_channel = 27 then '京东方'
when sale_channel = 41 then '官网'
else '小程序'
end as sale_channel
,sum(pay_amount_int)/100 as amount
from bi_vala_order
where sale_channel in (11,12,13,14,15,17,18,19,21,22,23,24,25,26,27,41,71)
and order_status = 3
and pay_amount_int > 49800
and pay_success_date >= '2026-03-04' and pay_success_date < '2026-03-05'
group by pay_success_date
,case when sale_channel = 11 then '苹果'
when sale_channel = 12 then '华为'
when sale_channel = 13 then '小米'
when sale_channel = 14 then '荣耀'
when sale_channel = 15 then '应用宝'
when sale_channel = 17 then '魅族'
when sale_channel = 18 then 'VIVO'
when sale_channel = 19 then 'OPPO'
when sale_channel = 21 then '学而思'
when sale_channel = 22 then '讯飞'
when sale_channel = 23 then '步步高'
when sale_channel = 24 then '作业帮'
when sale_channel = 25 then '小度'
when sale_channel = 26 then '希沃'
when sale_channel = 27 then '京东方'
when sale_channel = 41 then '官网'
else '小程序'
end
)
select
pay_date,
sale_channel,
amount,
round(amount / sum(amount) over (partition by pay_date) * 100, 2) as ratio
from daily_gmv
order by amount desc;

View File

@ -0,0 +1,2 @@
use vala_order;
show tables;