add company sync command
This commit is contained in:
@@ -37,10 +37,10 @@ class AppCompanySync extends HyperfCommand
|
|||||||
$companies->each(function($el){
|
$companies->each(function($el){
|
||||||
$exist_company = Company::find($el['id']);
|
$exist_company = Company::find($el['id']);
|
||||||
if($exist_company){
|
if($exist_company){
|
||||||
# @attention update 方法不会进行 cast 类型转换,执行时需要注意
|
# @attention update 方法不会进行 cast 类型转换,执行时需要注意, tools 数据中 isEnabled 存在值为 空字符串的情况
|
||||||
$exist_company->update([
|
$exist_company->update([
|
||||||
'name' => $el['name'],
|
'name' => $el['name'],
|
||||||
'enabled' => $el['isEnabled']
|
'enabled' => \boolval($el['isEnabled']) === true ? true : false,
|
||||||
] );
|
] );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -66,5 +66,6 @@ class AppCompanySync extends HyperfCommand
|
|||||||
$this->info("公司数据同步失败,数据更新已撤销");
|
$this->info("公司数据同步失败,数据更新已撤销");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user