diff --git a/backend/app/api/endpoints/prediction.py b/backend/app/api/endpoints/prediction.py index b405c56..1c77df9 100644 --- a/backend/app/api/endpoints/prediction.py +++ b/backend/app/api/endpoints/prediction.py @@ -72,14 +72,25 @@ def get_ensemble_prediction( @router.post("/recommend/today") def recommend_today(db: Session = Depends(get_db)): """ - 每日推荐:一三六推荐大乐透,二四日推荐双色球,固定投注1注+推荐4注,共5注,推送内容合并快乐8。 + 每日推荐:一三六推荐大乐透,二四日推荐双色球,周五休息一天。 """ + # 判断彩种 + weekday = datetime.datetime.now().isoweekday() + + # 周五休息一天 + if weekday == 5: # 周五 + return { + 'success': True, + 'lottery_type': 'rest', + 'message': '今日休息,明天再来!', + 'recommend': [] + } + # 固定投注号码(写死) FIXED_SSQ = {'red': [4, 6, 7, 12, 18, 19], 'blue': [9]} FIXED_DLT = {'red': [4, 6, 9, 18, 19], 'blue': [7, 12]} - # 判断彩种 - weekday = datetime.datetime.now().isoweekday() - if weekday in [1, 3, 6]: + + if weekday in [1, 3, 6]: # 周一、三、六 lottery_type = 'dlt' BetModel = DLTLotteryBetRecord recommend_type = '集成预测-每日推荐' @@ -90,7 +101,7 @@ def recommend_today(db: Session = Depends(get_db)): fixed = FIXED_DLT title = "你好,帮忙买下大乐透。" dlt_append = True - else: + else: # 周二、四、日 lottery_type = 'ssq' BetModel = SSQLotteryBetRecord recommend_type = '集成预测-每日推荐' @@ -186,10 +197,12 @@ def recommend_today(db: Session = Depends(get_db)): # 2. 组装推送内容(固定投注+4注推荐) msg_lines = [title] # 固定投注 - msg_lines.append(f"红球:{' '.join(f'{n:02d}' for n in fixed['red'])} 蓝球:{' '.join(f'{n:02d}' for n in fixed['blue'])}") + msg_lines.append(f"红球:{' '.join(f'{n:02d}' for n in fixed['red'])} 蓝球:{ + ' '.join(f'{n:02d}' for n in fixed['blue'])}") # 推荐号码 for rec in results: - msg_lines.append(f"红球:{' '.join(f'{n:02d}' for n in rec['red'])} 蓝球:{' '.join(f'{n:02d}' for n in rec['blue'])}") + msg_lines.append(f"红球:{' '.join(f'{n:02d}' for n in rec['red'])} 蓝球:{ + ' '.join(f'{n:02d}' for n in rec['blue'])}") if dlt_append: msg_lines.append("都追加,谢谢。") # 3. 快乐8推送(3注十选,合并到主消息) @@ -217,15 +230,26 @@ def get_today_recommendations(db: Session = Depends(get_db)): """获取今日拼盘推荐""" try: today = datetime.datetime.now().strftime('%Y%m%d') + weekday = datetime.datetime.now().isoweekday() + + # 周五休息一天 + if weekday == 5: + return { + 'success': True, + 'lottery_type': 'rest', + 'message': '今日休息,明天再来!', + 'recommend': [], + 'count': 0 + } # 查询今日的双色球推荐 ssq_recommendations = db.query(SSQLotteryBetRecord).filter( - SSQLotteryBetRecord.batch_id.like(f'SSQ_{today}%') + SSQLotteryBetRecord.batch_id.like(f'{today}%') ).order_by(SSQLotteryBetRecord.created_at.desc()).all() # 查询今日的大乐透推荐 dlt_recommendations = db.query(DLTLotteryBetRecord).filter( - DLTLotteryBetRecord.batch_id.like(f'DLT_{today}%') + DLTLotteryBetRecord.batch_id.like(f'{today}%') ).order_by(DLTLotteryBetRecord.created_at.desc()).all() # 确定当前彩票类型(根据推荐数量) diff --git a/frontend/src/views/NumberGenerator.vue b/frontend/src/views/NumberGenerator.vue index 5417af4..fd76afd 100644 --- a/frontend/src/views/NumberGenerator.vue +++ b/frontend/src/views/NumberGenerator.vue @@ -47,14 +47,17 @@
下单时间:{{ todayRecommend.length ? todayRecommend[0].time : '还没开锅,快来点一份吧~' }}
-拼盘编号:{{ todayRecommend.length ? todayRecommend[0].batch_id : '暂无,先点单再说~' }}
+今日休息,明天再来!
+{{ todayRecommend.length ? todayRecommend[0].time : '还没开锅,快来点一份吧~' }}
+{{ todayRecommend.length ? todayRecommend[0].batch_id : '暂无,先点单再说~' }}
今日休息,大厨也要休息一天哦!明天再来享受美味拼盘吧~
+今日拼盘还没出锅,快点下方按钮,开启你的好运早餐!