- 游戏来源常量/按目录特征识别(云更新/网维大师/易乐游)/RunAppRecord 上报框架 - 网吧业务专用包, 附测试、examples/cafegame 例程与包 README
91 lines
3.0 KiB
Go
91 lines
3.0 KiB
Go
// Package cafegame 提供网咖游戏目录识别与游戏运行监控/统计(Windows)。
|
|
package cafegame
|
|
|
|
// AppData 单个游戏信息(目录识别结果)
|
|
type AppData struct {
|
|
AppSource int `json:"appSource"`
|
|
AppId int `json:"appId"`
|
|
AppName string `json:"appName"`
|
|
AppAlias string `json:"appAlias"`
|
|
AppDir string `json:"appDir"`
|
|
AppGuid string `json:"appGuid"`
|
|
}
|
|
|
|
// CountItem 单条游戏统计记录
|
|
type CountItem struct {
|
|
Runs int64 `json:"runs"` // 运行次数
|
|
RunTime int64 `json:"runTime"` // 运行时间
|
|
Duration int64 `json:"duration"` // 运行时长
|
|
Foreground int64 `json:"foreground"` // 前台时长
|
|
}
|
|
|
|
// AppCountInfo 单个游戏的统计汇总
|
|
type AppCountInfo struct {
|
|
Source int `json:"source"`
|
|
Id int `json:"id"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
// AppCountItem 上报用的游戏统计项(游戏信息 + 统计)
|
|
type AppCountItem struct {
|
|
AppCountInfo
|
|
CountItem
|
|
}
|
|
|
|
// AppCountReqData 游戏统计请求数据
|
|
type AppCountReqData struct {
|
|
HostName string `json:"hostName"`
|
|
HostIp string `json:"hostIp"`
|
|
GatewayMac string `json:"gatewayMac"`
|
|
Apps []AppData `json:"game"`
|
|
BootTime uint64 `json:"bootTime"`
|
|
Duration int `json:"duration"`
|
|
Foreground []ForegroundApp `json:"foreground"`
|
|
Time int64 `json:"time"`
|
|
}
|
|
|
|
// ForegroundApp 前台窗口关联的游戏及持续时间(秒)
|
|
type ForegroundApp struct {
|
|
AppData
|
|
Duration int
|
|
}
|
|
|
|
// AppDownloadReqData 游戏下载上报数据
|
|
type AppDownloadReqData struct {
|
|
AppId int `json:"appId"`
|
|
AppName string `json:"appName"`
|
|
AppSource int `json:"appSource"`
|
|
Status int `json:"status"`
|
|
Progress float32 `json:"progress"`
|
|
UpdateQuantity float64 `json:"updateQuantity"`
|
|
Residue float64 `json:"residue"`
|
|
Speed float64 `json:"speed"`
|
|
ConnNumber int `json:"connNumber"`
|
|
Remainder int `json:"remainder"`
|
|
}
|
|
|
|
// AppRunReqData 游戏运行上报数据
|
|
type AppRunReqData struct {
|
|
HostName string `json:"hostName"`
|
|
HostIp string `json:"hostIp"`
|
|
GatewayMac string `json:"gatewayMac"`
|
|
App AppData `json:"app"`
|
|
BootTime uint64 `json:"bootTime"`
|
|
Status int `json:"status"`
|
|
Time int64 `json:"time"`
|
|
RecordId int `json:"recordId"`
|
|
}
|
|
|
|
// AppEventData 游戏事件上报数据
|
|
type AppEventData struct {
|
|
AppId int `json:"appId"` // 游戏ID
|
|
AppName string `json:"appName"` // 游戏名称
|
|
AppSource int `json:"appSource"` // 游戏来源
|
|
ProcessPid int `json:"processPid"` // 进程ID
|
|
ProcessPath string `json:"processPath"` // 进程路径
|
|
ProcessOldPath string `json:"processOldPath"` // 进程原路径
|
|
EventType int `json:"eventType"` // 事件类型
|
|
EventSource string `json:"eventSource"` // 事件来源
|
|
Message string `json:"message"` // 事件信息
|
|
}
|