完成queryBelongByWhere方法
This commit is contained in:
parent
0e81623947
commit
baffbd6dcf
@ -9,13 +9,35 @@ require_once UELEARNING_LIB_ROOT.'/Database/Exception.php';
|
|||||||
|
|
||||||
class DBRecomamnd extends Database
|
class DBRecomamnd extends Database
|
||||||
{
|
{
|
||||||
public function __construct()
|
|
||||||
{
|
/**
|
||||||
|
* 內部查詢用
|
||||||
}
|
* @param string $where SQL WHERE子句
|
||||||
|
* @return array 查詢結果
|
||||||
|
*/
|
||||||
protected function queryBelongByWhere($where)
|
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;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -28,6 +28,8 @@ class RecommandPoint
|
|||||||
* @type double
|
* @type double
|
||||||
*/
|
*/
|
||||||
private const $ALPHA = 0.5;
|
private const $ALPHA = 0.5;
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -41,14 +43,14 @@ class RecommandPoint
|
|||||||
*/
|
*/
|
||||||
private function computeNormalizationParameter()
|
private function computeNormalizationParameter()
|
||||||
{
|
{
|
||||||
|
$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推薦學習點
|
* 推薦學習點
|
||||||
* @return array 學習點清單
|
* @return array 學習點清單
|
||||||
*/
|
*/
|
||||||
public function recommand()
|
public function recommand($ )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user