feat(video): add user-specific video query and filter accounts functionality
- Introduced `buildUserQuery` method in `DysVideoLog` model to create a base query for user-specific video logs. - Added `getVideoFilterAccountsByUserId` method in `DyVideoUser` model to retrieve active accounts for a specified user. - Updated routing to include new video work API endpoints under `v1/video-work`, requiring user authentication.
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
namespace app\api\model;
|
||||
|
||||
use think\Model;
|
||||
use think\db\Query;
|
||||
|
||||
/**
|
||||
* 抖音发布日志模型(对应分表 dys_video_log_{userid % 1000})
|
||||
@@ -41,6 +42,25 @@ class DysVideoLog extends Model
|
||||
->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建当前用户的视频作品基础查询。
|
||||
*
|
||||
* 作品日志按 `dys_video_log_{userid % 1000}` 分表存储,
|
||||
* 这里统一返回已定位分表且已限定用户范围的查询对象。
|
||||
*
|
||||
* @param int $userid 用户ID
|
||||
* @return Query
|
||||
*/
|
||||
public static function buildUserQuery(int $userid): Query
|
||||
{
|
||||
$tableName = self::resolveTableName($userid);
|
||||
|
||||
return (new self())
|
||||
->db()
|
||||
->name($tableName)
|
||||
->where('userid', $userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID计算分表名。
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user