UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

93 lines (90 loc) 3.54 kB
import _regeneratorRuntime from '@babel/runtime/regenerator'; import { _ as __awaiter } from '../tslib.es6-848120af.js'; import { updateTencentSheet, updateTencentSheetImage } from '../tencent-doc/sheet.mjs'; import { uploadTencentDocImage } from '../tencent-doc/tencent-doc.mjs'; import 'axios'; import '../nodejs/fs.mjs'; import '../third-party/form-data.mjs'; import '../third-party/qs.mjs'; function updateQQMpResultToSheetV0(_ref) { var accessToken = _ref.accessToken, clientId = _ref.clientId, openId = _ref.openId, bookId = _ref.bookId, sheetId = _ref.sheetId, startRow = _ref.startRow, qqMpQRCodePath = _ref.qqMpQRCodePath, result = _ref.result; return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee() { var uploadImageResult, updateImageResult, time, branch, env, robot, version, lastCommit, link, updateTextResult; return _regeneratorRuntime.wrap(function (_context) { while (1) switch (_context.prev = _context.next) { case 0: _context.next = 1; return uploadTencentDocImage({ accessToken: accessToken, clientId: clientId, openId: openId, image: qqMpQRCodePath }); case 1: uploadImageResult = _context.sent; console.log('[CI] upload image result: ', uploadImageResult); if (!((uploadImageResult === null || uploadImageResult === void 0 ? void 0 : uploadImageResult.ret) != 0)) { _context.next = 2; break; } return _context.abrupt("return", uploadImageResult); case 2: _context.next = 3; return 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 3: updateImageResult = _context.sent; console.log('[CI] update sheet image result: ', updateImageResult); if (!((updateImageResult === null || updateImageResult === void 0 ? void 0 : updateImageResult.ret) != 0)) { _context.next = 4; break; } return _context.abrupt("return", updateImageResult); case 4: time = result.time, branch = result.branch, env = result.env, robot = result.robot, version = result.version, lastCommit = result.lastCommit, link = result.link; _context.next = 5; return 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 5: updateTextResult = _context.sent; console.log('[CI] update sheet text result: ', updateTextResult); return _context.abrupt("return", updateTextResult); case 6: case "end": return _context.stop(); } }, _callee); })); } export { updateQQMpResultToSheetV0 };