Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-common
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
hujiebin
hilo-common
Commits
ddc1a92e
Commit
ddc1a92e
authored
Mar 17, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update group_activity_award.go
parent
52bd8e8d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
6 deletions
+38
-6
group_activity_award.go
script/group_activity_award.go
+38
-6
No files found.
script/group_activity_award.go
View file @
ddc1a92e
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"git.hilo.cn/hilo-common/script/model"
"git.hilo.cn/hilo-common/script/model"
"git.hilo.cn/hilo-common/script/mysql"
"git.hilo.cn/hilo-common/script/mysql"
"github.com/tealeg/xlsx"
"github.com/tealeg/xlsx"
"time"
)
)
type
GroupActivityAwardLog
struct
{
type
GroupActivityAwardLog
struct
{
...
@@ -30,10 +31,17 @@ type GroupActivityData struct {
...
@@ -30,10 +31,17 @@ type GroupActivityData struct {
AwardGift3101Num
int
// 3101礼物id数量
AwardGift3101Num
int
// 3101礼物id数量
AwardGift3091Num
int
// 3091礼物id数量
AwardGift3091Num
int
// 3091礼物id数量
AwardPrice
int
// 总的礼物价值
AwardPrice
int
// 总的礼物价值
ActivityConsume
uint64
// 活动流水
AwardTime
string
// 奖励时间
AwardTime
string
// 奖励时间
}
}
func
ats3
(
a
int
)
string
{
type
GroupActivity
struct
{
Id
uint64
StartAt
int64
EndAt
int64
}
func
ats3
(
a
interface
{})
string
{
return
fmt
.
Sprintf
(
"%d"
,
a
)
return
fmt
.
Sprintf
(
"%d"
,
a
)
}
}
...
@@ -80,6 +88,28 @@ func main() {
...
@@ -80,6 +88,28 @@ func main() {
num3091
=
a
.
Num
num3091
=
a
.
Num
}
}
}
}
var
groupActivity
=
new
(
GroupActivity
)
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
GroupActivity
{})
.
Where
(
"id = ?"
,
log
.
GroupActId
)
.
First
(
groupActivity
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
start
:=
time
.
UnixMilli
(
groupActivity
.
StartAt
)
end
:=
time
.
UnixMilli
(
groupActivity
.
EndAt
)
type
summary
struct
{
C
uint32
Consume
uint64
}
rows
:=
make
([]
summary
,
0
)
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"gift_operate"
)
.
Select
(
"COUNT(DISTINCT(send_user_id)) AS c, SUM(send_user_diamond) AS Consume"
)
.
Where
(
"scene_type = 4 AND scene_uid = ?"
,
log
.
ImGroupId
)
.
Where
(
"created_time BETWEEN ? AND ?"
,
start
,
end
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
consume
:=
uint64
(
0
)
if
len
(
rows
)
>
0
{
consume
=
rows
[
0
]
.
Consume
}
data
=
append
(
data
,
GroupActivityData
{
data
=
append
(
data
,
GroupActivityData
{
Country
:
user
.
Country
,
Country
:
user
.
Country
,
Area
:
area
,
Area
:
area
,
...
@@ -89,6 +119,7 @@ func main() {
...
@@ -89,6 +119,7 @@ func main() {
AwardGift3101Num
:
num3101
,
AwardGift3101Num
:
num3101
,
AwardGift3091Num
:
num3091
,
AwardGift3091Num
:
num3091
,
AwardPrice
:
num3111
*
10000
+
num3101
*
3000
+
num3091
*
1000
,
AwardPrice
:
num3111
*
10000
+
num3101
*
3000
+
num3091
*
1000
,
ActivityConsume
:
consume
,
AwardTime
:
log
.
CreatedTime
,
AwardTime
:
log
.
CreatedTime
,
})
})
}
}
...
@@ -96,13 +127,14 @@ func main() {
...
@@ -96,13 +127,14 @@ func main() {
xlFile
:=
xlsx
.
NewFile
()
xlFile
:=
xlsx
.
NewFile
()
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
row
:=
sheet
.
AddRow
()
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
,
c8
,
c9
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
()
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
,
c8
,
c9
,
c10
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
()
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
,
c9
.
Value
=
"国家"
,
"区域"
,
"房主靓号"
,
"群组靓号"
,
"3111礼物数量"
,
"3101礼物数量"
,
"3091礼物数量"
,
"总的礼物价值"
,
"奖励时间"
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
,
c9
.
Value
,
c10
.
Value
=
"国家"
,
"区域"
,
"房主靓号"
,
"群组靓号"
,
"3111礼物数量"
,
"3101礼物数量"
,
"3091礼物数量"
,
"总的礼物价值"
,
"活动流水"
,
"奖励时间"
for
_
,
d
:=
range
data
{
for
_
,
d
:=
range
data
{
row
:=
sheet
.
AddRow
()
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
,
c8
,
c9
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
()
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
,
c8
,
c9
,
c10
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
()
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
,
c9
.
Value
=
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
,
c9
.
Value
,
c10
.
Value
=
d
.
Country
,
d
.
Area
,
d
.
OwnerCode
,
d
.
GroupCode
,
ats3
(
d
.
AwardGift3111Num
),
ats3
(
d
.
AwardGift3101Num
),
ats3
(
d
.
AwardGift3091Num
),
ats3
(
d
.
AwardPrice
),
d
.
AwardTime
d
.
Country
,
d
.
Area
,
d
.
OwnerCode
,
d
.
GroupCode
,
ats3
(
d
.
AwardGift3111Num
),
ats3
(
d
.
AwardGift3101Num
),
ats3
(
d
.
AwardGift3091Num
),
ats3
(
d
.
AwardPrice
),
ats3
(
d
.
ActivityConsume
),
d
.
AwardTime
}
}
_
=
xlFile
.
Save
(
excelFileName
)
_
=
xlFile
.
Save
(
excelFileName
)
}
}
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