Files
huangjingfen/pro_v3.5.1/app/dao/hjf/PointsReleaseLogDao.php
apple 76ccb24679 feat(fsgx): HJF queue merge, brokerage timing, cycle commission, points release
- Add HJF jobs, services, DAOs, models, admin/API controllers, release command
- Respect brokerage_timing (on_pay vs confirm); dispatch HjfOrderPayJob for queue goods
- Queue-only cycle commission and position index fix in StoreOrderCreateServices
- UserBill income types: frozen_points_brokerage, frozen_points_release
- Timer: fsgx_release_frozen_points -> PointsReleaseServices
- Agent tasks: no_assess filtering for direct/umbrella counts
- Migrations: queue_pool, points_release_log, fsgx_v1 checklist updates
- Admin/uniapp: crontab preset, membership level, user list, finance routes, docs

Made-with: Cursor
2026-03-24 11:59:09 +08:00

85 lines
2.5 KiB
PHP

<?php
declare(strict_types=1);
namespace app\dao\hjf;
use app\dao\BaseDao;
use app\model\hjf\PointsReleaseLog;
/**
* 积分释放日志 DAO
* Class PointsReleaseLogDao
* @package app\dao\hjf
*/
class PointsReleaseLogDao extends BaseDao
{
protected function setModel(): string
{
return PointsReleaseLog::class;
}
/**
* 查询积分明细列表(分页,支持按 type 筛选)
* type: reward_direct | reward_umbrella | release | consume | ''(全部)
*/
public function getDetailList(int $uid, string $type, int $page, int $limit): array
{
$model = $this->getModel()->where('uid', $uid);
if ($type !== '') {
$model = $model->where('type', $type);
}
$count = (clone $model)->count();
$list = $model->order('add_time', 'desc')
->page($page, $limit)
->select()
->toArray();
return compact('list', 'count');
}
/**
* Admin 积分释放日志(分页)
*/
public function getAdminList(array $where, int $page, int $limit): array
{
$model = $this->getModel();
if (!empty($where['keyword'])) {
$model = $model->where('uid', 'like', '%' . $where['keyword'] . '%');
}
if (!empty($where['type'])) {
$model = $model->where('type', $where['type']);
}
if (!empty($where['start_time'])) {
$model = $model->where('add_time', '>=', strtotime($where['start_time']));
}
if (!empty($where['end_time'])) {
$model = $model->where('add_time', '<=', strtotime($where['end_time']) + 86399);
}
$count = (clone $model)->count();
$list = $model->order('add_time', 'desc')
->page($page, $limit)
->select()
->toArray();
// 今日统计
$todayStart = strtotime(date('Y-m-d'));
$todayReleased = $this->getModel()
->where('type', 'release')
->where('add_time', '>=', $todayStart)
->sum('points');
$todayUsers = $this->getModel()
->where('type', 'release')
->where('add_time', '>=', $todayStart)
->group('uid')
->count();
return [
'list' => $list,
'count' => $count,
'statistics' => [
'total_released_today' => (int)$todayReleased,
'total_users_released' => (int)$todayUsers,
],
];
}
}