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
495bd057
Commit
495bd057
authored
Jul 31, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
H5GameData
parent
fccd95b4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
184 additions
and
0 deletions
+184
-0
Makefile
script/Makefile
+2
-0
h5_game_yellow.go
script/h5_game_yellow.go
+182
-0
No files found.
script/Makefile
View file @
495bd057
...
@@ -16,4 +16,6 @@ charge_month:
...
@@ -16,4 +16,6 @@ charge_month:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
charge_month charge_month.go
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
charge_month charge_month.go
user_register_stat
:
user_register_stat
:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
user_register_stat user_register_stat.go
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
user_register_stat user_register_stat.go
h5_game_yellow
:
CGO_ENABLED
=
0
GOOS
=
linux
GOARCH
=
amd64 go build
-o
h5_game_yellow h5_game_yellow.go
script/h5_game_yellow.go
0 → 100644
View file @
495bd057
package
main
import
(
"fmt"
"git.hilo.cn/hilo-common/script/model"
"git.hilo.cn/hilo-common/script/mysql"
"github.com/tealeg/xlsx"
)
type
H5GameData
struct
{
Game
string
// 游戏名字
Date
string
// 日期
UserId
uint64
// 用户原始id
Code
string
// 用户ID
Stake
uint64
// 下注
Award
uint64
// 奖励
GoldCharge
uint64
// 当日金币充值
DiamondCharge
uint64
// 当日钻石充值
}
func
ats31
(
a
interface
{})
string
{
return
fmt
.
Sprintf
(
"%v"
,
a
)
}
func
main
()
{
wheel
()
fruit
()
}
func
wheel
()
{
type
GameListRank
struct
{
Date
string
GameId
uint64
UserId
uint64
Stake
uint64
Award
uint64
}
var
rows
[]
GameListRank
// 摩天轮sql
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
GameListRank
{})
.
Where
(
"game_id = 11"
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
var
userIds
[]
uint64
for
_
,
v
:=
range
rows
{
userIds
=
append
(
userIds
,
v
.
UserId
)
}
var
users
[]
model
.
User
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
model
.
User
{})
.
Where
(
"id in ?"
,
userIds
)
.
Find
(
&
users
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
var
uM
=
make
(
map
[
uint64
]
model
.
User
)
for
i
:=
range
users
{
uM
[
users
[
i
]
.
Id
]
=
users
[
i
]
}
var
data
[]
H5GameData
for
_
,
row
:=
range
rows
{
data
=
append
(
data
,
H5GameData
{
Game
:
"摩天轮"
,
Date
:
row
.
Date
,
UserId
:
row
.
UserId
,
Stake
:
row
.
Stake
,
Award
:
row
.
Award
,
Code
:
uM
[
row
.
UserId
]
.
Code
,
GoldCharge
:
getChargeGolds
(
row
.
UserId
,
row
.
Date
),
DiamondCharge
:
getChargeDiamonds
(
row
.
UserId
,
row
.
Date
),
})
}
excelFileName
:=
fmt
.
Sprintf
(
"./摩天轮.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
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
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
=
"游戏名字"
,
"日期"
,
"用户原始id"
,
"用户ID"
,
"下注"
,
"奖励"
,
"当日金币充值"
,
"当日钻石充值"
for
_
,
d
:=
range
data
{
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
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
=
d
.
Game
,
d
.
Date
,
ats31
(
d
.
UserId
),
d
.
Code
,
ats31
(
d
.
Stake
),
ats31
(
d
.
Award
),
ats31
(
d
.
GoldCharge
),
ats31
(
d
.
DiamondCharge
)
}
_
=
xlFile
.
Save
(
excelFileName
)
}
func
fruit
()
{
type
GameListRank
struct
{
Date
string
GameId
uint64
UserId
uint64
Stake
uint64
Award
uint64
}
var
rows
[]
GameListRank
// 水果slot
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
GameListRank
{})
.
Where
(
"game_id = 12"
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
var
userIds
[]
uint64
for
_
,
v
:=
range
rows
{
userIds
=
append
(
userIds
,
v
.
UserId
)
}
var
users
[]
model
.
User
if
err
:=
mysql
.
ProdReadOnlyDB
.
Model
(
model
.
User
{})
.
Where
(
"id in ?"
,
userIds
)
.
Find
(
&
users
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
var
uM
=
make
(
map
[
uint64
]
model
.
User
)
for
i
:=
range
users
{
uM
[
users
[
i
]
.
Id
]
=
users
[
i
]
}
var
data
[]
H5GameData
for
_
,
row
:=
range
rows
{
data
=
append
(
data
,
H5GameData
{
Game
:
"水果slot"
,
Date
:
row
.
Date
,
UserId
:
row
.
UserId
,
Stake
:
row
.
Stake
,
Award
:
row
.
Award
,
Code
:
uM
[
row
.
UserId
]
.
Code
,
GoldCharge
:
getChargeGolds
(
row
.
UserId
,
row
.
Date
),
DiamondCharge
:
getChargeDiamonds
(
row
.
UserId
,
row
.
Date
),
})
}
excelFileName
:=
fmt
.
Sprintf
(
"./水果slot.xlsx"
)
xlFile
:=
xlsx
.
NewFile
()
sheet
,
_
:=
xlFile
.
AddSheet
(
"charge"
)
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
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
=
"游戏名字"
,
"日期"
,
"用户原始id"
,
"用户ID"
,
"下注"
,
"奖励"
,
"当日金币充值"
,
"当日钻石充值"
for
_
,
d
:=
range
data
{
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
.
Value
,
c2
.
Value
,
c3
.
Value
,
c4
.
Value
,
c5
.
Value
,
c6
.
Value
,
c7
.
Value
,
c8
.
Value
=
d
.
Game
,
d
.
Date
,
ats31
(
d
.
UserId
),
d
.
Code
,
ats31
(
d
.
Stake
),
ats31
(
d
.
Award
),
ats31
(
d
.
GoldCharge
),
ats31
(
d
.
DiamondCharge
)
}
_
=
xlFile
.
Save
(
excelFileName
)
}
func
getChargeDiamonds
(
userId
uint64
,
date
string
)
uint64
{
var
res
uint64
type
R
struct
{
Money
uint64
}
var
money
R
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"pay_order AS p"
)
.
Where
(
"p.status = 2 AND p.`type` = 0 AND platform >= 1 AND platform <= 6"
)
.
// type=0 就是用户给自己充值,status=2成功
Where
(
"p.user_id = ? AND DATE(p.created_time) BETWEEN ? AND ?"
,
userId
,
date
,
date
)
.
Select
(
"SUM(price) as money"
)
.
Scan
(
&
money
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
res
+=
money
.
Money
var
money2
R
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"dealer_transfer_detail AS t"
)
.
Where
(
"t.receiver_id = ? AND DATE(t.created_time) BETWEEN ? AND ?"
,
userId
,
date
,
date
)
.
Select
(
"SUM(t.dollar) as money"
)
.
Scan
(
&
money2
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
res
+=
money2
.
Money
return
res
}
func
getChargeGolds
(
userId
uint64
,
date
string
)
uint64
{
var
res
uint64
type
R
struct
{
Money
uint64
}
var
money
R
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"pay_order AS p"
)
.
Where
(
"p.status = 2 AND p.`type` = 0 AND platform >= 31"
)
.
// type=0 就是用户给自己充值,status=2成功
Where
(
"p.user_id = ? AND DATE(p.created_time) BETWEEN ? AND ?"
,
userId
,
date
,
date
)
.
Select
(
"SUM(price) as money"
)
.
Scan
(
&
money
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
res
+=
money
.
Money
var
money2
R
if
err
:=
mysql
.
ProdReadOnlyDB
.
Table
(
"dealer_transfer_detail_pink AS t"
)
.
Where
(
"t.receiver_id = ? AND DATE(t.created_time) BETWEEN ? AND ?"
,
userId
,
date
,
date
)
.
Select
(
"SUM(t.dollar) as money"
)
.
Scan
(
&
money2
)
.
Error
;
err
!=
nil
{
panic
(
err
)
}
res
+=
money2
.
Money
return
res
}
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