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
d9e63096
Commit
d9e63096
authored
Aug 20, 2023
by
JiebinHu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:race day award
parent
20a516c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
2 deletions
+119
-2
Makefile
script/Makefile
+2
-0
fruit_day_award.go
script/fruit_day_award.go
+2
-2
race_day_award.go
script/race_day_award.go
+115
-0
No files found.
script/Makefile
View file @
d9e63096
...
...
@@ -22,4 +22,6 @@ fruit_fix:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
fruit_fix fruit_fix.go
fruit_day_award
:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
fruit_day_award fruit_day_award.go
race_day_award
:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
race_day_award race_day_award.go
script/fruit_day_award.go
View file @
d9e63096
...
...
@@ -41,7 +41,7 @@ func ats32(a interface{}) string {
}
func
main
()
{
url
:=
"https://apiv2.faceline.live/v1/fruitMachine/rank/award?lang=zh-cn&pageIndex=1&pageSize=50000&beginDate=2023-08-1
7&endDate=2023-08-17
&userCode=&timezone=1"
url
:=
"https://apiv2.faceline.live/v1/fruitMachine/rank/award?lang=zh-cn&pageIndex=1&pageSize=50000&beginDate=2023-08-1
9&endDate=2023-08-19
&userCode=&timezone=1"
method
:=
"GET"
client
:=
&
http
.
Client
{}
...
...
@@ -95,7 +95,7 @@ func main() {
for
_
,
v
:=
range
svips
{
svipMap
[
v
.
Code
]
=
v
.
Level
}
excelFileName
:=
fmt
.
Sprintf
(
"./081
7
水果机中奖榜.xlsx"
)
excelFileName
:=
fmt
.
Sprintf
(
"./081
9
水果机中奖榜.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
row
:=
sheet
.
AddRow
()
...
...
script/race_day_award.go
0 → 100644
View file @
d9e63096
package
main
import
(
"encoding/json"
"fmt"
"git.hilo.cn/hilo-common/script/mysql"
"github.com/tealeg/xlsx"
"io/ioutil"
"net/http"
)
type
RaceDayAward
struct
{
Code
int
`json:"code"`
Message
string
`json:"message"`
Data
struct
{
Total
int
`json:"total"`
Data
[]
struct
{
Rank
int
`json:"rank"`
UserCode
string
`json:"userCode"`
Country
string
`json:"country"`
Stake
int
`json:"stake"`
Award
int
`json:"award"`
ProfitLoss
int
`json:"profitLoss"`
ChargeMoney
float64
`json:"chargeMoney"`
}
`json:"data"`
}
`json:"data"`
}
type
ResCountry3
struct
{
Name
string
Area
int
}
func
(
ResCountry3
)
TableName
()
string
{
return
"res_country"
}
type
UserSvip3
struct
{
Code
string
Level
int
}
func
ats33
(
a
interface
{})
string
{
return
fmt
.
Sprintf
(
"%v"
,
a
)
}
func
main
()
{
url
:=
"https://apiv2.faceline.live/v1/race/rank/award?lang=zh-cn&pageIndex=1&pageSize=50000&beginDate=2023-08-18&endDate=2023-08-18&userCode=&timezone=1"
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.eyJVc2VySWQiOjI1MSwiRXh0ZXJuYWxJZCI6IiIsImV4cCI6MTY5MzIwNjcxOH0.V-5CfVUGbQDtn04vy85rjb2TtrfntZCuv209tUKFcgU"
)
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
{
panic
(
err
)
}
var
response
=
new
(
RaceDayAward
)
err
=
json
.
Unmarshal
(
body
,
&
response
)
if
err
!=
nil
{
panic
(
err
)
}
var
countryArea
=
make
(
map
[
string
]
string
)
// get from db
var
countries
[]
ResCountry3
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
ResCountry3
{})
.
Find
(
&
countries
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
for
_
,
v
:=
range
countries
{
area
:=
"阿语"
if
v
.
Area
==
2
{
area
=
"非阿语"
}
countryArea
[
v
.
Name
]
=
area
}
var
svipMap
=
make
(
map
[
string
]
int
)
var
codes
[]
string
for
_
,
v
:=
range
response
.
Data
.
Data
{
codes
=
append
(
codes
,
v
.
UserCode
)
}
var
svips
[]
UserSvip3
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"user_svip s"
)
.
Joins
(
"INNER JOIN user u ON u.id = s.user_id"
)
.
Select
(
"u.code,s.level"
)
.
Where
(
"u.code in ?"
,
codes
)
.
Find
(
&
svips
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
for
_
,
v
:=
range
svips
{
svipMap
[
v
.
Code
]
=
v
.
Level
}
excelFileName
:=
fmt
.
Sprintf
(
"./0818赛车中奖榜.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
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
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
,
c9
.
Value
=
"排名"
,
"用户ID"
,
"区域"
,
"国家"
,
"SVIP等级"
,
"投注钻石数"
,
"中奖钻石数"
,
"盈亏(中奖-投注)"
,
"充值金额$"
for
_
,
d
:=
range
response
.
Data
.
Data
{
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
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
,
c9
.
Value
=
ats33
(
d
.
Rank
),
ats33
(
d
.
UserCode
),
countryArea
[
d
.
Country
],
ats33
(
d
.
Country
),
ats33
(
svipMap
[
d
.
UserCode
]),
ats33
(
d
.
Stake
),
ats33
(
d
.
Award
),
ats33
(
d
.
ProfitLoss
),
ats33
(
d
.
ChargeMoney
)
}
_
=
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