update
This commit is contained in:
parent
0f6ebdb702
commit
1b89cef9a9
@ -104,6 +104,7 @@ class SupervisionAcceptLogic extends BaseLogic
|
||||
*/
|
||||
public static function edit(array $params,$admin_id): bool
|
||||
{
|
||||
$data = SupervisionAccept::field('check_item_detail_ids')->where('id',$params['id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
SupervisionAccept::where('id', $params['id'])->update([
|
||||
@ -120,6 +121,10 @@ class SupervisionAcceptLogic extends BaseLogic
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
if(json_encode($data['check_item_detail_ids']) != json_encode($params['check_item_detail_ids'])){
|
||||
$accept_check_result_result_ids = SupervisionAcceptResult::where('accept_id',$params['id'])->column('id');
|
||||
SupervisionAcceptResult::destroy($accept_check_result_result_ids);
|
||||
}
|
||||
if(!empty($params['accept_check_result'])){
|
||||
foreach($params['accept_check_result'] as $v){
|
||||
if(!empty($v['id'])){
|
||||
|
@ -106,6 +106,7 @@ class SupervisionSideStationLogic extends BaseLogic
|
||||
*/
|
||||
public static function edit(array $params,$admin_id): bool
|
||||
{
|
||||
$data = SupervisionSideStation::field('check_item_detail_ids')->where('id',$params['id'])->findOrEmpty();
|
||||
Db::startTrans();
|
||||
try {
|
||||
SupervisionSideStation::where('id', $params['id'])->update([
|
||||
@ -125,6 +126,10 @@ class SupervisionSideStationLogic extends BaseLogic
|
||||
'annex' => $params['annex'] ? json_encode($params['annex']) : null,
|
||||
'update_time' => time(),
|
||||
]);
|
||||
if(json_encode($data['check_item_detail_ids']) != json_encode($params['check_item_detail_ids'])){
|
||||
$side_result_ids = SupervisionSideStationResult::where('side_station_id',$params['id'])->column('id');
|
||||
SupervisionSideStationResult::destroy($side_result_ids);
|
||||
}
|
||||
if(!empty($params['side_result'])){
|
||||
foreach($params['side_result'] as $v){
|
||||
if(!empty($v['id'])){
|
||||
|
Loading…
x
Reference in New Issue
Block a user