Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doc_phone
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangyipeng
doc_phone
Commits
07e507fe
Commit
07e507fe
authored
May 25, 2020
by
huanle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
05.25
parent
bbfab218
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
Index.php
application/login/controller/Index.php
+55
-0
No files found.
application/login/controller/Index.php
0 → 100644
View file @
07e507fe
<?php
namespace
app\login\controller
;
use
cjango\Dingtalk\User
;
use
src\Dingtalk\Utils
;
use
think\Controller
;
use
think\Db
;
use
src\Dingtalk
;
use
think\Session
;
class
Index
extends
Controller
{
// public function index(){
//
// return $this->fetch();
//
//
// }
public
function
config
(){
$Ding
=
new
Dingtalk
();
$Token
=
new
Dingtalk\Token
();
$token
=
$Token
->
get
();
$access_token
=
$Ding
->
config
(
'access_token'
,
$token
);
Session
::
set
(
'access_token'
,
$token
);
$ticket
=
$Token
->
jsapi
();
Session
::
set
(
'jsapi_ticket'
,
$ticket
);
$jsapi_ticket
=
$Ding
->
config
(
'jsapi_ticket'
,
$ticket
);
$config
=
$Ding
->
ddconfig
();
if
(
$config
){
$data
[
'config'
]
=
$config
;
$data
[
'status'
]
=
200
;
}
return
json
(
$data
);
}
public
function
getSsoToken
(){
$code
=
input
(
'post.code'
);
//var_dump($code);
//$access_token= Session::get('access_token');
$User
=
new
Dingtalk\User
();
$userid
=
$User
->
code
(
$code
);
if
(
$userid
===
false
){
$data
[
'status'
]
=
100000
;
$data
[
'errmsg'
]
=
'登录失败'
;
}
else
{
$data
[
'status'
]
=
0
;
$data
[
'errmsg'
]
=
'登录成功'
;
$data
[
'userid'
]
=
$userid
;
}
return
json
(
$data
);
// var_dump($_SESSION);
}
}
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