feat: admin login
This commit is contained in:
56
app/Model/AdminUser.php
Normal file
56
app/Model/AdminUser.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?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
|
||||
*/
|
||||
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 = null;
|
||||
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user