1234567891011121314151617181920212223242526272829303132333435 |
- // 输入输出参数格式化
- input = INPUT;
- output = {};
- try {
- input = decodeURIComponent(input);
- } catch (e) { }
- try {
- input = base64.decode(input);
- } catch (e) { }
- try {
- input = JSON.parse(input);
- input = JSON.parse(input); // 解析可能存在的重复编码
- } catch (e) { }
- // 主执行阶段
- try {
- main(input, output);
- } catch (e) {
- // 错误信息输出处理,抛出 ok 表示正常结束
- if (e != "ok") {
- if (typeof (e) == "object") {
- output.error = e;
- } else if (typeof (e) == "string") {
- output.error = "错误:" + e;
- } else {
- output.error = JSON.stringify(e);
- }
- log.error(output.error);
- STATUS = "error";
- }
- }
- // 返回输出信息
- OUTPUT = output;
|