200 lines
17 KiB
Go
200 lines
17 KiB
Go
package botser
|
|
|
|
import (
|
|
"fmt"
|
|
"stat/models/appInfoMod"
|
|
"stat/models/botreport"
|
|
"stat/models/rechargemod"
|
|
"stat/models/syncrecharge"
|
|
)
|
|
|
|
func GetDateDesc(moveBackDays int) string {
|
|
if moveBackDays < 0 {
|
|
moveBackDays = moveBackDays * -1
|
|
}
|
|
switch moveBackDays {
|
|
case 0:
|
|
return "今天"
|
|
case 1:
|
|
return "昨天"
|
|
case 2:
|
|
return "前天"
|
|
default:
|
|
return fmt.Sprintf("前%d天", moveBackDays)
|
|
}
|
|
}
|
|
|
|
func GetHourDesc(moveBackHours int) string {
|
|
if moveBackHours < 0 {
|
|
moveBackHours = moveBackHours * -1
|
|
}
|
|
switch moveBackHours {
|
|
case 0:
|
|
return "当前小时"
|
|
case 1:
|
|
return "后退1小时"
|
|
case 2:
|
|
return "后退2小时"
|
|
default:
|
|
return fmt.Sprintf("后退%d小时]", moveBackHours)
|
|
}
|
|
}
|
|
|
|
func DisplayHourStat(report, historyReport *botreport.BotReport, appInfo *appInfoMod.AppInfo, dateDesc string) string {
|
|
text := fmt.Sprintf("应用名称:%s\n", appInfo.Name)
|
|
text += fmt.Sprintf("统计名称:%s数据\n", dateDesc)
|
|
text += fmt.Sprintf("统计时间:%s\n", report.SumDate.Format("2006-01-02T15:04:05"))
|
|
text += fmt.Sprintf("1️⃣%s充值统计:\n", dateDesc)
|
|
text += Line("总计:%s", report.HourRecharge/100, float64(report.HourRecharge-historyReport.HourRecharge), float64(historyReport.HourRecharge))
|
|
if appInfo.AppId == 888 {
|
|
text += Line("官网:%s", report.HourWebRecharge/100, float64(report.HourWebRecharge-historyReport.HourWebRecharge), float64(historyReport.HourWebRecharge))
|
|
}
|
|
text += Line("自来:%s", report.HourNormalRecharge/100, float64(report.HourNormalRecharge-historyReport.HourNormalRecharge), float64(historyReport.HourNormalRecharge))
|
|
text += Line("渠道:%s", report.HourDistrictRecharge/100, float64(report.HourDistrictRecharge-historyReport.HourDistrictRecharge), float64(historyReport.HourDistrictRecharge))
|
|
text += Line("┣会员:%s", report.HourDistrictVip/100, float64(report.HourDistrictVip-historyReport.HourDistrictVip), float64(historyReport.HourDistrictVip))
|
|
text += Line("┗轻量:%s", report.HourH5DistrictRecharge/100, float64(report.HourH5DistrictRecharge-historyReport.HourH5DistrictRecharge), float64(historyReport.HourH5DistrictRecharge))
|
|
text += Line("安卓:%s", report.HourAndroidRecharge/100, float64(report.HourAndroidRecharge-historyReport.HourAndroidRecharge), float64(historyReport.HourAndroidRecharge))
|
|
text += Line("苹果:%s", report.HourIosRecharge/100, float64(report.HourIosRecharge-historyReport.HourIosRecharge), float64(historyReport.HourIosRecharge))
|
|
text += Line("轻量:%s", report.HourH5Recharge/100, float64(report.HourH5Recharge-historyReport.HourH5Recharge), float64(historyReport.HourH5Recharge))
|
|
text += Line("┣苹果:%s", report.HourH5IosRecharge/100, float64(report.HourH5IosRecharge-historyReport.HourH5IosRecharge), float64(historyReport.HourH5IosRecharge))
|
|
text += Line("┣安卓:%s", report.HourH5AndroidRecharge/100, float64(report.HourH5AndroidRecharge-historyReport.HourH5AndroidRecharge), float64(historyReport.HourH5AndroidRecharge))
|
|
text += Line("┗电脑:%s", report.HourH5PcRecharge/100, float64(report.HourH5PcRecharge-historyReport.HourH5PcRecharge), float64(historyReport.HourH5PcRecharge))
|
|
text += Line("金币:%s", (report.HourRecharge-report.HourVipRecharge)/100, float64(report.HourRecharge-report.HourVipRecharge-(historyReport.HourRecharge-historyReport.HourVipRecharge)), float64(historyReport.HourRecharge-historyReport.HourVipRecharge))
|
|
text += Line("会员:%s", (report.HourVipRecharge)/100, float64(report.HourVipRecharge-historyReport.HourVipRecharge), float64(historyReport.HourVipRecharge))
|
|
if appInfo.AppId == 888 {
|
|
text += Line("┣官网:%s", report.HourWebVip/100, float64(report.HourWebVip-historyReport.HourWebVip), float64(historyReport.HourWebVip))
|
|
}
|
|
text += Line("┣自来:%s", report.HourNormalVip/100, float64(report.HourNormalVip-historyReport.HourNormalVip), float64(historyReport.HourNormalVip))
|
|
text += Line("┗渠道:%s", report.HourDistrictVip/100, float64(report.HourDistrictVip-historyReport.HourDistrictVip), float64(historyReport.HourDistrictVip))
|
|
|
|
text += Line("老用户:%s", report.HourOldRecharge/100, float64(report.HourOldRecharge-historyReport.HourOldRecharge), float64(historyReport.HourOldRecharge))
|
|
text += Line("新用户:%s", report.HourNewRecharge/100, float64(report.HourNewRecharge-historyReport.HourNewRecharge), float64(historyReport.HourNewRecharge))
|
|
text += Line("┣苹果:%s", report.HourIosNewRecharge/100, float64(report.HourIosNewRecharge-historyReport.HourIosNewRecharge), float64(historyReport.HourIosNewRecharge))
|
|
text += Line("┣安卓:%s", report.HourAndroidNewRecharge/100, float64(report.HourAndroidNewRecharge-historyReport.HourAndroidNewRecharge), float64(historyReport.HourAndroidNewRecharge))
|
|
text += Line("┗轻量:%s", report.HourH5NewRecharge/100, float64(report.HourH5NewRecharge-historyReport.HourH5NewRecharge), float64(historyReport.HourH5NewRecharge))
|
|
text += Line(" ┣苹果:%s", report.HourH5IosNewRecharge/100, float64(report.HourH5IosNewRecharge-historyReport.HourH5IosNewRecharge), float64(historyReport.HourH5IosNewRecharge))
|
|
text += Line(" ┣安卓:%s", report.HourH5AndroidNewRecharge/100, float64(report.HourH5AndroidNewRecharge-historyReport.HourH5AndroidNewRecharge), float64(historyReport.HourH5AndroidNewRecharge))
|
|
text += Line(" ┗电脑:%s", report.HourH5PcNewRecharge/100, float64(report.HourH5PcNewRecharge-historyReport.HourH5PcNewRecharge), float64(historyReport.HourH5PcNewRecharge))
|
|
text += fmt.Sprintf("2️⃣%s订单统计:\n", dateDesc)
|
|
text += Line("总数:%s: %s", report.HourOrder, float64(report.HourOrder-historyReport.HourOrder), float64(historyReport.HourOrder))
|
|
text += Line("成功:%s", report.HourSuccessOrder, float64(report.HourSuccessOrder-historyReport.HourSuccessOrder), float64(historyReport.HourSuccessOrder))
|
|
text += Rate("成功率:%s", float64(report.HourSuccessOrder), float64(report.HourOrder))
|
|
text += fmt.Sprintf("3️⃣%s注册用户:\n", dateDesc)
|
|
text += Line("总计:%s", report.HourNew, float64(report.HourNew-historyReport.HourNew), float64(historyReport.HourNew))
|
|
if appInfo.AppId == 888 {
|
|
text += Line("官网:%s", report.HourNewWeb, float64(report.HourNewWeb-historyReport.HourNewWeb), float64(historyReport.HourNewWeb))
|
|
}
|
|
text += Line("自来:%s", report.HourNewNormal, float64(report.HourNewNormal-historyReport.HourNewNormal), float64(historyReport.HourNewNormal))
|
|
text += Line("渠道:%s", report.HourNewDistrict, float64(report.HourNewDistrict-historyReport.HourNewDistrict), float64(historyReport.HourNewDistrict))
|
|
text += Line("安卓:%s", report.HourAndroidNew, float64(report.HourAndroidNew-historyReport.HourAndroidNew), float64(historyReport.HourAndroidNew))
|
|
text += Line("苹果:%s", report.HourIosNew, float64(report.HourIosNew-historyReport.HourIosNew), float64(historyReport.HourIosNew))
|
|
text += Line("轻量:%s", report.HourH5New, float64(report.HourH5New-historyReport.HourH5New), float64(historyReport.HourH5New))
|
|
text += Line("┣苹果:%s", report.HourH5IosNew, float64(report.HourH5IosNew-historyReport.HourH5IosNew), float64(historyReport.HourH5IosNew))
|
|
text += Line("┣安卓:%s", report.HourH5AndroidNew, float64(report.HourH5AndroidNew-historyReport.HourH5AndroidNew), float64(historyReport.HourH5AndroidNew))
|
|
text += Line("┗电脑:%s", report.HourH5PcNew, float64(report.HourH5PcNew-historyReport.HourH5PcNew), float64(historyReport.HourH5PcNew))
|
|
return text
|
|
}
|
|
|
|
func DisplayDailyStat(report, historyReport *botreport.BotReport, appInfo *appInfoMod.AppInfo, dateDesc string) string {
|
|
text := fmt.Sprintf("应用名称:%s\n", appInfo.Name)
|
|
text += fmt.Sprintf("统计名称:%s数据\n", dateDesc)
|
|
text += fmt.Sprintf("统计时间:%s\n", report.SumDate.Format("2006-01-02T15:04:05"))
|
|
text += fmt.Sprintf("1️⃣%s充值统计:\n", dateDesc)
|
|
text += Line("总计:%s", report.TodayRecharge/100, float64(report.TodayRecharge-historyReport.TodayRecharge), float64(historyReport.TodayRecharge))
|
|
if appInfo.AppId == 888 {
|
|
text += Line("官网:%s", report.TodayWebRecharge/100, float64(report.TodayWebRecharge-historyReport.TodayWebRecharge), float64(historyReport.TodayWebRecharge))
|
|
}
|
|
text += Line("自来:%s", report.TodayNormalRecharge/100, float64(report.TodayNormalRecharge-historyReport.TodayNormalRecharge), float64(historyReport.TodayNormalRecharge))
|
|
text += Line("渠道:%s", report.TodayDistrictRecharge/100, float64(report.TodayDistrictRecharge-historyReport.TodayDistrictRecharge), float64(historyReport.TodayDistrictRecharge))
|
|
text += Line("┣会员:%s", report.TodayDistrictVip/100, float64(report.TodayDistrictVip-historyReport.TodayDistrictVip), float64(historyReport.TodayDistrictVip))
|
|
text += Line("┗轻量:%s", report.TodayH5DistrictRecharge/100, float64(report.TodayH5DistrictRecharge-historyReport.TodayH5DistrictRecharge), float64(historyReport.TodayH5DistrictRecharge))
|
|
text += Line("安卓:%s", report.TodayAndroidRecharge/100, float64(report.TodayAndroidRecharge-historyReport.TodayAndroidRecharge), float64(historyReport.TodayAndroidRecharge))
|
|
text += Line("苹果:%s", report.TodayIosRecharge/100, float64(report.TodayIosRecharge-historyReport.TodayIosRecharge), float64(historyReport.TodayIosRecharge))
|
|
text += Line("轻量:%s", report.TodayH5Recharge/100, float64(report.TodayH5Recharge-historyReport.TodayH5Recharge), float64(historyReport.TodayH5Recharge))
|
|
text += Line("┣苹果:%s", report.TodayH5IosRecharge/100, float64(report.TodayH5IosRecharge-historyReport.TodayH5IosRecharge), float64(historyReport.TodayH5IosRecharge))
|
|
text += Line("┣安卓:%s", report.TodayH5AndroidRecharge/100, float64(report.TodayH5AndroidRecharge-historyReport.TodayH5AndroidRecharge), float64(historyReport.TodayH5AndroidRecharge))
|
|
text += Line("┗电脑:%s", report.TodayH5PcRecharge/100, float64(report.TodayH5PcRecharge-historyReport.TodayH5PcRecharge), float64(historyReport.TodayH5PcRecharge))
|
|
text += Line("金币:%s", (report.TodayRecharge-report.TodayVipRecharge)/100, float64(report.TodayRecharge-report.TodayVipRecharge-(historyReport.TodayRecharge-historyReport.TodayVipRecharge)), float64(historyReport.TodayRecharge-historyReport.TodayVipRecharge))
|
|
text += Line("会员:%s", report.TodayVipRecharge/100, float64(report.TodayVipRecharge-historyReport.TodayVipRecharge), float64(historyReport.TodayVipRecharge))
|
|
if appInfo.AppId == 888 {
|
|
text += Line("┣官网:%s", report.TodayWebVip/100, float64(report.TodayWebVip-historyReport.TodayWebVip), float64(historyReport.TodayWebVip))
|
|
}
|
|
text += Line("┣自来:%s", report.TodayNormalVip/100, float64(report.TodayNormalVip-historyReport.TodayNormalVip), float64(historyReport.TodayNormalVip))
|
|
text += Line("┗渠道:%s", report.TodayDistrictVip/100, float64(report.TodayDistrictVip-historyReport.TodayDistrictVip), float64(historyReport.TodayDistrictVip))
|
|
text += Line("老用户:%s", report.TodayOldRecharge/100, float64(report.TodayOldRecharge-historyReport.TodayOldRecharge), float64(historyReport.TodayOldRecharge))
|
|
text += Line("新用户:%s", report.TodayNewRecharge/100, float64(report.TodayNewRecharge-historyReport.TodayNewRecharge), float64(historyReport.TodayNewRecharge))
|
|
text += Line("┣苹果:%s", report.TodayIosNewRecharge/100, float64(report.TodayIosNewRecharge-historyReport.TodayIosNewRecharge), float64(historyReport.TodayIosNewRecharge))
|
|
text += Line("┣安卓:%s", report.TodayAndroidNewRecharge/100, float64(report.TodayAndroidNewRecharge-historyReport.TodayAndroidNewRecharge), float64(historyReport.TodayAndroidNewRecharge))
|
|
text += Line("┗轻量:%s", report.TodayH5NewRecharge/100, float64(report.TodayH5NewRecharge-historyReport.TodayH5NewRecharge), float64(historyReport.TodayH5NewRecharge))
|
|
text += Line(" ┣苹果:%s", report.TodayH5IosNewRecharge/100, float64(report.TodayH5IosNewRecharge-historyReport.TodayH5IosNewRecharge), float64(historyReport.TodayH5IosNewRecharge))
|
|
text += Line(" ┣安卓:%s", report.TodayH5AndroidNewRecharge/100, float64(report.TodayH5AndroidNewRecharge-historyReport.TodayH5AndroidNewRecharge), float64(historyReport.TodayH5AndroidNewRecharge))
|
|
text += Line(" ┗电脑:%s", report.TodayH5PcNewRecharge/100, float64(report.TodayH5PcNewRecharge-historyReport.TodayH5PcNewRecharge), float64(historyReport.TodayH5PcNewRecharge))
|
|
text += fmt.Sprintf("2️⃣%s订单统计:\n", dateDesc)
|
|
text += Line("订单总数:%s", report.TodayOrder, float64(report.TodayOrder-historyReport.TodayOrder), float64(historyReport.TodayOrder))
|
|
text += Line("成功订单:%s", report.TodaySuccessOrder, float64(report.TodaySuccessOrder-historyReport.TodaySuccessOrder), float64(historyReport.TodaySuccessOrder))
|
|
text += Rate("成功率: %s", float64(report.TodaySuccessOrder), float64(report.TodayOrder))
|
|
text += fmt.Sprintf("3️⃣%s访问统计:\n", dateDesc)
|
|
text += Line("累计:%s", report.AccessUser, float64(report.AccessUser-historyReport.AccessUser), float64(historyReport.AccessUser))
|
|
text += Line("渠道:%s", report.TodayAccessDistrict, float64(report.TodayAccessDistrict-historyReport.TodayAccessDistrict), float64(historyReport.TodayAccessDistrict))
|
|
text += Line("┗轻量:%s", report.TodayAccessH5District, float64(report.TodayAccessH5District-historyReport.TodayAccessH5District), float64(historyReport.TodayAccessH5District))
|
|
text += Line("安卓:%s", report.TodayAccessAndroid, float64(report.TodayAccessAndroid-historyReport.TodayAccessAndroid), float64(historyReport.TodayAccessAndroid))
|
|
text += Line("苹果:%s", report.TodayAccessIos, float64(report.TodayAccessIos-historyReport.TodayAccessIos), float64(historyReport.TodayAccessIos))
|
|
text += Line("轻量:%s", report.TodayAccessH5, float64(report.TodayAccessH5-historyReport.TodayAccessH5), float64(historyReport.TodayAccessH5))
|
|
text += Line("┣苹果:%s", report.TodayAccessH5Ios, float64(report.TodayAccessH5Ios-historyReport.TodayAccessH5Ios), float64(historyReport.TodayAccessH5Ios))
|
|
text += Line("┣安卓:%s", report.TodayAccessH5Android, float64(report.TodayAccessH5Android-historyReport.TodayAccessH5Android), float64(historyReport.TodayAccessH5Android))
|
|
text += Line("┗电脑:%s", report.TodayAccessH5Pc, float64(report.TodayAccessH5Pc-historyReport.TodayAccessH5Pc), float64(historyReport.TodayAccessH5Pc))
|
|
|
|
text += fmt.Sprintf("4️⃣%s注册用户:\n", dateDesc)
|
|
text += Line("总计:%s", report.TodayNew, float64(report.TodayNew-historyReport.TodayNew), float64(historyReport.TodayNew))
|
|
if appInfo.AppId == 888 {
|
|
text += Line("官网:%s", report.TodayNewWeb, float64(report.TodayNewWeb-historyReport.TodayNewWeb), float64(historyReport.TodayNewWeb))
|
|
}
|
|
text += Line("自来:%s", report.TodayNewNormal, float64(report.TodayNewNormal-historyReport.TodayNewNormal), float64(historyReport.TodayNewNormal))
|
|
text += Line("渠道:%s", report.TodayNewDistrict, float64(report.TodayNewDistrict-historyReport.TodayNewDistrict), float64(historyReport.TodayNewDistrict))
|
|
text += Line("苹果:%s", report.TodayIosNew, float64(report.TodayIosNew-historyReport.TodayIosNew), float64(historyReport.TodayIosNew))
|
|
text += Line("安卓:%s", report.TodayAndroidNew, float64(report.TodayAndroidNew-historyReport.TodayAndroidNew), float64(historyReport.TodayAndroidNew))
|
|
text += Line("轻量:%s", report.TodayH5New, float64(report.TodayH5New-historyReport.TodayH5New), float64(historyReport.TodayH5New))
|
|
text += Line("┣苹果:%s", report.TodayH5IosNew, float64(report.TodayH5IosNew-historyReport.TodayH5IosNew), float64(historyReport.TodayH5IosNew))
|
|
text += Line("┣安卓:%s", report.TodayH5AndroidNew, float64(report.TodayH5AndroidNew-historyReport.TodayH5AndroidNew), float64(historyReport.TodayH5AndroidNew))
|
|
text += Line("┗电脑:%s", report.TodayH5PcNew, float64(report.TodayH5PcNew-historyReport.TodayH5PcNew), float64(historyReport.TodayH5PcNew))
|
|
if appInfo.AppId == 888 {
|
|
text += fmt.Sprintf("5️⃣%s游戏统计:\n", dateDesc)
|
|
text += fmt.Sprintf("游戏充值: %d\n", report.GameRchgAmount)
|
|
text += fmt.Sprintf("代充充值: %d\n", report.GameDCRchgAmount)
|
|
text += fmt.Sprintf("有效投注: %d\n", report.ValidBet)
|
|
text += fmt.Sprintf("系统盈利: %d\n", report.Profit)
|
|
text += fmt.Sprintf("提现金额: %d\n", report.GameWtdrRealAmount)
|
|
text += fmt.Sprintf("游戏上分: %d\n", report.GameIncAmount)
|
|
text += fmt.Sprintf("游戏下分: %d\n", report.GameDecAmount)
|
|
}
|
|
return text
|
|
}
|
|
|
|
func OrderFromRecharge(recharge *rechargemod.RechargeMod) *syncrecharge.SyncRechargeOrder {
|
|
order := &syncrecharge.SyncRechargeOrder{
|
|
ID: recharge.ID,
|
|
PlatformId: recharge.PlatformId,
|
|
UserId: recharge.UserId,
|
|
AppId: recharge.AppId,
|
|
SysType: recharge.SysType,
|
|
DevType: recharge.DevType,
|
|
ChannelName: recharge.ChannelName,
|
|
CID: recharge.CID,
|
|
Type: recharge.Type,
|
|
OrderId: recharge.OrderId,
|
|
Money: recharge.Money,
|
|
PayMoney: recharge.PayMoney,
|
|
Status: recharge.Status,
|
|
SuccessAt: recharge.SuccessAt,
|
|
BlocDeduction: recharge.BlocDeduction,
|
|
PromCode: recharge.PromCode,
|
|
RegisterTime: recharge.RegisterTime,
|
|
IsDirect: recharge.IsDirect,
|
|
IsFormalUser: recharge.IsFormalUser,
|
|
DistrictCode: recharge.DistrictCode,
|
|
Rate: recharge.Rate,
|
|
CreatedAt: recharge.CreatedAt,
|
|
}
|
|
return order
|
|
}
|