|
@@ -270,45 +270,53 @@ class Practice extends Backend
|
|
|
|
|
|
public function del($ids = null)
|
|
|
{
|
|
|
- if (false === $this->request->isPost()) {
|
|
|
- $this->error(__("Invalid parameters"));
|
|
|
- }
|
|
|
- $ids = $ids ?: $this->request->post("ids");
|
|
|
- if (empty($ids)) {
|
|
|
- $this->error(__('Parameter %s can not be empty', 'ids'));
|
|
|
- }
|
|
|
- $pk = $this->model->getPk();
|
|
|
- $adminIds = $this->getDataLimitAdminIds();
|
|
|
- if (is_array($adminIds)) {
|
|
|
- $this->model->where($this->dataLimitField, 'in', $adminIds);
|
|
|
- }
|
|
|
- $list = $this->model->where($pk, 'in', $ids)->select();
|
|
|
-
|
|
|
+// if (false === $this->request->isPost()) {
|
|
|
+// $this->error(__("Invalid parameters"));
|
|
|
+// }
|
|
|
+// $ids = $ids ?: $this->request->post("ids");
|
|
|
+// if (empty($ids)) {
|
|
|
+// $this->error(__('Parameter %s can not be empty', 'ids'));
|
|
|
+// }
|
|
|
+// $pk = $this->model->getPk();
|
|
|
+// $adminIds = $this->getDataLimitAdminIds();
|
|
|
+// if (is_array($adminIds)) {
|
|
|
+// $this->model->where($this->dataLimitField, 'in', $adminIds);
|
|
|
+// }
|
|
|
+// $list = $this->model->where($pk, 'in', $ids)->select();
|
|
|
$count = 0;
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
- //删除考试集合 real_exam_collection
|
|
|
- foreach ($list as $item) {
|
|
|
-// if($item['yikao_count']>0){
|
|
|
-// $this->error('已有学员参加训练,无法删除');
|
|
|
-// }
|
|
|
- $count += $item->delete();
|
|
|
- }
|
|
|
- //删除学员考试 mx_real_exam
|
|
|
- $exam_list = $this->exam_model->where('exam_collection_id',$ids)->select();
|
|
|
- if(!empty($exam_list)){
|
|
|
- foreach ($exam_list as $k=>$it)
|
|
|
- {
|
|
|
- //删除学员考试故障表 mx_real_exam_fault
|
|
|
- Db::name('real_exam_fault')->where('exam_id',$it['exam_id'])->delete();
|
|
|
- $it->delete();
|
|
|
+ if(Env::get('app.is_fault')){
|
|
|
+ $url = config('site.url_type').'/sim/real-exam-collection/teacher/ref/'.$ids;
|
|
|
+ $ret = json_decode(send_post($url),true);
|
|
|
+ if($ret['code']!=200){
|
|
|
+ $this->error($ret['msg']);
|
|
|
+ }else{
|
|
|
+ $count = 1;
|
|
|
}
|
|
|
-
|
|
|
+ }else{
|
|
|
+ $count =1;
|
|
|
}
|
|
|
+ //删除考试集合 real_exam_collection
|
|
|
+// foreach ($list as $item) {
|
|
|
+//// if($item['yikao_count']>0){
|
|
|
+//// $this->error('已有学员参加训练,无法删除');
|
|
|
+//// }
|
|
|
+// $count += $item->delete();
|
|
|
+// }
|
|
|
+// //删除学员考试 mx_real_exam
|
|
|
+// $exam_list = $this->exam_model->where('exam_collection_id',$ids)->select();
|
|
|
+// if(!empty($exam_list)){
|
|
|
+// foreach ($exam_list as $k=>$it)
|
|
|
+// {
|
|
|
+// //删除学员考试故障表 mx_real_exam_fault
|
|
|
+// Db::name('real_exam_fault')->where('exam_id',$it['exam_id'])->delete();
|
|
|
+// $it->delete();
|
|
|
+// }
|
|
|
+//
|
|
|
+// }
|
|
|
//删除考试关联区队表 mx_real_exam_collection_dept
|
|
|
// Db::name('real_exam_collection_dept')->where('exam_collection_id',$ids)->delete();
|
|
|
-
|
|
|
-
|
|
|
Db::commit();
|
|
|
} catch (PDOException|Exception $e) {
|
|
|
Db::rollback();
|