Commit 5ffa4783 authored by zhoujun's avatar zhoujun

'初始版本'

parent d3661d9a
Pipeline #538 canceled with stages
...@@ -44,6 +44,7 @@ class UserController extends BaseController ...@@ -44,6 +44,7 @@ class UserController extends BaseController
public function getReturnLogin(Request $request) public function getReturnLogin(Request $request)
{ {
$input = $request->all(); $input = $request->all();
print_r($input);die();
$code = $input('get.code'); $code = $input('get.code');
$state = $input('get.state'); $state = $input('get.state');
if(!$code or !$state) { if(!$code or !$state) {
...@@ -54,15 +55,14 @@ class UserController extends BaseController ...@@ -54,15 +55,14 @@ class UserController extends BaseController
} }
$accessKey = env('DD_APP_SECRET'); $accessKey = env('DD_APP_SECRET');
$timestamp = $this->mTime(); $timestamp = $this->getmTime();
$signature = $this->signature($timestamp,$accessKey); $signature = $this->getsignature($timestamp,$accessKey);
$url = 'https://oapi.dingtalk.com/sns/getuserinfo_bycode?accessKey=' . $accessKey . '&timestamp=' . $timestamp . '&signature=' . $signature; $url = 'https://oapi.dingtalk.com/sns/getuserinfo_bycode?accessKey=' . $accessKey . '&timestamp=' . $timestamp . '&signature=' . $signature;
$data = [ 'tmp_auth_code' => $code ]; $data = [ 'tmp_auth_code' => $code ];
$userInfo = $this->curl_json($url, $data); $userInfo = $this->curl_json($url, $data);
$res = json_decode($userInfo, true); $res = json_decode($userInfo, true);
print_r($res);die(); print_r($res);die();
if(isset($res['errcode']) and $res['errcode'] == 0) { if(isset($res['errcode']) and $res['errcode'] == 0) {
} }
} }
...@@ -71,7 +71,7 @@ class UserController extends BaseController ...@@ -71,7 +71,7 @@ class UserController extends BaseController
* @param $timestamp * @param $timestamp
* @return string * @return string
*/ */
public function signature($timestamp,$accessKey) public function getsignature($timestamp,$accessKey)
{ {
// 根据timestamp, appSecret计算签名值 // 根据timestamp, appSecret计算签名值
$s = hash_hmac('sha256', $timestamp, $accessKey, true); $s = hash_hmac('sha256', $timestamp, $accessKey, true);
...@@ -84,7 +84,7 @@ class UserController extends BaseController ...@@ -84,7 +84,7 @@ class UserController extends BaseController
* 毫秒级时间戳 * 毫秒级时间戳
* @return float * @return float
*/ */
public function mTime() public function getmTime()
{ {
list($s1, $s2) = explode(' ', microtime()); list($s1, $s2) = explode(' ', microtime());
$mTime = (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000); $mTime = (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
......
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
*/ */
Route::any('/','UserController@getLogin'); Route::any('/','UserController@getLogin');
Route::any('return/login','UserController@getReturnLogin'); Route::any('/return/login','UserController@getReturnLogin');
Route::any('apk/down/{md5}','ApkController@getApkDown'); Route::any('/apk/down/{md5}','ApkController@getApkDown');
Route::group(['middleware' => ['login']],function() { Route::group(['middleware' => ['login']],function() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment