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
6f934c51
authored
Jun 13, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
导出供应商
parent
c96286cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
1 deletions
app/Http/Services/DataService.php
app/Http/routes.php
app/Http/Services/DataService.php
View file @
6f934c51
...
@@ -491,4 +491,87 @@ class DataService
...
@@ -491,4 +491,87 @@ class DataService
}
}
function
exportSupplier
()
{
$keywords
=
[
'One Capital Place'
,
'18 Luard Rd'
,
'18 Luard Road'
,
'海德中心'
,
'卢押道'
,
'盧押道'
,
'Bright Way Tower'
,
'33 Mong Kok Road'
,
'33 Mong Kok Rd'
,
'凯途发展大厦'
,
'旺角道33号'
,
'凱途發展大廈'
,
'Lockhart Rd'
,
'Lockhart Road'
,
'Lockhart Centre'
,
'骆克道'
,
'駱克道'
,
'Room 803'
,
'Chevalier House'
,
'Chatham Road South'
,
'漆咸道南45'
,
'漆咸道南45'
,
'2-16 Fa Yuen Street'
,
'King Commercial Centre'
,
'花园街'
,
'花園街'
,
'Fayuen'
,
'Fa Yuen Street'
,
'Ho King Commercial'
,
'好景商业中心'
,
'好景商業中心'
,
'610 Nathan Rd'
,
'Hollywood Plaza'
,
'弥敦道610号'
,
'彌敦道610號'
,
'610 Nathan Road'
,
'荷李活商业中心'
,
'荷李活商業中心'
,
];
$suppliers
=
[];
foreach
(
$keywords
as
$keyword
)
{
$supplierList
=
SupplierChannelModel
::
where
(
'supplier_address'
,
'like'
,
"%
{
$keyword
}
%"
)
->
select
([
'supplier_name'
,
'phone'
,
'supplier_address'
,
])
->
get
()
->
toArray
();
if
(
$supplierList
)
{
$supplierList
=
array_map
(
function
(
$supplier
)
use
(
$keyword
)
{
$supplier
[
'keyword'
]
=
$keyword
;
return
$supplier
;
},
$supplierList
);
$suppliers
=
array_merge
(
$suppliers
,
$supplierList
);
}
}
Excel
::
create
(
'供应商导出'
,
function
(
$excel
)
use
(
$suppliers
)
{
$header
=
[
'供应商名字'
,
'联系方式'
,
'命中地址'
,
'命中关键词'
,
];
$excelData
=
[];
foreach
(
$suppliers
as
$supplier
)
{
$excelData
[]
=
[
$supplier
[
'supplier_name'
],
$supplier
[
'phone'
],
$supplier
[
'supplier_address'
],
$supplier
[
'keyword'
],
];
}
array_unshift
(
$excelData
,
$header
);
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$excelData
)
{
$sheet
->
fromArray
(
$excelData
);
});
})
->
export
(
'xlsx'
);
}
}
}
app/Http/routes.php
View file @
6f934c51
...
@@ -82,5 +82,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
...
@@ -82,5 +82,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
(
new
\App\Http\Services\
SyncSupplierService
())
->
syncSupplierToErp
(
12469
);
(
new
\App\Http\Services\
DataService
())
->
exportSupplier
(
);
});
});
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