Files
plugins/changyandandian/Action.php
chorblack e75f275ef4
Some checks failed
定时更新GitHub源插件 / 自动更新GitHub插件 (push) Has been cancelled
Initial commit
2026-03-07 11:19:25 +08:00

65 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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).')';
}
}