feat: add syj promote workflow

This commit is contained in:
apple
2026-05-03 14:44:12 +08:00
parent 12c2431d4e
commit 0e07a65e3f
36 changed files with 1972 additions and 1 deletions

View File

@@ -0,0 +1,119 @@
<?php
declare(strict_types=1);
namespace app\controller\admin\v1\syj;
use app\controller\admin\AuthController;
use app\services\syj\SyjPromoteConfigServices;
use app\services\syj\SyjPromoteRewardTriggerServices;
use app\services\syj\SyjPromoteSettlementServices;
use app\services\syj\SyjPromoteTaskServices;
use think\annotation\Inject;
class PromoteController extends AuthController
{
#[Inject]
protected SyjPromoteTaskServices $services;
#[Inject]
protected SyjPromoteSettlementServices $settlementServices;
#[Inject]
protected SyjPromoteConfigServices $configServices;
#[Inject]
protected SyjPromoteRewardTriggerServices $triggerServices;
public function taskList(): mixed
{
$where = $this->request->getMore([
['keyword', ''],
['status', ''],
['reward_trigger_status', ''],
['start_time', ''],
['end_time', ''],
['page', 1],
['limit', 20],
]);
$page = (int)$where['page'];
$limit = (int)$where['limit'];
unset($where['page'], $where['limit']);
return $this->success($this->services->adminTasks($where, $page, $limit));
}
public function taskDetail(int $id): mixed
{
return $this->success($this->services->adminTaskDetail($id));
}
public function taskRecords(int $id): mixed
{
return $this->success($this->services->records($id));
}
public function cashoutList(): mixed
{
$where = $this->request->getMore([
['keyword', ''],
['audit_status', ''],
['page', 1],
['limit', 20],
]);
$where['settle_type'] = 'early_cashout';
$page = (int)$where['page'];
$limit = (int)$where['limit'];
unset($where['page'], $where['limit']);
return $this->success($this->settlementServices->adminList($where, $page, $limit));
}
public function settlementList(): mixed
{
$where = $this->request->getMore([
['keyword', ''],
['audit_status', ''],
['settle_type', ''],
['page', 1],
['limit', 20],
]);
$page = (int)$where['page'];
$limit = (int)$where['limit'];
unset($where['page'], $where['limit']);
return $this->success($this->settlementServices->adminList($where, $page, $limit));
}
public function auditCashout(int $id): mixed
{
$data = $this->request->postMore([
['status', 1],
['remark', ''],
]);
$this->settlementServices->auditCashout($id, (int)$this->adminId, (int)$data['status'], (string)$data['remark']);
return $this->success('审核成功');
}
public function getConfig(): mixed
{
return $this->success($this->configServices->getConfig());
}
public function saveConfig(): mixed
{
$data = $this->request->postMore([
['base_amount', 4333],
['target_count', 4],
['reward_rates', [10, 20, 30, 40]],
['early_cashout_fee_rate', 7],
['task_generate_timing', 'on_confirm'],
['task_order_dedupe', 'order'],
['reward_trigger_enable', 1],
]);
$this->configServices->saveConfig($data);
return $this->success('保存成功');
}
public function retryTrigger(int $taskId): mixed
{
$this->triggerServices->retry($taskId);
return $this->success('重试完成');
}
}