1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-23 20:00:27 +08:00

用会退款列表中增加me属性

This commit is contained in:
koogua 2021-10-07 14:47:27 +08:00
parent 2a30589716
commit e2e3479851
2 changed files with 23 additions and 1 deletions

View File

@ -7,6 +7,7 @@
namespace App\Builders;
use App\Models\Refund as RefundModel;
use App\Repos\Order as OrderRepo;
use App\Repos\User as UserRepo;
@ -35,6 +36,24 @@ class RefundList extends Builder
return $refunds;
}
public function handleMeInfo(array $refund)
{
$me = [
'allow_cancel' => 0,
];
$statusTypes = [
RefundModel::STATUS_PENDING,
RefundModel::STATUS_APPROVED,
];
if (in_array($refund['status'], $statusTypes)) {
$me['allow_cancel'] = 1;
}
return $me;
}
public function getOrders(array $trades)
{
$ids = kg_array_column($trades, 'order_id');

View File

@ -65,8 +65,9 @@ class RefundList extends LogicService
$order = $orders[$refund['order_id']] ?? new \stdClass();
$me = $builder->handleMeInfo($refund);
$items[] = [
'order' => $order,
'sn' => $refund['sn'],
'subject' => $refund['subject'],
'amount' => (float)$refund['amount'],
@ -75,6 +76,8 @@ class RefundList extends LogicService
'review_note' => $refund['review_note'],
'create_time' => $refund['create_time'],
'update_time' => $refund['update_time'],
'order' => $order,
'me' => $me,
];
}