浏览代码

Merge branch 'dev'

luolongfei 3 年之前
父节点
当前提交
1b1eb74ca9
共有 1 个文件被更改,包括 33 次插入1 次删除
  1. 33 1
      index.php

+ 33 - 1
index.php

@@ -66,7 +66,10 @@ function exception_handler($e)
     Message::send("具体的异常内容是:\n" . $e->getMessage(), '主人,未捕获的异常');
     Message::send("具体的异常内容是:\n" . $e->getMessage(), '主人,未捕获的异常');
 }
 }
 
 
-function main_handler($event, $context)
+/**
+ * @return string
+ */
+function run()
 {
 {
     try {
     try {
         system_check();
         system_check();
@@ -84,3 +87,32 @@ function main_handler($event, $context)
 
 
     return '云函数执行失败。';
     return '云函数执行失败。';
 }
 }
+
+/**
+ * 腾讯云函数
+ *
+ * @param $event
+ * @param $context
+ *
+ * @return string
+ */
+function main_handler($event, $context)
+{
+    return run();
+}
+
+/**
+ * 阿里云函数
+ *
+ * @param $event
+ * @param $context
+ *
+ * @return string
+ */
+function handler($event, $context)
+{
+    $logger = $GLOBALS['fcLogger'];
+    $logger->info('开始执行阿里云函数');
+
+    return run();
+}