diff --git a/htdocs/api/v2/index.php b/htdocs/api/v2/index.php index 839aed2..a7b6f12 100644 --- a/htdocs/api/v2/index.php +++ b/htdocs/api/v2/index.php @@ -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( diff --git a/htdocs/lib/Database/DBRecommand.php b/htdocs/lib/Database/DBRecommand.php index 1a6fa9b..03d5c31 100644 --- a/htdocs/lib/Database/DBRecommand.php +++ b/htdocs/lib/Database/DBRecommand.php @@ -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; } diff --git a/htdocs/lib/Database/DBStudy.php b/htdocs/lib/Database/DBStudy.php index bf34120..f715e4b 100644 --- a/htdocs/lib/Database/DBStudy.php +++ b/htdocs/lib/Database/DBStudy.php @@ -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; } diff --git a/htdocs/lib/Recommand/RecommandPoint.php b/htdocs/lib/Recommand/RecommandPoint.php index 0eec0b5..8b631df 100644 --- a/htdocs/lib/Recommand/RecommandPoint.php +++ b/htdocs/lib/Recommand/RecommandPoint.php @@ -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); + } } }