cqp пре 1 недеља
родитељ
комит
448ed1da53
1 измењених фајлова са 13 додато и 5 уклоњено
  1. 13 5
      app/Http/Controllers/Api/DingTalkController.php

+ 13 - 5
app/Http/Controllers/Api/DingTalkController.php

@@ -91,9 +91,13 @@ class DingTalkController extends BaseController
 
         // 3. 验证 challenge
         if (isset($event['EventType']) && $event['EventType'] === 'check_url') {
-            $encryptMsg = '';
-            $crypt->encryptMsg($event['Random'], $timestamp, $nonce, $encryptMsg);
-            return response()->json($encryptMsg);
+            $encryptMsg = $crypt->encryptMsg($event['Random'], $timestamp, $nonce);
+            return response()->json([
+                "msg_signature" => $encryptMsg['msg_signature'],
+                "timeStamp"     => $timestamp,
+                "nonce"         => $nonce,
+                "encrypt"       => $encryptMsg['encrypt']
+            ]);
         }
 
         // 4. 处理事件
@@ -121,7 +125,11 @@ class DingTalkController extends BaseController
 
         // 5. 返回 success(加密)
         $resEncrypt = $crypt->encryptMsg('success', $timestamp, $nonce);
-
-        return response()->json($resEncrypt);
+        return response()->json([
+            "msg_signature" => $resEncrypt['msg_signature'],
+            "timeStamp"     => $timestamp,
+            "nonce"         => $nonce,
+            "encrypt"       => $resEncrypt['encrypt']
+        ]);
     }
 }