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
b682c964
Commit
b682c964
authored
Nov 26, 2020
by
zhoujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'初始版本'
parent
68dd36da
Pipeline
#540
failed with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
29 deletions
+21
-29
app/Http/Controllers/UserController.php
app/Http/Controllers/UserController.php
+6
-14
resources/views/login/index.blade.php
resources/views/login/index.blade.php
+15
-15
No files found.
app/Http/Controllers/UserController.php
View file @
b682c964
...
...
@@ -31,8 +31,10 @@ class UserController extends BaseController
*/
public
function
getLogin
(
Request
$request
)
{
$data
[
'key'
]
=
env
(
'DD_APP_KEY'
);
return
view
(
'login.index'
,
$data
);
$key
=
env
(
'dingoap7dwt39svqfxlnkx'
);
$redirectUri
=
env
(
'dingoap7dwt39svqfxlnkx'
);
$url
=
'https://oapi.dingtalk.com/connect/qrconnect?appid='
.
$key
.
'&response_type=code&scope=snsapi_login&state=STATE&redirect_uri='
.
$redirectUri
;
return
redirect
(
$url
);
}
/**
...
...
@@ -43,22 +45,12 @@ class UserController extends BaseController
*/
public
function
getReturnLogin
(
Request
$request
)
{
$input
=
$request
->
all
();
print_r
(
$input
);
die
();
$code
=
$input
(
'get.code'
);
$state
=
$input
(
'get.state'
);
if
(
!
$code
or
!
$state
)
{
$this
->
error
(
'参数缺失'
);
}
if
(
$state
>
time
())
{
$this
->
error
(
'参数异常'
);
}
$Input
=
$request
->
all
();
$accessKey
=
env
(
'DD_APP_SECRET'
);
$timestamp
=
$this
->
getmTime
();
$signature
=
$this
->
getsignature
(
$timestamp
,
$accessKey
);
$url
=
'https://oapi.dingtalk.com/sns/getuserinfo_bycode?accessKey='
.
$accessKey
.
'×tamp='
.
$timestamp
.
'&signature='
.
$signature
;
$data
=
[
'tmp_auth_code'
=>
$
code
];
$data
=
[
'tmp_auth_code'
=>
$
Input
[
'code'
]
];
$userInfo
=
$this
->
curl_json
(
$url
,
$data
);
$res
=
json_decode
(
$userInfo
,
true
);
print_r
(
$res
);
die
();
...
...
resources/views/login/index.blade.php
View file @
b682c964
<!doctype html>
<html
lang=
"en"
class=
"fixed"
>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>
apk管理
</title>
<link
rel=
"icon"
type=
"image/png"
sizes=
"192x192"
href=
""
>
<link
rel=
"stylesheet"
href=
"/html/vendor/bootstrap/css/bootstrap.css"
>
<script
src=
"https://g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"
></script>
<style
type=
"text/css"
>
</style>
...
...
@@ -14,34 +12,36 @@
<body>
<div
id=
"login_container"
style=
"width: 400px; margin:200px auto;"
></div>
<script
src=
"https://g.alicdn.com/dingding/dinglogin/0.0.5/ddLogin.js"
></script>
<script>
var
url
=
encodeURIComponent
(
'
http://upload-apk.srccwl.com/return/login
'
);
alert
(
url
);
var
goto
=
encodeURIComponent
(
'
https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoap7dwt39svqfxlnkx &response_type=code&scope=snsapi_login&state=STATE&redirect_uri=
'
+
url
)
alert
(
goto
);
var
obj
=
DDLogin
({
var
goto
=
encodeURIComponent
(
'
https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoap7dwt39svqfxlnkx &response_type=code&scope=snsapi_login&state=STATE&redirect_uri=
'
+
url
);
DDLogin
({
id
:
"
login_container
"
,
goto
:
goto
,
style
:
"
border:none;background-color:#FFFFFF;
"
,
width
:
"
322
"
,
height
:
"
320
"
});
window
.
location
.
href
=
"
https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoap7dwt39svqfxlnkx&response_type=code&scope=snsapi_login&state=STATE&redirect_uri=
"
+
url
+
"
&loginTmpCode=
"
+
loginTmpCode
var
handleMessage
=
function
(
event
)
{
var
origin
=
event
.
origin
;
if
(
origin
==
"
https://login.dingtalk.com
"
)
{
console
.
log
(
"
origin
"
,
event
.
origin
);
//if( origin == "https://login.dingtalk.com" ) { //判断是否来自ddLogin扫码事件。
var
loginTmpCode
=
event
.
data
;
alert
(
loginTmpCode
);
alert
(
url
);
window
.
location
.
href
=
'
https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingoap7dwt39svqfxlnkx &response_type=code&scope=snsapi_login&state=STATE&redirect_uri=
'
+
url
+
'
&loginTmpCode=
'
+
loginTmpCode
}
console
.
log
(
"
loginTmpCode
"
,
loginTmpCode
);
// }
};
if
(
typeof
window
.
addEventListener
!=
'
undefined
'
)
{
window
.
addEventListener
(
'
message
'
,
handleMessage
,
false
);
window
.
addEventListener
(
'
message
'
,
handleMessage
);
}
else
if
(
typeof
window
.
attachEvent
!=
'
undefined
'
)
{
window
.
attachEvent
(
'
onmessage
'
,
handleMessage
);
}
</script>
</body>
</html>
...
...
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