def chkClassRoom(checkDate=None,sendMsg=True):
if checkDate ==None:
checkDate=datetime.now() + timedelta(days=1)
result = ""
mailDetail=""
total=0
invalid=0
camera = upper(getCamera(schoolId))
courseUrl = edu_api_course.format(schoolId, checkDate, '00:00', '23:59')
jsonData = json.loads(urllib2.urlopen(courseUrl, timeout=10).read())
if jsonData["status"]=="0":
mailDetail = "<div><br></div><div><span><div><table border=\"1\"bordercolor=\"#000000\"cellpadding=\"2\"cellspacing=\"0\"style=\"font-size: 10pt; border-collapse:collapse; border:none\"width=\"50%\"><caption><font size=\"2\"face=\"Verdana\">test</font></caption><tbody><tr><td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><font size=\"2\"face=\"Verdana\"><div> ??</div></font></td><td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><font size=\"2\"face=\"Verdana\"><div> ????</div></font></td><td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><font size=\"2\"face=\"Verdana\"><div> ??</div></font></td><td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><font size=\"2\"face=\"Verdana\"><div> ????</div></font></td><td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><font size=\"2\"face=\"Verdana\"><div> ??</div></font></td></tr>"
total=len(jsonData["data"])
for data in jsonData["data"]:
if "\"" + upper(data["classRoom"]) + "\"" not in camera \
and "\"" + upper(data["classRoom"]).replace("??","") + "\"" not in camera \
and "\"" + upper(data["classRoom"])+"??" + "\"" not in camera:
invalid+=1
result += json.dumps(data) + "\n"
logging.error("classRoom??" + json.dumps(data))
mailDetail += "<tr>"
mailDetail += "<td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><span>{0}</span></td>".format(invalid)
mailDetail += "<td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><span>{0}</span></td>".format(data["courseNo"])
mailDetail += "<td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><span>{0}</span></td>".format(data["classIdx"])
mailDetail += "<td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><span>{0}</span></td>".format(data["startTime"])
mailDetail += "<td width=\"20%\"style=\"border: solid 1 #000000\"nowrap=\"\"><span>{0}</span></td>".format(data["classRoom"])
mailDetail+="</tr>"
mailDetail+="</tbody></table></div></span></div>"
if len(result) > 0:
if sendMsg==True:
errmsg = "??:{0}\n ??:{1}\n ????:{2}\n ????:\n{3}\n"\
.format(schoolId,checkDate,courseUrl,mailDetail)
sendMailNotifier("edu_room", "edu_room", errmsg)
return total,invalid,mailDetail
else:
return total,invalid,""
# 02 07:0-23:00 10???????????
评论列表
文章目录