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
This commit is contained in:
84
pro_v3.5.1/app/dao/hjf/PointsReleaseLogDao.php
Normal file
84
pro_v3.5.1/app/dao/hjf/PointsReleaseLogDao.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?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,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
140
pro_v3.5.1/app/dao/hjf/QueuePoolDao.php
Normal file
140
pro_v3.5.1/app/dao/hjf/QueuePoolDao.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\dao\hjf;
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\hjf\QueuePool;
|
||||
use crmeb\basic\BaseModel;
|
||||
|
||||
/**
|
||||
* 公排池 DAO
|
||||
* Class QueuePoolDao
|
||||
* @package app\dao\hjf
|
||||
*/
|
||||
class QueuePoolDao extends BaseDao
|
||||
{
|
||||
protected function setModel(): string
|
||||
{
|
||||
return QueuePool::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户的公排记录列表(分页)
|
||||
*/
|
||||
public function getUserList(int $uid, int $status, int $page, int $limit): array
|
||||
{
|
||||
$model = $this->getModel()->where('uid', $uid);
|
||||
if ($status >= 0) {
|
||||
$model = $model->where('status', $status);
|
||||
}
|
||||
$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('order_id|uid', 'like', '%' . $where['keyword'] . '%');
|
||||
}
|
||||
if (isset($where['status']) && $where['status'] !== '') {
|
||||
$model = $model->where('status', (int)$where['status']);
|
||||
}
|
||||
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('queue_no', 'asc')
|
||||
->page($page, $limit)
|
||||
->select()
|
||||
->toArray();
|
||||
return compact('list', 'count');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最早尚未退款的一条记录
|
||||
*/
|
||||
public function getEarliestPending(): ?array
|
||||
{
|
||||
$row = $this->getModel()
|
||||
->where('status', 0)
|
||||
->order('queue_no', 'asc')
|
||||
->find();
|
||||
return $row ? $row->toArray() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前排队中总单数
|
||||
*/
|
||||
public function countPending(): int
|
||||
{
|
||||
return $this->getModel()->where('status', 0)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全局总单数(含已退款)
|
||||
*/
|
||||
public function countTotal(): int
|
||||
{
|
||||
return $this->getModel()->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下一个全局排队序号(MAX queue_no + 1)
|
||||
*/
|
||||
public function nextQueueNo(): int
|
||||
{
|
||||
$max = $this->getModel()->max('queue_no');
|
||||
return (int)$max + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记一条记录为已退款
|
||||
*/
|
||||
public function markRefunded(int $id, int $batchNo): bool
|
||||
{
|
||||
return (bool)$this->getModel()
|
||||
->where('id', $id)
|
||||
->update([
|
||||
'status' => 1,
|
||||
'refund_time' => time(),
|
||||
'trigger_batch' => $batchNo,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取退款财务流水(Admin 分页)
|
||||
*/
|
||||
public function getFinanceList(array $where, int $page, int $limit): array
|
||||
{
|
||||
$model = $this->getModel()->where('status', 1);
|
||||
if (!empty($where['start_time'])) {
|
||||
$model = $model->where('refund_time', '>=', strtotime($where['start_time']));
|
||||
}
|
||||
if (!empty($where['end_time'])) {
|
||||
$model = $model->where('refund_time', '<=', strtotime($where['end_time']) + 86399);
|
||||
}
|
||||
$count = (clone $model)->count();
|
||||
$totalRefund = (clone $model)->sum('amount');
|
||||
$list = $model->order('refund_time', 'desc')
|
||||
->page($page, $limit)
|
||||
->select()
|
||||
->toArray();
|
||||
return [
|
||||
'list' => $list,
|
||||
'count' => $count,
|
||||
'total_refund' => number_format((float)$totalRefund, 2, '.', ''),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -187,6 +187,10 @@ class UserWechatUserDao extends BaseDao
|
||||
}
|
||||
}
|
||||
|
||||
// HJF / 分销等级:eb_user.agent_level(由 hjf_member_level 归一化得到)
|
||||
if (isset($where['hjf_agent_level_id']) && $where['hjf_agent_level_id'] !== '' && $where['hjf_agent_level_id'] !== null) {
|
||||
$model = $model->where($userAlias . 'agent_level', (int)$where['hjf_agent_level_id']);
|
||||
}
|
||||
//用户等级
|
||||
if (isset($where['level']) && $where['level']) {
|
||||
$model = $model->where($userAlias . 'level', $where['level']);
|
||||
|
||||
Reference in New Issue
Block a user