Files
huangjingfen/pro_v3.5.1/app/controller/api/v1/hjf/HjfAssets.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

53 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// +----------------------------------------------------------------------
// | 范氏国香 fsgx — 资产总览 API
// +----------------------------------------------------------------------
namespace app\controller\api\v1\hjf;
use app\Request;
use app\services\user\UserServices;
use app\services\agent\AgentLevelServices;
class HjfAssets
{
/**
* GET /api/hjf/assets/overview
* 资产总览聚合接口
* 返回:佣金余额、待释放积分、已释放积分、今日释放、分销等级名称
*/
public function overview(Request $request)
{
$uid = (int)$request->uid();
/** @var UserServices $userServices */
$userServices = app()->make(UserServices::class);
$user = $userServices->get($uid, ['uid', 'brokerage_price', 'frozen_points', 'available_points', 'agent_level', 'now_money']);
if (!$user) {
return app('json')->fail('用户不存在');
}
$agentLevelName = '';
if (!empty($user['agent_level'])) {
/** @var AgentLevelServices $agentLevelServices */
$agentLevelServices = app()->make(AgentLevelServices::class);
$levelInfo = $agentLevelServices->get((int)$user['agent_level'], ['id', 'name']);
$agentLevelName = $levelInfo ? $levelInfo['name'] : '';
}
// 今日释放积分frozen_points * 0.4‰(与定时任务逻辑一致)
$frozenPoints = (int)($user['frozen_points'] ?? 0);
$todayRelease = (int)floor($frozenPoints * 0.0004);
return app('json')->successful([
'brokerage_price' => (string)($user['brokerage_price'] ?? '0.00'),
'now_money' => (string)($user['now_money'] ?? '0.00'),
'frozen_points' => $frozenPoints,
'available_points' => (int)($user['available_points'] ?? 0),
'today_release' => $todayRelease,
'agent_level' => (int)($user['agent_level'] ?? 0),
'agent_level_name' => $agentLevelName,
]);
}
}