好的,我来给你写一个加工工厂,你只需要将该工厂代码新增到方案的事件 AfterTargetGenerate 即可。
<?php
use Domain\Datahub\Instance\Storage\LogStorage;
class AfterTargetGenerate
{
protected $params = [];
protected $ids = [];
public function __construct(&$params, $ids)
{
$this->params = &$params;
$this->ids = $ids;
}
public function run()
{
foreach ($this->params[1]['Model'][0]['FBankInfo'] as $index => &$item){
$FBankCode = str_replace(' ', '', $item['FBankCode']);
preg_match_all('!\d+!', $FBankCode, $matches);
$item['FBankCode'] = implode('', $matches[0]);; // 如果字段为数字,则返回当前数字
}
}
}