排序规则调整

This commit is contained in:
2025-10-23 17:09:40 +08:00
parent 0f505d5c56
commit 7036e3b849
2 changed files with 19 additions and 3 deletions
+15 -1
View File
@@ -12,6 +12,7 @@ use app\common\model\User;
use app\common\service\OssService;
use app\common\traits\crud\CrudControllerTrait;
use app\common\service\FinReceiptService;
use support\Request;
class FinReceiptController extends BaseController
{
@@ -23,7 +24,18 @@ class FinReceiptController extends BaseController
{
$this->service = new FinReceiptService();
}
public function show(Request $request)
{
try {
$raw = $this->service->serviceShow($request);
$data = $this->transformData($raw, method_exists($this, 'showFormat')
? [$this, 'showFormat']
: null);
return $this->success($data);
} catch (\Throwable $e) {
return $this->error($e->getMessage());
}
}
/**
* 列表页数据格式化
*
@@ -91,6 +103,8 @@ class FinReceiptController extends BaseController
if(!$paymentApply)
return $data;
$paymentApply = $paymentApply->toArray();
$paymentApply['created_at'] = strtotime($paymentApply['created_at']);
$paymentApply['updated_at'] = strtotime($paymentApply['updated_at']);
$paymentApply = (new FinPaymentApplyController())->showFormat($paymentApply);
$data['payment_apply'] = $paymentApply;
}
@@ -217,14 +217,16 @@ class FinPaymentApplyService
$orderByClause = "CASE
WHEN created_at >= {$sevenDaysAgo} THEN
(" . implode(' + ', $similarityOrder) . ")
ELSE 999999
ELSE 0
END ASC, ";
}
$orderByClause .= "CASE
WHEN created_at < {$sevenDaysAgo} THEN id
ELSE 0
ELSE 999999
END DESC";
$orderByClause .= ", id DESC";
$query->orderByRaw($orderByClause);