-
Notifications
You must be signed in to change notification settings - Fork 595
/
Copy pathAction.php
64 lines (44 loc) · 1.54 KB
/
Action.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
class changyandandian_Action extends Widget_Abstract_Contents implements Widget_Interface_Do
{
public function __construct($request, $response, $params = NULL) {
parent::__construct($request, $response, $params);
}
public function execute()
{
}
public function action()
{
if($this->user->hasLogin()){
$ret=array(
"is_login"=>1, //已登录,返回登录的用户信息
"user"=>array(
"user_id"=>$this->user->uid,
"nickname"=>$this->user->screenName,
"img_url"=>"https://gravatar.helingqi.com/wavatar/".md5($this->user->mail)."?d=mm",
"profile_url"=>$this->user->url,
"sign"=>"zezechupin", //注意这里的sign签名验证已弃用,任意赋值即可
'reload_page'=>1,
));
setcookie("cyCookie",'1');//畅言已通过站点账号自动登录,使用cookie做个标记,用于判断进行同步登出
}else{
$ret=array("is_login"=>0);//未登录
}
echo $_GET['callback'].'('.json_encode($ret).')';
}
public function logout(){
if(!$this->user->hasLogin()){
$return=array(
'code'=>1,
'reload_page'=>1,
);
}else{
$this->user->logout();
$return=array(
'code'=>1,
'reload_page'=>1,
);
}
echo $_GET['callback'].'('.json_encode($return).')';
}
}