作者 何书鹏
1 个管道 的构建 失败 耗费 0 秒

全能题库

... ... @@ -91,12 +91,14 @@ class Almighty extends Backend
}
if($params['type'] != '4'){
$num = (int)$params['type'] - 1;
empty($params['answer'.$num]) && $this->error('请选择正确答案');
$answer = isset($params['answer'.$num]) ? $params['answer'.$num] : '';
$answer = is_array($answer) ? implode(',', $answer) : $answer;
empty($answer) && $this->error('请选择正确答案');
foreach(json_decode($params['selectdata'.$num],true) as $k => $v){
empty($v['key']) && $this->error('请填写选项'.($k+1));
empty($v['value']) && $this->error('请填写选项'.($k+1).'内容');
}
$params['answer'] = $params['answer'.$num];
$params['answer'] = $answer;
$params['option'] = $params['selectdata'.$num];
}
$result = false;
... ... @@ -152,12 +154,14 @@ class Almighty extends Backend
$params = $this->preExcludeFields($params);
if($params['type'] != '4'){
$num = (int)$params['type'] - 1;
empty($params['answer'.$num]) && $this->error('请选择正确答案');
$answer = isset($params['answer'.$num]) ? $params['answer'.$num] : '';
$answer = is_array($answer) ? implode(',', $answer) : $answer;
empty($answer) && $this->error('请选择正确答案');
foreach(json_decode($params['selectdata'.$num],true) as $k => $v){
empty($v['key']) && $this->error('请填写选项'.($k+1));
empty($v['value']) && $this->error('请填写选项'.($k+1).'内容');
}
$params['answer'] = $params['answer'.$num];
$params['answer'] = $answer;
$params['option'] = $params['selectdata'.$num];
}
$result = false;
... ... @@ -192,7 +196,7 @@ class Almighty extends Backend
if($row['type'] != '4'){
$option_arr = json_decode($row['option'],true);
foreach ($option_arr as &$v) {
if($row['answer'] == $v['key']){
if(in_array($v['key'],explode(',', $row['answer']))){
$v['checked'] = 'checked';
}
}
... ...
... ... @@ -76,6 +76,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
edit: function () {
Controller.api.bindevent();
setTimeout(function () {
$("#c-type").trigger("change");
}, 100);
},
api: {
bindevent: function () {
... ...