feat: add note module and route fixes
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\note\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* note 模块小程序用户模型
|
||||
*/
|
||||
class NoteUser extends Model
|
||||
{
|
||||
protected $connection = 'dbnote';
|
||||
|
||||
protected $name = 'note_user';
|
||||
|
||||
protected $pk = 'id';
|
||||
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
/**
|
||||
* 根据 openid 查找用户
|
||||
*
|
||||
* @param string $openid
|
||||
* @return self|null
|
||||
*/
|
||||
public static function findByOpenid(string $openid): ?self
|
||||
{
|
||||
return self::where('openid', $openid)
|
||||
->where('deleted_at', 0)
|
||||
->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键查找用户
|
||||
*
|
||||
* @param int $id
|
||||
* @return self|null
|
||||
*/
|
||||
public static function findActiveById(int $id): ?self
|
||||
{
|
||||
return self::where('id', $id)
|
||||
->where('deleted_at', 0)
|
||||
->find();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user