Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
project-api
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
project-api
Commits
c5bb270b
Commit
c5bb270b
authored
Mar 31, 2018
by
fangzhipeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加日志模块
parent
20577d5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
application.py
application.py
+3
-1
common/sms/sms_service.py
common/sms/sms_service.py
+3
-3
No files found.
application.py
View file @
c5bb270b
...
...
@@ -8,8 +8,10 @@ from common.middleware import PrefixMiddleware
from
config
import
config
from
daylife.record_service
import
record
from
daylife.user_service
import
user
import
logging
sys
.
stdout
=
io
.
TextIOWrapper
(
sys
.
stdout
.
buffer
,
encoding
=
'utf8'
)
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
# sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf8')
app
=
Flask
(
__name__
)
app
.
wsgi_app
=
PrefixMiddleware
(
app
.
wsgi_app
,
prefix
=
'/api'
)
# app.register_blueprint(weather)
...
...
common/sms/sms_service.py
View file @
c5bb270b
# coding=utf-8
import
logging
import
uuid
from
common.sms
import
demo_sms_send
,
sms_mapping
...
...
@@ -12,13 +13,12 @@ def send_verify_code(phone, verify_code):
template_code
=
getattr
(
sms_mapping
,
'verify_code'
)[
'aliyun'
][
'template_code'
]
sign_name
=
getattr
(
sms_mapping
,
'verify_code'
)[
'aliyun'
][
'sign_name'
]
# {"code": 1234}
params
=
"{
\"
code
\"
:
"
+
verify_code
+
"}"
params
=
"{
\"
code
\"
:
\"
"
+
verify_code
+
"
\
"
}"
res
=
demo_sms_send
.
send_sms
(
uuid
.
uuid1
(),
phone
,
sign_name
,
template_code
,
params
)
logging
.
info
(
'发送短信'
+
str
(
res
))
if
res
[
'Code'
]
==
'OK'
:
print
(
'发送成功!'
)
return
'ok'
else
:
print
(
'发送失败'
)
return
'fail'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment