Skip to content

Commit 54ed537

Browse files
committed
修正问题
1 parent 351b68c commit 54ed537

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ $client->set('phpems:knows', json_encode(Cache::knows()));
9494

9595
composer create-project --prefer-dist phpems/phpems phpems "5.*"
9696

97+
提示:推荐使用[阿里云 Composer 全量镜像](https://developer.aliyun.com/composer)
98+
9799
#### 方式2:使用 git 创建项目
98100

99101
使用 git 复制项目后使用 composer 安装依赖

app/exam/tpls/phone/exercise.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@
4747
</div>
4848
</div>
4949
<ol id="questionnumbers">
50+
{x2;if:is_array($questype)}
5051
{x2;tree:$questype,quest,qid}
5152
{x2;if:$numbers[v:quest['questid']]}
5253
<li class="form-group">
5354
{x2;v:quest['questype']}(共{x2;$numbers[v:quest['questid']]}题),选 <input id="question_{x2;v:quest['questid']}" size="5" type="text" name="args[number][{x2;v:quest['questid']}]" rel="{x2;$numbers[v:quest['questid']]}" value="0"/> 题
5455
</li>
5556
{x2;endif}
5657
{x2;endtree}
58+
{x2;endif}
5759
</ol>
5860
</li>
5961
<li class="unstyled">

model/ExamHistory.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,10 @@ public function getEhsettingAttribute($value)
6161
{
6262
return unserialize(gzuncompress(base64_decode($value)));
6363
}
64+
65+
// 获取考生答案
66+
public function getEhuseranswerAttribute($value)
67+
{
68+
return unserialize($value);
69+
}
6470
}

tasks/Cache.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,12 @@ public static function questions()
4949
if (!isset($stats[$question['questionid']][$o])) {
5050
$stats[$question['questionid']][$o] = 0;
5151
}
52+
// 多选
5253
if (is_array($p->ehuseranswer[$question['questionid']]) && in_array($o, $p->ehuseranswer[$question['questionid']])) {
5354
$stats[$question['questionid']][$o] = intval($stats[$question['questionid']][$o]) + 1;
54-
} elseif (!is_array($p->ehuseranswer[$question['questionid']]) && false !== strpos($p->ehuseranswer[$question['questionid']], $o)) {
55+
}
56+
// 单选
57+
if (!is_array($p->ehuseranswer[$question['questionid']]) && false !== strpos($p->ehuseranswer[$question['questionid']], $o)) {
5558
$stats[$question['questionid']][$o] = intval($stats[$question['questionid']][$o]) + 1;
5659
}
5760
}
@@ -159,5 +162,7 @@ public static function knows()
159162
$client = new Predis\Client('tcp://127.0.0.1:6379');
160163
$questions = $client->get('phpems:questions');
161164
$questions = json_decode($questions,true);
162-
$this->tpl->assign('questions', $questions);
165+
// $this->tpl->assign('questions', $questions);
166+
dd($questions);
163167
*/
168+

0 commit comments

Comments
 (0)