getList(); $Transaction = Yii::$app->db->beginTransaction(); if (!empty($wordinfo)) { $query = Sensitivewords::findOne($wordinfo['id']); $query->content = $content; $query->info = $info; $query->update_at = time(); $s = $query->save(); if ($s != true) return '目标站敏感四更新失败'; $cordInfo = new Syncwordrecord(); $cordInfo->mode = 'edit'; $cordInfo->operator = $operator; $cordInfo->oos_content = $content; $cordInfo->oos_info = $info; $cordInfo->this_content = $wordinfo['content']; $cordInfo->this_info = $wordinfo['info']; $cordInfo->create_at = time(); $cordInfo->update_at = time(); $s = $cordInfo->save(); if ($s != true) { $Transaction->rollBack(); return '目标站更新纪录失败'; } $Transaction->commit(); } else { $query = $model; $query->content = $content; $query->info = $info; $query->create_at = time(); $s = $query->save(); if ($s != true) return '目标站敏感四添加失败'; $cordInfo = new Syncwordrecord(); $cordInfo->mode = 'add'; $cordInfo->operator = $operator; $cordInfo->oos_content = $content; $cordInfo->oos_info = $info; $cordInfo->create_at = time(); $cordInfo->update_at = time(); $s = $cordInfo->save(); if ($s != true) { $Transaction->rollBack(); return '目标站添加纪录失败'; } $Transaction->commit(); } return true; } }