Skip to content

Commit

Permalink
20200612更新
Browse files Browse the repository at this point in the history
  • Loading branch information
AragonSnow committed Jun 12, 2020
1 parent 847c202 commit fb25316
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 122 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Build Image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
publish: true
imageName: asdaragon/qiandao # dockerid/imageName
platform: linux/arm64,linux/amd64 # 你准备构建的镜像平台
tag: 20200606,latest
tag: 20200612,latest
dockerHubUser: ${{ secrets.DOCKER_USERNAME }} # docker hub userid 在setting创建secrets name=DOCKER_USERNAME value=dockerid
dockerHubPassword: ${{ secrets.DOCKER_PASSWORD }} # docker hub password,在setting创建secrets name=DOCKER_PASSWORD value=dockerpassword
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ docker地址:[https://hub.docker.com/r/asdaragon/qiandao](https://hub.docker.c

docker部署命令:``` docker run -d --name qiandao -p 12345:80 -v $(pwd)/qiandao/config:/usr/src/app/config asdaragon/qiandao ```

## 2020.6.12 更新
1. 定时日志BUG太多,修不过来,取消此功能
2. 修复用户不存在时登录500错误

## 2020.6.11 更新
1. 修复MySQL的支持,不需要手动更新Mysql数据库

Expand Down
84 changes: 0 additions & 84 deletions logdaily.py

This file was deleted.

8 changes: 6 additions & 2 deletions web/handlers/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ def post(self):
return

user_try = self.db.user.get(email=email, fields=('id', 'role', 'status'))
if (user_try['status'] != 'Enable') and (user_try['role'] != 'admin'):
self.render('login.html', password_error=u'账号已被禁用,请联系管理员', email=email)
if (user_try):
if (user_try['status'] != 'Enable') and (user_try['role'] != 'admin'):
self.render('login.html', password_error=u'账号已被禁用,请联系管理员', email=email)
return
else:
self.render('login.html', password_error=u'不存在此邮箱或密码错误', email=email)
return

if self.db.user.challenge(email, password):
Expand Down
50 changes: 27 additions & 23 deletions web/handlers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def post(self, userid):
task['pushsw']["pushen"] = False
tasks.append(task)
temp = self.db.user.get(userid, fields=('noticeflg'))
logtime = json.loads(self.db.user.get(userid, fields=('logtime'))['logtime'])
#logtime = json.loads(self.db.user.get(userid, fields=('logtime'))['logtime'])
env = json.loads(self.request.body_arguments['env'][0])

barksw_flg = 1 if ("barksw" in env) else 0
Expand All @@ -159,39 +159,43 @@ def post(self, userid):
| (handpush_fail_flg << 2) \
| (autopush_succ_flg << 1) \
| (autopush_fail_flg)
logtime['en'] = True if ('logensw' in env) else False
logtime['time'] = env['timevalue']
logtime['schanEn'] = True if ('schanlogsw' in env) else False
logtime['WXPEn'] = True if ('wxpusherlogsw' in env) else False

# logtime['en'] = True if ('logensw' in env) else False
# logtime['time'] = ""
# logtime['schanEn'] = True if ('schanlogsw' in env) else False
# logtime['WXPEn'] = True if ('wxpusherlogsw' in env) else False

Nextlogtime={
"sw" : True,
"time" : logtime['time'],
"randsw" : False,
"tz1" : 0,
"tz2" : 0
}
next_ts = calNextTimestamp(Nextlogtime, True)
logtime['ts'] = next_ts
# Nextlogtime={
# "sw" : True,
# "time" : logtime['time'],
# "randsw" : False,
# "tz1" : 0,
# "tz2" : 0
# }
# next_ts = calNextTimestamp(Nextlogtime, True)
# logtime['ts'] = next_ts

for e in env:
temp = re.findall(r"(.+?)logen", e)
if len(temp) > 0:
taskid = int(temp[0])
for task in tasks:
if (taskid == task["id"]):
task['pushsw']["logen"] = True

# for e in env:
# temp = re.findall(r"(.+?)logen", e)
# if len(temp) > 0:
# taskid = int(temp[0])
# for task in tasks:
# if (taskid == task["id"]):
# task['pushsw']["logen"] = True

for e in env:
temp = re.findall(r"(.+?)pushen", e)
if len(temp) > 0:
taskid = int(temp[0])
for task in tasks:
if (taskid == task["id"]):
task['pushsw']["pushen"] = True

self.db.user.mod(userid, noticeflg=flg, logtime=json.dumps(logtime))
#self.db.user.mod(userid, noticeflg=flg, logtime=json.dumps(logtime))
self.db.user.mod(userid, noticeflg=flg)
for task in tasks:
self.db.task.mod(task["id"], pushsw=json.dumps(task['pushsw']))

except Exception as e:
self.render('tpl_run_failed.html', log=e)
return
Expand Down
10 changes: 5 additions & 5 deletions web/tpl/user_register_pushsw.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h2 class="text-center">推送设置</h2>
</label>
</div>

<label>定时日志设置:</label>
<!-- <label>定时日志设置:</label>
<div class="checkbox">
<label>
<input type="checkbox" id="logensw" name="logensw" {% if logtime.en %} checked="" {% endif %}>总开关
Expand All @@ -59,15 +59,15 @@ <h2 class="text-center">推送设置</h2>
<div>定时日志推送时间:
<input type="time" id="timevalue" value="{{ logtime.time }}" name='timevalue', step="1" />
</div>
</div> -->

<div id="taskpushsw">
<table class="table table-hover">
<thead>
<tr>
<th title="签到网站平台名称">任务名称</th>
<th style="text-align:center" title="签到成功/失败次数">任务推送开关</th>
<th title="上次签到成功时间">定时日志开关</th>
<!-- <th title="上次签到成功时间">定时日志开关</th> -->
</tr>
</thead>
<tbody>
Expand All @@ -89,11 +89,11 @@ <h2 class="text-center">推送设置</h2>
<input type="checkbox" name="{{ task.id }} pushen" {% if task.pushsw.pushen %} checked="" {% endif %} value="1">
</label>
</td>
<td>
<!-- <td>
<label>
<input type="checkbox" name="{{ task.id }} logen" {% if task.pushsw.logen %} checked="" {% endif %} value="1">
</label>
</td>
</td> -->
</tr>
{% endfor %}
</tbody>
Expand Down
7 changes: 0 additions & 7 deletions worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

logger = logging.getLogger('qiandao.worker')

import logdaily

class MainWorker(object):
def __init__(self):
self.running = False
Expand All @@ -46,18 +44,13 @@ def __call__(self):
if self.running:
return
self.running = self.run()
self.logscheduler()
def done(future):
self.running = None
success, failed = future.result()
if success or failed:
logger.info('%d task done. %d success, %d failed' % (success+failed, success, failed))
return
self.running.add_done_callback(done)

def logscheduler(self):
converter = logdaily.logdaily()
converter.logpusher()

@gen.coroutine
def run(self):
Expand Down

0 comments on commit fb25316

Please sign in to comment.