采购单处理
This commit is contained in:
@@ -23,16 +23,63 @@ class PurchaseOrdersController extends BaseController
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
// protected function indexFormat($data)
|
||||
// {
|
||||
// if (isset($data['created_at']))
|
||||
// $data['created_at'] = date('Y-m-d H:i:s', $data['created_at']);
|
||||
// if (isset($data['updated_at']))
|
||||
// $data['updated_at'] = date('Y-m-d H:i:s', $data['updated_at']);
|
||||
// return $data;
|
||||
// }
|
||||
protected function indexFormat($data)
|
||||
{
|
||||
if (isset($data['records']) && count($data['records']) > 0) {
|
||||
foreach ($data['records'] as &$record) {
|
||||
$result = [
|
||||
'id' => $record['id'],
|
||||
'po_no' => $record['po_no'],
|
||||
'pi_no' => $record['pi_no'],
|
||||
'buyer_id' => $record['buyer_id'],
|
||||
'buyer_name' => $record['buyer_name'],
|
||||
'contract_file' => $record['contract_file'],
|
||||
'contract_file_url' => $record['contract_file'] ? (new \app\common\service\OssService)->generatePrivateUrl($data['contract_file']) : '',
|
||||
'status' => $record['status'],
|
||||
'remark' => $record['remark'],
|
||||
'created_at' => date('Y-m-d H:i:s', strtotime($record['created_at'])),
|
||||
'updated_at' => date('Y-m-d H:i:s', strtotime($record['updated_at'])),
|
||||
];
|
||||
$record = $result;
|
||||
}
|
||||
unset($record);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
protected function showFormat($data)
|
||||
{
|
||||
$result = [
|
||||
'id' => $data['id'],
|
||||
'po_no' => $data['po_no'],
|
||||
'pi_no' => $data['pi_no'],
|
||||
'buyer_id' => $data['buyer_id'],
|
||||
'buyer_name' => $data['buyer_name'],
|
||||
'contract_file' => $data['contract_file'],
|
||||
'contract_file_url' => $data['contract_file'] ? (new \app\common\service\OssService)->generatePrivateUrl($data['contract_file']) : '',
|
||||
'status' => $data['status'],
|
||||
'remark' => $data['remark']
|
||||
];
|
||||
|
||||
if (isset($data['items']) && count($data['items']) > 0) {
|
||||
foreach ($data['items'] as $record) {
|
||||
$result['stock_order'][] = [
|
||||
'id' => $record['stockOrder']['id'],
|
||||
'order_no' => $record['stockOrder']['order_no'],
|
||||
'salesperson_snapshot' => $record['stockOrder']['salesperson_snapshot'],
|
||||
'biz_date' => date('Y-m-d', $record['stockOrder']['biz_date']),
|
||||
'stock_order_items' => [
|
||||
'id' => $record['stockOrderItems']['id'],
|
||||
'model_snapshot' => $record['stockOrderItems']['model_snapshot'],
|
||||
'unique_id' => $record['stockOrderItems']['unique_id'],
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 前置查询处理
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user