dyjh 6 gadi atpakaļ
vecāks
revīzija
e7fa420815
1 mainītis faili ar 20 papildinājumiem un 2 dzēšanām
  1. 20 2
      app/Http/Controllers/Web/AuthController.php

+ 20 - 2
app/Http/Controllers/Web/AuthController.php

xqd xqd xqd
@@ -72,7 +72,7 @@ class AuthController extends Controller
 
     public function notifyAccount(Request $request)
     {
-        $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
+        /*$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
         if (!empty($postStr)) {
             $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
             $fromUsername = $postObj->FromUserName;
@@ -84,7 +84,7 @@ class AuthController extends Controller
         } else {
             echo "";
             exit;
-        }
+        }*/
         $echoStr = $_GET["echostr"];
         //如果有$echoStr说明是对接
         if (!empty($echoStr)) {
@@ -106,6 +106,24 @@ class AuthController extends Controller
         }
     }
 
+    private function checkSignature()
+    {
+        $signature = $_GET["signature"];
+        $timestamp = $_GET["timestamp"];
+        $nonce = $_GET["nonce"];
+        $token = 'bshbdajdbjadwedwqer';
+        $tmpArr = array($token, $timestamp, $nonce);
+        sort($tmpArr);
+        $tmpStr = implode( $tmpArr );
+        $tmpStr = sha1( $tmpStr );
+
+        if( $tmpStr == $signature ){
+            return true;
+        }else{
+            return false;
+        }
+    }
+
     public function welcome()
     {
         return view('welcome');