2023-02-21 22:34:08 +08:00

30 lines
601 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 在该文件中来封装云函数逻辑
const cloud = require('wx-server-sdk');
exports.main = async(event) => {
let result = 0;
// 根据传递过来的参数做不同的计算
// num1、num2、tag+ - * /
switch(event.tag){
case "+": {
result = ~~event.num1 + ~~event.num2;
break;
}
case "-":{
result = ~~event.num1 - ~~event.num2;
break;
}
case "*":{
result = ~~event.num1 * ~~event.num2;
break;
}
case "/":{
result = ~~event.num1 / ~~event.num2;
break;
}
}
return {
calcResult : result
}
}