58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Model;
|
|
|
|
use Hyperf\Database\Model\Builder;
|
|
use Hyperf\DbConnection\Model\Model;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $username
|
|
* @property string $password
|
|
* @property string $salt
|
|
* @property int $avatar
|
|
* @property string $chinese_name
|
|
* @property string $mobile
|
|
* @property int $status
|
|
* @property string $last_login_ip
|
|
* @property string $last_login_time
|
|
* @property int $is_del
|
|
* @property int $role_id
|
|
* @property string $create_time
|
|
* @property string $update_time
|
|
*/
|
|
class AdminUser extends Model
|
|
{
|
|
/**
|
|
* The table associated with the model.
|
|
*/
|
|
protected ?string $table = 'admin_user';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*/
|
|
protected array $fillable = [];
|
|
|
|
protected array $guarded = [];
|
|
|
|
/**
|
|
* The attributes that should be cast to native types.
|
|
*/
|
|
protected array $casts = ['id' => 'integer', 'avatar' => 'integer', 'status' => 'integer', 'is_del' => 'integer', 'role_id' => 'integer'];
|
|
|
|
const CREATED_AT = 'create_time';
|
|
|
|
const UPDATED_AT = 'update_time';
|
|
|
|
/**
|
|
* @param $account
|
|
* @return Builder|\Hyperf\Database\Model\Model|null
|
|
*/
|
|
public function getAdminInfoByAccount($account): \Hyperf\Database\Model\Model|Builder|null
|
|
{
|
|
return $this->where('username', $account)->where('is_del',1)->first();
|
|
}
|
|
}
|