fix 推薦學習點功能Bug: 取得已學習展點SQL語法錯誤

This commit is contained in:
Yuan Chiu 2016-05-01 13:38:00 +08:00
parent 3f2f66629f
commit 8620db35bc
4 changed files with 21 additions and 21 deletions

View File

@ -1399,26 +1399,27 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
else {
$result_recommand_total = $recommandTotal;
}
}
// 製作
$output_targets = array();
$output_target_ids = array();
for($i=0; $i<$result_recommand_total; $i++) {
$target_id = $recommandResult[$i]['nextPoint'];
$isEntity = $recommandResult[$i]['isEntity'];
array_push($output_targets, output_the_target_array($target_id, $isEntity, $materialMode));
array_push($output_target_ids, $target_id);
// 製作
$output_targets = array();
$output_target_ids = array();
for($i=0; $i<$result_recommand_total; $i++) {
$target_id = $recommandResult[$i]['nextPoint'];
$isEntity = $recommandResult[$i]['isEntity'];
array_push($output_targets, output_the_target_array($target_id, $isEntity, $materialMode));
array_push($output_target_ids, $target_id);
// TODO: 標的進出資料多增加行進中、確實進入的欄位
if($maxItemTotal == 1) {
$sid = $sact->enteringInTarget($target_id, true);
}
// TODO: 標的進出資料多增加行進中、確實進入的欄位
if($maxItemTotal == 1) {
$sid = $sact->enteringInTarget($target_id, true);
}
// 紀錄所有推薦進歷程
$recommand->insertRecommandHistory($saId, $output_target_ids);
}
// 紀錄所有推薦進歷程
$recommand->insertRecommandHistory($saId, $output_target_ids);
// 噴出結果
$app->render(201,array(

View File

@ -24,7 +24,7 @@ class DBRecommand extends Database
protected function queryEdgeByWhere($where)
{
$sqlString = "SELECT DISTINCT ".$this->table('learn_path').".Ti, ".$this->table('learn_path').".Tj, ".$this->table('learn_path').".MoveTime".
$sqlString = "SELECT DISTINCT Ti, Tj, MoveTime".
" FROM ".$this->table('learn_path')." WHERE ".$where;
$query = $this->connDB->prepare($sqlString);
$query->execute();
@ -93,8 +93,7 @@ class DBRecommand extends Database
*/
public function queryEdgeByID($currentPoint)
{
$AllOfResult = $this->queryEdgeByWhere($this->table('learn_path').".Ti = ".$this->connDB->quote($currentPoint)." OR ".
$this->table('learn_path').".Tj = ".$this->connDB->quote($currentPoint));
$AllOfResult = $this->queryEdgeByWhere($this->table('learn_path').".Ti = ".$this->connDB->quote($currentPoint));
if(count($AllOfResult) != 0) return $AllOfResult;
else return null;
}

View File

@ -465,8 +465,7 @@ class DBStudy extends Database {
$queryResultAll = $this->queryByWhere(
"`TID` = ".$this->connDB->quote($target_id).
" AND `SaID` = ".$this->connDB->quote($activity_id).
" AND `IsEnter` = '1'");
" AND `SaID` = ".$this->connDB->quote($activity_id));
return $queryResultAll;
}

View File

@ -187,7 +187,8 @@ class RecommandPoint
}
public function insertRecommandHistory($activity_id, $target_ids) {
return $this->recommand->insertRecommandHistory($activity_id, $target_ids);
if( count($target_ids) > 0 ) {
return $this->recommand->insertRecommandHistory($activity_id, $target_ids);
}
}
}