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
1fea53c3
authored
May 17, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改导出脚本
parent
4eb893c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
62 deletions
app/Http/Services/DataService.php
app/Http/Services/DataService.php
View file @
1fea53c3
...
@@ -1049,77 +1049,77 @@ class DataService
...
@@ -1049,77 +1049,77 @@ class DataService
public
function
exportSupplierBySourceType
()
public
function
exportSupplierBySourceType
()
{
{
//找出所有大数据的供应商
//
//找出所有大数据的供应商
$bigDataSuppliers
=
DataManageModel
::
where
(
'is_type'
,
0
)
->
get
()
->
toArray
();
$bigDataSuppliers
=
DataManageModel
::
where
(
'is_type'
,
0
)
->
get
()
->
toArray
();
//如果platform_type不等于6,都是API采集
//
//如果platform_type不等于6,都是API采集
//剩下的是普通采集的
//
//剩下的是普通采集的
$apiSourceSupplierCodeList
=
$paSourceSupplierCodeList
=
[];
//
$apiSourceSupplierCodeList = $paSourceSupplierCodeList = [];
foreach
(
$bigDataSuppliers
as
$supplier
)
{
//
foreach ($bigDataSuppliers as $supplier) {
if
(
$supplier
[
'platform_type'
]
!=
6
)
{
//
if ($supplier['platform_type'] != 6) {
$apiSourceSupplierCodeList
[]
=
$supplier
[
'canal'
];
//
$apiSourceSupplierCodeList[] = $supplier['canal'];
}
else
{
//
} else {
$paSourceSupplierCodeList
[]
=
$supplier
[
'canal'
];
//
$paSourceSupplierCodeList[] = $supplier['canal'];
}
//
}
}
//
}
$intraCodeModel
=
new
IntracodeModel
();
$intraCodeModel
=
new
IntracodeModel
();
$users
=
$intraCodeModel
->
getSampleName
(
true
);
$users
=
$intraCodeModel
->
getSampleName
(
true
);
$header
=
[
'供应商编码'
,
'供应商名称'
,
'sku采购员'
,
'采购组别'
];
$header
=
[
'供应商编码'
,
'供应商名称'
,
'sku采购员'
,
'采购组别'
];
//
//导出sku接入方式为专营API
//
//导出sku接入方式为专营API
$excelData
=
[];
//
$excelData = [];
//导出sku接入方式为专营API
//
//导出sku接入方式为专营API
foreach
(
$apiSourceSupplierCodeList
as
$code
)
{
//
foreach ($apiSourceSupplierCodeList as $code) {
$supplier
=
SupplierChannelModel
::
where
(
'supplier_code'
,
$code
)
->
first
();
//
$supplier = SupplierChannelModel::where('supplier_code', $code)->first();
if
(
empty
(
$supplier
))
{
//
if (empty($supplier)) {
continue
;
//
continue;
}
//
}
$skuUserNameRaw
=
array_get
(
$users
,
$supplier
[
'yunxin_channel_uid'
]);
//
$skuUserNameRaw = array_get($users, $supplier['yunxin_channel_uid']);
$supplier
=
$supplier
->
toArray
();
//
$supplier = $supplier->toArray();
$departmentName
=
(
new
DepartmentService
())
->
getDepartmentNameByUserName
(
$skuUserNameRaw
);
//
$departmentName = (new DepartmentService())->getDepartmentNameByUserName($skuUserNameRaw);
$excelData
[]
=
[
//
$excelData[] = [
$supplier
[
'supplier_code'
],
//
$supplier['supplier_code'],
$supplier
[
'supplier_name'
],
//
$supplier['supplier_name'],
$skuUserNameRaw
,
//
$skuUserNameRaw,
$departmentName
,
//
$departmentName,
];
//
];
}
//
}
array_unshift
(
$excelData
,
$header
);
//
array_unshift($excelData, $header);
Excel
::
create
(
'sku接入方式为专营API'
,
function
(
$excel
)
use
(
$excelData
)
{
//
Excel::create('sku接入方式为专营API', function ($excel) use ($excelData) {
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$excelData
)
{
//
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet
->
fromArray
(
$excelData
);
//
$sheet->fromArray($excelData);
});
//
});
})
->
store
(
'csv'
);
//
})->store('csv');
//
//专营采集的供应商
//
//专营采集的供应商
$excelData
=
[];
//
$excelData = [];
foreach
(
$paSourceSupplierCodeList
as
$code
)
{
//
foreach ($paSourceSupplierCodeList as $code) {
$supplier
=
SupplierChannelModel
::
where
(
'supplier_code'
,
$code
)
->
first
();
//
$supplier = SupplierChannelModel::where('supplier_code', $code)->first();
if
(
empty
(
$supplier
))
{
//
if (empty($supplier)) {
continue
;
//
continue;
}
//
}
$skuUserNameRaw
=
array_get
(
$users
,
$supplier
[
'yunxin_channel_uid'
]);
//
$skuUserNameRaw = array_get($users, $supplier['yunxin_channel_uid']);
$supplier
=
$supplier
->
toArray
();
//
$supplier = $supplier->toArray();
$departmentName
=
(
new
DepartmentService
())
->
getDepartmentNameByUserName
(
$skuUserNameRaw
);
//
$departmentName = (new DepartmentService())->getDepartmentNameByUserName($skuUserNameRaw);
$excelData
[]
=
[
//
$excelData[] = [
$supplier
[
'supplier_code'
],
//
$supplier['supplier_code'],
$supplier
[
'supplier_name'
],
//
$supplier['supplier_name'],
$skuUserNameRaw
,
//
$skuUserNameRaw,
$departmentName
,
//
$departmentName,
];
//
];
}
//
}
array_unshift
(
$excelData
,
$header
);
//
array_unshift($excelData, $header);
Excel
::
create
(
'专营采集的供应商'
,
function
(
$excel
)
use
(
$excelData
)
{
//
Excel::create('专营采集的供应商', function ($excel) use ($excelData) {
$excel
->
sheet
(
'sheet1'
,
function
(
$sheet
)
use
(
$excelData
)
{
//
$excel->sheet('sheet1', function ($sheet) use ($excelData) {
$sheet
->
fromArray
(
$excelData
);
//
$sheet->fromArray($excelData);
});
//
});
})
->
store
(
'csv'
);
//
})->store('csv');
//供应商性质为“分销平台”的有上传过sku的供应商
//供应商性质为“分销平台”的有上传过sku的供应商
$excelData
=
[];
$excelData
=
[];
$uploadedSkuSuppliers
=
SupplierChannelModel
::
where
(
'supplier_group'
,
5
)
$uploadedSkuSuppliers
=
SupplierChannelModel
::
where
(
'supplier_group'
,
5
)
->
where
(
'is_type'
,
0
)
->
where
(
'uploaded_sku'
,
1
)
->
get
()
->
toArray
();
->
where
(
'is_type'
,
0
)
->
where
(
'uploaded_sku'
,
1
)
->
get
()
->
toArray
();
foreach
(
$uploadedSkuSuppliers
as
$
code
)
{
foreach
(
$uploadedSkuSuppliers
as
$
supplier
)
{
$supplier
=
SupplierChannelModel
::
where
(
'supplier_code'
,
$
code
)
->
first
();
$supplier
=
SupplierChannelModel
::
where
(
'supplier_code'
,
$
supplier
[
'supplier_code'
]
)
->
first
();
if
(
empty
(
$supplier
))
{
if
(
empty
(
$supplier
))
{
continue
;
continue
;
}
}
...
...
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