Commit c3e4b737 by 杨树贤

日志同步

parent 4909d17f
...@@ -120,9 +120,9 @@ class LogService ...@@ -120,9 +120,9 @@ class LogService
$filter = new LogFilter(); $filter = new LogFilter();
$query = $filter->defaultFilter($query); $query = $filter->defaultFilter($query);
if ($type) { if ($type) {
$logs = $query->where('supplier_id', $supplierId)->where('type', $type)->limit($limit)->get(); $logs = $query->where('supplier_id', $supplierId)->where('type', $type)->limit($limit)->get()->toArray();
} else { } else {
$logs = $query->where('supplier_id', $supplierId)->limit($limit)->get(); $logs = $query->where('supplier_id', $supplierId)->limit($limit)->get()->toArray();
} }
$transformer = new LogTransformer(); $transformer = new LogTransformer();
$logs = $transformer->transformList($logs); $logs = $transformer->transformList($logs);
...@@ -256,4 +256,4 @@ class LogService ...@@ -256,4 +256,4 @@ class LogService
} }
} }
\ No newline at end of file
...@@ -103,6 +103,20 @@ class SyncSupplierService ...@@ -103,6 +103,20 @@ class SyncSupplierService
} }
} }
//审核流程
$updateLogs = (new LogService())->getLogs($supplierId, LogModel::UPDATE_OPERATE);
$reviewProcess = [];
if ($updateLogs) {
foreach ($updateLogs as $log) {
$content = is_array($log['content']) && !empty($log['content']) ? $log['content'][0] : $log['content'];
$reviewProcess[] = [
'operator' => $log['admin_name'],
'operateDate' => $log['add_time'],
'operate' => $content,
];
}
}
$message['reviewProcess'] = $reviewProcess;
if ($conn) { if ($conn) {
} else { } else {
......
...@@ -5,6 +5,7 @@ namespace App\Http\Transformers; ...@@ -5,6 +5,7 @@ namespace App\Http\Transformers;
use App\Http\Services\LogService; use App\Http\Services\LogService;
use App\Model\SupplierReceiptModel;
class LogTransformer class LogTransformer
{ {
...@@ -41,7 +42,20 @@ class LogTransformer ...@@ -41,7 +42,20 @@ class LogTransformer
$oldReceipt = json_decode($item['remark'], true); $oldReceipt = json_decode($item['remark'], true);
//新增 //新增
if (empty($oldReceipt['receipt_id'])) { if (empty($oldReceipt['receipt_id'])) {
$item['content'] .= ' : ' . "银行名称 : {$oldReceipt['bank_name']} | 账户号码 : {$oldReceipt['account_no']}"; $type = array_get($oldReceipt, 'receipt_type', 1);
$type = $type == 1 ? "大陆" : "香港以及国外";
$swiftCodeText = ($type =='香港以及国外') ? ' | 国际代码 : ' . array_get($oldReceipt, 'swift_code') : '';
$item['content'] .= ' : ' . "银行所在地 : {$type} | 银行名称 : {$oldReceipt['bank_name']} | 账户号码 : {$oldReceipt['account_no']} | 银行地址 : {$oldReceipt['account_adderss']}" . $swiftCodeText;
} else {
$newReceipt = SupplierReceiptModel::where('receipt_id', $oldReceipt['receipt_id'])->first();
if (!empty($newReceipt)) {
$newReceipt = $newReceipt->toArray();
$type = array_get($newReceipt, 'receipt_type', 1);
$type = $type == 1 ? "大陆" : "香港以及国外";
$swiftCodeText = ($type =='香港以及国外') ? ' | 国际代码 : ' . array_get($newReceipt, 'swift_code') : '';
$item['content'] .= ' : ' . "银行所在地 : {$type} | 银行名称 : {$newReceipt['bank_name']} | 账户号码 : {$newReceipt['account_no']} | 银行地址 : {$newReceipt['account_adderss']}".$swiftCodeText;
}
} }
} }
...@@ -63,11 +77,11 @@ class LogTransformer ...@@ -63,11 +77,11 @@ class LogTransformer
if (empty($oldReceipt['receipt_id'])) { if (empty($oldReceipt['receipt_id'])) {
//新增日志 //新增日志
$content = "银行名称 : {$oldReceipt['bank_name']} | 账户号码 : {$oldReceipt['account_no']}"; $content = "银行名称 : {$oldReceipt['bank_name']} | 账户号码 : {$oldReceipt['account_no']}";
}else{ } else {
if ($receipt) { if ($receipt) {
//修改日志 //修改日志
}else{ } else {
//删除日志 //删除日志
} }
} }
......
...@@ -82,9 +82,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function () ...@@ -82,9 +82,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
}); });
Route::match(['get', 'post'], '/test', function () { Route::match(['get', 'post'], '/test', function () {
//(new \App\Http\Services\StatisticsSkuUploadService())->statisticBrandSkuNum(); (new \App\Http\Services\SyncSupplierService())->syncSupplierToErp(12469);
//(new \App\Http\Services\DataService())->exportSupplierDataForLevel();
\App\Model\SupplierChannelModel::where('supplier_code', 'L0016240')->update([
'supplier_name' => 'RUID (HONG KONG) ELECTRONICS CO., LIMITED'
]);
}); });
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