修該資料庫 & 推薦點紀錄功能
This commit is contained in:
parent
341619b7bb
commit
eaa96d9bb2
@ -1254,11 +1254,16 @@ $app->group('/tokens', 'APIrequest', function () use ($app, $app_template) {
|
||||
|
||||
// 製作
|
||||
$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);
|
||||
}
|
||||
|
||||
// 紀錄所有推薦進歷程
|
||||
$recommand->insertRecommandHistory($saId, $output_target_ids);
|
||||
}
|
||||
|
||||
// 噴出結果
|
||||
|
@ -93,10 +93,27 @@ class DBRecommand extends Database
|
||||
*/
|
||||
public function queryEdgeByID($currentPoint)
|
||||
{
|
||||
//echo "EEEEEEEEE";
|
||||
$AllOfResult = $this->queryEdgeByWhere($this->table('learn_path').".Ti = ".$this->connDB->quote($currentPoint));
|
||||
if(count($AllOfResult) != 0) return $AllOfResult;
|
||||
else return null;
|
||||
}
|
||||
|
||||
// ========================================================================
|
||||
|
||||
public function insertRecommandHistory($activity_id, $target_ids) {
|
||||
|
||||
$nowDateQuery = $this->connDB->query("SELECT NOW()");
|
||||
$nowDate = $nowDateQuery->fetch()[0];
|
||||
|
||||
foreach($target_ids as $target_id) {
|
||||
$sqlString = "INSERT INTO ".$this->table('user_history_recommand')." (`SaID`, `Date`, `TID`) VALUES ( :said , :now , :tid )";
|
||||
$query = $this->connDB->prepare($sqlString);
|
||||
$query->bindParam(":said", $activity_id);
|
||||
$query->bindParam(":now", $nowDate);
|
||||
$query->bindParam(":tid", $target_id);
|
||||
$query->execute();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -185,4 +185,9 @@ class RecommandPoint
|
||||
|
||||
return $recommand;
|
||||
}
|
||||
|
||||
public function insertRecommandHistory($activity_id, $target_ids) {
|
||||
|
||||
return $this->recommand->insertRecommandHistory($activity_id, $target_ids);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user