Esempio n. 1
0
$db_utils = new DatabaseUtils();
$update_time = TimeUtils::getNowTime();
$start_time = TimeUtils::getNowTime();
$user_link = $db_utils->initUserDatabase();
if (mysql_select_db(DBName::getUserDB)) {
    for ($i = 0; $i < count($wordList); $i++) {
        $enWordDiry = $wordList[$i];
        $enWordID = TimeUtils::getId();
        $enWordDiry["enWordID"] = $enWordID;
        $enWordDiry["create_time"] = $update_time;
        $enWordDiry["update_time"] = $update_time;
        $db_utils->addENWordTable($user_link, $enWordDiry);
        $configList = $enWordDiry["configList"];
        for ($x = 0; $x < count($configList); $x++) {
            $configDiry = $configList[$x];
            $configDiry["enExampleID"] = TimeUtils::getId();
            $configDiry["enDefinitionID"] = TimeUtils::getId();
            $configDiry["enTranslateID"] = TimeUtils::getId();
            $configDiry["enWordID"] = $enWordID;
            $configDiry["create_time"] = $update_time;
            $configDiry["update_time"] = $update_time;
            $db_utils->addWordDefinitionTable($user_link, $configDiry);
            $db_utils->addWordTranslateTable($user_link, $configDiry);
            $db_utils->addWordExampleTable($user_link, $configDiry);
        }
    }
    $res["message"] = "加入成功!";
    $db_utils->response($start_time, $res, $user_link);
} else {
    $db_utils->responseError($start_time, mysql_error(), mysql_errno(), $user_link);
}