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,32 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 会员登录日志模型(对应 member_login_log 表)
|
||||
*
|
||||
* 这里封装登录日志写入,避免业务层直接拼接表名。
|
||||
*/
|
||||
class MemberLoginLog extends Model
|
||||
{
|
||||
protected $connection = 'dbmember';
|
||||
|
||||
protected $name = 'member_login_log';
|
||||
|
||||
protected $autoWriteTimestamp = false;
|
||||
|
||||
/**
|
||||
* 记录一次登录结果。
|
||||
*
|
||||
* @param array $payload 登录日志字段
|
||||
* @return void
|
||||
*/
|
||||
public static function recordLogin(array $payload): void
|
||||
{
|
||||
$model = new self();
|
||||
$model->save($payload);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user