| xqd
@@ -73,26 +73,8 @@ class AuthController extends Controller
|
|
|
public function notifyAccount(Request $request)
|
|
|
{
|
|
|
/**/
|
|
|
- $echoStr = $_GET["echostr"];
|
|
|
- //如果有$echoStr说明是对接
|
|
|
- if (!empty($echoStr)) {
|
|
|
- //对接规则
|
|
|
- $signature = $_GET["signature"];
|
|
|
- $timestamp = $_GET["timestamp"];
|
|
|
- $nonce = $_GET["nonce"];
|
|
|
- $token = 'bshbdajdbjadwedwqer';
|
|
|
- $tmpArr = array($token, $timestamp, $nonce);
|
|
|
- sort($tmpArr, SORT_STRING);
|
|
|
- $tmpStr = implode($tmpArr);
|
|
|
- $tmpStr = sha1($tmpStr);
|
|
|
- if ($tmpStr == $signature) {
|
|
|
- echo $echoStr;
|
|
|
- } else {
|
|
|
- echo "";
|
|
|
- exit;
|
|
|
- }
|
|
|
- } else {
|
|
|
- \Log::info("111");
|
|
|
+
|
|
|
+ \Log::info("111");$this->checkSignature();
|
|
|
$postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
|
|
|
if (!empty($postStr)) {
|
|
|
$postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
|
| xqd
@@ -106,10 +88,26 @@ class AuthController extends Controller
|
|
|
echo "";
|
|
|
exit;
|
|
|
}
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
|
|
|
+ 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');
|