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
8601ecaa
Commit
8601ecaa
authored
Mar 04, 2024
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:提交一波脚本
parent
34c5793e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
188 additions
and
21 deletions
+188
-21
Makefile
script/Makefile
+6
-0
act_710_data.go
script/act_710_data.go
+76
-0
clear_redis.go
script/clear_redis.go
+79
-0
promotion_data.go
script/promotion_data.go
+3
-3
svip_user_charge.go
script/svip_user_charge.go
+21
-16
test_20_in_mic.go
script/test_20_in_mic.go
+3
-2
No files found.
script/Makefile
View file @
8601ecaa
...
@@ -30,3 +30,9 @@ promotion_data:
...
@@ -30,3 +30,9 @@ promotion_data:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
promotion_data promotion_data.go
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
promotion_data promotion_data.go
group_room_visit500
:
group_room_visit500
:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
group_room_visit500 group_room_visit500.go
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
group_room_visit500 group_room_visit500.go
svip_user_charge
:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
svip_user_charge svip_user_charge.go
act_710_data
:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
act_710_data act_710_data.go
clear_redis
:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
clear_redis clear_redis.go
script/act_710_data.go
0 → 100644
View file @
8601ecaa
package
main
import
(
"fmt"
"git.hilo.cn/hilo-common/script/model"
"git.hilo.cn/hilo-common/script/mysql"
"github.com/tealeg/xlsx"
"strings"
)
type
Act710Data
struct
{
Code
string
SendUserId
uint64
ActDiamond
uint64
Levels
[]
int
`gorm:"-"`
RealDiamond
uint64
}
func
ats39
(
a
interface
{})
string
{
return
fmt
.
Sprintf
(
"%v"
,
a
)
}
type
ActUserAward
struct
{
Level
int
}
func
main
()
{
var
data
[]
Act710Data
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"act_gift_record"
)
.
Where
(
"activity_id = 710"
)
.
Select
(
"send_user_id,SUM(diamond) act_diamond"
)
.
Group
(
"send_user_id"
)
.
Find
(
&
data
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
for
i
,
v
:=
range
data
{
var
user
model
.
User
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
model
.
User
{})
.
Where
(
"id = ? "
,
v
.
SendUserId
)
.
First
(
&
user
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
var
realDiamond
uint64
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"gift_operate"
)
.
Where
(
"send_user_id = ? AND res_gift_id in (4766,4767,4768,4769) AND created_time >=
\"
2024-01-01 05:00:00
\"
AND created_time <=
\"
2024-01-08 05:00:00
\"
"
,
v
.
SendUserId
)
.
Select
(
"SUM(send_user_diamond) real_diamond"
)
.
Scan
(
&
realDiamond
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
data
[
i
]
.
Code
=
user
.
Code
data
[
i
]
.
RealDiamond
=
realDiamond
var
levels
[]
ActUserAward
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"act_user_award"
)
.
Where
(
"activity_id = 710 AND user_id = ?"
,
v
.
SendUserId
)
.
Select
(
"level"
)
.
Find
(
&
levels
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
var
l
[]
int
for
_
,
v
:=
range
levels
{
l
=
append
(
l
,
v
.
Level
)
}
data
[
i
]
.
Levels
=
l
//break
}
excelFileName
:=
fmt
.
Sprintf
(
"./710数据.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
()
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
=
"用户"
,
"实际送礼"
,
"活动统计送礼"
,
"已经领取的任务"
for
_
,
d
:=
range
data
{
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
()
var
l
[]
string
for
_
,
v
:=
range
d
.
Levels
{
l
=
append
(
l
,
fmt
.
Sprintf
(
"%v"
,
v
))
}
levels
:=
strings
.
Join
(
l
,
","
)
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
=
ats39
(
d
.
Code
),
ats39
(
d
.
RealDiamond
),
ats39
(
d
.
ActDiamond
),
ats39
(
levels
)
}
_
=
xlFile
.
Save
(
excelFileName
)
}
script/clear_redis.go
0 → 100644
View file @
8601ecaa
package
main
import
(
"context"
"fmt"
"github.com/go-redis/redis/v8"
"log"
)
const
redisAddr
=
"172.28.16.31:6379"
// 替换为你的Redis地址
func
main
()
{
// 创建Redis客户端
client
:=
redis
.
NewClient
(
&
redis
.
Options
{
Addr
:
redisAddr
,
DB
:
0
,
// 替换为你的数据库编号
//Password: "yPyZH1DYMJhrVQgr",
})
// 关闭连接
defer
func
()
{
if
err
:=
client
.
Close
();
err
!=
nil
{
log
.
Fatalf
(
"Failed to close Redis connection: %v"
,
err
)
}
}()
// 获取所有以"user_qps_"为前缀的键
keys
,
err
:=
getKeysWithPrefix
(
client
,
"hilo_zsdb_round_"
)
if
err
!=
nil
{
log
.
Fatalf
(
"Failed to get keys with prefix: %v"
,
err
)
}
println
(
len
(
keys
))
// 删除所有匹配的键
//err = deleteKeys(client, keys)
//if err != nil {
// log.Fatalf("Failed to delete keys: %v", err)
//}
fmt
.
Println
(
"Cleanup completed."
)
}
// 获取所有以特定前缀开头的键
func
getKeysWithPrefix
(
client
*
redis
.
Client
,
prefix
string
)
([]
string
,
error
)
{
ctx
:=
context
.
Background
()
var
cursor
uint64
var
keys
[]
string
var
err
error
for
{
var
result
[]
string
result
,
cursor
,
err
=
client
.
Scan
(
ctx
,
cursor
,
prefix
+
"*"
,
1000
)
.
Result
()
if
err
!=
nil
{
return
nil
,
err
}
keys
=
append
(
keys
,
result
...
)
if
cursor
==
0
{
break
}
}
return
keys
,
nil
}
// 删除指定的键
func
deleteKeys
(
client
*
redis
.
Client
,
keys
[]
string
)
error
{
ctx
:=
context
.
Background
()
for
_
,
key
:=
range
keys
{
err
:=
client
.
Del
(
ctx
,
key
)
.
Err
()
if
err
!=
nil
{
return
err
}
}
return
nil
}
script/promotion_data.go
View file @
8601ecaa
...
@@ -43,7 +43,7 @@ func main() {
...
@@ -43,7 +43,7 @@ func main() {
pageIndex
:=
1
pageIndex
:=
1
pageSize
:=
1000
pageSize
:=
1000
for
{
for
{
url
:=
fmt
.
Sprintf
(
"https://apiv2.faceline.live/v1/mgr/promotion/invite/data?lang=zh-cn&pageIndex=%d&pageSize=%d&startTime=2023-
10-01&endTime=2023-10-31
&teamName=&agentCode=&inviteeCode=&platform=All"
,
url
:=
fmt
.
Sprintf
(
"https://apiv2.faceline.live/v1/mgr/promotion/invite/data?lang=zh-cn&pageIndex=%d&pageSize=%d&startTime=2023-
09-01&endTime=2023-11-30
&teamName=&agentCode=&inviteeCode=&platform=All"
,
pageIndex
,
pageSize
)
pageIndex
,
pageSize
)
method
:=
"GET"
method
:=
"GET"
...
@@ -55,7 +55,7 @@ func main() {
...
@@ -55,7 +55,7 @@ func main() {
return
return
}
}
req
.
Header
.
Add
(
"nonce"
,
"hilo"
)
req
.
Header
.
Add
(
"nonce"
,
"hilo"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTcw
MjU0NjkzMX0.-3OB6g_T9sX4XZIh3BaDlG7uSpYkRAcOh6PobBFyOKA
"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTcw
NTIxODE0MH0.Xb7DU89AUYBahJfV4MDcr-pBbsLJcf1VM0WgnCNb-ig
"
)
res
,
err
:=
client
.
Do
(
req
)
res
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -80,7 +80,7 @@ func main() {
...
@@ -80,7 +80,7 @@ func main() {
data
=
append
(
data
,
resp
.
Data
.
Items
...
)
data
=
append
(
data
,
resp
.
Data
.
Items
...
)
pageIndex
++
pageIndex
++
}
}
excelFileName
:=
fmt
.
Sprintf
(
"./推广员数据
10月
.xlsx"
)
excelFileName
:=
fmt
.
Sprintf
(
"./推广员数据
0901-1130
.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
xlFile
:=
xlsx
.
NewFile
()
sheet
,
err
:=
xlFile
.
AddSheet
(
"promotion"
)
sheet
,
err
:=
xlFile
.
AddSheet
(
"promotion"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
script/svip_user_charge.go
View file @
8601ecaa
...
@@ -14,15 +14,17 @@ type AutoGenerated34 struct {
...
@@ -14,15 +14,17 @@ type AutoGenerated34 struct {
Data
struct
{
Data
struct
{
Total
int
`json:"total"`
Total
int
`json:"total"`
Data
[]
struct
{
Data
[]
struct
{
UserID
int
`json:"userId"`
UserID
int
`json:"userId"`
Date
string
`json:"date"`
Date
string
`json:"date"`
Country
string
`json:"country"`
Country
string
`json:"country"`
UserCode
string
`json:"userCode"`
UserCode
string
`json:"userCode"`
UserName
string
`json:"userName"`
UserName
string
`json:"userName"`
ChargeMoney
string
`json:"chargeMoney"`
ChargeMoney
string
`json:"chargeMoney"`
HaveFirst
int
`json:"haveFirst"`
HaveFirst
int
`json:"haveFirst"`
RegisterAt
string
`json:"registerAt"`
RegisterAt
string
`json:"registerAt"`
SvipLevel
int
`json:"svipLevel"`
SvipLevel
int
`json:"svipLevel"`
MaxDollar
int
`json:"maxDollar"`
// 历史最高单笔
MaxDollarDuration
int
`json:"maxDollarDuration"`
// 时段最高单笔
}
`json:"data"`
}
`json:"data"`
}
`json:"data"`
}
`json:"data"`
}
}
...
@@ -32,7 +34,9 @@ func ats34(a interface{}) string {
...
@@ -32,7 +34,9 @@ func ats34(a interface{}) string {
}
}
func
main
()
{
func
main
()
{
url
:=
"https://apiv2.faceline.live/v1/stats/charge/user?lang=zh-cn&diamondType=2&beginDate=2023-10-01&endDate=2023-10-31&pageIndex=1&pageSize=10000&country=All&code=&area=1&timezone=1"
//url := "https://apiv2.faceline.live/v1/stats/charge/user?lang=zh-cn&diamondType=2&beginDate=2023-10-01&endDate=2023-10-31&pageIndex=1&pageSize=10000&country=All&code=&area=1&timezone=1"
//url := "https://apiv2.faceline.live/v1/stats/charge/user?lang=zh-cn&diamondType=1&beginDate=2022-06-01&endDate=2023-12-13&pageIndex=1&pageSize=4805&country=All&code=&area=1&timezone=0"
url
:=
"https://apiv2.faceline.live/v1/stats/charge/user?lang=zh-cn&diamondType=1&beginDate=2023-12-01&endDate=2023-12-31&pageIndex=2&pageSize=2500&country=All&code=&area=2&timezone=0"
method
:=
"GET"
method
:=
"GET"
client
:=
&
http
.
Client
{}
client
:=
&
http
.
Client
{}
...
@@ -43,7 +47,7 @@ func main() {
...
@@ -43,7 +47,7 @@ func main() {
return
return
}
}
req
.
Header
.
Add
(
"nonce"
,
"hilo"
)
req
.
Header
.
Add
(
"nonce"
,
"hilo"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTcw
MTIyNTI5Nn0.YIz5lhgvqIxgmK0lLXICUhiISHNP4_g-LHsg4foL-qc
"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTcw
NTIxODE0MH0.Xb7DU89AUYBahJfV4MDcr-pBbsLJcf1VM0WgnCNb-ig
"
)
res
,
err
:=
client
.
Do
(
req
)
res
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -56,22 +60,23 @@ func main() {
...
@@ -56,22 +60,23 @@ func main() {
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
println
(
string
(
body
))
var
response
=
new
(
AutoGenerated34
)
var
response
=
new
(
AutoGenerated34
)
err
=
json
.
Unmarshal
(
body
,
&
response
)
err
=
json
.
Unmarshal
(
body
,
&
response
)
if
err
!=
nil
{
if
err
!=
nil
{
panic
(
err
)
panic
(
err
)
}
}
excelFileName
:=
fmt
.
Sprintf
(
"./
粉钻充值10月-沙特时间
.xlsx"
)
excelFileName
:=
fmt
.
Sprintf
(
"./
非阿语区黄钻充值202312月2
.xlsx"
)
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
:=
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
=
"日期"
,
"国家"
,
"用户ID"
,
"用户昵称"
,
"充值金额"
,
"注册时间"
,
"是否举办首场活动"
,
"svip等级
"
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
,
c9
.
Value
,
c10
.
Value
=
"日期"
,
"国家"
,
"用户ID"
,
"用户昵称"
,
"充值金额"
,
"注册时间"
,
"是否举办首场活动"
,
"svip等级"
,
"时段最高单笔"
,
"历史最高单笔
"
for
_
,
d
:=
range
response
.
Data
.
Data
{
for
_
,
d
:=
range
response
.
Data
.
Data
{
row
:=
sheet
.
AddRow
()
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
,
c8
:=
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
=
ats34
(
d
.
Date
),
ats34
(
d
.
Country
),
ats34
(
d
.
UserCode
),
ats34
(
d
.
UserName
),
ats34
(
d
.
ChargeMoney
),
ats34
(
d
.
RegisterAt
)
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
=
ats34
(
d
.
Date
),
ats34
(
d
.
Country
),
ats34
(
d
.
UserCode
),
ats34
(
d
.
UserName
),
ats34
(
d
.
ChargeMoney
),
ats34
(
d
.
RegisterAt
)
c7
.
Value
,
c8
.
Value
=
ats34
(
d
.
HaveFirst
),
ats34
(
d
.
SvipLevel
)
c7
.
Value
,
c8
.
Value
,
c9
.
Value
,
c10
.
Value
=
ats34
(
d
.
HaveFirst
),
ats34
(
d
.
SvipLevel
),
ats34
(
d
.
MaxDollarDuration
),
ats34
(
d
.
MaxDollar
)
}
}
_
=
xlFile
.
Save
(
excelFileName
)
_
=
xlFile
.
Save
(
excelFileName
)
}
}
script/test_20_in_mic.go
View file @
8601ecaa
...
@@ -10,7 +10,8 @@ import (
...
@@ -10,7 +10,8 @@ import (
"time"
"time"
)
)
var
micCodes
=
[]
string
{
"1000653"
,
"1000516"
,
"1000675"
,
"1000890"
,
"1000755"
,
"1000593"
,
"1000629"
,
"1000634"
,
"1000765"
,
"1000591"
,
"1000633"
,
"1000224"
,
"1000611"
,
"1000689"
,
"1000467"
,
"1000384"
,
"1000367"
,
"1000623"
}
//var micCodes = []string{"1000653", "1000516", "1000675", "1000890", "1000755", "1000593", "1000629", "1000634", "1000765", "1000591", "1000633", "1000224", "1000611", "1000689", "1000467", "1000384", "1000367", "1000623"}
var
micCodes
=
[]
string
{
"1110189"
,
"1110188"
,
"1110186"
,
"1110183"
,
"1110180"
,
"1110175"
,
"1110170"
,
"1110160"
,
"1110158"
,
"1110154"
,
"1110152"
,
"1110150"
,
"1110141"
,
"1110139"
,
"1110130"
,
"199777"
,
"1110124"
,
"1110122"
,
"1110120"
,
"1110118"
}
func
main
()
{
func
main
()
{
var
users
[]
model
.
User
var
users
[]
model
.
User
...
@@ -21,7 +22,7 @@ func main() {
...
@@ -21,7 +22,7 @@ func main() {
url
:=
"https://test.apiv1.faceline.live/v1/imGroup/mic/in"
url
:=
"https://test.apiv1.faceline.live/v1/imGroup/mic/in"
method
:=
"POST"
method
:=
"POST"
payload
:=
strings
.
NewReader
(
"groupUuid=HTGS%23a5
6194639
&i="
)
payload
:=
strings
.
NewReader
(
"groupUuid=HTGS%23a5
0923362
&i="
)
client
:=
&
http
.
Client
{}
client
:=
&
http
.
Client
{}
req
,
err
:=
http
.
NewRequest
(
method
,
url
,
payload
)
req
,
err
:=
http
.
NewRequest
(
method
,
url
,
payload
)
...
...
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