Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
F
fund_report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
fund_report
Commits
acb12545
Commit
acb12545
authored
Jan 15, 2021
by
pengxiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新建自定义模版
parent
ec03c6d1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
template_manage_service.py
app/service/template_manage_service.py
+15
-3
auth.py
app/utils/auth.py
+1
-1
No files found.
app/service/template_manage_service.py
View file @
acb12545
...
@@ -57,10 +57,22 @@ def get_default_template(args):
...
@@ -57,10 +57,22 @@ def get_default_template(args):
def
add_template
(
args
):
def
add_template
(
args
):
"""新建模版"""
"""新建模版"""
type
=
args
.
get
(
'type'
)
custom_template
=
json
.
loads
(
args
.
get
(
'custom_template'
))
with
TAMP_SQL
(
tamp_diagnose_app_engine
)
as
tamp_diagnose_app
:
with
TAMP_SQL
(
tamp_diagnose_app_engine
)
as
tamp_diagnose_app
:
tamp_diagnose_session
=
tamp_diagnose_app
.
session
tamp_diagnose_session
=
tamp_diagnose_app
.
session
args
[
'id'
]
=
str
(
uuid
.
uuid4
())
args
[
'id'
]
=
str
(
uuid
.
uuid4
())
args
[
'default_template'
]
=
json
.
dumps
(
hold_default_template
)
if
type
==
1
:
allowed_keys
=
hold_default_template
.
keys
()
for
key
in
list
(
custom_template
.
keys
()):
if
key
not
in
allowed_keys
:
custom_template
.
pop
(
key
)
elif
type
==
2
:
allowed_keys
=
diagnose_default_template
.
keys
()
for
key
in
list
(
custom_template
.
keys
()):
if
key
not
in
allowed_keys
:
custom_template
.
pop
(
key
)
args
[
'custom_template'
]
=
json
.
dumps
(
custom_template
)
args
[
'create_by'
]
=
args
.
get
(
'ifa_id'
)
args
[
'create_by'
]
=
args
.
get
(
'ifa_id'
)
args
[
'create_time'
]
=
datetime
.
datetime
.
now
()
args
[
'create_time'
]
=
datetime
.
datetime
.
now
()
fund_report_manange
=
FundReportManange
(
**
args
)
fund_report_manange
=
FundReportManange
(
**
args
)
...
@@ -68,7 +80,7 @@ def add_template(args):
...
@@ -68,7 +80,7 @@ def add_template(args):
def
update_template
(
args
):
def
update_template
(
args
):
"""更新模版"""
"""更新模版"""
template_data
=
args
.
get
(
'template_data'
)
template_data
=
json
.
loads
(
args
.
get
(
'template_data'
)
)
with
TAMP_SQL
(
tamp_diagnose_app_engine
)
as
tamp_diagnose_app
:
with
TAMP_SQL
(
tamp_diagnose_app_engine
)
as
tamp_diagnose_app
:
tamp_diagnose_session
=
tamp_diagnose_app
.
session
tamp_diagnose_session
=
tamp_diagnose_app
.
session
res
=
tamp_diagnose_session
.
query
(
FundReportManange
)
.
filter
(
and_
(
res
=
tamp_diagnose_session
.
query
(
FundReportManange
)
.
filter
(
and_
(
...
@@ -79,7 +91,7 @@ def update_template(args):
...
@@ -79,7 +91,7 @@ def update_template(args):
return
False
return
False
if
res
[
0
]
.
default_template
:
if
res
[
0
]
.
default_template
:
allowed_keys
=
json
.
loads
(
res
[
0
]
.
default_template
)
.
keys
()
allowed_keys
=
json
.
loads
(
res
[
0
]
.
default_template
)
.
keys
()
for
key
,
value
in
template_data
.
items
(
):
for
key
in
list
(
template_data
.
keys
()
):
if
key
not
in
allowed_keys
:
if
key
not
in
allowed_keys
:
template_data
.
pop
(
key
)
template_data
.
pop
(
key
)
# 更新默认模版
# 更新默认模版
...
...
app/utils/auth.py
View file @
acb12545
...
@@ -18,6 +18,6 @@ def login_require(func):
...
@@ -18,6 +18,6 @@ def login_require(func):
ifa_id
=
redis
.
get
(
token
)
ifa_id
=
redis
.
get
(
token
)
if
not
ifa_id
:
if
not
ifa_id
:
return
{
"code"
:
'9005'
,
"message"
:
"请登录"
,
"attributes"
:
[]}
return
{
"code"
:
'9005'
,
"message"
:
"请登录"
,
"attributes"
:
[]}
g
.
ifa_id
=
ifa_id
.
decode
()
.
replace
(
'
\
'
'
,
''
)
g
.
ifa_id
=
ifa_id
.
decode
()
.
replace
(
'
\
"
'
,
''
)
return
func
(
*
args
,
**
kwargs
)
return
func
(
*
args
,
**
kwargs
)
return
auth
return
auth
\ No newline at end of file
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