90 lines
4.6 KiB
Go
90 lines
4.6 KiB
Go
package botser
|
|
|
|
import (
|
|
"fmt"
|
|
"stat/common/statutils"
|
|
"stat/models/appInfoMod"
|
|
"strings"
|
|
|
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
|
)
|
|
|
|
var MenuKeyboard = tgbotapi.NewInlineKeyboardMarkup(
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("今天统计", strings.Join([]string{"/today"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("昨天统计", strings.Join([]string{"/yesterday"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("前天统计", strings.Join([]string{"/daily", "-back=2"}, " ")),
|
|
),
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("小时统计", strings.Join([]string{"/hour", "-back=0"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("上一小时", strings.Join([]string{"/hour", "-back=1"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("上二小时", strings.Join([]string{"/hour", "-back=2"}, " ")),
|
|
),
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("今日详细", strings.Join([]string{"/daily_hour", "-back=0"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("昨日详细", strings.Join([]string{"/daily_hour", "-back=1"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("前日详细", strings.Join([]string{"/daily_hour", "-back=2"}, " ")),
|
|
),
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("今天排行", strings.Join([]string{"/cross_stat", "-back=0"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("昨天排行", strings.Join([]string{"/cross_stat", "-back=1"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("前天排行", strings.Join([]string{"/cross_stat", "-back=2"}, " ")),
|
|
),
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("应用列表", strings.Join([]string{"/apps"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("同步状态", strings.Join([]string{"/sync"}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("关闭菜单", strings.Join([]string{"/close"}, " ")),
|
|
),
|
|
)
|
|
|
|
var MenuKeyboard0 = tgbotapi.NewInlineKeyboardMarkup(
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("单天前一天旧的 /recharge", " "),
|
|
),
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("综合统计前一天的 /rechargenew", " "),
|
|
),
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("综合从第几天到第几天/rechargedate -begin=2024-01-01 -end=2024-01-21 @bot", ""),
|
|
),
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("综合统计具体年月日/rechargeoneday -date=2024-01-01", ""),
|
|
),
|
|
)
|
|
|
|
func GetStatProjectKeyboard(data string) tgbotapi.InlineKeyboardMarkup {
|
|
return tgbotapi.NewInlineKeyboardMarkup(
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("充值总计", strings.Join([]string{data, fmt.Sprintf("-stat=%s", statutils.StatProjectRecharge)}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("老用户充值", strings.Join([]string{data, fmt.Sprintf("-stat=%s", statutils.StatProjectRechargeOld)}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("新用户充值", strings.Join([]string{data, fmt.Sprintf("-stat=%s", statutils.StatProjectRechargeNew)}, " ")),
|
|
),
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("金币充值", strings.Join([]string{data, fmt.Sprintf("-stat=%s", statutils.StatProjectRechargeGold)}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("会员购买", strings.Join([]string{data, fmt.Sprintf("-stat=%s", statutils.StatProjectRechargeVip)}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("订单统计", strings.Join([]string{data, fmt.Sprintf("-stat=%s", statutils.StatProjectOrder)}, " ")),
|
|
),
|
|
tgbotapi.NewInlineKeyboardRow(
|
|
tgbotapi.NewInlineKeyboardButtonData("注册统计", strings.Join([]string{data, fmt.Sprintf("-stat=%s", statutils.StatProjectRegister)}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("访问统计", strings.Join([]string{data, fmt.Sprintf("-stat=%s", statutils.StatProjectVisit)}, " ")),
|
|
tgbotapi.NewInlineKeyboardButtonData("关闭菜单", strings.Join([]string{"/close"}, " ")),
|
|
),
|
|
)
|
|
}
|
|
|
|
func GetAppKeyboard(appList appInfoMod.AppInfoList, data string, column int) tgbotapi.InlineKeyboardMarkup {
|
|
rows := make([][]tgbotapi.InlineKeyboardButton, 0)
|
|
row := make([]tgbotapi.InlineKeyboardButton, 0)
|
|
for _, app := range appList {
|
|
row = append(row, tgbotapi.NewInlineKeyboardButtonData(app.Name, strings.Join([]string{data, fmt.Sprintf("-app=%d", app.AppId)}, " ")))
|
|
if len(row) >= column {
|
|
rows = append(rows, row)
|
|
row = make([]tgbotapi.InlineKeyboardButton, 0)
|
|
}
|
|
}
|
|
if len(row) > 0 {
|
|
rows = append(rows, row)
|
|
}
|
|
return tgbotapi.NewInlineKeyboardMarkup(rows...)
|
|
}
|