Commit 051eb57a by 杨树贤

Merge branch 'ysx-CRM转化供应商流程-20260518' into Dev

parents f07a47d8 01f7fd20
...@@ -7,6 +7,7 @@ use App\Http\Controllers\Filter\LogFilter; ...@@ -7,6 +7,7 @@ use App\Http\Controllers\Filter\LogFilter;
use App\Http\Transformers\LogTransformer; use App\Http\Transformers\LogTransformer;
use App\Http\Transformers\SupplierTransformer; use App\Http\Transformers\SupplierTransformer;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\NationModel;
class LogService class LogService
{ {
...@@ -153,12 +154,18 @@ class LogService ...@@ -153,12 +154,18 @@ class LogService
return $value; return $value;
}, $oldSupplier); }, $oldSupplier);
$diff = array_diff($newSupplier, $oldSupplier); $diff = array_diff($newSupplier, $oldSupplier);
// 国家/地区映射(循环外获取,避免重复查库)
$nationMap = NationModel::getNationList();
$result = []; $result = [];
foreach ($diff as $key => $item) { foreach ($diff as $key => $item) {
$columnMap = config('validate.SupplierNeedLogColumn'); $columnMap = config('validate.SupplierNeedLogColumn');
if (in_array($key, array_keys($columnMap))) { if (in_array($key, array_keys($columnMap))) {
$oldValue = array_get($oldSupplier, $key, '空'); $oldValue = array_get($oldSupplier, $key, '空');
$newValue = array_get($newSupplier, $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 . ' ];'; $content = array_get($columnMap, $key) . '由 [ ' . $oldValue . ' ] 改成 [ ' . $newValue . ' ];';
$result[] = $content; $result[] = $content;
} else { } else {
......
...@@ -282,6 +282,9 @@ class SupplierService ...@@ -282,6 +282,9 @@ class SupplierService
$channel['system_tags'] = trim(implode(',', $channel['system_tags']), ','); $channel['system_tags'] = trim(implode(',', $channel['system_tags']), ',');
// 防御:禁止编辑时覆盖 supplier_source,防止被意外改为0
unset($channel['supplier_source']);
$model->where('supplier_id', $supplierId)->update($channel); $model->where('supplier_id', $supplierId)->update($channel);
$supplierAddressService = new SupplierAddressService(); $supplierAddressService = new SupplierAddressService();
...@@ -1423,4 +1426,4 @@ class SupplierService ...@@ -1423,4 +1426,4 @@ class SupplierService
return $result; 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