完成queryBelongByWhere方法
This commit is contained in:
parent
0e81623947
commit
baffbd6dcf
@ -8,14 +8,36 @@ require_once UELEARNING_LIB_ROOT.'/Database/Database.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Database/Exception.php';
|
||||
|
||||
class DBRecomamnd extends Database
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 內部查詢用
|
||||
* @param string $where SQL WHERE子句
|
||||
* @return array 查詢結果
|
||||
*/
|
||||
protected function queryBelongByWhere($where)
|
||||
{
|
||||
$sqlString = "SELECT DISTINCT ".$this->table('Edge').".Ti, ".$this->table('Edge').".Tj, ".$this->table('Edge').".MoveTime".
|
||||
" FROM ".$this->table('Edge')." WHERE ".$where;
|
||||
$this->conndb->prepare($sqlString);
|
||||
$this->conndb->execute();
|
||||
|
||||
$queryAllResult = $this->conndb->fetchAll();
|
||||
|
||||
if(count($queryAllResult) != 0)
|
||||
{
|
||||
$result = array();
|
||||
foreach ($queryAllResult as $key => $thisResult)
|
||||
{
|
||||
array_push($result,
|
||||
array("Ti" => $thisResult['Ti'],
|
||||
"Tj" => $thisResult['Tj'],
|
||||
"MoveTime" => $thisResult['MoveTime']));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
else return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -29,6 +29,8 @@ class RecommandPoint
|
||||
*/
|
||||
private const $ALPHA = 0.5;
|
||||
|
||||
private
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -41,14 +43,14 @@ class RecommandPoint
|
||||
*/
|
||||
private function computeNormalizationParameter()
|
||||
{
|
||||
|
||||
$
|
||||
}
|
||||
|
||||
/**
|
||||
* 推薦學習點
|
||||
* @return array 學習點清單
|
||||
*/
|
||||
public function recommand()
|
||||
public function recommand($ )
|
||||
{
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user