def GetClassCSV(semester, reminder): obtainedClass.clear() global requestid requestid = session.get("requestid") setReminder(reminder) setFirstWeekDate(CONST.FIRST_WEEK_DATE[semester]) setClassInfo() setClassTime() uniteSetting(); classInfoHandle(); icsCreateAndSave(); print('课程表已保存至脚本目录下的 class.ics 中,你现在可以导入了:)') result = { "link": "/output/class_" + requestid +".ics", "obtained_class": obtainedClass, "reminder": reminder } with open (DEPLOY_PATH + 'log/success.log', 'a+', encoding='utf-8') as f: f.write(Utils.getCurrentDateTime() + ',' + requestid + ',' + session.get('realname') + ',' + reminder + ',' + str(obtainedClass)+'\n') f.close() return result
def Send(msg, contact, withFile): global RECIEVERS requestid = session.get("requestid") if session.get( "requestid") is not None else "N/A" realname = session.get("realname") if session.get( "realname") is not None else "N/A" if (msg is None): msg = "" if (contact is None or contact == ''): contact = "匿名用户" if (withFile): contact = contact + " 📎" for one in RECIEVERS: text = "`<ECNU-class2ics>`\n收到来自 *" + contact + "* 的反馈:\n\n" + msg + "\n\n`requestid: " + requestid + "`" postUrl = "https://api.telegram.org/bot" + BOT_TOKEN + "/sendMessage?parse_mode=markdown&chat_id=" + one + "&text=" + text result = requests.post(postUrl) print(result.content) with open(DEPLOY_PATH + 'log/feedback.log', 'a+', encoding='utf-8') as f: f.write(Utils.getCurrentDateTime() + ',' + requestid + ',' + realname + ',' + contact + ',' + msg + '\n') f.close() return json.loads(result.content, encoding="unicode")