Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
financial-system
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xianyang
financial-system
Commits
effdc312
Commit
effdc312
authored
Mar 31, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop/xp' into development
# Conflicts: # libs/functions.py
parents
c59d6a49
acd77a5f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
42 deletions
+66
-42
views.py
app/api/account/views.py
+1
-1
crud.py
app/api/role/crud.py
+0
-1
crud.py
app/api/statement/crud.py
+22
-27
views.py
app/api/statement/views.py
+4
-4
functions.py
libs/functions.py
+13
-8
main.py
main.py
+26
-1
No files found.
app/api/account/views.py
View file @
effdc312
...
@@ -11,7 +11,7 @@ router = APIRouter()
...
@@ -11,7 +11,7 @@ router = APIRouter()
@
router
.
post
(
"/create"
)
@
router
.
post
(
"/create"
)
def
create_account
(
data
:
schemas
.
AccountCreate
,
token
=
Depends
(
login_required
)):
def
create_account
(
data
:
schemas
.
AccountCreate
,
token
=
Depends
(
login_required
)):
"""添加账户"""
"""添加账户"""
db_info
=
crud
.
get_account
(
data
.
name
)
db_info
=
crud
.
get_account
(
data
.
name
)
if
db_info
:
if
db_info
:
...
...
app/api/role/crud.py
View file @
effdc312
...
@@ -3,7 +3,6 @@ from fastapi import HTTPException, status
...
@@ -3,7 +3,6 @@ from fastapi import HTTPException, status
from
sqlalchemy.orm
import
Session
from
sqlalchemy.orm
import
Session
from
sqlalchemy
import
func
from
sqlalchemy
import
func
from
app.api.role
import
schemas
from
app.api.role
import
schemas
from
libs.functions
import
wrapper_out
from
models
import
roles
as
models
from
models
import
roles
as
models
...
...
app/api/statement/crud.py
View file @
effdc312
This diff is collapsed.
Click to expand it.
app/api/statement/views.py
View file @
effdc312
...
@@ -21,9 +21,9 @@ router = APIRouter()
...
@@ -21,9 +21,9 @@ router = APIRouter()
@
router
.
get
(
"/recharge/list"
)
@
router
.
get
(
"/recharge/list"
)
def
statement_recharge_list
(
page
:
Optional
[
int
]
=
0
,
size
:
Optional
[
int
]
=
10
,
order_number
:
Optional
[
str
]
=
""
,
u
ser_
id
:
Optional
[
int
]
=
""
,
sid
:
Optional
[
str
]
=
""
,
start_time
:
Optional
[
str
]
=
''
,
end_time
:
Optional
[
str
]
=
""
,
types
:
Optional
[
str
]
=
""
,
reference_type
:
Optional
[
str
]
=
""
,
month_type
:
Optional
[
int
]
=
""
,
token
=
Depends
(
login_required
)):
def
statement_recharge_list
(
page
:
Optional
[
int
]
=
0
,
size
:
Optional
[
int
]
=
10
,
order_number
:
Optional
[
str
]
=
""
,
u
u
id
:
Optional
[
int
]
=
""
,
sid
:
Optional
[
str
]
=
""
,
start_time
:
Optional
[
str
]
=
''
,
end_time
:
Optional
[
str
]
=
""
,
types
:
Optional
[
str
]
=
""
,
reference_type
:
Optional
[
str
]
=
""
,
month_type
:
Optional
[
int
]
=
""
,
token
=
Depends
(
login_required
)):
"""充值报表列表"""
"""充值报表列表"""
total
,
statement_list
,
money
=
RechargeStatement
()
.
query_data
(
page
,
size
,
order_number
,
u
ser_
id
,
sid
,
start_time
,
end_time
,
types
,
reference_type
,
month_type
)
total
,
statement_list
,
money
=
RechargeStatement
()
.
query_data
(
page
,
size
,
order_number
,
u
u
id
,
sid
,
start_time
,
end_time
,
types
,
reference_type
,
month_type
)
return
HttpResultResponse
(
total
=
total
,
count
=
float
(
money
),
data
=
statement_list
)
return
HttpResultResponse
(
total
=
total
,
count
=
float
(
money
),
data
=
statement_list
)
...
@@ -36,9 +36,9 @@ def statement_derive_excel(data: schemas.StatementList, request: Request, db: Se
...
@@ -36,9 +36,9 @@ def statement_derive_excel(data: schemas.StatementList, request: Request, db: Se
@
router
.
get
(
"/userWithdrawal/list"
)
@
router
.
get
(
"/userWithdrawal/list"
)
def
user_withdrawal_list
(
page
:
Optional
[
int
]
=
0
,
size
:
Optional
[
int
]
=
10
,
name
:
Optional
[
str
]
=
''
,
status
:
Optional
[
int
]
=
''
,
start_time
:
Optional
[
str
]
=
''
,
end_time
:
Optional
[
str
]
=
""
,
month_type
:
Optional
[
int
]
=
""
,
token
=
Depends
(
login_required
)):
def
user_withdrawal_list
(
page
:
Optional
[
int
]
=
0
,
size
:
Optional
[
int
]
=
10
,
uuid
:
Optional
[
int
]
=
''
,
status
:
Optional
[
int
]
=
''
,
start_time
:
Optional
[
str
]
=
''
,
end_time
:
Optional
[
str
]
=
""
,
month_type
:
Optional
[
int
]
=
""
,
token
=
Depends
(
login_required
)):
"""用户提现列表"""
"""用户提现列表"""
total
,
statement_list
,
money
=
WithdrawStatement
()
.
get_user_withdraw_cash
(
page
,
size
,
name
,
status
,
start_time
,
end_time
,
month_type
)
total
,
statement_list
,
money
=
WithdrawStatement
()
.
get_user_withdraw_cash
(
page
,
size
,
uuid
,
status
,
start_time
,
end_time
,
month_type
)
return
HttpResultResponse
(
total
=
total
,
count
=
float
(
money
),
data
=
statement_list
)
return
HttpResultResponse
(
total
=
total
,
count
=
float
(
money
),
data
=
statement_list
)
...
...
libs/functions.py
View file @
effdc312
...
@@ -85,9 +85,7 @@ def wrapper_out():
...
@@ -85,9 +85,7 @@ def wrapper_out():
param
.
size
=
param
.
size
if
param
.
size
else
10
param
.
size
=
param
.
size
if
param
.
size
else
10
ret
=
func
(
db
,
param
)
ret
=
func
(
db
,
param
)
return
ret
return
ret
return
inner
return
inner
return
wrapper
return
wrapper
...
@@ -117,9 +115,16 @@ def get_ip():
...
@@ -117,9 +115,16 @@ def get_ip():
def
get_month_last_month
(
month_type
):
def
get_month_last_month
(
month_type
):
last_month
=
0
last_month
=
0
if
month_type
==
2
:
if
month_type
==
2
:
month_date
=
datetime
.
now
()
.
date
()
-
relativedelta
(
months
=
1
)
month_date
=
datetime
.
now
()
.
date
()
-
relativedelta
(
months
=
1
)
last_month
=
month_date
.
strftime
(
"
%
Y
%
m"
)
last_month
=
month_date
.
strftime
(
"
%
Y
%
m"
)
now_month
=
datetime
.
now
()
.
strftime
(
"
%
Y
%
m"
)
now_month
=
datetime
.
now
()
.
strftime
(
"
%
Y
%
m"
)
return
last_month
,
now_month
return
last_month
,
now_month
def
time_format
(
utc_timestamp
:
int
):
days
=
(
utc_timestamp
+
3600
*
8
)
%
86400
hours
=
int
(
days
/
3600
)
time_str
=
hours
return
time_str
\ No newline at end of file
main.py
View file @
effdc312
import
time
from
datetime
import
timedelta
,
datetime
import
uvicorn
import
uvicorn
from
fastapi
import
FastAPI
from
fastapi
import
FastAPI
,
Depends
from
jose
import
jwt
from
app.api.api_v1
import
api_router
from
app.api.api_v1
import
api_router
from
starlette.middleware.cors
import
CORSMiddleware
from
starlette.middleware.cors
import
CORSMiddleware
from
fastapi
import
Request
from
core.config.env
import
env
from
core.dependencies.auth_dependen
import
create_access_token
from
libs.functions
import
time_format
from
libs.token_verify
import
oauth2_scheme
app
=
FastAPI
()
app
=
FastAPI
()
...
@@ -15,6 +25,21 @@ app.add_middleware(
...
@@ -15,6 +25,21 @@ app.add_middleware(
allow_methods
=
[
'*'
],
# 设置允许跨域的http方法,比如 get、post、put等。
allow_methods
=
[
'*'
],
# 设置允许跨域的http方法,比如 get、post、put等。
allow_headers
=
[
'*'
])
# 允许跨域的headers,可以用来鉴别来源等作用。
allow_headers
=
[
'*'
])
# 允许跨域的headers,可以用来鉴别来源等作用。
@
app
.
middleware
(
"http"
)
async
def
add_process_time_header
(
request
:
Request
,
call_next
):
hs
=
request
.
headers
token
=
hs
.
get
(
"authorization"
)
.
replace
(
'Bearer'
,
''
)
.
replace
(
' '
,
''
)
start_time
=
time
.
time
()
response
=
await
call_next
(
request
)
process_time
=
time
.
time
()
-
start_time
response
.
headers
[
"X-Process-Time"
]
=
str
(
process_time
)
if
token
:
payload
=
jwt
.
decode
(
token
,
env
.
SECRET_KEY
,
algorithms
=
[
env
.
ALGORITHM
])
timestamp
=
payload
.
get
(
"exp"
)
access_token_expires
=
timedelta
(
hours
=
time_format
(
timestamp
))
create_access_token
({
'username'
:
payload
.
get
(
"xup"
),
'password'
:
payload
.
get
(
"password"
)},
expires_delta
=
access_token_expires
)
#更新token时间
return
response
app
.
include_router
(
api_router
,
prefix
=
"/api"
)
# 路由
app
.
include_router
(
api_router
,
prefix
=
"/api"
)
# 路由
...
...
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