t-comm
Version:
专业、稳定、纯粹的工具库
80 lines (77 loc) • 2.08 kB
JavaScript
import { b as __awaiter, c as __generator } from '../tslib.es6-096fffdd.js';
import { batchUpdateTencentSheetV3 } from '../tencent-doc/sheet.mjs';
import 'axios';
function getUpdateQQMpResultRows(_a) {
var result = _a.result;
var time = result.time,
branch = result.branch,
env = result.env,
robot = result.robot,
version = result.version,
lastCommit = result.lastCommit,
link = result.link;
var rowValues = [time, branch, env, robot, version, lastCommit].map(function (item) {
return {
cellValue: {
text: item
}
};
});
rowValues.push({
cellValue: {
link: {
url: link,
text: link
}
}
});
var rows = [{
values: rowValues
}];
return rows;
}
function updateQQMpResultToSheet(_a) {
var result = _a.result,
accessToken = _a.accessToken,
clientId = _a.clientId,
openId = _a.openId,
bookId = _a.bookId,
sheetId = _a.sheetId,
startRow = _a.startRow,
_b = _a.startColumn,
startColumn = _b === void 0 ? 1 : _b;
return __awaiter(this, void 0, void 0, function () {
var rows;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
rows = getUpdateQQMpResultRows({
result: result
});
if (!startRow) {
console.log('[updateQQMpResultToSheet.error] startRow 不可为空,且必须大于等于1');
return [2 /*return*/];
}
return [4 /*yield*/, batchUpdateTencentSheetV3({
accessToken: accessToken,
clientId: clientId,
openId: openId,
bookId: bookId,
requests: [{
updateRangeRequest: {
sheetId: sheetId,
gridData: {
startRow: startRow - 1,
startColumn: startColumn,
rows: rows
}
}
}]
})];
case 1:
return [2 /*return*/, _c.sent()];
}
});
});
}
export { updateQQMpResultToSheet };