"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const wechat_1 = tslib_1.__importDefault(require("./wechat")); const WechatSDK_1 = tslib_1.__importDefault(require("oak-external-sdk/lib/WechatSDK")); const assert_1 = require("oak-domain/lib/utils/assert"); const types_1 = require("oak-domain/lib/types"); class WechatBackend extends wechat_1.default { getConfigAndInstance(application) { const { config, type } = this.getConfig(application); return { config, type, }; } async composeFileUrlBackend(options) { const { application, extraFile, context, style } = options; return ''; } async formUploadMeta(application, extraFile) { // 微信上传素材库 } async checkWhetherSuccess(application, extraFile) { const { extra1 } = extraFile; return !!extra1; } async removeFile(application, extraFile) { const { extra2, extra1: mediaId } = extraFile; const isPermanent = extra2?.isPermanent || false; const { config, type } = this.getConfigAndInstance(application); // 只有永久素材 才能删除素材 if (isPermanent) { (0, assert_1.assert)(mediaId); const { appId, appSecret } = config; const wechatInstance = WechatSDK_1.default.getInstance(appId, type, appSecret); const result = await wechatInstance.deleteMaterial({ mediaId, }); return result; } } async composeChunkUploadInfo(application, extraFile, context) { throw new types_1.OakPreConditionUnsetException('微信暂不支持分片上传'); return { uploadId: '', chunkSize: 0, partSize: 0, partCount: 0, parts: [], }; } /** * 完成分片上传后的合并操作 */ async mergeChunkedUpload(application, extraFile, context) { // Implementation here } async abortMultipartUpload(application, extraFile, context) { } async listMultipartUploads(application, extraFile, context) { return { parts: [], }; } } exports.default = WechatBackend; ;