update zhaoan

This commit is contained in:
SiHuan 2021-01-13 09:50:36 +08:00
parent 911796444b
commit 27cb20fffe
2 changed files with 40 additions and 4 deletions

View file

@ -46,7 +46,7 @@ def getWeather(id='101120206'):
def calendar(): def calendar():
ymc = ["十一", "十二", "", "", "", "", "", "", "", "", "", ""] ymc = ["", "", "", "", "", "", "", "", "", "", "", ""]
rmc = ["初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十", "十一", "十二", "十三", "十四", "十五", rmc = ["初一", "初二", "初三", "初四", "初五", "初六", "初七", "初八", "初九", "初十", "十一", "十二", "十三", "十四", "十五",
"十六", "十七", "十八", "十九", "二十", "廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十", "卅一"] "十六", "十七", "十八", "十九", "二十", "廿一", "廿二", "廿三", "廿四", "廿五", "廿六", "廿七", "廿八", "廿九", "三十", "卅一"]
zmc = ["", "", "", "", "", "", ""] zmc = ["", "", "", "", "", "", ""]
@ -54,16 +54,16 @@ def calendar():
y = nowdate.year y = nowdate.year
m = nowdate.month m = nowdate.month
d = nowdate.day d = nowdate.day
zc = int(nowdate.strftime("%W")) - 34 zc = int(nowdate.strftime("%W")) - 1
z = zmc[nowdate.weekday()] z = zmc[nowdate.weekday()]
lunar = sxtwl.Lunar() lunar = sxtwl.Lunar()
lunarday = lunar.getDayBySolar(y, m, d) lunarday = lunar.getDayBySolar(y, m, d)
lunardaychinese = f"{ymc[lunarday.Lmc]}{rmc[lunarday.Ldi]}" lunardaychinese = f"{ymc[lunarday.Lmc]}{rmc[lunarday.Ldi]}"
if lunarday.Lleap: if lunarday.Lleap:
lunardaychinese = "" + lunardaychinese lunardaychinese = "" + lunardaychinese
cal = f"{m}{d}日,农历{lunardaychinese}本学期{zc}周,星期{z}" cal = f"{m}{d}日,{lunardaychinese}寒假{zc}周,星期{z}"
return cal return cal

36
zaoan.py Normal file
View file

@ -0,0 +1,36 @@
import requests
import json
url = 'http://127.0.0.1:5580/'
headers = {'Content-Type': 'application/json'}
gids = [743539576, 959613860, 1107535671]
data = {
"anonymous": "None",
"font": 1501544,
"group_id": 959613860,
"message": "/zhaoan",
"message_id": 2071,
"message_type": "group",
"post_type": "message",
"raw_message": "/zhaoan",
"self_id": 161795000,
"sender": {
"age": 18,
"area": "济宁",
"card": "",
"level": "活跃",
"nickname": "SiHuan",
"role": "owner",
"sex": "unknown",
"title": "",
"user_id": 1318000000
},
"sub_type": "normal",
"time": 1582805370,
"user_id": 1318000000
}
for gid in gids:
data['group_id'] = gid
requests.post(url=url, headers=headers, data=json.dumps(data))