43 lines
806 B
PHP
43 lines
806 B
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: yancheng<cheng@love.xiaoyan.me>
|
|
* Date: 2019/6/18
|
|
* Time: 7:22 PM
|
|
*/
|
|
|
|
namespace app\model;
|
|
|
|
|
|
use app\BaseModel;
|
|
|
|
class UserInfo extends BaseModel
|
|
{
|
|
protected $table = 'user_info';
|
|
protected $globalScope = ['status'];
|
|
|
|
|
|
public function scopeStatus($query)
|
|
{
|
|
$query->where('status', 1);
|
|
}
|
|
|
|
public function detail()
|
|
{
|
|
return $this->hasOne('UserDetail', 'uid', 'id');
|
|
}
|
|
|
|
public function search()
|
|
{
|
|
return $this->query("SELECT u.avatar,u.nickname,u.username,u.open_id,d.* from user_detail d , user_info u where u.id = d.uid");
|
|
}
|
|
|
|
/**
|
|
* 获取已经格式过的用户详情
|
|
* @return UserDetail
|
|
*/
|
|
public function getParsedDetail()
|
|
{
|
|
return $this->detail;
|
|
}
|
|
} |