dyjh 6 vuotta sitten
vanhempi
commit
aa59e02270
2 muutettua tiedostoa jossa 26 lisäystä ja 0 poistoa
  1. 25 0
      app/Http/Controllers/Web/AuthController.php
  2. 1 0
      routes/web.php

+ 25 - 0
app/Http/Controllers/Web/AuthController.php

xqd
@@ -70,8 +70,33 @@ class AuthController extends Controller
         return view('web.auth.bind');
     }
 
+    public function notifyAccount(Request $request)
+    {
+        $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
+        if (!empty($postStr)) {
+            $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
+            $fromUsername = $postObj->FromUserName;
+            $toUsername = $postObj->ToUserName;
+            $MsgT = $postObj->MsgType;
+            $time = time();
+            \Log::info($postObj);
+            //如果用户发的text类型
+        } else {
+            echo "";
+            exit;
+        }
+    }
+
     public function welcome()
     {
         return view('welcome');
     }
+
+//用于回复用户消息
+    function responseMsg(){
+
+    }
+
+
+
 }

+ 1 - 0
routes/web.php

xqd
@@ -42,5 +42,6 @@ Route::get('image/{md5}', [
 Route::get('/test', 'TestController@index');
 Route::get('/web/bind', 'Web\AuthController@bind');
 Route::any('/web/notify', 'Web\AuthController@notify');
+Route::any('/web/notify-account', 'Web\AuthController@notifyAccount');
 /*Route::group(['prefix'=>'web','namespace'=>'Web','middleware' => ['web', 'wechat.oauth:snsapi_userinfo']],function (){
     Route::any('bind','AuthController@bind');});*/