diff --git a/XianyuAutoAsync.py b/XianyuAutoAsync.py
index 3de38cb..ae9fcac 100644
--- a/XianyuAutoAsync.py
+++ b/XianyuAutoAsync.py
@@ -37,6 +37,11 @@ class AutoReplyPauseManager:
logger.error(f"获取账号 {cookie_id} 暂停时间失败: {e},使用默认10分钟")
pause_minutes = 10
+ # 如果暂停时间为0,表示不暂停
+ if pause_minutes == 0:
+ logger.info(f"【{cookie_id}】检测到手动发出消息,但暂停时间设置为0,不暂停自动回复")
+ return
+
pause_duration_seconds = pause_minutes * 60
pause_until = time.time() + pause_duration_seconds
self.paused_chats[chat_id] = pause_until
diff --git a/db_manager.py b/db_manager.py
index 1924f29..a5ca8fb 100644
--- a/db_manager.py
+++ b/db_manager.py
@@ -1211,7 +1211,7 @@ class DBManager:
'user_id': result[2],
'auto_confirm': bool(result[3]),
'remark': result[4] or '',
- 'pause_duration': result[5] if result[5] is not None else 10,
+ 'pause_duration': result[5] if result[5] is not None else 10, # 0是有效值,表示不暂停
'created_at': result[6]
}
return None
@@ -1272,7 +1272,7 @@ class DBManager:
self._execute_sql(cursor, "UPDATE cookies SET pause_duration = 10 WHERE id = ?", (cookie_id,))
self.conn.commit()
return 10
- return result[0] # 返回实际值,不使用or操作符
+ return result[0] # 返回实际值,包括0(0表示不暂停)
else:
logger.warning(f"账号 {cookie_id} 未找到记录,使用默认值10分钟")
return 10
diff --git a/reply_server.py b/reply_server.py
index 354155c..9f62aa1 100644
--- a/reply_server.py
+++ b/reply_server.py
@@ -1068,6 +1068,11 @@ class MessageNotificationIn(BaseModel):
class SystemSettingIn(BaseModel):
+ value: str
+ description: Optional[str] = None
+
+
+class SystemSettingCreateIn(BaseModel):
key: str
value: str
description: Optional[str] = None
@@ -2167,9 +2172,9 @@ def update_cookie_pause_duration(cid: str, update_data: PauseDurationUpdate, cur
if cid not in user_cookies:
raise HTTPException(status_code=403, detail="无权限操作该Cookie")
- # 验证暂停时间范围(1-60分钟)
- if not (1 <= update_data.pause_duration <= 60):
- raise HTTPException(status_code=400, detail="暂停时间必须在1-60分钟之间")
+ # 验证暂停时间范围(0-60分钟,0表示不暂停)
+ if not (0 <= update_data.pause_duration <= 60):
+ raise HTTPException(status_code=400, detail="暂停时间必须在0-60分钟之间(0表示不暂停)")
# 更新暂停时间
success = db_manager.update_cookie_pause_duration(cid, update_data.pause_duration)
diff --git a/static/index.html b/static/index.html
index d095d9c..0d32cad 100644
--- a/static/index.html
+++ b/static/index.html
@@ -319,7 +319,7 @@
+ title="检测到手动发出消息后,自动回复暂停的时间长度(分钟)。设置为0表示不暂停。如果在暂停期间再次手动发出消息,会重新开始计时。">
操作 |
diff --git a/static/js/app.js b/static/js/app.js
index 91905b2..a6cc644 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -1269,8 +1269,8 @@ async function loadCookies() {
-
- ${cookie.pause_duration || 10}分钟
+
+ ${cookie.pause_duration === 0 ? '不暂停' : (cookie.pause_duration || 10) + '分钟'}
|
@@ -7797,16 +7797,16 @@ function editPauseDuration(cookieId, currentDuration) {
const input = document.createElement('input');
input.type = 'number';
input.className = 'form-control form-control-sm';
- input.value = currentDuration || 10;
+ input.value = currentDuration !== undefined ? currentDuration : 10;
input.placeholder = '请输入暂停时间...';
input.style.fontSize = '0.875rem';
- input.min = 1;
+ input.min = 0;
input.max = 60;
input.step = 1;
// 保存原始内容和原始值
const originalContent = pauseCell.innerHTML;
- const originalValue = currentDuration || 10;
+ const originalValue = currentDuration !== undefined ? currentDuration : 10;
// 标记是否已经进行了编辑
let hasChanged = false;
@@ -7818,7 +7818,7 @@ function editPauseDuration(cookieId, currentDuration) {
// 监听输入变化
input.addEventListener('input', () => {
- const newValue = parseInt(input.value) || 10;
+ const newValue = input.value === '' ? 10 : parseInt(input.value);
hasChanged = newValue !== originalValue;
});
@@ -7827,12 +7827,12 @@ function editPauseDuration(cookieId, currentDuration) {
console.log('savePauseDuration called, isProcessing:', isProcessing, 'hasChanged:', hasChanged); // 调试信息
if (isProcessing) return; // 防止重复调用
- const newDuration = parseInt(input.value) || 10;
+ const newDuration = input.value === '' ? 10 : parseInt(input.value);
console.log('newDuration:', newDuration, 'originalValue:', originalValue); // 调试信息
// 验证范围
- if (newDuration < 1 || newDuration > 60) {
- showToast('暂停时间必须在1-60分钟之间', 'warning');
+ if (isNaN(newDuration) || newDuration < 0 || newDuration > 60) {
+ showToast('暂停时间必须在0-60分钟之间(0表示不暂停)', 'warning');
input.focus();
return;
}
@@ -7860,7 +7860,7 @@ function editPauseDuration(cookieId, currentDuration) {
// 更新显示
pauseCell.innerHTML = `
- ${newDuration}分钟
+ ${newDuration === 0 ? '不暂停' : newDuration + '分钟'}
`;
showToast('暂停时间更新成功', 'success');
diff --git a/static/update_log.txt b/static/update_log.txt
index 5ce3085..8fa0873 100644
--- a/static/update_log.txt
+++ b/static/update_log.txt
@@ -1,4 +1,6 @@
🎉1.新增qq直接回复闲鱼消息,无需在进入闲鱼;
①回复哪条消息引用即可
②系统设置维护qq回复秘钥
-
\ No newline at end of file
+ ③在qq上给机器人发送 咸鱼绑定 key:url 其中key是你系统设置配置的秘钥,url 是你公网服务器的 ip加端口,例如 zheshimiyao:http://10.12.13.14:8080
+ ④如果没有公网,可联系我购买内网穿透服务,2块一个月,物美价廉
+🎉2.支持自动回复暂停时间支持设置为0;
\ No newline at end of file