将快乐8投注替换为排列3组选3投注

This commit is contained in:
Mars 2025-07-15 11:04:45 +08:00
parent b88ddc92d6
commit 1efcb4bcfb
2 changed files with 69 additions and 4 deletions

View File

@ -621,5 +621,64 @@ else: # 昨天是周五,休息日,没有投注
---
*最后更新2025-07-14*
## 2025-01-16 彩票投注内容调整
### 背景
用户需求将快乐8投注内容替换为排列3组选3投注。
### 排列3组选3规则
- **投注方式**从000-999中选择号码其中有两个数字相同
- **中奖条件**:所选号码与开奖号码相同且顺序不限
- **奖金设定**单注固定奖金346元
- **示例**开奖544中奖号码可为544、454、445中任意一个
### 修改内容
`backend/scheduler.py``generate_daily_recommendations_job`函数中:
#### 原快乐8投注
```python
msg_lines.append("\n快乐8单式选十")
for _ in range(3):
nums = sorted(random.sample(range(1, 81), 10))
msg_lines.append(' '.join(f"{n:02d}" for n in nums))
```
#### 新排列3组选3投注
```python
msg_lines.append("\n排列三组选三")
for _ in range(3):
# 生成组选3号码两个相同数字 + 一个不同数字
same_digit = random.randint(0, 9) # 相同的数字
different_digit = random.choice([d for d in range(0, 10) if d != same_digit]) # 不同的数字
# 将三个数字随机排列
digits = [same_digit, same_digit, different_digit]
random.shuffle(digits)
msg_lines.append(' '.join(str(d) for d in digits))
```
### 推送消息示例
```
你好,帮忙买下大乐透。
红球04 06 09 18 19 蓝球07 12
红球01 03 05 06 31 蓝球03 06
红球06 09 18 23 32 蓝球02 07
红球02 07 13 14 22 蓝球03 09
红球02 09 22 31 32 蓝球07 12
都追加,谢谢。
排列三,组选三
9 6 6
1 4 4
5 5 3
```
### 技术特点
1. **随机生成**每次生成3注不同的组选3号码
2. **规则保证**:确保每注都包含两个相同数字和一个不同数字
3. **顺序随机**:相同数字的位置完全随机
4. **无需存储**与快乐8一样不保存投注记录不进行中奖比对
---
*最后更新2025-01-16*
*问题状态:✅ 已完全修复并验证*

View File

@ -184,10 +184,16 @@ class LotteryScheduler:
msg_lines.append(f"红球:{red_str} 蓝球:{blue_str}")
if dlt_append:
msg_lines.append("都追加,谢谢。")
msg_lines.append("\n快乐8单式选十")
msg_lines.append("\n排列三,组选三")
for _ in range(3):
nums = sorted(random.sample(range(1, 81), 10))
msg_lines.append(' '.join(f"{n:02d}" for n in nums))
# 生成组选3号码两个相同数字 + 一个不同数字
same_digit = random.randint(0, 9) # 相同的数字
different_digit = random.choice(
[d for d in range(0, 10) if d != same_digit]) # 不同的数字
# 将三个数字随机排列
digits = [same_digit, same_digit, different_digit]
random.shuffle(digits)
msg_lines.append(' '.join(str(d) for d in digits))
# 推送到Telegram
try:
logger.info("开始推送到Telegram...")