fixed
This commit is contained in:
@@ -121,23 +121,32 @@ class Firm extends Backend
|
|||||||
public function importBasic($ids = null)
|
public function importBasic($ids = null)
|
||||||
{
|
{
|
||||||
$firmstoreData = Db::table('fa_firmstore')->where('firm_id',$ids)->select();
|
$firmstoreData = Db::table('fa_firmstore')->where('firm_id',$ids)->select();
|
||||||
if (count($firmstoreData) == 0){
|
if (empty($firmstoreData)){
|
||||||
return json(['code'=>201,'msg'=>'请先添加门店']);
|
return json(['code'=>201,'msg'=>'请先添加门店']);
|
||||||
}
|
}
|
||||||
//大类
|
//大类
|
||||||
$firmbigcategoryData = Db::table('fa_firmbigcategory')->where('firm_id',1)->select();
|
$firmbigcategoryData = Db::table('fa_firmbigcategory')->where('firm_id',1)->select();
|
||||||
|
if (empty($firmbigcategoryData)){
|
||||||
|
return json(['code'=>201,'msg'=>'请先添加大类模版']);
|
||||||
|
}
|
||||||
foreach ($firmbigcategoryData as $key=>&$val){
|
foreach ($firmbigcategoryData as $key=>&$val){
|
||||||
unset($val['id']);
|
unset($val['id']);
|
||||||
$val['firm_id'] = $ids;
|
$val['firm_id'] = $ids;
|
||||||
}
|
}
|
||||||
//客户来源
|
//客户来源
|
||||||
$firmcustomeroriginData = Db::table('fa_firmcustomerorigin')->where('firm_id',1)->select();
|
$firmcustomeroriginData = Db::table('fa_firmcustomerorigin')->where('firm_id',1)->select();
|
||||||
|
if (empty($firmcustomeroriginData)){
|
||||||
|
return json(['code'=>201,'msg'=>'请先添加客户来源模版']);
|
||||||
|
}
|
||||||
foreach ($firmcustomeroriginData as $key=>&$val){
|
foreach ($firmcustomeroriginData as $key=>&$val){
|
||||||
unset($val['id']);
|
unset($val['id']);
|
||||||
$val['firm_id'] = $ids;
|
$val['firm_id'] = $ids;
|
||||||
}
|
}
|
||||||
//职务
|
//职务
|
||||||
$firmdutyData = Db::table('fa_firmduty')->where('firm_id',1)->where('firmstore_id',1)->select();
|
$firmdutyData = Db::table('fa_firmduty')->where('firm_id',1)->where('firmstore_id',1)->select();
|
||||||
|
if (empty($firmdutyData)){
|
||||||
|
return json(['code'=>201,'msg'=>'请先添加职务模版']);
|
||||||
|
}
|
||||||
$firmdutyMore = [];
|
$firmdutyMore = [];
|
||||||
foreach ($firmdutyData as $key=>&$val){
|
foreach ($firmdutyData as $key=>&$val){
|
||||||
$data = [];
|
$data = [];
|
||||||
@@ -150,6 +159,9 @@ class Firm extends Backend
|
|||||||
}
|
}
|
||||||
//标签
|
//标签
|
||||||
$firmtagsData = Db::table('fa_firmtags')->where('firm_id',1)->select();
|
$firmtagsData = Db::table('fa_firmtags')->where('firm_id',1)->select();
|
||||||
|
if (empty($firmtagsData)){
|
||||||
|
return json(['code'=>201,'msg'=>'请先添加职务模版']);
|
||||||
|
}
|
||||||
foreach ($firmtagsData as $key=>&$val){
|
foreach ($firmtagsData as $key=>&$val){
|
||||||
unset($val['id']);
|
unset($val['id']);
|
||||||
$val['firm_id'] = $ids;
|
$val['firm_id'] = $ids;
|
||||||
|
|||||||
Reference in New Issue
Block a user