|
@@ -3,6 +3,7 @@
|
|
|
require_once '../path.php';
|
|
require_once '../path.php';
|
|
|
require_once '../public/_pdo.php';
|
|
require_once '../public/_pdo.php';
|
|
|
require_once '../redis/function.php';
|
|
require_once '../redis/function.php';
|
|
|
|
|
+require_once '../dict/function.php';
|
|
|
|
|
|
|
|
if (isset($_GET["language"])) {
|
|
if (isset($_GET["language"])) {
|
|
|
$currLanguage = $_GET["language"];
|
|
$currLanguage = $_GET["language"];
|
|
@@ -15,19 +16,32 @@ if (isset($_GET["language"])) {
|
|
|
}
|
|
}
|
|
|
$currLanguage = explode("-", $currLanguage)[0];
|
|
$currLanguage = explode("-", $currLanguage)[0];
|
|
|
|
|
|
|
|
-if (isset($_GET["word"])) {
|
|
|
|
|
|
|
+if (isset($_GET["word"]) && !empty($_GET["word"])) {
|
|
|
$word = $_GET["word"];
|
|
$word = $_GET["word"];
|
|
|
} else {
|
|
} else {
|
|
|
echo json_encode(array(), JSON_UNESCAPED_UNICODE);
|
|
echo json_encode(array(), JSON_UNESCAPED_UNICODE);
|
|
|
exit;
|
|
exit;
|
|
|
}
|
|
}
|
|
|
-/*
|
|
|
|
|
|
|
+
|
|
|
$redis = redis_connect();
|
|
$redis = redis_connect();
|
|
|
if($redis!==false){
|
|
if($redis!==false){
|
|
|
- $redis->hexist()
|
|
|
|
|
|
|
+ $arrWordIdx = $redis->hget("ref_dict_idx",$word);
|
|
|
|
|
+ if($arrWordIdx===FALSE){
|
|
|
|
|
+ PDO_Connect(_FILE_DB_REF_INDEX_);
|
|
|
|
|
+ $query = "SELECT word,count from " . _TABLE_REF_INDEX_ . " where eword like ? OR word like ? limit 0,15";
|
|
|
|
|
+ $Fetch = PDO_FetchAll($query, array($word . '%', $word . '%'));
|
|
|
|
|
+ $arrWordIdx=json_encode($Fetch, JSON_UNESCAPED_UNICODE);
|
|
|
|
|
+ $redis->hset("ref_dict_idx",$word,$arrWordIdx);
|
|
|
|
|
+ }
|
|
|
|
|
+ $arrResult = json_decode($arrWordIdx,true);
|
|
|
|
|
+ foreach ($arrResult as $key => $value) {
|
|
|
|
|
+ # code...
|
|
|
|
|
+ $arrResult[$key]["mean"]=getRefFirstMeaning($arrResult[$key]["word"],$currLanguage,$redis);
|
|
|
|
|
+ }
|
|
|
|
|
+ echo json_encode($arrResult, JSON_UNESCAPED_UNICODE);
|
|
|
|
|
+ exit;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
-*/
|
|
|
|
|
{
|
|
{
|
|
|
PDO_Connect(_FILE_DB_REF_INDEX_);
|
|
PDO_Connect(_FILE_DB_REF_INDEX_);
|
|
|
$query = "SELECT word,count from " . _TABLE_REF_INDEX_ . " where eword like ? OR word like ? limit 0,15";
|
|
$query = "SELECT word,count from " . _TABLE_REF_INDEX_ . " where eword like ? OR word like ? limit 0,15";
|
|
@@ -53,6 +67,7 @@ else
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-echo json_encode($Fetch, JSON_UNESCAPED_UNICODE);
|
|
|
|
|
|
|
+
|