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
6ebafc02
authored
Feb 09, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
6c0e607b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
83 deletions
app/Http/Services/DataService.php
app/Http/routes.php
app/Http/Services/DataService.php
View file @
6ebafc02
...
...
@@ -499,105 +499,34 @@ class DataService
})
->
save
(
'xlsx'
);
}
function
exportSupplier
()
public
static
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
);
}
//再去匹配发货地址
$supplierIdAddr
=
SupplierAddressModel
::
where
(
'address'
,
'like'
,
"%
{
$keyword
}
%"
)
->
pluck
(
'supplier_id'
)
->
toArray
();
if
(
$supplierIdAddr
)
{
$supplierList
=
SupplierChannelModel
::
whereIn
(
'supplier_id'
,
$supplierIdAddr
)
->
select
([
ini_set
(
'memory_limit'
,
-
1
);
$suppliers
=
SupplierChannelModel
::
select
([
'supplier_name'
,
'phon
e'
,
'supplier_address'
,
'stockup_typ
e'
,
'supplier_group'
])
->
get
()
->
toArray
();
if
(
$supplierList
)
{
$supplierList
=
array_map
(
function
(
$supplier
)
use
(
$keyword
)
{
$supplier
[
'keyword'
]
=
$keyword
;
return
$supplier
;
},
$supplierList
);
$suppliers
=
array_merge
(
$suppliers
,
$supplierList
);
}
}
}
$idColumn
=
array_column
(
$suppliers
,
'supplier_name'
);
$idColumn
=
array_unique
(
$idColumn
);
$suppliers
=
array_intersect_key
(
$suppliers
,
$idColumn
);
Excel
::
create
(
'
实体名单供应商导出
'
,
function
(
$excel
)
use
(
$suppliers
)
{
Excel
::
create
(
'
供应商
'
,
function
(
$excel
)
use
(
$suppliers
)
{
$header
=
[
'供应商名字'
,
'联系方式'
,
'命中地址'
,
'命中关键词'
,
'合作类型'
,
'供应商性质'
,
];
$excelData
=
[];
foreach
(
$suppliers
as
$supplier
)
{
$excelData
[]
=
[
$supplier
[
'supplier_name'
],
$supplier
[
'phone'
],
$supplier
[
'supplier_address'
],
$supplier
[
'keyword'
],
array_get
((
new
SupplierTransformer
())
->
getStockupType
(
$supplier
),
'stockup_type_name'
),
array_get
(
\config
(
'fixed.SupplierGroup'
),
$supplier
[
'supplier_group'
]),
];
}
array_unshift
(
$excelData
,
$header
);
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$excelData
)
{
$sheet
->
fromArray
(
$excelData
);
});
})
->
save
(
'xlsx'
);
})
->
download
(
'xlsx'
);
}
public
static
function
checkSupplierBandAccount
()
...
...
app/Http/routes.php
View file @
6ebafc02
...
...
@@ -97,5 +97,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
DataService
::
initSkuUploadRul
er
();
DataService
::
exportSuppli
er
();
});
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