付款申请查询相关字段名

This commit is contained in:
2025-09-23 16:45:06 +08:00
parent 4717bb01ca
commit e6d3cc3f04
4 changed files with 89 additions and 12 deletions
@@ -1,7 +1,13 @@
<?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\model\SysDictItem;
use app\common\model\User;
use app\common\traits\crud\CrudControllerTrait;
use app\common\service\FinPaymentApplyService;
@@ -22,12 +28,55 @@ class FinPaymentApplyController 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['doc_user_id'])) //内勤
$data['doc_user_name'] = User::where('id', $data['doc_user_id'])->first()->name;
if (isset($data['sales_user_id'])) //业务员
$data['sales_user_name'] = User::where('id', $data['doc_user_id'])->first()->name;
if (isset($data['corp_id'])) //公司(渠道)
$data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->first()->item_label;
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['submit_files']))
$data['submit_files'] = json_decode($data['submit_files'], true);
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;
}
/**
* 数据格式化
*
* @param array $data
* @return array
*/
protected function showFormat($data)
{
if (isset($data['doc_user_id'])) //内勤
$data['doc_user_name'] = User::where('id', $data['doc_user_id'])->first()->name;
if (isset($data['sales_user_id'])) //业务员
$data['sales_user_name'] = User::where('id', $data['doc_user_id'])->first()->name;
if (isset($data['corp_id'])) //公司(渠道)
$data['corp_name'] = SysDictItem::where('id', $data['corp_id'])->first()->item_label;
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['submit_files']))
$data['submit_files'] = json_decode($data['submit_files'], true);
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;
}
}