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
72a10b61
Commit
72a10b61
authored
Mar 13, 2024
by
brent
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify debit
parent
a8d691ab
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
195 additions
and
62 deletions
+195
-62
funds.go
controllers/funds.go
+11
-37
task.go
controllers/task.go
+106
-25
util.go
libs/utils/util.go
+13
-0
main.go
main.go
+62
-0
app.go
models/app.go
+3
-0
No files found.
controllers/funds.go
View file @
72a10b61
...
@@ -69,7 +69,7 @@ func (server *FundsController) Recharge() {
...
@@ -69,7 +69,7 @@ func (server *FundsController) Recharge() {
// return
// return
//}
//}
tradeTime
:=
fmt
.
Sprintf
(
time
.
Now
()
.
Format
(
format
))
tradeTime
:=
fmt
.
Sprintf
(
time
.
Now
()
.
UTC
()
.
Format
(
format
))
//fundsData := models.Funds{
//fundsData := models.Funds{
// Id: max + 1,
// Id: max + 1,
// Uid: info.UserID,
// Uid: info.UserID,
...
@@ -250,36 +250,6 @@ func (server *FundsController) IncomeAndExpense() {
...
@@ -250,36 +250,6 @@ func (server *FundsController) IncomeAndExpense() {
return
return
}
}
//qs := postgres.GetOrmer().QueryTable("funds")
//infoQs := qs.Filter("id", 1)
timeCondition
:=
""
if
appRequest
.
StartTime
!=
""
&&
appRequest
.
EndTime
!=
""
{
temp
,
_
:=
time
.
Parse
(
layout
,
appRequest
.
StartTime
)
startTime
:=
fmt
.
Sprintf
(
temp
.
Format
(
format
))
temp
,
_
=
time
.
Parse
(
layout
,
appRequest
.
EndTime
)
endTime
:=
fmt
.
Sprintf
(
temp
.
Format
(
format
))
timeCondition
=
fmt
.
Sprintf
(
"time >= '%s' and time <= '%s'"
,
startTime
,
endTime
)
// //infoQs = qs.Filter("trade_time__gte", startTime).Filter("trade_time__lte", endTime)
}
if
appRequest
.
TradeType
!=
0
{
if
timeCondition
!=
""
{
timeCondition
=
timeCondition
+
" and"
}
timeCondition
=
fmt
.
Sprintf
(
"%s trade_type = %d"
,
timeCondition
,
appRequest
.
TradeType
)
}
if
appRequest
.
TradeFlow
!=
0
{
if
timeCondition
!=
""
{
timeCondition
=
timeCondition
+
" and"
}
timeCondition
=
fmt
.
Sprintf
(
"%s trade_flow = %d"
,
timeCondition
,
appRequest
.
TradeFlow
)
}
if
appRequest
.
TradeChannel
!=
0
{
if
timeCondition
!=
""
{
timeCondition
=
timeCondition
+
" and"
}
timeCondition
=
fmt
.
Sprintf
(
"%s trade_channel = %d"
,
timeCondition
,
appRequest
.
TradeChannel
)
}
countQB
,
_
:=
orm
.
NewQueryBuilder
(
"mysql"
)
countQB
,
_
:=
orm
.
NewQueryBuilder
(
"mysql"
)
countQB
.
Select
(
"count(*)"
)
.
countQB
.
Select
(
"count(*)"
)
.
From
(
"funds"
)
.
Where
(
"uid != '0'"
)
From
(
"funds"
)
.
Where
(
"uid != '0'"
)
...
@@ -294,12 +264,16 @@ func (server *FundsController) IncomeAndExpense() {
...
@@ -294,12 +264,16 @@ func (server *FundsController) IncomeAndExpense() {
}
}
if
appRequest
.
StartTime
!=
""
&&
appRequest
.
EndTime
!=
""
{
if
appRequest
.
StartTime
!=
""
&&
appRequest
.
EndTime
!=
""
{
temp
,
_
:=
time
.
Parse
(
layout
,
appRequest
.
StartTime
)
start
,
_
:=
time
.
Parse
(
layout
,
appRequest
.
StartTime
)
startTime
:=
fmt
.
Sprintf
(
temp
.
Format
(
format
))
startTime
:=
fmt
.
Sprintf
(
start
.
Format
(
format
))
temp
,
_
=
time
.
Parse
(
layout
,
appRequest
.
EndTime
)
end
,
_
:=
time
.
Parse
(
layout
,
appRequest
.
EndTime
)
endTime
:=
fmt
.
Sprintf
(
temp
.
Format
(
format
))
endTime
:=
fmt
.
Sprintf
(
end
.
Format
(
format
))
countQB
.
And
(
fmt
.
Sprintf
(
"time >= '%s'"
,
startTime
))
.
And
(
fmt
.
Sprintf
(
"time <= '%s'"
,
endTime
))
if
end
.
Before
(
start
)
{
queryQB
.
And
(
fmt
.
Sprintf
(
"time >= '%s'"
,
startTime
))
.
And
(
fmt
.
Sprintf
(
"time <= '%s'"
,
endTime
))
server
.
respond
(
models
.
BusinessFailed
,
"起始时间不能大于结束时间"
)
return
}
countQB
.
And
(
fmt
.
Sprintf
(
"trade_time >= '%s'"
,
startTime
))
.
And
(
fmt
.
Sprintf
(
"trade_time <= '%s'"
,
endTime
))
queryQB
.
And
(
fmt
.
Sprintf
(
"trade_time >= '%s'"
,
startTime
))
.
And
(
fmt
.
Sprintf
(
"trade_time <= '%s'"
,
endTime
))
}
}
if
appRequest
.
TradeType
!=
0
{
if
appRequest
.
TradeType
!=
0
{
countQB
.
And
(
fmt
.
Sprintf
(
"trade_type = %d"
,
appRequest
.
TradeType
))
countQB
.
And
(
fmt
.
Sprintf
(
"trade_type = %d"
,
appRequest
.
TradeType
))
...
...
controllers/task.go
View file @
72a10b61
This diff is collapsed.
Click to expand it.
libs/utils/util.go
View file @
72a10b61
...
@@ -22,3 +22,16 @@ func SplitDate(beginDate, endDate, format string) []string {
...
@@ -22,3 +22,16 @@ func SplitDate(beginDate, endDate, format string) []string {
dlist
=
append
(
dlist
,
endDate
)
dlist
=
append
(
dlist
,
endDate
)
return
dlist
return
dlist
}
}
func
YearMonthRange
(
start
,
end
time
.
Time
,
format
string
)
[]
string
{
// 创建年月数组
start
=
time
.
Date
(
start
.
Year
(),
start
.
Month
(),
1
,
0
,
0
,
0
,
0
,
start
.
Location
())
yms
:=
make
([]
string
,
0
)
// 遍历每个月
for
t
:=
start
;
t
.
Before
(
end
);
t
=
t
.
AddDate
(
0
,
1
,
0
)
{
yms
=
append
(
yms
,
t
.
Format
(
format
))
}
return
yms
}
main.go
View file @
72a10b61
...
@@ -60,6 +60,27 @@ func main() {
...
@@ -60,6 +60,27 @@ func main() {
//dates := utils.SplitDate(startTimeStr, endTimeStr, "2006-01-02T15:04:05.000000Z")
//dates := utils.SplitDate(startTimeStr, endTimeStr, "2006-01-02T15:04:05.000000Z")
//logs.Debug("dates = ", dates)
//logs.Debug("dates = ", dates)
//currentTime := time.Now()
////start := time.Date(2023, 4, 1, 0, 0, 0, 0, currentTime.Location())
//end := time.Date(2024, 4, 1, 0, 0, 0, 0, currentTime.Location())
//
////currentTime := time.Now()
////end := time.Date(currentTime.Year(), currentTime.Month(), currentTime.Day(), 23, 59, 59, 0, time.UTC)
//temp := fmt.Sprintf("-%dh", 24*365)
//m, _ := time.ParseDuration(temp)
//tempTime := end.Add(m)
//if tempTime.Day() != 1 {
// tempTime = tempTime.AddDate(0, 1, 0)
//}
//tempTime = time.Date(tempTime.Year(), tempTime.Month(), tempTime.Day(), 0, 0, 0, 0, time.UTC)
////endDateIn := time.Date(end.Year(), end.Month(), end.Day(), 0, 0, 0, 0, time.UTC)
////endDate := fmt.Sprintf(endDateIn.Format("2006-01-02T15:04:05.000000Z"))
//
//months := yearMonthRange(tempTime, end)
//for _, month := range months {
// fmt.Println(month)
//}
cronjob
.
Start
()
cronjob
.
Start
()
mysql
.
GetMysqlInstace
()
mysql
.
GetMysqlInstace
()
//postgres.Query("")
//postgres.Query("")
...
@@ -77,3 +98,44 @@ func main() {
...
@@ -77,3 +98,44 @@ func main() {
//}
//}
//logs.Debug("id = ", id)
//logs.Debug("id = ", id)
}
}
func
yearMonthRange
(
start
,
end
time
.
Time
)
[]
string
{
// 创建年月数组
start
=
time
.
Date
(
start
.
Year
(),
start
.
Month
(),
1
,
0
,
0
,
0
,
0
,
start
.
Location
())
//end = time.Date(end.Year(), end.Month(), 1, 0, 0, 0, 0, end.Location())
yms
:=
make
([]
string
,
0
)
// 遍历每个月
temp
:=
end
.
AddDate
(
0
,
1
,
0
)
for
t
:=
start
;
t
.
Compare
(
end
)
<=
0
;
t
=
t
.
AddDate
(
0
,
1
,
0
)
{
temp
=
end
.
AddDate
(
0
,
1
,
0
)
yms
=
append
(
yms
,
t
.
Format
(
"2006-01-02T15:04:05.000000Z"
))
}
fmt
.
Println
(
temp
)
return
yms
}
func
dayRange
(
start
,
end
time
.
Time
)
[]
time
.
Time
{
// 创建天数组
days
:=
make
([]
time
.
Time
,
0
)
// 遍历每一天
for
t
:=
start
;
t
.
Before
(
end
.
AddDate
(
0
,
0
,
1
));
t
=
t
.
AddDate
(
0
,
0
,
1
)
{
days
=
append
(
days
,
t
)
}
return
days
}
func
monthRange
(
start
,
end
time
.
Time
)
[]
time
.
Month
{
// 创建月份数组
months
:=
make
([]
time
.
Month
,
0
)
// 遍历每个月
for
t
:=
start
;
t
.
Before
(
end
.
AddDate
(
0
,
1
,
0
));
t
=
t
.
AddDate
(
0
,
1
,
0
)
{
months
=
append
(
months
,
t
.
Month
())
}
return
months
}
models/app.go
View file @
72a10b61
...
@@ -63,6 +63,9 @@ type AppRequest struct {
...
@@ -63,6 +63,9 @@ type AppRequest struct {
//显卡列表
//显卡列表
Type
int
`json:"type,omitempty"`
Type
int
`json:"type,omitempty"`
//任务柱状图
Period
int
`json:"period,omitempty"`
}
}
type
EnumType
struct
{
type
EnumType
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