Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
admin-backend
Project
Project
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
Odysseus
admin-backend
Commits
d4f1eda5
Commit
d4f1eda5
authored
Mar 18, 2024
by
brent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify user level
parent
8d5c1b47
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
funds.go
controllers/funds.go
+17
-6
funds.go
models/funds.go
+1
-0
No files found.
controllers/funds.go
View file @
d4f1eda5
...
...
@@ -26,12 +26,6 @@ func (server *FundsController) Recharge() {
server
.
respond
(
http
.
StatusUnauthorized
,
err
.
Error
())
return
}
checkUser
:=
&
models
.
User
{
Id
:
info
.
UserID
}
err
=
mysql
.
GetMysqlInstace
()
.
Ormer
.
Read
(
checkUser
)
if
err
!=
nil
{
server
.
respond
(
models
.
BusinessFailed
,
"用户不存在"
)
return
}
var
chargeRequest
models
.
ChargeRequest
body
:=
server
.
Ctx
.
Input
.
RequestBody
...
...
@@ -42,6 +36,23 @@ func (server *FundsController) Recharge() {
return
}
if
info
.
Role
!=
1
&&
info
.
Role
!=
2
&&
chargeRequest
.
PaymentMethod
!=
models
.
ManualPay
{
server
.
respond
(
models
.
BusinessFailed
,
"只有超级管理员或系统管理员允许手动充值"
)
return
}
checkUser
:=
&
models
.
User
{
Id
:
info
.
UserID
}
cond
:=
"id"
if
chargeRequest
.
Mail
!=
""
{
checkUser
=
&
models
.
User
{
Id
:
info
.
UserID
}
cond
=
"mail"
}
err
=
mysql
.
GetMysqlInstace
()
.
Ormer
.
Read
(
checkUser
,
cond
)
if
err
!=
nil
{
server
.
respond
(
models
.
BusinessFailed
,
"用户不存在"
)
return
}
timestamp
:=
time
.
Now
()
amount
:=
int64
(
chargeRequest
.
Amount
*
1000000
)
//charge := models.ChargeRecord{
...
...
models/funds.go
View file @
d4f1eda5
...
...
@@ -206,6 +206,7 @@ func (m PayStatus) EnString() string {
type
ChargeRequest
struct
{
Amount
float64
`json:"amount"`
PaymentMethod
PayMethodType
`json:"pay_method"`
Mail
string
`json:"mail"`
}
type
ChargeRecord
struct
{
...
...
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