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
96e3c960
Commit
96e3c960
authored
Jul 26, 2024
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat
parent
029c199c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
412 additions
and
23 deletions
+412
-23
act_rank_data.go
script/act_rank_data.go
+227
-0
clear_redis.go
script/clear_redis.go
+1
-1
fruit_day_detail.go
script/fruit_day_detail.go
+76
-0
fruit_day_stat.go
script/fruit_day_stat.go
+4
-3
fruit_slot_race_charge_history_sum.go
script/fruit_slot_race_charge_history_sum.go
+2
-2
promotion_data.go
script/promotion_data.go
+3
-3
svip_user_charge.go
script/svip_user_charge.go
+93
-8
test_20_in_mic.go
script/test_20_in_mic.go
+2
-2
jwt.go
script/utils/jwt/jwt.go
+2
-2
utils_test.go
script/utils/utils_test.go
+2
-2
No files found.
script/act_rank_data.go
0 → 100644
View file @
96e3c960
package
main
import
(
"encoding/json"
"fmt"
"github.com/spf13/cast"
"github.com/tealeg/xlsx"
"io/ioutil"
"net/http"
"time"
)
type
ActRankData
struct
{
Code
int
`json:"code,omitempty"`
Message
string
`json:"message,omitempty"`
MessageData
any
`json:"messageData,omitempty"`
OperationMessage
string
`json:"operationMessage,omitempty"`
Data
struct
{
Top3
[]
struct
{
ID
int
`json:"id,omitempty"`
CreatedTime
time
.
Time
`json:"createdTime,omitempty"`
UpdatedTime
time
.
Time
`json:"updatedTime,omitempty"`
ExternalID
string
`json:"externalId,omitempty"`
Avatar
string
`json:"avatar,omitempty"`
DefaultAvatar
bool
`json:"defaultAvatar,omitempty"`
Nick
string
`json:"nick,omitempty"`
Sex
int
`json:"sex,omitempty"`
Birthday
int
`json:"birthday,omitempty"`
Country
string
`json:"country,omitempty"`
CountryIcon
string
`json:"countryIcon,omitempty"`
Language
string
`json:"language,omitempty"`
Description
string
`json:"description,omitempty"`
Code
string
`json:"code,omitempty"`
OriginCode
string
`json:"originCode,omitempty"`
IsPush
int
`json:"isPush,omitempty"`
IsShowAge
int
`json:"isShowAge,omitempty"`
Status
int
`json:"status,omitempty"`
DeviceType
string
`json:"deviceType,omitempty"`
LogoutTime
int
`json:"logoutTime,omitempty"`
MaskNick
string
`json:"maskNick,omitempty"`
MaskAvatar
string
`json:"maskAvatar,omitempty"`
CountryID
bool
`json:"countryId,omitempty"`
IsRealCertification
int
`json:"isRealCertification,omitempty"`
Rank
int
`json:"Rank,omitempty"`
Score
int
`json:"Score,omitempty"`
User2
struct
{
ID
int
`json:"id,omitempty"`
CreatedTime
time
.
Time
`json:"createdTime,omitempty"`
UpdatedTime
time
.
Time
`json:"updatedTime,omitempty"`
ExternalID
string
`json:"externalId,omitempty"`
Avatar
string
`json:"avatar,omitempty"`
DefaultAvatar
bool
`json:"defaultAvatar,omitempty"`
Nick
string
`json:"nick,omitempty"`
Sex
int
`json:"sex,omitempty"`
Birthday
int
`json:"birthday,omitempty"`
Country
string
`json:"country,omitempty"`
CountryIcon
string
`json:"countryIcon,omitempty"`
Language
string
`json:"language,omitempty"`
Description
string
`json:"description,omitempty"`
Code
string
`json:"code,omitempty"`
OriginCode
string
`json:"originCode,omitempty"`
IsPush
int
`json:"isPush,omitempty"`
IsShowAge
int
`json:"isShowAge,omitempty"`
Status
int
`json:"status,omitempty"`
DeviceType
string
`json:"deviceType,omitempty"`
LogoutTime
int
`json:"logoutTime,omitempty"`
MaskNick
string
`json:"maskNick,omitempty"`
MaskAvatar
string
`json:"maskAvatar,omitempty"`
CountryID
bool
`json:"countryId,omitempty"`
IsRealCertification
int
`json:"isRealCertification,omitempty"`
}
`json:"User2,omitempty"`
Supporter
any
`json:"supporter,omitempty"`
Family
any
`json:"Family,omitempty"`
TodayScore
int
`json:"TodayScore,omitempty"`
Today
string
`json:"Today,omitempty"`
}
`json:"top3,omitempty"`
List
[]
struct
{
ID
int
`json:"id,omitempty"`
CreatedTime
time
.
Time
`json:"createdTime,omitempty"`
UpdatedTime
time
.
Time
`json:"updatedTime,omitempty"`
ExternalID
string
`json:"externalId,omitempty"`
Avatar
string
`json:"avatar,omitempty"`
DefaultAvatar
bool
`json:"defaultAvatar,omitempty"`
Nick
string
`json:"nick,omitempty"`
Sex
int
`json:"sex,omitempty"`
Birthday
int
`json:"birthday,omitempty"`
Country
string
`json:"country,omitempty"`
CountryIcon
string
`json:"countryIcon,omitempty"`
Language
string
`json:"language,omitempty"`
Description
string
`json:"description,omitempty"`
Code
string
`json:"code,omitempty"`
OriginCode
string
`json:"originCode,omitempty"`
IsPush
int
`json:"isPush,omitempty"`
IsShowAge
int
`json:"isShowAge,omitempty"`
Status
int
`json:"status,omitempty"`
DeviceType
string
`json:"deviceType,omitempty"`
LogoutTime
int
`json:"logoutTime,omitempty"`
MaskNick
string
`json:"maskNick,omitempty"`
MaskAvatar
string
`json:"maskAvatar,omitempty"`
CountryID
bool
`json:"countryId,omitempty"`
IsRealCertification
int
`json:"isRealCertification,omitempty"`
Rank
int
`json:"Rank,omitempty"`
Score
int
`json:"Score,omitempty"`
User2
struct
{
ID
int
`json:"id,omitempty"`
CreatedTime
time
.
Time
`json:"createdTime,omitempty"`
UpdatedTime
time
.
Time
`json:"updatedTime,omitempty"`
ExternalID
string
`json:"externalId,omitempty"`
Avatar
string
`json:"avatar,omitempty"`
DefaultAvatar
bool
`json:"defaultAvatar,omitempty"`
Nick
string
`json:"nick,omitempty"`
Sex
int
`json:"sex,omitempty"`
Birthday
int
`json:"birthday,omitempty"`
Country
string
`json:"country,omitempty"`
CountryIcon
string
`json:"countryIcon,omitempty"`
Language
string
`json:"language,omitempty"`
Description
string
`json:"description,omitempty"`
Code
string
`json:"code,omitempty"`
OriginCode
string
`json:"originCode,omitempty"`
IsPush
int
`json:"isPush,omitempty"`
IsShowAge
int
`json:"isShowAge,omitempty"`
Status
int
`json:"status,omitempty"`
DeviceType
string
`json:"deviceType,omitempty"`
LogoutTime
int
`json:"logoutTime,omitempty"`
MaskNick
string
`json:"maskNick,omitempty"`
MaskAvatar
string
`json:"maskAvatar,omitempty"`
CountryID
bool
`json:"countryId,omitempty"`
IsRealCertification
int
`json:"isRealCertification,omitempty"`
}
`json:"User2,omitempty"`
Supporter
any
`json:"supporter,omitempty"`
Family
any
`json:"Family,omitempty"`
TodayScore
int
`json:"TodayScore,omitempty"`
Today
string
`json:"Today,omitempty"`
}
`json:"List,omitempty"`
OrdinaryTop5
any
`json:"OrdinaryTop5,omitempty"`
Mine
struct
{
ID
int
`json:"id,omitempty"`
CreatedTime
time
.
Time
`json:"createdTime,omitempty"`
UpdatedTime
time
.
Time
`json:"updatedTime,omitempty"`
ExternalID
string
`json:"externalId,omitempty"`
Avatar
string
`json:"avatar,omitempty"`
DefaultAvatar
bool
`json:"defaultAvatar,omitempty"`
Nick
string
`json:"nick,omitempty"`
Sex
int
`json:"sex,omitempty"`
Birthday
int
`json:"birthday,omitempty"`
Country
string
`json:"country,omitempty"`
CountryIcon
string
`json:"countryIcon,omitempty"`
Language
string
`json:"language,omitempty"`
Description
string
`json:"description,omitempty"`
Code
string
`json:"code,omitempty"`
OriginCode
string
`json:"originCode,omitempty"`
IsPush
int
`json:"isPush,omitempty"`
IsShowAge
int
`json:"isShowAge,omitempty"`
Status
int
`json:"status,omitempty"`
DeviceType
string
`json:"deviceType,omitempty"`
LogoutTime
int
`json:"logoutTime,omitempty"`
MaskNick
string
`json:"maskNick,omitempty"`
MaskAvatar
string
`json:"maskAvatar,omitempty"`
CountryID
bool
`json:"countryId,omitempty"`
IsRealCertification
int
`json:"isRealCertification,omitempty"`
Rank
int
`json:"Rank,omitempty"`
Score
int
`json:"Score,omitempty"`
User2
any
`json:"User2,omitempty"`
Supporter
any
`json:"supporter,omitempty"`
Family
any
`json:"Family,omitempty"`
TodayScore
int
`json:"TodayScore,omitempty"`
Today
string
`json:"Today,omitempty"`
}
`json:"Mine,omitempty"`
TeamList
any
`json:"TeamList,omitempty"`
Team
any
`json:"Team,omitempty"`
MyTeam
any
`json:"MyTeam,omitempty"`
}
`json:"data,omitempty"`
Edata
any
`json:"edata,omitempty"`
}
func
main
()
{
url
:=
"https://api.hiloconn.com/v1/h5/activity/ranking?activityId=1028&rankType=4&nonce=0.9194299152147352"
method
:=
"GET"
client
:=
&
http
.
Client
{}
req
,
err
:=
http
.
NewRequest
(
method
,
url
,
nil
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjE3NjMyMTEsIkV4dGVybmFsSWQiOiJkYTllMTJhM2I0ZGU0YWE5Yjc2MjBlNDllYzUyMTliYyIsImV4cCI6MTcyNDU3ODA5MiwiaXNzIjoiaGlsb0FwaSJ9.zzqt1wz20MurMPYL5vvusKB8Fue3QtcHePEP5yQ18-I"
)
req
.
Header
.
Add
(
"nonce"
,
"hilo"
)
res
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
defer
res
.
Body
.
Close
()
body
,
err
:=
ioutil
.
ReadAll
(
res
.
Body
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
rsp
:=
new
(
ActRankData
)
if
err
:=
json
.
Unmarshal
(
body
,
rsp
);
err
!=
nil
{
panic
(
err
)
}
excelFileName
:=
fmt
.
Sprintf
(
"./1028-活动榜单.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
err
:=
xlFile
.
AddSheet
(
"data"
)
if
err
!=
nil
{
panic
(
err
)
}
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
()
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
=
"排名"
,
"User1"
,
"User2"
,
"分数"
for
_
,
d
:=
range
rsp
.
Data
.
Top3
{
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
()
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
=
cast
.
ToString
(
d
.
Rank
),
cast
.
ToString
(
d
.
Code
),
cast
.
ToString
(
d
.
User2
.
Code
),
cast
.
ToString
(
d
.
Score
)
}
for
_
,
d
:=
range
rsp
.
Data
.
List
{
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
()
c1
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
=
cast
.
ToString
(
d
.
Rank
),
cast
.
ToString
(
d
.
Code
),
cast
.
ToString
(
d
.
User2
.
Code
),
cast
.
ToString
(
d
.
Score
)
}
_
=
xlFile
.
Save
(
excelFileName
)
}
script/clear_redis.go
View file @
96e3c960
...
...
@@ -25,7 +25,7 @@ func main() {
}()
// 获取所有以"user_qps_"为前缀的键
keys
,
err
:=
getKeysWithPrefix
(
client
,
"
group_in_user_duration_
"
)
keys
,
err
:=
getKeysWithPrefix
(
client
,
"
lobby:match:msg:
"
)
if
err
!=
nil
{
log
.
Fatalf
(
"Failed to get keys with prefix: %v"
,
err
)
}
...
...
script/fruit_day_detail.go
0 → 100644
View file @
96e3c960
package
main
import
(
"encoding/json"
"fmt"
"github.com/tealeg/xlsx"
"io/ioutil"
"net/http"
)
type
FruitDayDetailResp
struct
{
Code
int
`json:"code,omitempty"`
Message
string
`json:"message,omitempty"`
Data
struct
{
Total
int
`json:"total,omitempty"`
Data
[]
struct
{
Date
string
`json:"Date,omitempty"`
Round
int
`json:"Round,omitempty"`
Pool
int
`json:"Pool,omitempty"`
UserNum
int
`json:"UserNum,omitempty"`
Stake
int
`json:"Stake,omitempty"`
Total
int
`json:"Total,omitempty"`
AwardNum
int
`json:"AwardNum,omitempty"`
Award
int
`json:"Award,omitempty"`
Recycle
int
`json:"Recycle,omitempty"`
LeftOver
int
`json:"LeftOver,omitempty"`
FruitId
uint64
`json:"FruitId"`
}
`json:"data,omitempty"`
}
`json:"data,omitempty"`
}
func
ats48
(
a
interface
{})
string
{
return
fmt
.
Sprintf
(
"%v"
,
a
)
}
func
main
()
{
url
:=
"http://43.135.4.137:8088/v1/fruitMachine/day/detail?lang=zh-cn&pageIndex=1&pageSize=10000&date=2025-11-11"
method
:=
"GET"
client
:=
&
http
.
Client
{}
req
,
err
:=
http
.
NewRequest
(
method
,
url
,
nil
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
req
.
Header
.
Add
(
"nonce"
,
"hilo"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjEsIkV4dGVybmFsSWQiOiIiLCJleHAiOjE3MTk3NDMzNDd9.O9UCpSAR82xW_w9wKNXOP5jW3lfX5TPYkv8un8Gu1q8"
)
res
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
defer
res
.
Body
.
Close
()
body
,
err
:=
ioutil
.
ReadAll
(
res
.
Body
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
}
var
response
=
new
(
FruitDayDetailResp
)
json
.
Unmarshal
(
body
,
&
response
)
excelFileName
:=
fmt
.
Sprintf
(
"./水果机每日明细.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
:=
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
=
"轮次"
,
"开奖位置"
,
"投注"
,
"奖励"
,
"奖池盈余"
,
"系统回收"
,
"本轮盈余"
for
_
,
d
:=
range
response
.
Data
.
Data
{
row
:=
sheet
.
AddRow
()
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
:=
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
=
ats48
(
d
.
Round
),
ats48
(
d
.
FruitId
),
ats48
(
d
.
Stake
),
ats48
(
d
.
Award
),
ats48
(
d
.
Pool
),
ats48
(
d
.
Recycle
),
ats48
(
d
.
LeftOver
)
}
_
=
xlFile
.
Save
(
excelFileName
)
}
script/fruit_day_stat.go
View file @
96e3c960
...
...
@@ -36,7 +36,8 @@ func ats28(a interface{}) string {
}
func
main
()
{
url
:=
"https://apiv2.faceline.live/v1/fruitMachine/day/stats?lang=zh-cn&pageIndex=1&pageSize=100000&beginDate=2023-04-01&endDate=2023-06-31"
//url := "https://apiv2.faceline.live/v1/fruitMachine/day/stats?lang=zh-cn&pageIndex=1&pageSize=100000&beginDate=2024-04-01&endDate=2024-06-30"
url
:=
"https://apiv2.faceline.live/v1/race/day/stats?lang=zh-cn&pageIndex=1&pageSize=100000&beginDate=2024-04-01&endDate=2024-06-30"
method
:=
"GET"
client
:=
&
http
.
Client
{}
...
...
@@ -47,7 +48,7 @@ func main() {
return
}
req
.
Header
.
Add
(
"nonce"
,
"hilo"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MT
Y5MDYwOTY4NX0.dVsFGjc1wLPxqhAMloXICs-xQcVxM5FkweLvFta3ncA
"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MT
cyMjczNzEzMH0.LZDmjeRkUiYIQA7hVnbb6_xFQtyGf9yev-y6NQqVhRY
"
)
res
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
...
...
@@ -63,7 +64,7 @@ func main() {
}
var
response
=
new
(
AutoGenerated
)
json
.
Unmarshal
(
body
,
&
response
)
excelFileName
:=
fmt
.
Sprintf
(
"./
水果机每日统计
.xlsx"
)
excelFileName
:=
fmt
.
Sprintf
(
"./
赛车每日统计-4-6月
.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
row
:=
sheet
.
AddRow
()
...
...
script/fruit_slot_race_charge_history_sum.go
View file @
96e3c960
...
...
@@ -19,7 +19,7 @@ func ats42(a interface{}) string {
return
fmt
.
Sprintf
(
"%v"
,
a
)
}
var
start
,
end
=
"2024-05-2
0 05:00:00"
,
"2024-05-27
05:00:00"
// 左闭右开,沙特时间
var
start
,
end
=
"2024-05-2
7 05:00:00"
,
"2024-06-03
05:00:00"
// 左闭右开,沙特时间
func
main
()
{
...
...
@@ -58,7 +58,7 @@ func main() {
charges
[
i
]
.
Bet
=
bets
[
uc
.
UserId
]
}
excelFileName
:=
fmt
.
Sprintf
(
"./5月2
0日-5月26
日水果机slot赛车数据.xlsx"
)
excelFileName
:=
fmt
.
Sprintf
(
"./5月2
7日-6月02
日水果机slot赛车数据.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
err
:=
xlFile
.
AddSheet
(
"data"
)
if
err
!=
nil
{
...
...
script/promotion_data.go
View file @
96e3c960
...
...
@@ -43,7 +43,7 @@ func main() {
pageIndex
:=
1
pageSize
:=
1000
for
{
url
:=
fmt
.
Sprintf
(
"https://apiv2.faceline.live/v1/mgr/promotion/invite/data?lang=zh-cn&pageIndex=%d&pageSize=%d&startTime=202
3-12-01&endTime=2024-03-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=202
4-01-01&endTime=2024-06-30
&teamName=&agentCode=&inviteeCode=&platform=All"
,
pageIndex
,
pageSize
)
method
:=
"GET"
...
...
@@ -55,7 +55,7 @@ func main() {
return
}
req
.
Header
.
Add
(
"nonce"
,
"hilo"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTc
xNDcxNjcyOH0.Mt_gpOenB25vRXDFM4u-oReTNMBYgS7ZvzQumQHOuvU
"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTc
yMjczNzEzMH0.LZDmjeRkUiYIQA7hVnbb6_xFQtyGf9yev-y6NQqVhRY
"
)
res
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
...
...
@@ -80,7 +80,7 @@ func main() {
data
=
append
(
data
,
resp
.
Data
.
Items
...
)
pageIndex
++
}
excelFileName
:=
fmt
.
Sprintf
(
"./推广员数据1
2月1日-3月31
日.xlsx"
)
excelFileName
:=
fmt
.
Sprintf
(
"./推广员数据1
月1日-6月30
日.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
err
:=
xlFile
.
AddSheet
(
"promotion"
)
if
err
!=
nil
{
...
...
script/svip_user_charge.go
View file @
96e3c960
...
...
@@ -3,9 +3,11 @@ package main
import
(
"encoding/json"
"fmt"
"git.hilo.cn/hilo-common/script/mysql"
"github.com/tealeg/xlsx"
"io/ioutil"
"net/http"
"time"
)
type
AutoGenerated34
struct
{
...
...
@@ -18,7 +20,7 @@ type AutoGenerated34 struct {
}
type
AutoGenerated34Data
struct
{
UserID
int
`json:"userId"`
UserID
uint64
`json:"userId"`
Date
string
`json:"date"`
Country
string
`json:"country"`
UserCode
string
`json:"userCode"`
...
...
@@ -29,6 +31,9 @@ type AutoGenerated34Data struct {
SvipLevel
int
`json:"svipLevel"`
MaxDollar
int
`json:"maxDollar"`
// 历史最高单笔
MaxDollarDuration
int
`json:"maxDollarDuration"`
// 时段最高单笔
Phone
string
`json:"phone"`
Charm
int
`json:"charm"`
LastRequestTime
string
`json:"lastRequestTime"`
}
func
ats34
(
a
interface
{})
string
{
...
...
@@ -42,7 +47,7 @@ func main() {
pageIndex
:=
1
pageSize
:=
1000
for
{
url
:=
fmt
.
Sprintf
(
"https://apiv2.faceline.live/v1/stats/charge/user?lang=zh-cn&diamondType=1&beginDate=202
4-03-01&endDate=2024-03-31
&pageIndex=%d&pageSize=%d&country=All&code=&area=2&timezone=0"
,
url
:=
fmt
.
Sprintf
(
"https://apiv2.faceline.live/v1/stats/charge/user?lang=zh-cn&diamondType=1&beginDate=202
0-01-01&endDate=2024-07-05
&pageIndex=%d&pageSize=%d&country=All&code=&area=2&timezone=0"
,
pageIndex
,
pageSize
)
method
:=
"GET"
...
...
@@ -54,7 +59,7 @@ func main() {
return
}
req
.
Header
.
Add
(
"nonce"
,
"hilo"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTc
xNDcxNjcyOH0.Mt_gpOenB25vRXDFM4u-oReTNMBYgS7ZvzQumQHOuvU
"
)
req
.
Header
.
Add
(
"token"
,
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTc
yMjczNzEzMH0.LZDmjeRkUiYIQA7hVnbb6_xFQtyGf9yev-y6NQqVhRY
"
)
res
,
err
:=
client
.
Do
(
req
)
if
err
!=
nil
{
...
...
@@ -78,17 +83,97 @@ func main() {
data
=
append
(
data
,
response
.
Data
.
Data
...
)
pageIndex
++
}
excelFileName
:=
fmt
.
Sprintf
(
"./非阿语区黄钻充值20243月.xlsx"
)
var
userIds
[]
uint64
for
_
,
v
:=
range
data
{
userIds
=
append
(
userIds
,
v
.
UserID
)
}
phones
:=
GetPhones
(
userIds
)
charms
:=
GetUserCharmLevel
(
userIds
)
requsets
:=
GetRequestLast
(
userIds
)
for
i
,
v
:=
range
data
{
data
[
i
]
.
Phone
=
phones
[
v
.
UserID
]
data
[
i
]
.
Charm
=
charms
[
v
.
UserID
]
data
[
i
]
.
LastRequestTime
=
requsets
[
v
.
UserID
]
}
excelFileName
:=
fmt
.
Sprintf
(
"./非阿语区黄钻充值202001-至今.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
row
:=
sheet
.
AddRow
()
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
,
c10
.
Value
=
"日期"
,
"国家"
,
"用户ID"
,
"用户昵称"
,
"充值金额"
,
"注册时间"
,
"是否举办首场活动"
,
"svip等级"
,
"时段最高单笔"
,
"历史最高单笔
"
c1
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
,
c8
,
c9
,
c10
,
c11
,
c12
,
c13
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
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
,
c10
.
Value
,
c11
.
Value
,
c12
.
Value
,
c13
.
Value
=
"日期"
,
"国家"
,
"用户ID"
,
"用户昵称"
,
"充值金额"
,
"注册时间"
,
"是否举办首场活动"
,
"svip等级"
,
"时段最高单笔"
,
"历史最高单笔"
,
"手机号"
,
"魅力等级"
,
"最后登陆时间
"
for
_
,
d
:=
range
data
{
row
:=
sheet
.
AddRow
()
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
,
c2
,
c3
,
c4
,
c5
,
c6
,
c7
,
c8
,
c9
,
c10
,
c11
,
c12
,
c13
:=
row
.
AddCell
(),
row
.
AddCell
(),
row
.
AddCell
(),
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
)
c7
.
Value
,
c8
.
Value
,
c9
.
Value
,
c10
.
Value
=
ats34
(
d
.
HaveFirst
),
ats34
(
d
.
SvipLevel
),
ats34
(
d
.
MaxDollarDuration
),
ats34
(
d
.
MaxDollar
)
c7
.
Value
,
c8
.
Value
,
c9
.
Value
,
c10
.
Value
,
c11
.
Value
,
c12
.
Value
,
c13
.
Value
=
ats34
(
d
.
HaveFirst
),
ats34
(
d
.
SvipLevel
),
ats34
(
d
.
MaxDollarDuration
),
ats34
(
d
.
MaxDollar
),
d
.
Phone
,
ats34
(
d
.
Charm
),
d
.
LastRequestTime
}
_
=
xlFile
.
Save
(
excelFileName
)
}
type
UserBindInfo
struct
{
UserId
uint64
`gorm:"column:user_id"`
Phone
string
`gorm:"column:phone"`
// 手机号码(包含区号)
AreaCode
string
`gorm:"column:area_code"`
// 国家区号
}
func
(
UserBindInfo
)
TableName
()
string
{
return
"user_bind_info"
}
func
GetPhones
(
userIds
[]
uint64
)
map
[
uint64
]
string
{
var
rows
[]
UserBindInfo
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
UserBindInfo
{})
.
Where
(
"user_id in ?"
,
userIds
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
var
res
=
make
(
map
[
uint64
]
string
)
for
_
,
v
:=
range
rows
{
res
[
v
.
UserId
]
=
v
.
AreaCode
+
v
.
Phone
}
return
res
}
// MatchCharmUserScore 用户魅力分数
type
MatchCharmUserScore
struct
{
UserId
uint64
`gorm:"column:user_id"`
// user_id
Score
int64
`gorm:"column:score"`
// 分数
Grade
int
`gorm:"column:grade"`
// 等级
}
func
(
MatchCharmUserScore
)
TableName
()
string
{
return
"match_charm_user_score"
}
func
GetUserCharmLevel
(
userIds
[]
uint64
)
map
[
uint64
]
int
{
var
rows
[]
MatchCharmUserScore
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
MatchCharmUserScore
{})
.
Where
(
"user_id in ?"
,
userIds
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
res
:=
make
(
map
[
uint64
]
int
)
for
_
,
v
:=
range
rows
{
res
[
v
.
UserId
]
=
v
.
Grade
}
return
res
}
// UserRequestLast 用户请求最后时间
type
UserRequestLast
struct
{
ID
int64
`gorm:"column:id"`
// id
UserId
uint64
`gorm:"column:user_id"`
// 用户id
TimeLast
time
.
Time
`gorm:"column:time_last"`
// 最后的时间
}
func
(
UserRequestLast
)
TableName
()
string
{
return
"user_request_last"
}
func
GetRequestLast
(
userIds
[]
uint64
)
map
[
uint64
]
string
{
var
rows
[]
UserRequestLast
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
UserRequestLast
{})
.
Where
(
"user_id in ?"
,
userIds
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
res
:=
make
(
map
[
uint64
]
string
)
for
_
,
v
:=
range
rows
{
res
[
v
.
UserId
]
=
v
.
TimeLast
.
Format
(
"2006-01-02 15:04:05"
)
}
return
res
}
script/test_20_in_mic.go
View file @
96e3c960
...
...
@@ -10,7 +10,7 @@ import (
"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
()
{
...
...
@@ -22,7 +22,7 @@ func main() {
url
:=
"https://test.apiv1.faceline.live/v1/imGroup/mic/in"
method
:=
"POST"
payload
:=
strings
.
NewReader
(
"groupUuid=HTGS
%23a50923362
&i="
)
payload
:=
strings
.
NewReader
(
"groupUuid=HTGS
_3HIKK4QIV
&i="
)
client
:=
&
http
.
Client
{}
req
,
err
:=
http
.
NewRequest
(
method
,
url
,
payload
)
...
...
script/utils/jwt/jwt.go
View file @
96e3c960
...
...
@@ -12,7 +12,7 @@ type Claims struct {
jwt
.
StandardClaims
}
//生成token
//
生成token
func
GenerateToken
(
userId
uint64
,
externalId
string
,
issuer
string
)
(
string
,
error
)
{
duration
,
err
:=
time
.
ParseDuration
(
"240h"
)
if
err
!=
nil
{
...
...
@@ -37,7 +37,7 @@ func GetJWTSecret() []byte {
return
[]
byte
(
"hilo1632"
)
}
//解析token
//
解析token
func
ParseToken
(
token
string
)
(
*
Claims
,
error
)
{
tokenClaims
,
err
:=
jwt
.
ParseWithClaims
(
token
,
&
Claims
{},
func
(
token
*
jwt
.
Token
)
(
interface
{},
error
)
{
return
GetJWTSecret
(),
nil
...
...
script/utils/utils_test.go
View file @
96e3c960
...
...
@@ -15,6 +15,6 @@ func TestJwt(t *testing.T) {
}
func
TestJwtParse
(
t
*
testing
.
T
)
{
c
,
err
:=
jwt
.
ParseToken
(
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjQyNDAyNjEsIkV4dGVybmFsSWQiOiI0MTIwOWU5NTE0ZDI0ODQwYTliNTMxMDgyMWViNjRkNiIsImV4cCI6MTY5MjI2MTIxNiwiaXNzIjoiaGlsb0FwaSJ9.2ru292Z1q8p87Chzp5DWrR1hMHO3sQcD1X3QNwOio2U
"
)
println
(
c
,
err
)
c
,
_
:=
jwt
.
ParseToken
(
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjg4Nzc2OTEsIkV4dGVybmFsSWQiOiJkNmZlNmJhN2E3ZTI0NjRiYjhhNmU3OTFlNmQxY2E5ZCIsIlRva2VuVmVyc2lvbiI6NywiZXhwIjoxNzE5NTczOTkzLCJpc3MiOiJoaWxvQXBpIn0.EWSFvxzyPDRLWA5eNQ_MSrUDlAeoMhmn0RKw4vfvL6k
"
)
println
(
c
.
UserId
)
}
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