Skip to content

Commit

Permalink
Merge branch 'master' of github.com:jianghc724/HappyXueTang
Browse files Browse the repository at this point in the history
  • Loading branch information
lilygeek committed Dec 31, 2016
2 parents dfeb58c + 7814cff commit ed87233
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions HappyXueTang/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def get_url(path, params=None):
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'

CELERYBEAT_SCHEDULE = {
'add-every-2-hours': {
'remind-every-6-hours': {
'task': 'wechat.tasks.get_notice',
'schedule': timedelta(minutes=1)
'schedule': timedelta(minutes=360)
},
}
6 changes: 4 additions & 2 deletions user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import requests
import json
import html
from datetime import datetime

from wechat.models import *
Expand Down Expand Up @@ -182,11 +183,12 @@ def get(self):
'notice_detail':[],
'teacher': cous[0].teacher,
}

for notice in notices:
result['notice_detail'].append({
'title': notice['title'],
'title': html.unescape(notice['title']),
'publishtime': notice['publishtime'],
'content': notice['content'],
'content': html.unescape(notice['content']),
})
return result
else:
Expand Down
Empty file added wechat/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion wechat/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_notice():
access_json = r.json()
# print(access_json)
access_token = access_json['access_token']
return_str = "未读公告:" + str(total_notice) + ",未交作业:" + str(total_homework)
return_str = "Notices:" + str(total_notice) + " Homework:" + str(total_homework)
print (return_str)
we_addr = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" + access_token
we_data = {
Expand Down

0 comments on commit ed87233

Please sign in to comment.