Commit 01f7fd20 by 杨树贤

修复

parent b0376f77
......@@ -7,6 +7,7 @@ use App\Http\Controllers\Filter\LogFilter;
use App\Http\Transformers\LogTransformer;
use App\Http\Transformers\SupplierTransformer;
use App\Model\LogModel;
use App\Model\NationModel;
class LogService
{
......@@ -153,12 +154,18 @@ class LogService
return $value;
}, $oldSupplier);
$diff = array_diff($newSupplier, $oldSupplier);
// 国家/地区映射(循环外获取,避免重复查库)
$nationMap = NationModel::getNationList();
$result = [];
foreach ($diff as $key => $item) {
$columnMap = config('validate.SupplierNeedLogColumn');
if (in_array($key, array_keys($columnMap))) {
$oldValue = array_get($oldSupplier, $key, '空');
$newValue = array_get($newSupplier, $key, '空');
if ($key === 'nation_id') {
$oldValue = array_get($nationMap, $oldValue, '');
$newValue = array_get($nationMap, $newValue, $newValue);
}
$content = array_get($columnMap, $key) . '由 [ ' . $oldValue . ' ] 改成 [ ' . $newValue . ' ];';
$result[] = $content;
} else {
......
......@@ -282,6 +282,9 @@ class SupplierService
$channel['system_tags'] = trim(implode(',', $channel['system_tags']), ',');
// 防御:禁止编辑时覆盖 supplier_source,防止被意外改为0
unset($channel['supplier_source']);
$model->where('supplier_id', $supplierId)->update($channel);
$supplierAddressService = new SupplierAddressService();
......@@ -1423,4 +1426,4 @@ class SupplierService
return $result;
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment