Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8059ad50
authored
Jul 01, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
导出数据
parent
7efbfafc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
10 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/DataService.php
app/Http/routes.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
8059ad50
...
...
@@ -453,16 +453,19 @@ class SupplierApiController extends Controller
$this
->
response
(
0
,
'属于代购供应商,直接发送同步'
);
}
//去调取天眼查数据,有数据的话,更新
$regionType
=
$supplier
[
'region'
]
==
2
?
1
:
2
;
$companyInfo
=
(
new
CompanyService
())
->
getCompanyInfo
(
$supplier
[
'supplier_name'
],
''
,
$regionType
);
$companyInfo
=
(
new
CompanyService
())
->
getCompanyInfo
(
$supplier
[
'supplier_name'
],
''
);
//先判断是否是标准添加,如果标准添加,国内地区,但是没有税号的,不允许同步
if
(
$supplier
[
'is_standard_add'
]
==
1
&&
$supplier
[
'region'
]
==
2
&&
!
$supplier
[
'tax_number'
])
{
$this
->
response
(
-
1
,
'该供应商属于国内,但是没有税号,不允许同步'
);
if
(
$supplier
[
'is_standard_add'
]
==
1
&&
$supplier
[
'region'
]
==
2
&&
!
$supplier
[
'tax_number'
]
&&
$companyInfo
)
{
$taxNumber
=
$companyInfo
[
'tax_number'
];
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'tax_number'
=>
$taxNumber
,
]);
// $this->response(-1, '该供应商属于国内,但是没有税号,不允许同步');
}
if
(
$supplier
[
'is_standard_add'
]
==
1
&&
$supplier
[
'region'
]
!=
2
)
{
if
(
empty
(
$companyInfo
))
{
$this
->
response
(
-
1
,
'该供应商属于海外,但是无法查询公司信息,不允许同步'
);
}
//
if (empty($companyInfo)) {
//
$this->response(-1, '该供应商属于海外,但是无法查询公司信息,不允许同步');
//
}
}
$service
=
new
SyncSupplierService
();
$service
->
syncSupplierToUnited
(
$supplierId
);
...
...
app/Http/Services/DataService.php
View file @
8059ad50
...
...
@@ -472,7 +472,8 @@ class DataService
'supplier_name'
,
'channel_uid'
,
'create_time'
,
])
->
where
(
'is_type'
,
0
)
])
->
where
(
'is_type'
,
0
)
->
where
(
'create_time'
,
'>'
,
1655778780
)
->
where
(
'update_time'
,
'>'
,
1655778780
)
->
where
(
'group_code'
,
'!='
,
''
)
->
whereRaw
(
'supplier_name NOT LIKE "%-1"'
)
->
get
();
$excelData
=
[];
$header
=
[
...
...
@@ -522,7 +523,8 @@ class DataService
public
function
exportSupplierJsonForUnited
()
{
$suppliers
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
pluck
(
'supplier_group'
,
'supplier_id'
)
->
toArray
();
->
pluck
(
'supplier_group'
,
'supplier_id'
)
->
where
(
'create_time'
,
'>'
,
1655778780
)
->
where
(
'update_time'
,
'>'
,
1655778780
)
->
where
(
'group_code'
,
'!='
,
''
)
->
toArray
();
$exportJson
=
[];
$items
=
array_map
(
function
(
$value
)
{
$value
=
array_get
(
config
(
'fixed.SupplierGroup'
),
$value
);
...
...
app/Http/routes.php
View file @
8059ad50
...
...
@@ -60,5 +60,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
checkCompanyName
();
(
new
\App\Http\Services\DataService
())
->
exportSupplierForUnionData
();
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment