refactor(member, auth): streamline product info retrieval and enhance dashboard statistics
- Updated `getProductInfo` method in `Member` model to use a unified model for fetching product data. - Refactored `logLogin` method to utilize `MemberLoginLog` for logging login attempts. - Introduced `getDashboardStats` method in `AuthService` to gather user-specific statistics, including remaining quotas and counts of authorized accounts, published tasks, and works. - Added new database configuration for Douyin business statistics.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 发布任务模型(对应 dy_video_cron 表)
|
||||
*
|
||||
* 首页“发布任务”统计与 acgpmw 一致,只排除 status=3 的记录。
|
||||
*/
|
||||
class DyVideoCron extends Model
|
||||
{
|
||||
protected $connection = 'dbmember';
|
||||
|
||||
protected $name = 'dy_video_cron';
|
||||
|
||||
protected $pk = 'id';
|
||||
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
/**
|
||||
* 统计当前用户的有效发布任务数量。
|
||||
*
|
||||
* @param int $userid 用户ID
|
||||
* @return int
|
||||
*/
|
||||
public static function countActiveByUserId(int $userid): int
|
||||
{
|
||||
return (int) self::where('userid', $userid)
|
||||
->where('status', '<>', 3)
|
||||
->count();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user