parent
5f850e288d
commit
4366c4a2ef
@ -0,0 +1,26 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers\Api; |
||||
|
||||
use App\Http\Controllers\Controller; |
||||
use Illuminate\Http\Request; |
||||
|
||||
class WechatAuthController extends Controller |
||||
{ |
||||
// |
||||
public function checkSign(Request $request) |
||||
{ |
||||
$signature = $request->signature; |
||||
$timestamp = $request->timestamp; |
||||
$nonce = $request->nonce; |
||||
|
||||
$token = config('token.wechat_token'); |
||||
|
||||
$tmpArr = [$token, $timestamp, $nonce]; |
||||
sort($tmpArr, SORT_STRING); |
||||
$tmpStr = implode($tmpArr); |
||||
$tmpStr = sha1($tmpStr); |
||||
|
||||
return $tmpStr === $signature; |
||||
} |
||||
} |
@ -0,0 +1,7 @@ |
||||
<?php |
||||
|
||||
|
||||
return [ |
||||
'wechat_token' => env('WECHAT_TOKEN'), |
||||
|
||||
]; |
Loading…
Reference in new issue