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
0b30ebbf
Commit
0b30ebbf
authored
May 23, 2024
by
brent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify client api
parent
8ee233d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
client.go
controllers/client.go
+3
-3
cronjob.go
libs/cronjob/cronjob.go
+8
-5
No files found.
controllers/client.go
View file @
0b30ebbf
...
...
@@ -506,12 +506,12 @@ func (server *ClientController) TaskReward() {
for
_
,
task
:=
range
types
{
if
task
.
Id
==
item
.
TaskId
{
item
.
Type
=
models
.
ModelType
(
task
.
Type
)
.
String
()
if
strings
.
Compare
(
item
.
Type
,
"unknown"
)
==
0
{
item
.
Type
=
"base task"
}
item
.
BaseModel
=
task
.
BaseModel
}
}
if
strings
.
Compare
(
item
.
Type
,
"unknown"
)
==
0
{
item
.
Type
=
"base task"
}
workload
:=
big
.
NewInt
(
item
.
Workload
)
weiPerWorkload
,
_
:=
strconv
.
Atoi
(
value
.
Wei
)
weiPerWorkloadBig
:=
big
.
NewInt
(
int64
(
weiPerWorkload
))
...
...
libs/cronjob/cronjob.go
View file @
0b30ebbf
...
...
@@ -268,7 +268,7 @@ func startRevenue() {
//spec := "01 01 00 * * ?"
//spec, _ := beego.AppConfig.String("debitTime")
//spec := "@every 1m"
spec
:=
"@every
6
h"
spec
:=
"@every
1
h"
//dbhost, _ := beego.AppConfig.String("postgreshost")
//dbport, _ := beego.AppConfig.Int("senderport")
...
...
@@ -276,7 +276,7 @@ func startRevenue() {
revenueTask
.
AddFunc
(
spec
,
func
()
{
logs
.
Debug
(
"startRevenue revenueTask"
)
_
,
multipliers
,
err
:=
checkMultiplier
()
total
,
multipliers
,
err
:=
checkMultiplier
()
if
err
!=
nil
{
return
}
...
...
@@ -288,7 +288,7 @@ func startRevenue() {
date
:=
fmt
.
Sprintf
(
time
.
Format
(
"2006-01-02"
))
dates
=
append
(
dates
,
date
)
}
if
len
(
dates
)
<=
0
{
if
total
<=
0
{
dates
=
checkDate
()
}
reaponse
,
err
:=
getWeiPerWorkload
(
dates
)
...
...
@@ -442,11 +442,14 @@ func insertMultiplier(data []models.WeiPerWorkloadStruct) error {
return
err
}
defer
sender
.
Close
()
currentTime
:=
time
.
Now
()
currentTime
=
time
.
Date
(
currentTime
.
Year
(),
currentTime
.
Month
(),
currentTime
.
Day
(),
0
,
0
,
0
,
0
,
time
.
UTC
)
for
_
,
value
:=
range
data
{
if
strings
.
Compare
(
value
.
WeiPerWorkload
,
"0"
)
==
0
{
temp
,
_
:=
time
.
Parse
(
"2006-01-02"
,
value
.
Date
)
if
strings
.
Compare
(
value
.
WeiPerWorkload
,
"0"
)
==
0
&&
temp
.
Compare
(
currentTime
)
>=
0
{
continue
}
temp
,
_
:=
time
.
Parse
(
"2006-01-02"
,
value
.
Date
)
nanoseconds
:=
int64
(
uint64
(
temp
.
UnixNano
()))
seconds
:=
nanoseconds
/
1e9
...
...
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