Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
upload-apk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhoujun
upload-apk
Commits
5ffa4783
Commit
5ffa4783
authored
Nov 26, 2020
by
zhoujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'初始版本'
parent
d3661d9a
Pipeline
#538
canceled with stages
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
7 deletions
+28
-7
app/Http/Controllers/UserController.php
app/Http/Controllers/UserController.php
+5
-5
public/.htaccess
public/.htaccess
+21
-0
routes/web.php
routes/web.php
+2
-2
No files found.
app/Http/Controllers/UserController.php
View file @
5ffa4783
...
@@ -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
->
get
mTime
();
$signature
=
$this
->
signature
(
$timestamp
,
$accessKey
);
$signature
=
$this
->
get
signature
(
$timestamp
,
$accessKey
);
$url
=
'https://oapi.dingtalk.com/sns/getuserinfo_bycode?accessKey='
.
$accessKey
.
'×tamp='
.
$timestamp
.
'&signature='
.
$signature
;
$url
=
'https://oapi.dingtalk.com/sns/getuserinfo_bycode?accessKey='
.
$accessKey
.
'×tamp='
.
$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
get
signature
(
$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
get
mTime
()
{
{
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
);
...
...
public/.htaccess
View file @
5ffa4783
<
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
>
routes/web.php
View file @
5ffa4783
...
@@ -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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment