脚本格式
云函数
import问题 debug问题 访问数据问题
1. api script格式:
//必须写个main 方法
nodeJs :
import xx from 'xx'
function otherFunction(){
}
function main(param){
return otherFunction()
}java:
import xxx from xx;(可以用正则提取到)
public Object otherFunction(){
}
public JSONObject main(JSONObject param){
return otherFunction(param){}
}javascript:
import xxx from '@/xxx/XxxService'
function otherFun(){
}
function main(param ) {
return otherFun()
}2.service script 格式
nodeJs:
export function add(num1,num2){
}
export function sub(num1,num2){
}
export function add(context){
}
export function edit(context){
}javascript:
export function add(num1,num2){
}
export function sub(num1,num2){
}
export function add(context){
}
export function edit(context){
}java:
public Integer add(Integer num1,Integer num2){
return num1+num2;
}
//api call ,servcie call , test calljavascript 数据存储操作,
nodejs 在线编辑测试部署 到云函数 可调用ai
java=>jar部署到云函数
第一行参数选项,NO_WRAP函数不包裹, MJS_EXT .js还是.mjs (关系到export 方式导出 还是 exports.xxx=) , handler, 入口函数
//NO_WRAP;MJS_EXT;HANDLER=xxxx.handler
文档更新时间: 2026-06-25 03:24 作者:admin