Commit 5bde83ae by 杨树贤

修改同步逻辑

parent 3532dcbc
Showing with 6 additions and 1 deletions
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
namespace App\Http\Services; namespace App\Http\Services;
//后台用户相关信息服务 //后台用户相关信息服务
use App\Model\RedisModel;
use App\Model\SupplierAttachmentsModel; use App\Model\SupplierAttachmentsModel;
use App\Model\SupplierChannelModel; use App\Model\SupplierChannelModel;
use App\Model\SupplierContactModel; use App\Model\SupplierContactModel;
...@@ -153,6 +154,10 @@ class SyncSupplierService ...@@ -153,6 +154,10 @@ class SyncSupplierService
$sourceSn = array_get($syncResult, 'source_sn'); $sourceSn = array_get($syncResult, 'source_sn');
$supplierId = $sourceSn; $supplierId = $sourceSn;
if ($supplierId) { if ($supplierId) {
$supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first();
$supplier = !empty($supplier) ? $supplier->toArray() : [];
$redis = new RedisModel();
$redis->hset('supplier_sync_backup', $supplierId, json_encode($supplier));
return SupplierChannelModel::where('supplier_id', $supplierId) return SupplierChannelModel::where('supplier_id', $supplierId)
->update([ ->update([
'supplier_name' => $syncResult['company_name'], 'supplier_name' => $syncResult['company_name'],
...@@ -160,7 +165,7 @@ class SyncSupplierService ...@@ -160,7 +165,7 @@ class SyncSupplierService
'group_code' => $groupCode, 'group_code' => $groupCode,
'company_nature' => $syncResult['company_nature'], 'company_nature' => $syncResult['company_nature'],
]); ]);
}else{ } else {
return SupplierChannelModel::where('group_code', $groupCode) return SupplierChannelModel::where('group_code', $groupCode)
->update([ ->update([
'sync_united_status' => SupplierChannelModel::SYNC_UNITED_STATUS_OK, 'sync_united_status' => SupplierChannelModel::SYNC_UNITED_STATUS_OK,
......
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