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.

58 lines
1.1 KiB

<?php
namespace app\base\model\user;
use app\base\model\Base;
use think\model\concern\SoftDelete;
class UserInfo extends Base
{
use SoftDelete;
// 设置当前模型对应的完整数据表名称
protected $table = 'base_user_info';
/**
* 性别
* @date 2022-01-12
*/
public function getGenderTextAttr($value, $data)
{
$gender = ['未知', '男', '女'];
return $gender[$data['gender']];
}
/**
* 更新用户信息
* @param array $data 用户信息
* @date 2021-03-01
*/
public function updateUser($data)
{
$where = [
['user_id', '=', $data['user_id']]
];
$id = $this->getOneData($where, 'id');
if (!empty($id)) {
$data['id'] = $id;
}
return $this->dataUpdate($data);
}
/**
* 获取用户头像昵称
* @date 2022-08-26
*/
public function getUserHeadAndName()
{
return $this->getOneData([
['user_id', '=', $this->userId]
], 'user_id,head_img,nick_name')->toArray();
}
}