feat: add syj promote workflow
This commit is contained in:
66
pro_v3.5.1/app/controller/api/v1/syj/PromoteController.php
Normal file
66
pro_v3.5.1/app/controller/api/v1/syj/PromoteController.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\controller\api\v1\syj;
|
||||
|
||||
use app\Request;
|
||||
use app\services\syj\SyjPromoteSettlementServices;
|
||||
use app\services\syj\SyjPromoteTaskServices;
|
||||
use think\annotation\Inject;
|
||||
|
||||
class PromoteController
|
||||
{
|
||||
#[Inject]
|
||||
protected SyjPromoteTaskServices $services;
|
||||
|
||||
#[Inject]
|
||||
protected SyjPromoteSettlementServices $settlementServices;
|
||||
|
||||
public function overview(Request $request): mixed
|
||||
{
|
||||
return app('json')->success($this->services->overview((int)$request->uid()));
|
||||
}
|
||||
|
||||
public function taskList(Request $request): mixed
|
||||
{
|
||||
[$page, $limit] = $this->page($request);
|
||||
$where = ['status' => $request->param('status', '')];
|
||||
return app('json')->success($this->services->userTasks((int)$request->uid(), $where, $page, $limit));
|
||||
}
|
||||
|
||||
public function taskDetail(Request $request, int $id): mixed
|
||||
{
|
||||
return app('json')->success($this->services->userTaskDetail((int)$request->uid(), $id));
|
||||
}
|
||||
|
||||
public function taskRecords(Request $request, int $id): mixed
|
||||
{
|
||||
$task = $this->services->userTaskDetail((int)$request->uid(), $id);
|
||||
return app('json')->success($task['records'] ?? []);
|
||||
}
|
||||
|
||||
public function cashout(Request $request, int $id): mixed
|
||||
{
|
||||
return app('json')->success($this->settlementServices->applyCashout((int)$request->uid(), $id), '提交成功');
|
||||
}
|
||||
|
||||
public function amountLog(Request $request): mixed
|
||||
{
|
||||
[$page, $limit] = $this->page($request);
|
||||
return app('json')->success($this->services->amountLogs((int)$request->uid(), $page, $limit));
|
||||
}
|
||||
|
||||
public function settlementList(Request $request): mixed
|
||||
{
|
||||
[$page, $limit] = $this->page($request);
|
||||
return app('json')->success($this->settlementServices->listForUser((int)$request->uid(), $page, $limit));
|
||||
}
|
||||
|
||||
private function page(Request $request): array
|
||||
{
|
||||
return [
|
||||
max(1, (int)$request->param('page', 1)),
|
||||
min(50, max(1, (int)$request->param('limit', 15))),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user