Commit 07e507fe authored by huanle's avatar huanle

05.25

parent bbfab218
<?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);
}
}
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