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
569c124b
authored
Jun 15, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: able to disable quota consumption recording (close #156)
parent
8d74860f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
0 deletions
+16
-0
common/constants.go
+2
-0
model/log.go
+3
-0
model/option.go
+3
-0
web/src/components/SystemSetting.js
+8
-0
No files found.
common/constants.go
View file @
569c124b
...
...
@@ -35,6 +35,8 @@ var WeChatAuthEnabled = false
var
TurnstileCheckEnabled
=
false
var
RegisterEnabled
=
true
var
LogConsumeEnabled
=
true
var
SMTPServer
=
""
var
SMTPPort
=
587
var
SMTPAccount
=
""
...
...
model/log.go
View file @
569c124b
...
...
@@ -22,6 +22,9 @@ const (
)
func
RecordLog
(
userId
int
,
logType
int
,
content
string
)
{
if
logType
==
LogTypeConsume
&&
!
common
.
LogConsumeEnabled
{
return
}
log
:=
&
Log
{
UserId
:
userId
,
CreatedAt
:
common
.
GetTimestamp
(),
...
...
model/option.go
View file @
569c124b
...
...
@@ -34,6 +34,7 @@ func InitOptionMap() {
common
.
OptionMap
[
"TurnstileCheckEnabled"
]
=
strconv
.
FormatBool
(
common
.
TurnstileCheckEnabled
)
common
.
OptionMap
[
"RegisterEnabled"
]
=
strconv
.
FormatBool
(
common
.
RegisterEnabled
)
common
.
OptionMap
[
"AutomaticDisableChannelEnabled"
]
=
strconv
.
FormatBool
(
common
.
AutomaticDisableChannelEnabled
)
common
.
OptionMap
[
"LogConsumeEnabled"
]
=
strconv
.
FormatBool
(
common
.
LogConsumeEnabled
)
common
.
OptionMap
[
"ChannelDisableThreshold"
]
=
strconv
.
FormatFloat
(
common
.
ChannelDisableThreshold
,
'f'
,
-
1
,
64
)
common
.
OptionMap
[
"SMTPServer"
]
=
""
common
.
OptionMap
[
"SMTPFrom"
]
=
""
...
...
@@ -134,6 +135,8 @@ func updateOptionMap(key string, value string) (err error) {
common
.
RegisterEnabled
=
boolValue
case
"AutomaticDisableChannelEnabled"
:
common
.
AutomaticDisableChannelEnabled
=
boolValue
case
"LogConsumeEnabled"
:
common
.
LogConsumeEnabled
=
boolValue
}
}
switch
key
{
...
...
web/src/components/SystemSetting.js
View file @
569c124b
...
...
@@ -34,6 +34,7 @@ const SystemSetting = () => {
TopUpLink
:
''
,
AutomaticDisableChannelEnabled
:
''
,
ChannelDisableThreshold
:
0
,
LogConsumeEnabled
:
''
,
});
const
[
originInputs
,
setOriginInputs
]
=
useState
({});
let
[
loading
,
setLoading
]
=
useState
(
false
);
...
...
@@ -68,6 +69,7 @@ const SystemSetting = () => {
case
'TurnstileCheckEnabled'
:
case
'RegisterEnabled'
:
case
'AutomaticDisableChannelEnabled'
:
case
'LogConsumeEnabled'
:
value
=
inputs
[
key
]
===
'true'
?
'false'
:
'true'
;
break
;
default
:
...
...
@@ -349,6 +351,12 @@ const SystemSetting = () => {
placeholder
=
'为一个 JSON 文本,键为分组名称,值为倍率'
/>
<
/Form.Group
>
<
Form
.
Checkbox
checked
=
{
inputs
.
LogConsumeEnabled
===
'true'
}
label
=
'启用额度消费日志记录'
name
=
'LogConsumeEnabled'
onChange
=
{
handleInputChange
}
/
>
<
Form
.
Button
onClick
=
{
submitOperationConfig
}
>
保存运营设置
<
/Form.Button
>
<
Divider
/>
<
Header
as
=
'h3'
>
...
...
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