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
934ad8ed
authored
Mar 21, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
测试导出
parent
54ef12e0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
6 deletions
app/Http/Services/DataService.php
app/Http/routes.php
app/Http/Services/DataService.php
View file @
934ad8ed
...
...
@@ -18,6 +18,7 @@ use App\Model\StandardBrandModel;
use
App\Model\SupplierAccountModel
;
use
App\Model\SupplierAttachmentsModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierContactModel
;
use
App\Model\UserInfoModel
;
use
Carbon\Carbon
;
use
GuzzleHttp\Client
;
...
...
@@ -442,7 +443,8 @@ class DataService
}
function
syncDaigouSuppliersToErp
(){
function
syncDaigouSuppliersToErp
()
{
$supplierIdList
=
SupplierChannelModel
::
whereIn
(
'supplier_name'
,
config
(
'field.SkipChangeSupplierTypeNames'
))
->
pluck
(
'supplier_id'
)
->
toArray
();
foreach
(
$supplierIdList
as
$supplierId
)
{
...
...
@@ -450,4 +452,43 @@ class DataService
}
}
function
exportContact
()
{
$contacts
=
SupplierContactModel
::
where
(
'can_check_uids'
,
'10096'
)
->
get
()
->
toArray
();
Excel
::
create
(
'供应商导出'
,
function
(
$excel
)
use
(
$contacts
)
{
$header
=
[
'供应商编码'
,
'供应商名字'
,
'联系人'
,
'联系邮箱'
,
'联系手机'
,
'座机'
,
'职位'
,
'采购员'
,
];
$excelData
=
[];
foreach
(
$contacts
as
$contact
)
{
$supplierId
=
$contact
[
'supplier_id'
];
$supplier
=
SupplierChannelModel
::
select
([
'supplier_id'
,
'supplier_code'
,
'supplier_name'
])
->
where
(
'supplier_id'
,
$supplierId
)
->
first
()
->
toArray
();
$excelData
[]
=
[
$supplier
[
'supplier_code'
],
$supplier
[
'supplier_name'
],
$contact
[
'supplier_consignee'
],
$contact
[
'supplier_email'
],
$contact
[
'supplier_mobile'
],
$contact
[
'supplier_telephone'
],
$contact
[
'supplier_position'
],
"陈欢"
,
];
}
array_unshift
(
$excelData
,
$header
);
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$excelData
)
{
$sheet
->
fromArray
(
$excelData
);
});
})
->
export
(
'xlsx'
);
}
}
app/Http/routes.php
View file @
934ad8ed
...
...
@@ -82,9 +82,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
//(new \App\Http\Services\StatisticsSkuUploadService())->statisticBrandSkuNum();
//(new \App\Http\Services\DataService())->exportSupplierDataForLevel();
\App\Model\SupplierChannelModel
::
where
(
'supplier_code'
,
'L0016240'
)
->
update
([
'supplier_name'
=>
'RUID (HONG KONG) ELECTRONICS CO., LIMITED'
]);
(
new
\App\Http\Services\DataService
())
->
exportContact
();
});
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