Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
oiuv committed Sep 21, 2020
1 parent a827e8a commit 32427d9
Show file tree
Hide file tree
Showing 45 changed files with 390 additions and 396 deletions.
2 changes: 1 addition & 1 deletion app/bank/controller/coupon.master.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private function batadd()
if ($value > 9999) {
$value = 9999;
}
for ($i = 0; $i < $number; ++$i) {
for ($i = 0; $i < $number; $i++) {
$this->coupon->randCoupon($value);
}
$message = [
Expand Down
27 changes: 13 additions & 14 deletions app/certificate/controller/certificate.phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function display()
{
$action = $this->ev->url(3);
if (!method_exists($this, $action)) {
$action = "index";
$action = 'index';
}
$this->$action();
exit;
Expand All @@ -31,31 +31,31 @@ private function apply()
if ($user['usercoin'] < $ce['ceprice']) {
$message = [
'statusCode' => 300,
"message" => "余额不足,请到个人中心充值"
'message' => '余额不足,请到个人中心充值',
];
exit(json_encode($message));
}
$cq = $this->ce->getCeQueueByArgs([
["AND", "cequserid = :cequserid", "cequserid", $this->_user['sessionuserid']],
["AND", "ceqceid = :ceqceid", "ceqceid", $ceid],
["AND", "ceqstatus < 3"],
["AND", "ceqtime >= :ceqtime", "ceqtime", TIME - $ce['cedays'] * 24 * 3600]
['AND', 'cequserid = :cequserid', 'cequserid', $this->_user['sessionuserid']],
['AND', 'ceqceid = :ceqceid', 'ceqceid', $ceid],
['AND', 'ceqstatus < 3'],
['AND', 'ceqtime >= :ceqtime', 'ceqtime', TIME - $ce['cedays'] * 24 * 3600],
]);
if ($cq['ceqid']) {
$message = [
'statusCode' => 300,
"message" => "您已经申请过本证书了"
'message' => '您已经申请过本证书了',
];
exit(json_encode($message));
}
$ce['cebasic'] = explode(',', $ce['cebasic']);
foreach ($ce['cebasic'] as $basicid) {
if ($basicid) {
$eh = $this->G->make('favor', 'exam')->getExamHistoryByArgs([["AND", "ehuserid = :ehuserid", "ehuserid", $this->_user['sessionuserid']], ["AND", "ehispass = 1"], ["AND", "ehtype = 2"], ["AND", "ehbasicid = :ehbasicid", "ehbasicid", $basicid]]);
$eh = $this->G->make('favor', 'exam')->getExamHistoryByArgs([['AND', 'ehuserid = :ehuserid', 'ehuserid', $this->_user['sessionuserid']], ['AND', 'ehispass = 1'], ['AND', 'ehtype = 2'], ['AND', 'ehbasicid = :ehbasicid', 'ehbasicid', $basicid]]);
if (!$eh['ehid']) {
$message = [
'statusCode' => 300,
"message" => "您需要通过考试后才能申请"
'message' => '您需要通过考试后才能申请',
];
exit(json_encode($message));
}
Expand All @@ -65,7 +65,7 @@ private function apply()
if (!$info['useraddress'] || !$info['userphone']) {
$message = [
'statusCode' => 300,
"message" => "请填写地址和联系电话"
'message' => '请填写地址和联系电话',
];
exit(json_encode($message));
}
Expand All @@ -82,14 +82,13 @@ private function apply()
$user = $this->user->getUserById($this->_user['sessionuserid']);
$message = [
'statusCode' => 200,
"message" => "操作成功",
"callbackType" => "forward",
"forwardUrl" => "index.php?certificate"
'message' => '操作成功',
'callbackType' => 'forward',
'forwardUrl' => 'index.php?certificate',
];
exit(json_encode($message));
}


$this->tpl->assign('ce', $ce);
$this->tpl->display('certificate_apply');
}
Expand Down
4 changes: 2 additions & 2 deletions app/content/cls/content.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ public function _init()

public function setViewNumber($contentid)
{
$data = [false, 'content', [['AND', "contentid = :contentid", 'contentid', $contentid]]];
$data = [false, 'content', [['AND', 'contentid = :contentid', 'contentid', $contentid]]];
$sql = $this->pdosql->makeSelect($data);
$r = $this->db->fetch($sql);
$number = $r['contentview'] + 1;
$data = [
'table' => 'content',
'value' => ['contentview' => $number],
'query' => [['AND', "contentid = :contentid", 'contentid', $contentid]]
'query' => [['AND', 'contentid = :contentid', 'contentid', $contentid]],
];
$this->db->updateElement($data);
}
Expand Down
6 changes: 3 additions & 3 deletions app/content/controller/category.phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ private function index()
if ($cat['catuseurl'] && $cat['caturl']) {
$message = [
'statusCode' => 201,
"message" => "操作成功",
"callbackType" => "forward",
"forwardUrl" => html_entity_decode($cat['caturl'])
'message' => '操作成功',
'callbackType' => 'forward',
'forwardUrl' => html_entity_decode($cat['caturl']),
];
exit(json_encode($message));
}
Expand Down
6 changes: 3 additions & 3 deletions app/content/controller/content.phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public function index()
if ($content['contentlink']) {
$message = [
'statusCode' => 201,
"message" => "操作成功",
"callbackType" => "forward",
"forwardUrl" => html_entity_decode($content['contentlink'])
'message' => '操作成功',
'callbackType' => 'forward',
'forwardUrl' => html_entity_decode($content['contentlink']),
];
exit(json_encode($message));
}
Expand Down
2 changes: 1 addition & 1 deletion app/core/controller/index.api.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private function basic()
$this->db->exec($sql);
}
}
++$page;
$page++;
echo 'ok';
if (count($rs) > 0) {
echo '<script>window.location = "index.php?core-api-index-basic&page='.$page.'"</script>';
Expand Down
2 changes: 1 addition & 1 deletion app/course/cls/course.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function getCourseContentStatus($courseid, $userid)
if ($rs['logstatus']) {
$cdata['content'][$i] = $rs['logid'];
}
++$i;
$i++;
}
foreach ($cdata['course'] as $key => $p) {
if ($key) {
Expand Down
6 changes: 3 additions & 3 deletions app/course/controller/category.phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ private function index()
if ($cat['catuseurl'] && $cat['caturl']) {
$message = [
'statusCode' => 201,
"message" => "操作成功",
"callbackType" => "forward",
"forwardUrl" => html_entity_decode($cat['caturl'])
'message' => '操作成功',
'callbackType' => 'forward',
'forwardUrl' => html_entity_decode($cat['caturl']),
];
exit(json_encode($message));
}
Expand Down
2 changes: 1 addition & 1 deletion app/course/controller/coupon.master.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private function batadd()
if ($value > 9999) {
$value = 9999;
}
for ($i = 0; $i < $number; ++$i) {
for ($i = 0; $i < $number; $i++) {
$this->coupon->randCoupon($value);
}
$message = [
Expand Down
10 changes: 5 additions & 5 deletions app/document/controller/upload.api.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public function index()
$back = [
'error' => [
'number' => 105,
'message' => $message
]
'message' => $message,
],
];
exit(json_encode($back));
}
Expand All @@ -58,15 +58,15 @@ public function index()
$back = [
'fileName' => $upfile['name'],
'url' => $fileurl,
'uploaded' => 1
'uploaded' => 1,
];
} else {
$message = '上传失败,附件类型不符!';
$back = [
'error' => [
'number' => 105,
'message' => $message
]
'message' => $message,
],
];
}
exit(json_encode($back));
Expand Down
4 changes: 2 additions & 2 deletions app/exam/cls/exam.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ public function markscore($sessionvars, $questypes)
break;
}

++$rlen;
$rlen++;
}
$score = floatval($sessionvars['examsessionsetting']['examsetting']['questype'][$key]['score'] * $rlen / $alen);
} else {
Expand Down Expand Up @@ -1013,7 +1013,7 @@ public function markscore($sessionvars, $questypes)
$rlen = 0;
break;
}
++$rlen;
$rlen++;
}
$score = $sessionvars['examsessionsetting']['examsetting']['questype'][$key]['score'] * $rlen / $alen;
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/exam/cls/favor.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ public function modifyExamHistory($ehid, $args)
public function delExamHistory($ehid, $userid = false)
{
if ($userid) {
$data = ["examhistory", [["AND", "ehid = :ehid", 'ehid', $ehid], ["AND", "ehuserid = :ehuserid", 'ehuserid', $userid]]];
$data = ['examhistory', [['AND', 'ehid = :ehid', 'ehid', $ehid], ['AND', 'ehuserid = :ehuserid', 'ehuserid', $userid]]];
} else {
$data = ["examhistory", [["AND", "ehid = :ehid", 'ehid', $ehid]]];
$data = ['examhistory', [['AND', 'ehid = :ehid', 'ehid', $ehid]]];
}
$sql = $this->pdosql->makeDelete($data);
$this->db->exec($sql);
Expand Down
10 changes: 5 additions & 5 deletions app/exam/cls/question.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public function selectScaleQuestions($examid, $basic)
$par = 0;
foreach ($number as $nkey => $t) {
if (!$par && ($t > 0)) {
++$par;
$par++;
$trand = rand(1, 4);
if ($trand < 3) {
$qrs = $this->getRandQuestionRowsList([['AND', 'find_in_set(quest2knows.qkknowsid,:knowsids)', 'knowsids', $knowsids], ['AND', 'questionrows.qrlevel = :qrlevel', 'qrlevel', $nkey], ['AND', 'questionrows.qrtype = :qrtype', 'qrtype', $key], ['AND', 'questionrows.qrnumber <= :qrnumber', 'qrnumber', $t]]);
Expand Down Expand Up @@ -339,7 +339,7 @@ public function selectScaleQuestions($examid, $basic)
$par = 0;
$t = $num;
if (!$par) {
++$par;
$par++;
$trand = rand(1, 4);
if ($trand < 3) {
$qrs = $this->getRandQuestionRowsList([['AND', 'find_in_set(quest2knows.qkknowsid,:knowsids)', 'knowsids', $knowsids], ['AND', 'questionrows.qrtype = :qrtype', 'qrtype', $key], ['AND', 'questionrows.qrnumber <= :qrnumber', 'qrnumber', $t]]);
Expand Down Expand Up @@ -446,7 +446,7 @@ public function selectQuestions($examid, $basic)
$par = 0;
foreach ($number as $nkey => $t) {
if (!$par) {
++$par;
$par++;
$trand = rand(1, 4);
if ($trand < 3) {
$qrs = $this->getRandQuestionRowsList([['AND', 'find_in_set(quest2knows.qkknowsid,:knowsids)', 'knowsids', $knowsids], ['AND', 'questionrows.qrlevel = :qrlevel', 'qrlevel', $nkey], ['AND', 'questionrows.qrtype = :qrtype', 'qrtype', $key], ['AND', 'questionrows.qrnumber <= :qrnumber', 'qrnumber', $t]]);
Expand Down Expand Up @@ -541,7 +541,7 @@ public function selectQuestionsByKnows($knowsid, $qt)
$qrid = 0;
$par = 0;
if (!$par) {
++$par;
$par++;
$trand = rand(1, 4);
if ($trand < 3) {
$qrs = $this->getRandQuestionRowsList([['AND', 'find_in_set(quest2knows.qkknowsid,:knowsids)', 'knowsids', $knowsids], ['AND', 'questionrows.qrtype = :qrtype', 'qrtype', $key], ['AND', 'questionrows.qrnumber <= :qrnumber', 'qrnumber', $t]]);
Expand All @@ -559,7 +559,7 @@ public function selectQuestionsByKnows($knowsid, $qt)
if ((count($r) >= $t)) {
if ($t <= 1) {
$question[$key][] = $r[array_rand($r, 1)];
--$t;
$t--;
} else {
$ts = array_rand($r, $t);
foreach ($ts as $tmp) {
Expand Down
12 changes: 6 additions & 6 deletions app/exam/cls/section.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,23 +210,23 @@ public function getQuestionsByKnows($knowsid)
$knows['knowsnumber'] = unserialize($knows['knowsnumber']);
$knows['knowsquestions'] = unserialize($knows['knowsquestions']);
if (!$knows['knowsquestions']) {
$data = ['DISTINCT questionid', ['questions', 'quest2knows'], [["AND", "find_in_set(quest2knows.qkknowsid,:knowsid)", 'knowsid', $knowsid], ["AND", "quest2knows.qktype = 0"], ["AND", "quest2knows.qkquestionid = questions.questionid"], ["AND", "questions.questionstatus = 1"]], false, false, false];
$data = ['DISTINCT questionid', ['questions', 'quest2knows'], [['AND', 'find_in_set(quest2knows.qkknowsid,:knowsid)', 'knowsid', $knowsid], ['AND', 'quest2knows.qktype = 0'], ['AND', 'quest2knows.qkquestionid = questions.questionid'], ['AND', 'questions.questionstatus = 1']], false, false, false];
$sql1 = $this->pdosql->makeSelect($data);
$data = ['questionid,questiontype', "questions", [["AND", "questionid in (%CHILDSQL%)"]], false, "questionparent asc,questionsequence asc,questionid asc", false];
$data = ['questionid,questiontype', 'questions', [['AND', 'questionid in (%CHILDSQL%)']], false, 'questionparent asc,questionsequence asc,questionid asc', false];
$sql = $this->pdosql->makeSelect($data);
$sql['sql'] = str_replace("%CHILDSQL%", $sql1['sql'], $sql['sql']);
$sql['sql'] = str_replace('%CHILDSQL%', $sql1['sql'], $sql['sql']);
$sql['v'] = array_merge($sql1['v'], $sql['v']);
$r = $this->db->fetchAll($sql);
$t = [];
$n = [];
foreach ($r as $p) {
$t[$p['questiontype']][] = $p['questionid'];
}
$data = ['DISTINCT questionid', ['questions', 'questionrows', 'quest2knows'], [["AND", "find_in_set(quest2knows.qkknowsid,:knowsid)", 'knowsid', $knowsid], ["AND", "quest2knows.qktype = 1"], ["AND", "quest2knows.qkquestionid = questionrows.qrid"], ["AND", "questions.questionparent = questionrows.qrid"], ["AND", "questionrows.qrstatus = 1"]], false, false, false];
$data = ['DISTINCT questionid', ['questions', 'questionrows', 'quest2knows'], [['AND', 'find_in_set(quest2knows.qkknowsid,:knowsid)', 'knowsid', $knowsid], ['AND', 'quest2knows.qktype = 1'], ['AND', 'quest2knows.qkquestionid = questionrows.qrid'], ['AND', 'questions.questionparent = questionrows.qrid'], ['AND', 'questionrows.qrstatus = 1']], false, false, false];
$sql1 = $this->pdosql->makeSelect($data);
$data = ['questionid,qrtype', ['questions', 'questionrows'], [["AND", "questionid in (%CHILDSQL%)"], ["AND", "questionparent = qrid"]], false, "questionparent asc,questionsequence asc,questionid asc", false];
$data = ['questionid,qrtype', ['questions', 'questionrows'], [['AND', 'questionid in (%CHILDSQL%)'], ['AND', 'questionparent = qrid']], false, 'questionparent asc,questionsequence asc,questionid asc', false];
$sql = $this->pdosql->makeSelect($data);
$sql['sql'] = str_replace("%CHILDSQL%", $sql1['sql'], $sql['sql']);
$sql['sql'] = str_replace('%CHILDSQL%', $sql1['sql'], $sql['sql']);
$sql['v'] = array_merge($sql1['v'], $sql['v']);
$r = $this->db->fetchAll($sql);
foreach ($r as $p) {
Expand Down
16 changes: 8 additions & 8 deletions app/exam/controller/basic.master.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private function stats()
$stats[$question['questionid']]['number'] = intval($stats[$question['questionid']]['number']) + 1;
if ($p['ehuseranswer'][$question['questionid']] && 0 == $questiontype[$question['questiontype']]['questsort'] && $questiontype[$question['questiontype']]['questchoice'] < 5) {
if (is_array($p['ehuseranswer'][$question['questionid']])) {
$p['ehuseranswer'][$question['questionid']] = implode("", $p['ehuseranswer'][$question['questionid']]);
$p['ehuseranswer'][$question['questionid']] = implode('', $p['ehuseranswer'][$question['questionid']]);
}
foreach ($os as $o) {
if (false !== strpos($p['ehuseranswer'][$question['questionid']], $o)) {
Expand All @@ -189,7 +189,7 @@ private function stats()
$stats[$question['questionid']]['number'] = intval($stats[$question['questionid']]['number']) + 1;
if ($p['ehuseranswer'][$question['questionid']] && 0 == $questiontype[$question['questiontype']]['questsort'] && $questiontype[$question['questiontype']]['questchoice'] < 5) {
if (is_array($p['ehuseranswer'][$question['questionid']])) {
$p['ehuseranswer'][$question['questionid']] = implode("", $p['ehuseranswer'][$question['questionid']]);
$p['ehuseranswer'][$question['questionid']] = implode('', $p['ehuseranswer'][$question['questionid']]);
}
foreach ($os as $o) {
if (false !== strpos($p['ehuseranswer'][$question['questionid']], $o)) {
Expand Down Expand Up @@ -331,9 +331,9 @@ private function delhistory()
$this->favor->delExamHistory($ehid);
$message = [
'statusCode' => 200,
"message" => "操作成功",
"callbackType" => 'forward',
"forwardUrl" => "reload"
'message' => '操作成功',
'callbackType' => 'forward',
'forwardUrl' => 'reload',
];
exit(json_encode($message));
}
Expand Down Expand Up @@ -1121,9 +1121,9 @@ private function savepaper()
$result = $this->exam->markscore($sessionvars, $questype);
$message = [
'statusCode' => 200,
"message" => "操作成功",
"callbackType" => "forward",
"forwardUrl" => "reload"
'message' => '操作成功',
'callbackType' => 'forward',
'forwardUrl' => 'reload',
];
$this->G->R($message);
}
Expand Down
4 changes: 2 additions & 2 deletions app/exam/controller/basic.teach.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private function savepaper()
break;
}

++$rlen;
$rlen++;
}
$score = floatval($sessionvars['examsessionsetting']['examsetting']['questype'][$key]['score'] * $rlen / $alen);
} else {
Expand Down Expand Up @@ -159,7 +159,7 @@ private function savepaper()
break;
}

++$rlen;
$rlen++;
}
$score = $sessionvars['examsessionsetting']['examsetting']['questype'][$key]['score'] * $rlen / $alen;
} else {
Expand Down
Loading

0 comments on commit 32427d9

Please sign in to comment.