You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
831 B
30 lines
831 B
<?php
|
|
|
|
namespace app\model;
|
|
|
|
class WechatUser extends Base
|
|
{
|
|
|
|
/**
|
|
* 获取微信用户信息
|
|
* @param $id
|
|
* @return WechatUser|array|mixed|\think\Model|null
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
* @throws \think\db\exception\DbException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
*/
|
|
public function getUserInfo($id)
|
|
{
|
|
$field = 'id,openid,nickname,headimgurl,phone,unionid';
|
|
return $this->where('id',$id)->field($field)->find();
|
|
}
|
|
|
|
public function openIdUserInfo($openid){
|
|
$field = 'id,openid,nickname,headimgurl,phone,unionid,status';
|
|
return $this->where('openid',$openid)->field($field)->find();
|
|
}
|
|
|
|
public function addLoginTime($id) {
|
|
$this->where('id',$id)->save(['last_login_time' => time()]);
|
|
}
|
|
}
|