77 lines
3.0 KiB
PHP
77 lines
3.0 KiB
PHP
<?php
|
|
namespace app\common\controller;
|
|
|
|
use app\common\controller\BaseController;
|
|
use app\common\model\Country;
|
|
use app\common\model\SysAccount;
|
|
use app\common\model\SysCurrency;
|
|
use app\common\service\OssService;
|
|
use app\common\traits\crud\CrudControllerTrait;
|
|
use app\common\service\FinReceiptHisService;
|
|
use support\Request;
|
|
|
|
class FinReceiptHisController extends BaseController
|
|
{
|
|
use CrudControllerTrait;
|
|
|
|
protected $service;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->service = new FinReceiptHisService();
|
|
}
|
|
|
|
/**
|
|
* 列表页数据格式化
|
|
*
|
|
* @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']);
|
|
if (isset($data['arrived_at']))
|
|
$data['arrived_at'] = date('Y-m-d H:i:s', $data['arrived_at']);
|
|
if (isset($data['received_at']))
|
|
$data['received_at'] = date('Y-m-d H:i:s', $data['received_at']);
|
|
if (isset($data['account_id'])) //收款账号
|
|
$data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name;
|
|
if (isset($data['country_id'])) //付款来源国家
|
|
$data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr;
|
|
if (isset($data['currency_id'])) //付款币种
|
|
$data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name;
|
|
if (isset($data['fx_receipt_file']))
|
|
$data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']);
|
|
return $data;
|
|
}
|
|
|
|
/**
|
|
* 数据格式化
|
|
*
|
|
* @param array $data
|
|
* @return array
|
|
*/
|
|
protected function showFormat($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']);
|
|
if (isset($data['arrived_at']))
|
|
$data['arrived_at'] = date('Y-m-d H:i:s', $data['arrived_at']);
|
|
if (isset($data['received_at']))
|
|
$data['received_at'] = date('Y-m-d H:i:s', $data['received_at']);
|
|
if (isset($data['account_id'])) //收款账号
|
|
$data['account_name'] = SysAccount::where('id', $data['account_id'])->first()->account_name;
|
|
if (isset($data['country_id'])) //付款来源国家
|
|
$data['country_name'] = Country::where('id', $data['currency_id'])->first()->cn_addr;
|
|
if (isset($data['currency_id'])) //付款币种
|
|
$data['currency_name'] = SysCurrency::where('id', $data['currency_id'])->first()->currency_name;
|
|
if (isset($data['fx_receipt_file']))
|
|
$data['fx_receipt_file_full'] = (new OssService)->generatePrivateUrl($data['fx_receipt_file']);
|
|
return $data;
|
|
}
|
|
} |