时间处理

This commit is contained in:
liu 2024-06-14 16:37:05 +08:00
parent 0a0fba85df
commit 5de9a7f264

View File

@ -26,7 +26,8 @@ class FinancialTransfersLists extends BaseAdminDataLists implements ListsSearchI
public function setSearch(): array
{
return [
'=' => ['store_id', 'admin_id', 'uid', 'status', 'initiation_time', 'confirmation_time', 'mark', 'money', 'remark_time'],
'=' => ['store_id', 'admin_id', 'uid', 'status', 'initiation_time', 'confirmation_time', 'mark', 'money', 'remark_time','create_time'],
'between_time' => 'create_time',
];
}
@ -42,12 +43,23 @@ class FinancialTransfersLists extends BaseAdminDataLists implements ListsSearchI
*/
public function lists(): array
{
return FinancialTransfers::with(['store','staff','admin'])->where($this->searchWhere)
// ->field(['id', 'store_id', 'admin_id', 'status', 'initiation_time', 'confirmation_time', 'mark', 'money', 'remark_time'])
$data = FinancialTransfers::with(['store','staff','admin'])->where($this->searchWhere)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
foreach ($data as &$value){
if($value['initiation_time']){
$value['initiation_time'] = date('Y-m-d H:i:s',$value['initiation_time']);
}
if($value['confirmation_time']){
$value['confirmation_time'] = date('Y-m-d H:i:s',$value['confirmation_time']);
}
}
return $data;
}