36c506f4bf
- Introduced `note_audio` table for storing audio attachments related to notes. - Implemented audio upload endpoint in `Note` controller to handle audio file uploads. - Added sharing functionality with `note_share` table to manage share tokens and view counts. - Updated API routes to include endpoints for audio uploads and share creation. - Enhanced documentation to reflect new audio and sharing features.
37 lines
750 B
PHP
37 lines
750 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace app\note\model;
|
|
|
|
use think\Model;
|
|
|
|
/**
|
|
* note 模块分享模型
|
|
*/
|
|
class NoteShare extends Model
|
|
{
|
|
protected $connection = 'dbnote';
|
|
|
|
protected $name = 'note_share';
|
|
|
|
protected $pk = 'id';
|
|
|
|
protected $autoWriteTimestamp = false;
|
|
|
|
public static function findActiveByNote(int $noteId, int $noteUserId): ?self
|
|
{
|
|
return self::where('note_id', $noteId)
|
|
->where('note_user_id', $noteUserId)
|
|
->where('status', 1)
|
|
->order('id', 'desc')
|
|
->find();
|
|
}
|
|
|
|
public static function findByToken(string $token): ?self
|
|
{
|
|
return self::where('share_token', $token)
|
|
->where('status', 1)
|
|
->find();
|
|
}
|
|
}
|