Commit 5817e308 by 杨树贤

修改sku采购员同步修改采集供应商的采购员

parent 8cf49a4b
...@@ -555,6 +555,7 @@ class SupplierApiController extends Controller ...@@ -555,6 +555,7 @@ class SupplierApiController extends Controller
$this->response(-1, '选择的供应商里面不存在对应的线上采购员'); $this->response(-1, '选择的供应商里面不存在对应的线上采购员');
} }
$supplierService->batchAllocateYunxinChannelUser($supplierIds, $channelUid); $supplierService->batchAllocateYunxinChannelUser($supplierIds, $channelUid);
dd(1223);
$this->response(0, '批量分配线上采购员成功'); $this->response(0, '批量分配线上采购员成功');
} }
......
...@@ -6,6 +6,7 @@ namespace App\Http\Services; ...@@ -6,6 +6,7 @@ namespace App\Http\Services;
use App\Http\Controllers\Filter\SupplierFilter; use App\Http\Controllers\Filter\SupplierFilter;
use App\Http\Transformers\SupplierTransformer; use App\Http\Transformers\SupplierTransformer;
use App\Http\Validators\SupplierValidator; use App\Http\Validators\SupplierValidator;
use App\Model\BigData\DataManageModel;
use App\Model\LogModel; use App\Model\LogModel;
use App\Model\RedisModel; use App\Model\RedisModel;
use App\Model\SupplierAccountModel; use App\Model\SupplierAccountModel;
...@@ -59,7 +60,6 @@ class SupplierService ...@@ -59,7 +60,6 @@ class SupplierService
} }
public function saveSupplier($channel) public function saveSupplier($channel)
{ {
$supplierTransformer = new SupplierTransformer(); $supplierTransformer = new SupplierTransformer();
...@@ -493,14 +493,21 @@ class SupplierService ...@@ -493,14 +493,21 @@ class SupplierService
$logService = new LogService(); $logService = new LogService();
$redis = new RedisModel(); $redis = new RedisModel();
foreach ($supplierIds as $supplierId) { foreach ($supplierIds as $supplierId) {
$preYunxinChannelUid = SupplierChannelModel::where('supplier_id', $supplierId)->value('yunxin_channel_uid'); $supplier = SupplierChannelModel::where('supplier_id', $supplierId)->select(['supplier_code', 'yunxin_channel_uid'])
->first()->toArray();
$preYunxinChannelUid = $supplier['yunxin_channel_uid'];
SupplierChannelModel::where('supplier_id', $supplierId)->update([ SupplierChannelModel::where('supplier_id', $supplierId)->update([
'yunxin_channel_uid' => $yunxinChannelUid 'yunxin_channel_uid' => $yunxinChannelUid
]); ]);
//去查找数据对接系统是否有这个供应商,有的话,把采购员也改成这个
DataManageModel::where('canal', $supplier['supplier_code'])->update([
'pur_uid' => $yunxinChannelUid,
'update_time' => time(),
]);
$supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first()->toArray(); $supplier = SupplierChannelModel::where('supplier_id', $supplierId)->first()->toArray();
//还要丢队列给批量修改sku的内部编码 //还要丢队列给批量修改sku的内部编码
$redisKey = 'lie_supplier_change_yunxin_user_' . $supplierId; $redisKey = 'lie_supplier_change_yunxin_user_' . $supplierId;
if (!$redis->get($redisKey)) { if ($redis->get($redisKey)) {
$data = [ $data = [
'canal' => $supplier['supplier_code'], 'canal' => $supplier['supplier_code'],
"encoded" => $yunxinChannelUid, "encoded" => $yunxinChannelUid,
......
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