修复充值bug
This commit is contained in:
parent
0115d1d194
commit
01a66ff33c
@ -16,7 +16,7 @@ var ServerAddress = "http://localhost:3000"
|
||||
var PayAddress = ""
|
||||
var EpayId = ""
|
||||
var EpayKey = ""
|
||||
var Price = 7
|
||||
var Price = 7.3
|
||||
var Footer = ""
|
||||
var Logo = ""
|
||||
var TopUpLink = ""
|
||||
|
@ -40,7 +40,7 @@ func GetEpayClient() *epay.Client {
|
||||
|
||||
func GetAmount(count float64) float64 {
|
||||
// 别问为什么用float64,问就是这么点钱没必要
|
||||
amount := count * float64(common.Price)
|
||||
amount := count * common.Price
|
||||
return amount
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ func InitOptionMap() {
|
||||
common.OptionMap["PayAddress"] = ""
|
||||
common.OptionMap["EpayId"] = ""
|
||||
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["GitHubClientSecret"] = ""
|
||||
common.OptionMap["WeChatServerAddress"] = ""
|
||||
@ -183,7 +183,7 @@ func updateOptionMap(key string, value string) (err error) {
|
||||
case "EpayKey":
|
||||
common.EpayKey = value
|
||||
case "Price":
|
||||
common.Price, _ = strconv.Atoi(value)
|
||||
common.Price, _ = strconv.ParseFloat(value, 64)
|
||||
case "GitHubClientId":
|
||||
common.GitHubClientId = value
|
||||
case "GitHubClientSecret":
|
||||
|
@ -19,7 +19,7 @@ const SystemSetting = () => {
|
||||
ServerAddress: '',
|
||||
EpayId: '',
|
||||
EpayKey: '',
|
||||
Price: '',
|
||||
Price: 7.3,
|
||||
PayAddress: '',
|
||||
Footer: '',
|
||||
WeChatAuthEnabled: '',
|
||||
@ -90,6 +90,9 @@ const SystemSetting = () => {
|
||||
if (key === 'EmailDomainWhitelist') {
|
||||
value = value.split(',');
|
||||
}
|
||||
if (key === 'Price') {
|
||||
value = parseFloat(value);
|
||||
}
|
||||
setInputs((inputs) => ({
|
||||
...inputs, [key]: value
|
||||
}));
|
||||
@ -142,7 +145,7 @@ const SystemSetting = () => {
|
||||
await updateOption('PayAddress', PayAddress);
|
||||
await updateOption('EpayId', inputs.EpayId);
|
||||
await updateOption('EpayKey', inputs.EpayKey);
|
||||
await updateOption('Price', inputs.Price);
|
||||
await updateOption('Price', "" + inputs.Price);
|
||||
};
|
||||
|
||||
const submitSMTP = async () => {
|
||||
@ -289,7 +292,7 @@ const SystemSetting = () => {
|
||||
placeholder='例如:7,就是7元/美金'
|
||||
value={inputs.Price}
|
||||
name='Price'
|
||||
type='number'
|
||||
|
||||
min={0}
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
|
@ -132,9 +132,9 @@ const TopUp = () => {
|
||||
if (message === 'success') {
|
||||
setAmount(parseInt(data));
|
||||
} else {
|
||||
showError(message);
|
||||
showError(data);
|
||||
// setTopUpCount(parseInt(res.data.count));
|
||||
setAmount(parseInt(data));
|
||||
// setAmount(parseInt(data));
|
||||
}
|
||||
} else {
|
||||
showError(res);
|
||||
@ -179,12 +179,12 @@ const TopUp = () => {
|
||||
</Grid>
|
||||
</Segment>
|
||||
<Segment>
|
||||
<Header as='h3'>在线充值</Header>
|
||||
<Header as='h3'>在线充值,最低1</Header>
|
||||
<Grid columns={2} stackable>
|
||||
<Grid.Column>
|
||||
<Form>
|
||||
<Form.Input
|
||||
placeholder='充值金额,最低10,最高1000'
|
||||
placeholder='充值金额,最低1'
|
||||
name='redemptionCount'
|
||||
type={'number'}
|
||||
value={topUpCount}
|
||||
|
Loading…
Reference in New Issue
Block a user