Skip to content

Commit 503691f

Browse files
author
hustcc
committed
webhook 接口调试完毕
1 parent cc6492d commit 503691f

19 files changed

+247
-27934
lines changed

.gitignore

+63-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,65 @@
1-
*.pyc
2-
.settings
3-
.project
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
5+
# C extensions
6+
*.so
7+
8+
# Distribution / packaging
9+
.Python
10+
env/
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib64/
18+
sdist/
19+
var/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
24+
# PyInstaller
25+
# Usually these files are written by a python script from a template
26+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
27+
*.manifest
28+
*.spec
29+
30+
# Installer logs
31+
pip-log.txt
32+
pip-delete-this-directory.txt
33+
34+
# Unit test / coverage reports
35+
htmlcov/
36+
.tox/
37+
.coverage
38+
.coverage.*
39+
.cache
40+
nosetests.xml
41+
coverage.xml
42+
*,cover
43+
44+
# Translations
45+
*.mo
46+
*.pot
47+
48+
# Django stuff:
49+
*.log
50+
51+
# Sphinx documentation
52+
docs/_build/
53+
54+
# PyBuilder
55+
target/
56+
457
.pydevproject
58+
.project
59+
.settings
60+
61+
node_modules/*
62+
celerybeat*
63+
64+
config.py
565
git_webhook.db
6-
nohup.out
7-
app/config.py
8-
node_modules

app/config_example.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
@author: hustcc
66
'''
77

8+
# for sqlite
9+
DATABASE_URI = 'sqlite:///git_webhook.db'
10+
# for mysql
11+
# DATABASE_URI = 'mysql://dev:[email protected]/git_webhook'
812

9-
DATABASE_URI = 'mysql://dev:[email protected]/git_webhook'
10-
11-
12-
CELERY_BROKER_URL = 'redis://localhost:6379/0'
13-
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
13+
CELERY_BROKER_URL = 'redis://:[email protected]:6379/0'
14+
CELERY_RESULT_BACKEND = 'redis://:[email protected]:6379/0'
1415

1516

1617
GITHUB_CLIENT_ID = 'b6e751cc48d664240467'

app/database/model.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class WebHook(db.Model, BaseMethod):
7979

8080
key = db.Column(db.String(32), unique=True) # 用于webhook,保证私密,直接用 md5 salt
8181

82-
status = db.Column(db.String(1)) # 1: ing, 2:error, 3: success
82+
status = db.Column(db.String(1)) # 1:waiting, 2:ing, 3:error, 4:success, 5:except, other
8383

8484
def dict(self, with_key=False):
8585
rst = {}
@@ -95,12 +95,16 @@ def dict(self, with_key=False):
9595
rst['status'] = self.status
9696
return rst
9797

98+
def updateStatus(self, status):
99+
self.status = status
100+
self.save()
101+
98102

99103
class History(db.Model, BaseMethod):
100104
'''push history'''
101105
#md5, notice, output, push_name, push_email, success, add_time
102106
id = db.Column(db.Integer, primary_key=True)
103-
status = db.Column(db.String(1)) # 1: ing, 2: error, 3: success
107+
status = db.Column(db.String(1)) # 1:waiting, 2:ing, 3:error, 4:success, 5:except, other
104108
shell_log = db.Column(db.Text) # hook shell log
105109

106110
data = db.Column(db.Text) # git push data
@@ -121,3 +125,7 @@ def dict(self):
121125

122126
rst['webhook_id'] = self.webhook_id
123127
return rst
128+
129+
def updateStatus(self, status):
130+
self.status = status
131+
self.save()

0 commit comments

Comments
 (0)