30 lines
737 B
PHP
30 lines
737 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace app\smt\model;
|
|
|
|
class User extends BaseBizModel
|
|
{
|
|
protected $name = 'users';
|
|
|
|
protected $pk = 'id';
|
|
|
|
public static function findBySessionKey(string $sessionKey): ?self
|
|
{
|
|
return self::where('session_key', $sessionKey)->whereNull('deleted_at')->find();
|
|
}
|
|
|
|
public static function findActiveById(int $id): ?self
|
|
{
|
|
return self::where('id', $id)->whereNull('deleted_at')->find();
|
|
}
|
|
|
|
public static function findByMiniProgramOpenId(int $miniProgramId, string $openId): ?self
|
|
{
|
|
return self::where('mini_program_id', $miniProgramId)
|
|
->where('open_id', $openId)
|
|
->whereNull('deleted_at')
|
|
->find();
|
|
}
|
|
}
|