Commit 3294f141 by 杨树贤

修复广播接收

parent 2600ef53
......@@ -112,12 +112,10 @@ class SupplierApiController extends Controller
$validator = new SupplierValidator();
$data = $request->all();
//直接提交的不需要做复杂的表单校验
$isAudit = false;
if (request()->get('direct_apply')) {
$isAudit = true;
$validateResult = $validator->checkSave($data, $isAudit);
$validateResult = $validator->checkSave($data, true);
} else {
$validateResult = $validator->checkSave($data, $isAudit);
$validateResult = $validator->checkSave($data, false);
}
if ($validateResult) {
$this->response(-1, $validateResult);
......
......@@ -98,12 +98,11 @@ class CompanyService
'address_data' => [],
];
$url = config('website.UnitedDataDomain') . '/sync/Company/checkCompanyEntity';
$result = curl($url, $params);
$result = curlJson($url, $params);
$result = json_decode($result, true);
if (array_get($result, 'code') === 0) {
return $result['data']['result'];
}
\Log::error(json_encode($result));
return '一体化校验实体名单失败,请联系管理员';
}
......@@ -115,6 +114,7 @@ class CompanyService
->select([
'supplier_id',
'supplier_name',
'supplier_code',
'supplier_name_en',
'supplier_address',
'create_uid',
......@@ -153,7 +153,7 @@ class CompanyService
$params = [
'company_name_cn' => $supplier['supplier_name'],
'company_name_en' => $supplier['supplier_name'],
'register_address' => $supplier['supplier_name'],
'register_address' => $supplier['supplier_address'],
'business_license' => $businessLicense,
'company_id' => 1,
'create_uid' => $supplier['create_uid'],
......@@ -161,9 +161,10 @@ class CompanyService
'source_system_id' => 1,
'address_data' => $addressData,
];
//dump(json_encode($params));
$url = config('website.UnitedDataDomain') . '/sync/Company/checkCompanyEntity';
$result = curl($url, $params);
$result = curlJson($url, $params);
//dd($result);
$result = json_decode($result, true);
if (array_get($result, 'code') === 0) {
return $result['data']['result'];
......
......@@ -220,6 +220,11 @@ class SupplierService
$supplierAddressService = new SupplierAddressService();
$supplierAddressService->saveShippingAddress($supplierId, $shippingAddress);
//一体化新流程,如果是新建,新建完了以后还要去请求一次验证实体名单的接口,因为只有新建完才有具体的地址source_id这些东西
if (empty($channel['supplier_id'])) {
(new CompanyService())->checkSupplierCompanyAndAddress($supplierId);
}
} else {
/**这里的是更新供应商的操作**/
$supplierId = $this->newSupplierId = $channel['supplier_id'];
......@@ -376,11 +381,6 @@ class SupplierService
$redis->hset('supplier_status_before_disable', $supplierId, $newSupplier['status']);
}
//一体化新流程,如果是新建,新建完了以后还要去请求一次验证实体名单的接口,因为只有新建完才有具体的地址source_id这些东西
if (empty($channel['supplier_id'])) {
(new CompanyService())->checkSupplierCompanyAndAddress($supplierId);
}
//这里有个申请审核的判断逻辑
//如果是申请审核,并且原来的状态不是已通过,无论什么情况,都要变成审核中,如果是已通过,那么就要走下面的判断是否要忽略审核流程
if ($isAudit && $oldSupplier['status'] == SupplierChannelModel::STATUS_PASSED && !$needAudit && !empty($channel['supplier_id'])) {
......
......@@ -268,11 +268,11 @@ class SyncSupplierService
}
if ($result == 0) {
$isEntityResult = SupplierChannelModel::IS_ENTITY_NEED_CONFIRM;
$logContent = $reason = "待确认实体名单,系统自动拉入禁止交易,请联系“风控部门”进行确认. 风险类型 : {$resultData['warning_type']} 风险词 : $warningKeyword 风险数据 : $warningData";
$logContent = $reason = "待确认实体名单,系统自动拉入禁止交易,请联系“风控部门”进行确认. 风险类型 : $warningType 风险词 : $warningKeyword 风险数据 : $warningData";
}
if ($result == -3) {
$isEntityResult = SupplierChannelModel::IS_ENTITY_REJECT;
$logContent = $reason = "被驳回供应商,系统自动拉入禁止交易,请联系“风控部门”进行确认. 风险类型 : {$resultData['warning_type']} 风险词 : $warningKeyword 风险数据 : $warningData";
$logContent = $reason = "被驳回供应商,系统自动拉入禁止交易,请联系“风控部门”进行确认. 风险类型 : $warningType 风险词 : $warningKeyword 风险数据 : $warningData";
}
}
......
......@@ -57,6 +57,23 @@ function curl($url, $params = false, $isPost = 0, $https = 0, $cookie = '', $tim
return $response;
}
function curlJson($url, $data)
{
$ch = curl_init($url);
$data_string = json_encode($data);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
//检查权限,仅支持验证单个权限
function perm($userId, $perm1 = '')
{
......
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