Commit 72e968fa by 杨树贤

修改生成芯链账号的逻辑

parent 7c037059
Showing with 10 additions and 5 deletions
...@@ -86,8 +86,13 @@ class SupplierAccountService ...@@ -86,8 +86,13 @@ class SupplierAccountService
if (strpos($supplier->stockup_type, (string)SupplierChannelModel::SUPPLIER_STOCKUP_TYPE_XINLIAN) === false) { if (strpos($supplier->stockup_type, (string)SupplierChannelModel::SUPPLIER_STOCKUP_TYPE_XINLIAN) === false) {
return; return;
} }
$supplierContact = SupplierContactModel::where('supplier_id', $supplierId)->first()->toArray(); //只有供应商更新的时候才有联系人信息,所以这里要判断
//新建账号 //还没有集团编码的时候,代表这个是新建,需要这个联系信息
$supplierContact = [];
if (empty($supplier->group_code)) {
$supplierContact = SupplierContactModel::where('supplier_id', $supplierId)->first()->toArray();
}
SupplierAccountModel::insert([ SupplierAccountModel::insert([
'supplier_id' => $supplierId, 'supplier_id' => $supplierId,
'supplier_code' => $supplier->supplier_code, 'supplier_code' => $supplier->supplier_code,
...@@ -96,9 +101,9 @@ class SupplierAccountService ...@@ -96,9 +101,9 @@ class SupplierAccountService
'password_raw' => '123456', 'password_raw' => '123456',
'password' => Hash::make('123456'), 'password' => Hash::make('123456'),
'create_time' => time(), 'create_time' => time(),
'mobile' => array_get($supplierContact, 'supplier_mobile',''), 'mobile' => array_get($supplierContact, 'supplier_mobile', ''),
'email' => array_get($supplierContact, 'supplier_email',''), 'email' => array_get($supplierContact, 'supplier_email', ''),
'contacts_name' => array_get($supplierContact, 'supplier_consignee',''), 'contacts_name' => array_get($supplierContact, 'supplier_consignee', ''),
]); ]);
return true; return true;
} }
......
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