Skip to content

Commit

Permalink
增加注释说明
Browse files Browse the repository at this point in the history
  • Loading branch information
jianyan74 committed Nov 29, 2018
1 parent 41825c2 commit f1110db
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 40 deletions.
3 changes: 3 additions & 0 deletions src/Wechat.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
* @property \EasyWeChat\OpenPlatform\Application $openPlatform 微信开放平台(第三方平台)实例
* @property \EasyWeChat\Work\Application $work 企业微信实例
* @property \EasyWeChat\OpenWork\Application $openWork 企业微信开放平台实例
*
* @property bool $isWechat 检查客户端是否是微信浏览器
* @property WechatUser $user 获取微信身份信息
*/
class Wechat extends Component
{
Expand Down
99 changes: 59 additions & 40 deletions src/WechatUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,68 @@
use yii\base\Component;

/**
* 微信授权用户的个人信息
*
* Class WechatUser
* @package jianyan74\easywechat
* @package jianyan\easywechat
* @property string $openId 微信授权用户的唯一标识(openid)
* @see https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842 返回的JSON数据包的格式参考第四步
*/
class WechatUser extends Component
{
/**
* @var string
*/
public $id;
/**
* @var string
*/
public $nickname;
/**
* @var string
*/
public $name;
/**
* @var string
*/
public $email;
/**
* @var string
*/
public $avatar;
/**
* @var array
*/
public $original;
/**
* @var \Overtrue\Socialite\AccessToken
*/
public $token;
/**
* @var string
*/
public $provider;
/**
* 用户的唯一标识(openid)
*
* @var string
*/
public $id;
/**
* 用户昵称
*
* @var string
*/
public $nickname;
/**
* 用户昵称
*
* @var string
*/
public $name;
/**
* @var string
*/
public $email;
/**
* 用户头像, 最后一个数值代表正方形头像大小(有0,46,64,96,132数值可选, 0代表640*640正方形头像)
*
* @var string
*/
public $avatar;
/**
* 原数据, 微信授权返回的JSON数据包
*
* @var array
*/
public $original;
/**
* 微信授权获取用户信息token
*
* @var \Overtrue\Socialite\AccessToken
*/
public $token;
/**
* @var string
*/
public $provider;

/**
* @return string
*/
public function getOpenId()
{
return isset($this->original['openid']) ? $this->original['openid'] : '';
}

/**
* 微信授权用户的唯一标识(openid)
*
* @return string
*/
public function getOpenId()
{
return isset($this->original['openid']) ? $this->original['openid'] : '';
}
}

0 comments on commit f1110db

Please sign in to comment.