|
@@ -164,10 +164,7 @@ class ImportService extends Service
|
|
$config_array = config($config) ?? [];
|
|
$config_array = config($config) ?? [];
|
|
if(empty($config_array)) return [false, '配置文件不存在', ''];
|
|
if(empty($config_array)) return [false, '配置文件不存在', ''];
|
|
|
|
|
|
- $depart_id = $this->getDepart($user);
|
|
|
|
- $top_depart_id = $user['depart_map'][$depart_id] ?? 0;
|
|
|
|
- $result = BasicType::whereRaw('type = 22 And del_time = 0 And top_depart_id = ' . $top_depart_id)->get()->toArray();
|
|
|
|
-
|
|
|
|
|
|
+ $result = (new BasicTypeService())->getMyBasicList($user, 22);
|
|
if(! empty($result)){
|
|
if(! empty($result)){
|
|
foreach ($result as $value){
|
|
foreach ($result as $value){
|
|
$config_array[] = [
|
|
$config_array[] = [
|
|
@@ -251,12 +248,7 @@ class ImportService extends Service
|
|
->pluck('id','title')
|
|
->pluck('id','title')
|
|
->toArray();
|
|
->toArray();
|
|
|
|
|
|
- $model = BasicType::TopClear($user,[]);
|
|
|
|
- $basic = $model->where('del_time',0)
|
|
|
|
- ->whereIn('type',[1,2,3,4,5,9,10,30])
|
|
|
|
- ->select('id','title','type')
|
|
|
|
- ->get()
|
|
|
|
- ->toArray();
|
|
|
|
|
|
+ $basic = (new BasicTypeService())->getMyBasicList($user, [1,2,3,4,5,9,10,30]);
|
|
$basic_list = [];
|
|
$basic_list = [];
|
|
foreach ($basic as $value){
|
|
foreach ($basic as $value){
|
|
if($value['type'] == 1){
|
|
if($value['type'] == 1){
|
|
@@ -477,11 +469,8 @@ class ImportService extends Service
|
|
->where('top_depart_id',$top_depart_id)
|
|
->where('top_depart_id',$top_depart_id)
|
|
->get()->toArray();
|
|
->get()->toArray();
|
|
|
|
|
|
- $model = BasicType::TopClear($user,[]);
|
|
|
|
- $basic = $model->where('del_time',0)
|
|
|
|
- ->where('type',20)
|
|
|
|
- ->pluck('id','title')
|
|
|
|
- ->toArray();
|
|
|
|
|
|
+ $basic = (new BasicTypeService())->getMyBasicList($user, 20);
|
|
|
|
+ $basic = array_column($basic,'id','title');
|
|
|
|
|
|
$category = ProductCategory::whereIn('title',array_unique(array_column($array,'2')))
|
|
$category = ProductCategory::whereIn('title',array_unique(array_column($array,'2')))
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
@@ -596,12 +585,7 @@ class ImportService extends Service
|
|
unset($array[0]);
|
|
unset($array[0]);
|
|
if(empty($array)) return [false, '导入数据不能为空'];
|
|
if(empty($array)) return [false, '导入数据不能为空'];
|
|
|
|
|
|
- $model = BasicType::TopClear($user,[]);
|
|
|
|
- $basic = $model->where('del_time',0)
|
|
|
|
- ->whereIn('type',[18,23,24,29])
|
|
|
|
- ->select('id','title','type')
|
|
|
|
- ->get()
|
|
|
|
- ->toArray();
|
|
|
|
|
|
+ $basic = (new BasicTypeService())->getMyBasicList($user, [18,23,24,29]);
|
|
$basic_list = [];
|
|
$basic_list = [];
|
|
foreach ($basic as $value){
|
|
foreach ($basic as $value){
|
|
if($value['type'] == 18){
|
|
if($value['type'] == 18){
|