2026-03-23 22:32:19 +08:00
|
|
|
<?php
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | 范氏国香 fsgx — 推荐佣金周期进度 API
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
namespace app\controller\api\v1\hjf;
|
|
|
|
|
|
|
|
|
|
use app\Request;
|
|
|
|
|
use app\services\user\UserServices;
|
|
|
|
|
|
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
|
|
|
class HjfBrokerage
|
2026-03-23 22:32:19 +08:00
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* GET /api/hjf/brokerage/progress
|
|
|
|
|
* 推荐佣金周期进度聚合接口
|
|
|
|
|
*/
|
|
|
|
|
public function progress(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$uid = (int)$request->uid();
|
|
|
|
|
/** @var UserServices $userServices */
|
|
|
|
|
$userServices = app()->make(UserServices::class);
|
|
|
|
|
$userInfo = $userServices->get($uid, ['uid', 'brokerage_price', 'spread_uid', 'agent_level']);
|
|
|
|
|
|
|
|
|
|
// 周期配置
|
|
|
|
|
$cycleCount = (int)sys_config('brokerage_cycle_count', 3);
|
|
|
|
|
$cycleRatesRaw = sys_config('brokerage_cycle_rates', '[20,30,50]');
|
|
|
|
|
$cycleRates = json_decode($cycleRatesRaw, true) ?: [20, 30, 50];
|
|
|
|
|
|
|
|
|
|
// 统计当前用户作为 spread_uid 的下级已完成报单商品有效订单数
|
|
|
|
|
/** @var \app\dao\order\StoreOrderDao $orderDao */
|
|
|
|
|
$orderDao = app()->make(\app\dao\order\StoreOrderDao::class);
|
|
|
|
|
$totalCompleted = $orderDao->count([
|
|
|
|
|
'spread_uid' => $uid,
|
|
|
|
|
'is_queue_goods' => 1,
|
|
|
|
|
'paid' => 1,
|
|
|
|
|
'is_del' => 0,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
// 当前周期内完成人数
|
|
|
|
|
$cycleCurrent = $totalCompleted % $cycleCount;
|
|
|
|
|
|
|
|
|
|
// 累计佣金
|
|
|
|
|
$totalBrokerage = $userInfo ? (string)($userInfo['brokerage_price'] ?? '0.00') : '0.00';
|
|
|
|
|
|
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
|
|
|
return app('json')->successful([
|
2026-03-23 22:32:19 +08:00
|
|
|
'cycle_total' => $cycleCount,
|
|
|
|
|
'cycle_current' => $cycleCurrent,
|
|
|
|
|
'cycle_rates' => $cycleRates,
|
|
|
|
|
'total_brokerage' => $totalBrokerage,
|
|
|
|
|
'total_completed' => $totalCompleted,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
}
|