Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ff8df45f
authored
Sep 09, 2023
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复充值bug
parent
6ca32631
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
11 deletions
+14
-11
common/constants.go
+1
-1
controller/topup.go
+1
-1
model/option.go
+2
-2
web/src/components/SystemSetting.js
+6
-3
web/src/pages/TopUp/index.js
+4
-4
No files found.
common/constants.go
View file @
ff8df45f
...
@@ -16,7 +16,7 @@ var ServerAddress = "http://localhost:3000"
...
@@ -16,7 +16,7 @@ var ServerAddress = "http://localhost:3000"
var
PayAddress
=
""
var
PayAddress
=
""
var
EpayId
=
""
var
EpayId
=
""
var
EpayKey
=
""
var
EpayKey
=
""
var
Price
=
7
var
Price
=
7
.3
var
Footer
=
""
var
Footer
=
""
var
Logo
=
""
var
Logo
=
""
var
TopUpLink
=
""
var
TopUpLink
=
""
...
...
controller/topup.go
View file @
ff8df45f
...
@@ -40,7 +40,7 @@ func GetEpayClient() *epay.Client {
...
@@ -40,7 +40,7 @@ func GetEpayClient() *epay.Client {
func
GetAmount
(
count
float64
)
float64
{
func
GetAmount
(
count
float64
)
float64
{
// 别问为什么用float64,问就是这么点钱没必要
// 别问为什么用float64,问就是这么点钱没必要
amount
:=
count
*
float64
(
common
.
Price
)
amount
:=
count
*
common
.
Price
return
amount
return
amount
}
}
...
...
model/option.go
View file @
ff8df45f
...
@@ -56,7 +56,7 @@ func InitOptionMap() {
...
@@ -56,7 +56,7 @@ func InitOptionMap() {
common
.
OptionMap
[
"PayAddress"
]
=
""
common
.
OptionMap
[
"PayAddress"
]
=
""
common
.
OptionMap
[
"EpayId"
]
=
""
common
.
OptionMap
[
"EpayId"
]
=
""
common
.
OptionMap
[
"EpayKey"
]
=
""
common
.
OptionMap
[
"EpayKey"
]
=
""
common
.
OptionMap
[
"Price"
]
=
strconv
.
Itoa
(
common
.
Price
)
common
.
OptionMap
[
"Price"
]
=
strconv
.
FormatFloat
(
common
.
Price
,
'f'
,
-
1
,
64
)
common
.
OptionMap
[
"GitHubClientId"
]
=
""
common
.
OptionMap
[
"GitHubClientId"
]
=
""
common
.
OptionMap
[
"GitHubClientSecret"
]
=
""
common
.
OptionMap
[
"GitHubClientSecret"
]
=
""
common
.
OptionMap
[
"WeChatServerAddress"
]
=
""
common
.
OptionMap
[
"WeChatServerAddress"
]
=
""
...
@@ -183,7 +183,7 @@ func updateOptionMap(key string, value string) (err error) {
...
@@ -183,7 +183,7 @@ func updateOptionMap(key string, value string) (err error) {
case
"EpayKey"
:
case
"EpayKey"
:
common
.
EpayKey
=
value
common
.
EpayKey
=
value
case
"Price"
:
case
"Price"
:
common
.
Price
,
_
=
strconv
.
Atoi
(
value
)
common
.
Price
,
_
=
strconv
.
ParseFloat
(
value
,
64
)
case
"GitHubClientId"
:
case
"GitHubClientId"
:
common
.
GitHubClientId
=
value
common
.
GitHubClientId
=
value
case
"GitHubClientSecret"
:
case
"GitHubClientSecret"
:
...
...
web/src/components/SystemSetting.js
View file @
ff8df45f
...
@@ -19,7 +19,7 @@ const SystemSetting = () => {
...
@@ -19,7 +19,7 @@ const SystemSetting = () => {
ServerAddress
:
''
,
ServerAddress
:
''
,
EpayId
:
''
,
EpayId
:
''
,
EpayKey
:
''
,
EpayKey
:
''
,
Price
:
''
,
Price
:
7.3
,
PayAddress
:
''
,
PayAddress
:
''
,
Footer
:
''
,
Footer
:
''
,
WeChatAuthEnabled
:
''
,
WeChatAuthEnabled
:
''
,
...
@@ -90,6 +90,9 @@ const SystemSetting = () => {
...
@@ -90,6 +90,9 @@ const SystemSetting = () => {
if
(
key
===
'EmailDomainWhitelist'
)
{
if
(
key
===
'EmailDomainWhitelist'
)
{
value
=
value
.
split
(
','
);
value
=
value
.
split
(
','
);
}
}
if
(
key
===
'Price'
)
{
value
=
parseFloat
(
value
);
}
setInputs
((
inputs
)
=>
({
setInputs
((
inputs
)
=>
({
...
inputs
,
[
key
]:
value
...
inputs
,
[
key
]:
value
}));
}));
...
@@ -142,7 +145,7 @@ const SystemSetting = () => {
...
@@ -142,7 +145,7 @@ const SystemSetting = () => {
await
updateOption
(
'PayAddress'
,
PayAddress
);
await
updateOption
(
'PayAddress'
,
PayAddress
);
await
updateOption
(
'EpayId'
,
inputs
.
EpayId
);
await
updateOption
(
'EpayId'
,
inputs
.
EpayId
);
await
updateOption
(
'EpayKey'
,
inputs
.
EpayKey
);
await
updateOption
(
'EpayKey'
,
inputs
.
EpayKey
);
await
updateOption
(
'Price'
,
inputs
.
Price
);
await
updateOption
(
'Price'
,
""
+
inputs
.
Price
);
};
};
const
submitSMTP
=
async
()
=>
{
const
submitSMTP
=
async
()
=>
{
...
@@ -289,7 +292,7 @@ const SystemSetting = () => {
...
@@ -289,7 +292,7 @@ const SystemSetting = () => {
placeholder
=
'例如:7,就是7元/美金'
placeholder
=
'例如:7,就是7元/美金'
value
=
{
inputs
.
Price
}
value
=
{
inputs
.
Price
}
name
=
'Price'
name
=
'Price'
type
=
'number'
min
=
{
0
}
min
=
{
0
}
onChange
=
{
handleInputChange
}
onChange
=
{
handleInputChange
}
/
>
/
>
...
...
web/src/pages/TopUp/index.js
View file @
ff8df45f
...
@@ -132,9 +132,9 @@ const TopUp = () => {
...
@@ -132,9 +132,9 @@ const TopUp = () => {
if
(
message
===
'success'
)
{
if
(
message
===
'success'
)
{
setAmount
(
parseInt
(
data
));
setAmount
(
parseInt
(
data
));
}
else
{
}
else
{
showError
(
message
);
showError
(
data
);
// setTopUpCount(parseInt(res.data.count));
// setTopUpCount(parseInt(res.data.count));
setAmount
(
parseInt
(
data
));
//
setAmount(parseInt(data));
}
}
}
else
{
}
else
{
showError
(
res
);
showError
(
res
);
...
@@ -179,12 +179,12 @@ const TopUp = () => {
...
@@ -179,12 +179,12 @@ const TopUp = () => {
<
/Grid
>
<
/Grid
>
<
/Segment
>
<
/Segment
>
<
Segment
>
<
Segment
>
<
Header
as
=
'h3'
>
在线充值
<
/Header
>
<
Header
as
=
'h3'
>
在线充值
,最低
1
<
/Header
>
<
Grid
columns
=
{
2
}
stackable
>
<
Grid
columns
=
{
2
}
stackable
>
<
Grid
.
Column
>
<
Grid
.
Column
>
<
Form
>
<
Form
>
<
Form
.
Input
<
Form
.
Input
placeholder
=
'充值金额,最低1
0,最高1000
'
placeholder
=
'充值金额,最低1'
name
=
'redemptionCount'
name
=
'redemptionCount'
type
=
{
'number'
}
type
=
{
'number'
}
value
=
{
topUpCount
}
value
=
{
topUpCount
}
...
...
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