加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
getJson.py 3.76 KB
一键复制 编辑 原始数据 按行查看 历史
GuLu 提交于 2022-09-18 16:14 . 微信公众号自动早安晚安
import config
import getApi
# 早安的json数据
def getmoring_json(data_list):
# 数据整合
to_user = data_list[0]
day = data_list[1]
wek = data_list[2]
wea = data_list[3]
birthday = data_list[4]
lovedays = data_list[5]
city_name = data_list[6]
type = data_list[7]
max = data_list[8]
min = data_list[9]
content = getApi.getEvDayZaoAn()
data_baby = {
"touser": to_user,
"template_id": config.template_id.get("id_forBaby"),
"url": "https://m.tianqi.com/",
"topcolor": "#FF0000",
"data": {
"content":
{
"value": content,
"color": "#000000"
},
"date":
{
"value": "今天是" + "{} {}".format(day, wek),
"color": "#8470FF"
},
"city": {
"value": "城市:" + city_name,
"color": "#808A87"
},
"weather": {
"value": "天气:" + wea,
"color": "#ED9121"
},
"min_temperature": {
"value": "最低气温:" + min,
"color": "#00FF00"
},
"max_temperature": {
"value": "最高气温" + max,
"color": "#FF6100"
},
"love_day": {
"value": "今天是我们恋爱的第" + lovedays + "天",
"color": "#FFC0CB"
},
"birthday": {
"value": "距离小宝的生日还有" + birthday + "天",
"color": "#FF8000"
}
}
}
data_user = {
"touser": to_user,
"template_id": config.template_id.get("id_forUser"),
"url": "https://m.tianqi.com/",
"topcolor": "#FF0000",
"data": {
"content":
{
"value": content,
"color": "#000000"
},
"date": {
"value": "今天是" + "{} {}".format(day, wek),
"color": "#8470FF"
},
"city": {
"value": "城市:" + city_name,
"color": "#808A87"
},
"weather": {
"value": "天气:" + wea,
"color": "#ED9121"
},
"min_temperature": {
"value": "最低气温:" + min,
"color": "#00FF00"
},
"max_temperature": {
"value": "最高气温" + max,
"color": "#FF6100"
}
}
}
if type == "baby":
return data_baby
else:
return data_user
# 晚安的json数据
def getNight_json(to_user, type):
content = getApi.getEvDayWanAn()
data_baby = {
"touser": to_user,
"template_id": config.template_id_n.get("id_forBaby"),
"url": "https://music.163.com/",
"topcolor": "#FF0000",
"data": {
"content":
{
"value": content,
"color": "#000000"
},
"like":
{
"value": "时间过得真快 我们在一起的时间又多了一天,晚安宝贝",
"color": "#000000"
}
}
}
data_user = {
"touser": to_user,
"template_id": config.template_id_n.get("id_forUser"),
"url": "https://music.163.com/",
"topcolor": "#FF0000",
"data": {
"content":
{
"value": content,
"color": "#000000"
},
}
}
if type == "baby":
return data_baby
else:
return data_user
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化