# 引入

import {
  genCustomEventImgAndSendRobot,
  genMultiImgAndSendRobot,
  parseResult,
  genSummaryDataAndSendRobot
} from 't-comm';

// or

import {
  genCustomEventImgAndSendRobot,
  genMultiImgAndSendRobot,
  parseResult,
  genSummaryDataAndSendRobot
} from 't-comm/lib/tam/img/index';

# genCustomEventImgAndSendRobot(options)

描述

获取自定义事件图片并发送

参数

参数名 类型 描述
options object

配置信息

返回: string

图片url

示例

const requestMultiImgDate = Date.now() - 1 * 24 * 60 * 60 * 1000;

const tamGroupIdList = [1, 2, 3];

const eventProjectMap = {
  62659: {
    name: 'aaaaa',
  },
  57706: {
    name: 'bbbbb',
    extraProjectId: 66379,
  },
};

const eventMap = {
  WX_SUC: {
    // 总和
    type: 'SUMMARY',
    target: ['ENTER_GAME_WX_SUC', 'LAUNCH_GAME_SUC_WX'],
  },
  WX_FAIL: {
    // 总和
    type: 'SUMMARY',
    target: ['ENTER_GAME_WX_FAIL', 'LAUNCH_GAME_FAIL_WX'],
  },
};

const eventTableHeaderMap = {
  ProjectName: {
    name: '项目名称',
    tableWidth: 95,
  },
  ALL_SUMMARY: {
    name: '拉起总数',
    tableWidth: 65,
  },
};

genCustomEventImgAndSendRobot({
  date: requestLaunchGameDate,
  secretInfo: {
    getPwdCode,
    encrypt,
    apiKey: process.env.AEGIS_APP_KEY,
    loginName: 'lee',
  },
  projectIdMap: eventProjectMap,
  eventMap,
  tableHeaderMap: eventTableHeaderMap,
  webhookUrl: tamRobotWebhook,
  chatId: tamRobotChatId,
});

# genMultiImgAndSendRobot(options)

描述

生成多个图片并发送机器人

参数

参数名 类型 描述
options object

配置

示例

const requestMultiImgDate = Date.now() - 1 * 24 * 60 * 60 * 1000;

const tamGroupIdList = [1, 2, 3];

const summaryScoreTableHeaderMap = {
  ProjectName: {
    name: '项目名称',
    tableWidth: 95,
  },
  PagePv: {
    name: 'PV',
    tableWidth: 65,
  },
};

const eventProjectMap = {
  62659: {
    name: 'aaaaa',
  },
  57706: {
    name: 'bbbbb',
    extraProjectId: 66379,
  },
};

const eventMap = {
  WX_SUC: {
    // 总和
    type: 'SUMMARY',
    target: ['ENTER_GAME_WX_SUC', 'LAUNCH_GAME_SUC_WX'],
  },
  WX_FAIL: {
    // 总和
    type: 'SUMMARY',
    target: ['ENTER_GAME_WX_FAIL', 'LAUNCH_GAME_FAIL_WX'],
  },
};

const eventTableHeaderMap = {
  ProjectName: {
    name: '项目名称',
    tableWidth: 95,
  },
  ALL_SUMMARY: {
    name: '拉起总数',
    tableWidth: 65,
  },
};

await genMultiImgAndSendRobot({
  date: requestMultiImgDate,
  secretInfo: {
    getPwdCode,
    encrypt,
    apiKey: process.env.AEGIS_APP_KEY,
    loginName: 'lee',
  },
  webhookUrl: tamRobotWebhook,
  chatId: tamRobotChatId,

  groupIdList: tamGroupIdList,
  eventProjectIdMap: eventProjectMap,
  tableHeaderMap: summaryScoreTableHeaderMap,

  eventMap,
  eventTableHeaderMap,
});

# parseResult()

描述

[ { region: '巴西', allCount: 100, firstScreen: 1000, [key]: value }, 'xx': { // ... } ]

参数

# genSummaryDataAndSendRobot(options)

描述

生成TAM汇总数据并发送到机器人

参数

参数名 类型 描述
options object

配置

options.date string

日期,yyyyMMdd格式

options.groupIdList Array<number>

groupId列表

options.secretInfo object

密钥信息

options.secretInfo.apiKey string

apiKey

options.secretInfo.loginName string

loginName

options.secretInfo.getPwdCode function

getPwdCode

options.secretInfo.encrypt function

encrypt

options.extraDataMap object

额外数据Map

options.ignoreProjectIdList object

忽略的projectIdList

options.tableHeaderMap object

表格头部Map

options.webhookUrl object

机器人回调地址

options.chatId object

会话Id

示例

const requestSummaryScoreDate = Date.now() - 1 * 24 * 60 * 60 * 1000;

const tamGroupIdList = [1, 2, 3];

const summaryScoreTableHeaderMap = {
  ProjectName: {
    name: '项目名称',
    tableWidth: 95,
  },
  PagePv: {
    name: 'PV',
    tableWidth: 65,
  },
};

await genSummaryDataAndSendRobot({
  date: requestSummaryScoreDate,
  groupIdList: tamGroupIdList,
  secretInfo: {
    getPwdCode,
    encrypt,
    apiKey: process.env.AEGIS_APP_KEY,
    loginName: 'lee',
  },
  webhookUrl: tamRobotWebhook,
  chatId: tamRobotChatId,
  tableHeaderMap: summaryScoreTableHeaderMap,
});
Last Updated: 2024/10/11 07:54:02