t-comm
Version:
专业、稳定、纯粹的工具库
77 lines (74 loc) • 2.99 kB
JavaScript
import { b as __awaiter, c as __generator } from '../tslib.es6-48fa7a9b.js';
import { uploadTencentDocImage } from '../tencent-doc/tencent-doc.js';
import { updateTencentSheet, updateTencentSheetImage } from '../tencent-doc/sheet.js';
import 'axios';
function updateQQMpResultToSheetV0(_a) {
var accessToken = _a.accessToken,
clientId = _a.clientId,
openId = _a.openId,
bookId = _a.bookId,
sheetId = _a.sheetId,
startRow = _a.startRow,
qqMpQRCodePath = _a.qqMpQRCodePath,
result = _a.result;
return __awaiter(this, void 0, void 0, function () {
var uploadImageResult, updateImageResult, time, branch, env, robot, version, lastCommit, link, updateTextResult;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
return [4 /*yield*/, uploadTencentDocImage({
accessToken: accessToken,
clientId: clientId,
openId: openId,
image: qqMpQRCodePath
})];
case 1:
uploadImageResult = _b.sent();
console.log('[CI] upload image result: ', uploadImageResult);
if ((uploadImageResult === null || uploadImageResult === void 0 ? void 0 : uploadImageResult.ret) != 0) {
return [2 /*return*/, uploadImageResult];
}
return [4 /*yield*/, updateTencentSheetImage({
accessToken: accessToken,
clientId: clientId,
openId: openId,
bookId: bookId,
insertImages: {
sheetID: sheetId,
images: [{
type: 1,
imageID: uploadImageResult.data.imageID,
width: 100,
height: 100,
row: startRow,
col: 1,
offsetX: null,
offsetY: null,
clip_info: null
}]
}
})];
case 2:
updateImageResult = _b.sent();
console.log('[CI] update sheet image result: ', updateImageResult);
if ((updateImageResult === null || updateImageResult === void 0 ? void 0 : updateImageResult.ret) != 0) {
return [2 /*return*/, updateImageResult];
}
time = result.time, branch = result.branch, env = result.env, robot = result.robot, version = result.version, lastCommit = result.lastCommit, link = result.link;
return [4 /*yield*/, updateTencentSheet({
accessToken: accessToken,
clientId: clientId,
openId: openId,
bookId: bookId,
range: "".concat(sheetId, "!B").concat(startRow, ":H").concat(startRow),
values: [[time, branch, env, robot, version, lastCommit, link]]
})];
case 3:
updateTextResult = _b.sent();
console.log('[CI] update sheet text result: ', updateTextResult);
return [2 /*return*/, updateTextResult];
}
});
});
}
export { updateQQMpResultToSheetV0 };