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
572ac87f
Commit
572ac87f
authored
May 10, 2024
by
brent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
midify client api
parent
7c694525
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
417 additions
and
108 deletions
+417
-108
.DS_Store
.DS_Store
+0
-0
app.conf
conf/app.conf
+1
-0
client.go
controllers/client.go
+280
-57
explorer.go
controllers/explorer.go
+19
-15
task.go
controllers/task.go
+31
-7
cronjob.go
libs/cronjob/cronjob.go
+2
-4
client.go
models/client.go
+65
-9
task.go
models/task.go
+19
-16
No files found.
.DS_Store
View file @
572ac87f
No preview for this file type
conf/app.conf
View file @
572ac87f
...
...
@@ -7,6 +7,7 @@ sessiongcmaxlifetime = 127800
logLevel
=
7
logfile
=
"admin_backend.log"
debitTime
=
"0 46 15 * * ?"
rewardUrl
=
"http://18.167.203.17:20012"
;
01
01
00
* * ?
;
SessionProvider
=
"redis"
;
SessionProviderConfig
=
"192.168.1.10:6379,1000"
...
...
controllers/client.go
View file @
572ac87f
This diff is collapsed.
Click to expand it.
controllers/explorer.go
View file @
572ac87f
...
...
@@ -11,7 +11,7 @@ import (
"github.com/beego/beego/orm"
"github.com/beego/beego/v2/core/logs"
"net/http"
"
strconv
"
"
time
"
)
type
ExplorerController
struct
{
...
...
@@ -46,8 +46,8 @@ func (server *ExplorerController) Statistics() {
workload
:=
int64
(
0
)
if
len
(
taskCount
)
>
0
{
task
:=
taskCount
[
0
]
count
,
_
=
strconv
.
ParseInt
(
task
.
Count
,
10
,
64
)
workload
,
_
=
strconv
.
ParseInt
(
task
.
Workload
,
10
,
64
)
count
=
task
.
Count
workload
=
task
.
Workload
}
_
,
total
,
_
:=
registry
.
NodeManagersByPage
(
0
,
10
)
...
...
@@ -162,7 +162,16 @@ func (server *ExplorerController) Tasks() {
return
}
logs
.
Debug
(
"total = %d"
,
total
)
var
responseTasks
[]
models
.
Bills
type
ResponseBills
struct
{
Id
string
`json:"id,omitempty"`
Type
string
`json:"type,omitempty"`
ProfitAcc
string
`json:"profit_acc,omitempty"`
Result
string
`json:"result,omitempty"`
Workload
int64
`json:"workload,omitempty"`
Time
time
.
Time
`json:"time,omitempty"`
BaseModel
string
`json:"base_model,omitempty"`
}
var
responseTasks
[]
ResponseBills
if
total
==
0
{
responseData
:=
struct
{
Total
int64
`json:"total"`
...
...
@@ -189,7 +198,7 @@ func (server *ExplorerController) Tasks() {
baseModel
:=
""
//kind := 1
typeDe
:=
1
taskId
,
err
:=
strconv
.
Atoi
(
task
.
Type
)
taskId
:=
task
.
Type
if
err
==
nil
{
taskType
,
_
:=
odysseus
.
GetTaskType
(
int64
(
taskId
))
if
taskType
!=
nil
{
...
...
@@ -201,19 +210,14 @@ func (server *ExplorerController) Tasks() {
}
}
reTask
:=
models
.
Bills
{
reTask
:=
Response
Bills
{
Id
:
task
.
Id
,
Type
:
models
.
ModelType
(
typeDe
)
.
String
(),
Time
:
task
.
Time
,
Result
:
task
.
Result
,
//ApiPath: apiPath,
//Model: model,
BaseModel
:
baseModel
,
//Kind: models.TaskKind(kind).EnString(),
//Desc: desc,
Workload
:
task
.
Workload
,
ProfitAcc
:
task
.
ProfitAcc
,
//WorkerAcc: task.WorkerAcc,
}
responseTasks
=
append
(
responseTasks
,
reTask
)
}
...
...
controllers/task.go
View file @
572ac87f
...
...
@@ -183,7 +183,16 @@ func (server *TaskController) BillDetails() {
return
}
logs
.
Debug
(
"total = %d"
,
total
)
var
responseTasks
[]
models
.
Bills
type
ResponseBills
struct
{
Id
string
`json:"id,omitempty"`
Type
string
`json:"type,omitempty"`
Fee
string
`json:"fee,omitempty"`
Result
string
`json:"result,omitempty"`
Time
time
.
Time
`json:"time,omitempty"`
ApiPath
string
`json:"api_path,omitempty"`
Desc
string
`json:"desc,omitempty"`
}
var
responseTasks
[]
ResponseBills
if
total
==
0
{
responseData
:=
struct
{
Total
int64
`json:"total"`
...
...
@@ -208,7 +217,7 @@ func (server *TaskController) BillDetails() {
apiPath
:=
""
desc
:=
""
typeDesc
:=
""
taskId
,
err
:=
strconv
.
Atoi
(
task
.
Type
)
taskId
:=
task
.
Type
if
err
==
nil
{
taskType
,
err1
:=
odysseus
.
GetTaskType
(
int64
(
taskId
))
if
err1
==
nil
{
...
...
@@ -220,7 +229,7 @@ func (server *TaskController) BillDetails() {
//balance, _ := odysseus.GetUserBalance(int64(token.UserID))
reTask
:=
models
.
Bills
{
reTask
:=
Response
Bills
{
Id
:
task
.
Id
,
Type
:
typeDesc
,
Fee
:
task
.
Fee
,
...
...
@@ -306,7 +315,22 @@ func (server *TaskController) Tasks() {
return
}
logs
.
Debug
(
"total = %d"
,
total
)
var
responseTasks
[]
models
.
Bills
type
ResponseBills
struct
{
Id
string
`json:"id,omitempty"`
Type
string
`json:"type,omitempty"`
Fee
string
`json:"fee,omitempty"`
Result
string
`json:"result,omitempty"`
Time
time
.
Time
`json:"time,omitempty"`
ApiPath
string
`json:"api_path,omitempty"`
Desc
string
`json:"desc,omitempty"`
BaseModel
string
`json:"base_model,omitempty"`
Model
string
`json:"model,omitempty"`
ProfitAcc
string
`json:"profit_acc,omitempty"`
WorkerAcc
string
`json:"worker_acc,omitempty"`
Workload
int64
`json:"workload,omitempty"`
Kind
string
`json:"kind,omitempty"`
}
var
responseTasks
[]
ResponseBills
if
total
==
0
{
responseData
:=
struct
{
Total
int64
`json:"total"`
...
...
@@ -333,7 +357,7 @@ func (server *TaskController) Tasks() {
baseModel
:=
""
kind
:=
1
typeDe
:=
1
taskId
,
err
:=
strconv
.
Atoi
(
task
.
Type
)
taskId
:=
task
.
Type
if
err
==
nil
{
taskType
,
_
:=
odysseus
.
GetTaskType
(
int64
(
taskId
))
if
taskType
!=
nil
{
...
...
@@ -345,7 +369,7 @@ func (server *TaskController) Tasks() {
}
}
reTask
:=
models
.
Bills
{
reTask
:=
Response
Bills
{
Id
:
task
.
Id
,
Type
:
models
.
ModelType
(
typeDe
)
.
String
(),
Time
:
task
.
Time
,
...
...
@@ -581,7 +605,7 @@ func (server *TaskController) UserTasks() {
for
_
,
task
:=
range
tasks
{
apiPath
:=
""
desc
:=
""
taskId
,
err
:=
strconv
.
Atoi
(
task
.
Type
)
taskId
:=
task
.
Type
if
err
==
nil
{
taskType
,
err1
:=
odysseus
.
GetTaskType
(
int64
(
taskId
))
if
err1
==
nil
{
...
...
libs/cronjob/cronjob.go
View file @
572ac87f
...
...
@@ -305,12 +305,10 @@ func startRevenue() {
for
_
,
bill
:=
range
data
{
workload
,
_
:=
strconv
.
Atoi
(
bill
.
Workload
)
//nanoseconds := int64(uint64(dayTime.UnixNano()))
//seconds := nanoseconds / 1e9
taskId
,
err
:=
strconv
.
Atoi
(
bill
.
Type
)
taskId
:=
bill
.
Type
typeDesc
:=
""
baseModel
:=
""
if
err
==
nil
{
...
...
@@ -327,7 +325,7 @@ func startRevenue() {
Symbol
(
"base_model"
,
baseModel
)
.
Symbol
(
"profit_acc"
,
bill
.
ProfitAcc
)
.
Symbol
(
"worker_acc"
,
bill
.
WorkerAcc
)
.
Int64Column
(
"workload"
,
int64
(
workload
)
)
.
Int64Column
(
"workload"
,
bill
.
Workload
)
.
Int64Column
(
"income"
,
int64
(
0
))
.
TimestampColumn
(
"time"
,
bill
.
Time
)
.
AtNow
(
ctx
)
...
...
models/client.go
View file @
572ac87f
package
models
import
"time"
import
(
"math/big"
"time"
)
type
Revenues
struct
{
Id
string
`json:"id";orm:"column(id)"`
Time
time
.
Time
`json:"time";orm:"column(time);type(datetime)"`
Type
string
`json:"type";orm:"column(type)"`
BaseModel
string
`json:"base_model";orm:"column(base_model)"`
ProfitAcc
string
`json:"profit_acc";orm:"column(profit_acc)"`
WorkerAcc
string
`json:"worker_acc";orm:"column(worker_acc)"`
Workload
int
`json:"workload";orm:"column(workload)"`
Income
int64
`json:"income";orm:"column(income)"`
Id
string
`json:"id,omitempty";orm:"column(id)"`
Time
time
.
Time
`json:"time,omitempty";orm:"column(time);type(datetime)"`
Type
string
`json:"type,omitempty";orm:"column(type)"`
BaseModel
string
`json:"base_model,omitempty";orm:"column(base_model)"`
ProfitAcc
string
`json:"profit_acc,omitempty";orm:"column(profit_acc)"`
WorkerAcc
string
`json:"worker_acc,omitempty";orm:"column(worker_acc)"`
Workload
int64
`json:"workload,omitempty";orm:"column(workload)"`
Income
*
big
.
Float
`json:"income,omitempty";orm:"column(income)"`
}
type
WeiPerWorkloadStruct
struct
{
Date
string
`json:"date,omitempty"`
WeiPerWorkload
string
`json:"weiPerWorkload,omitempty"`
Workload
string
`json:"workload,omitempty"`
Reward
string
`json:"reward,omitempty"`
}
type
WeiPerWorkloadResponse
struct
{
Code
int
`json:"code,omitempty"`
Msg
string
`json:"msg,omitempty"`
Data
[]
WeiPerWorkloadStruct
`json:"data,omitempty"`
}
type
TotalRevenuesRequest
struct
{
Address
string
`json:"address,omitempty"`
}
type
TotalRevenuesStruct
struct
{
Total
string
`json:"total"`
Claimed
string
`json:"claimed"`
Unclaimed
string
`json:"unclaimed"`
}
type
TotalRevenuesResponse
struct
{
Code
int
`json:"code"`
Msg
string
`json:"msg"`
Data
TotalRevenuesStruct
`json:"data"`
}
type
WithdrawalRecordRequest
struct
{
Address
string
`json:"address,omitempty"`
Page
int
`json:"page,omitempty"`
PageSize
int
`json:"pageSize,omitempty"`
}
type
WithdrawalRecordStruct
struct
{
TxHash
string
`json:"txHash"`
Date
string
`json:"date"`
Timestamp
int
`json:"timestamp"`
Amount
string
`json:"amount"`
}
type
WithdrawalRecordData
struct
{
TotalCount
int
`json:"totalCount"`
Records
[]
WithdrawalRecordStruct
`json:"records"`
}
type
WithdrawalRecordResponse
struct
{
Code
int
`json:"code"`
Msg
string
`json:"msg"`
Data
WithdrawalRecordData
`json:"data"`
}
models/task.go
View file @
572ac87f
...
...
@@ -217,14 +217,14 @@ type ResonseModel struct {
type
Bills
struct
{
//Key int `orm:"column(key);auto"`
Id
string
`json:"id,omitempty";orm:"column(id)"`
Type
string
`json:"type,omitempty";orm:"column(type)"`
Kind
string
`json:"kind,omitempty"`
Uid
string
`json:"uid,omitempty";orm:"column(uid)"`
Type
int
`json:"type,omitempty";orm:"column(type)"`
Kind
int
`json:"kind,omitempty"`
Uid
int
`json:"uid,omitempty";orm:"column(uid)"`
ProfitAcc
string
`json:"profit_acc,omitempty";orm:"column(profit_acc)"`
Fee
string
`json:"fee,omitempty";orm:"column(fee)"`
WorkerAcc
string
`json:"worker_acc,omitempty";orm:"column(worker_acc)"`
Result
string
`json:"result,omitempty";orm:"column(result)"`
Workload
string
`json:"workload,omitempty";orm:"column(workload)"`
Workload
int64
`json:"workload,omitempty";orm:"column(workload)"`
//ApiPath string `json:"api_path";orm:"column(api_path)"`
Time
time
.
Time
`json:"time,omitempty";orm:"column(time);type(datetime)"`
TaskDuration
string
`json:"task_duration,omitempty";orm:"column(task_duration)"`
...
...
@@ -237,7 +237,10 @@ type Bills struct {
Balance
int64
`json:"balance,omitempty"`
BaseModel
string
`json:"base_model,omitempty"`
Model
string
`json:"model,omitempty"`
Count
string
`json:"count,omitempty"`
Count
int64
`json:"count,omitempty"`
Income
float64
`json:"income,omitempty"`
TotalTasks
int64
`json:"total_tasks,omitempty"`
TotalWorkload
int64
`json:"total_workload,omitempty"`
}
type
TotalType
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