Procházet zdrojové kódy

调整解析问题

hwz před 5 měsíci
rodič
revize
6c424a10ba
1 změnil soubory, kde provedl 1 přidání a 875 odebrání
  1. 1 875
      protected/controllers/WordapiController.php

+ 1 - 875
protected/controllers/WordapiController.php

@@ -25,877 +25,6 @@ class WordapiController extends CController
         $this->flag = isset($_GET['flag']) ? intval($_GET['flag']) : 1;
     }
 
-    public function actionIndex()
-    {
-        // 获取curl过来值
-        $word_id = isset($_GET['wid']) ? intval($_GET['wid']) : 0;
-        $school_id = isset($_GET['sid']) ? intval($_GET['sid']) : 0;
-        if (empty($word_id) || empty($school_id)) {
-            exit('未找到word Id或者学校id');
-        }
-        
-        // 连接业务库
-//        $busDsn = 'mysql:host=' . Yii::app()->params["default_server"]['addr'] . ';dbname=' . Yii::app()->params["default_db"]['name'] . ';';
-//        $busdbh = new PDO($busDsn, Yii::app()->params["default_server"]['username'], Yii::app()->params["default_server"]['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8";'));
-        $busdbh = Yii::app()->businessDb;
-        $dataBaseInfo = $busdbh->createCommand('SELECT * FROM `database` WHERE `school_id`=' . $school_id)->queryOne();
-        if (empty($dataBaseInfo)) {
-            exit('未找到数据库链接信息!');
-        }
-        $busdbh = null;
-
-        // 连接学校库
-        $schDsn = 'mysql:host=' . $dataBaseInfo['database_host'] . ';dbname=' . $dataBaseInfo['database_name'] . ';';
-        $schdbh = new PDO($schDsn, $dataBaseInfo['database_user'], $dataBaseInfo['database_password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8";'));
-        $wordInfo = $schdbh->query('SELECT `word_id`,`word_name`,`subject_id`,`uploader_id` FROM `topic_word` WHERE `word_id`=' . $word_id)->fetch(PDO::FETCH_ASSOC);
-        if (empty($wordInfo)) {
-            exit('未找到上传word信息!');
-        }
-
-        $getWordJson = file_get_contents('php://input');
-        $jsonArray = json_decode($getWordJson, true);
-        if (!$jsonArray || $jsonArray['errcode'] > 0) { // 解析失败
-            $docUrl = isset($jsonArray['docurl']) ? $jsonArray['docurl'] : '';
-            $word_down_url = self::downloadWord($wordInfo, $docUrl, $school_id);
-            $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,`file_path` = :path,parse_time=:time WHERE `word_id` =:wid');
-            $stmt->execute(array(':wid' => $word_id, ':reason' => $jsonArray['errmsg'], ':content' => $getWordJson, ':path' => $word_down_url, ':time' => time()));
-            exit('解析失败!');
-        } else {
-            if (empty($jsonArray['items'])) {
-                $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                $stmt->execute(array(':wid' => $word_id, ':reason' => '返回word试题内容为空', ':content' => $getWordJson, ':time' => time()));
-                exit('返回试题内容为空');
-            } else {
-                $sctmt = $schdbh->prepare('UPDATE `topic_word` SET `content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                $sctmt->execute(array(':wid' => $word_id, ':time' => time(), ':content' => $getWordJson));
-            }
-
-            // 试题入库操作
-            foreach ($jsonArray['items'] as $key => $val) {
-
-                // 试题类型ID
-				switch ($val['type']) {
-                    case '选择':
-                        $type_id = 1;
-                        break;
-                    case '多选':
-                        $type_id = 2;
-                        break;
-                    case '填空':
-                        $type_id = 5;
-                        break;
-                    default:
-                        $type_id = 7;
-                }
-
-                //处理答案
-                if (!empty($val['key'])) {
-                    $val['key'] = self::strip_content_tags($val['key']);
-                    $val['key'] = self::downloadImg($val['key'], $school_id);
-                }
-
-                // 处理题干中
-                if (empty($val['stem'])) {
-                    continue;
-                } else {
-                    $val['stem'] = self::strip_content_tags($val['stem']);
-                    $val['stem'] = self::downloadImg($val['stem'], $school_id);
-
-                    // 若是填空题下划线处理
-                    if ($val['type'] == '填空') {
-                        preg_match_all('/_{5,}/', $val['stem'], $matgap);
-                        if (!empty($matgap[0])) {
-                            $nnum = 0;
-                            foreach ($matgap[0] as $km => $vm) {
-                                $nnum = $km + 1;
-                                $val['stem'] = preg_replace('/_{3,}/', '<img class="tiankong" src="/images/list_' . $nnum . '.png">', $val['stem'], 1);
-                            }
-
-                            // 填空题是否多个答案
-                            preg_match_all('/<p>(.*?)<\/p>/', $val['key'], $key_array);
-                            if ($nnum > 1 && $key_array[1]) {
-                                $result_array = array_filter($key_array[1]);
-                                if ($result_array) {
-                                    if (count($result_array) == $nnum) { // 如果填空数与答案数匹配
-                                        $val['key'] = $key_array[1];
-                                    } else { // 出现填空数与答案数不一致情况处理
-                                        $new_array = array();
-                                        $new_nnum = $nnum - 1;
-                                        for ($t = 0; $t <= $new_nnum; $t++) {
-                                            if (isset($result_array[$t])) {
-                                                $new_array[] = $result_array[$t];
-                                            } else {
-                                                $new_array[] = '';
-                                            }
-                                        }
-                                        $val['key'] = $new_array;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-
-                // 试题解析
-                if (!empty($val['analysis'])) {
-                    $val['analysis'] = self::downloadImg($val['analysis'], $school_id);
-                    $val['analysis'] = self::strip_content_tags($val['analysis']);
-                }
-                // 单选题处理
-                if (!empty($val['options'])) {
-                    foreach ($val['options'] as $vk => &$vp) {
-                        $vp = self::downloadImg($vp, $school_id);
-                        $vp = self::strip_content_tags($vp);
-                        // $val['options'][$vk] = $vp;
-                    }
-                }
-
-                // 获取默认文件夹id
-                $subjectId = in_array($wordInfo['subject_id'],$this->mathSubject) ? 3 : $wordInfo['subject_id'];
-                $defaultFolder = $schdbh->query('SELECT `folder_id` FROM `topic_folder` WHERE `subject_id`='.$subjectId.' and `is_system`=1')->fetch(PDO::FETCH_ASSOC);
-                $folderId = empty($defaultFolder) ? 0 : $defaultFolder['folder_id'];
-
-                // 获取试题id
-                //$getUid =   $schdbh->query('SELECT UUID_SHORT() AS uuid')->fetch(PDO::FETCH_ASSOC);
-                //$resUid =   substr($getUid['uuid'],-6);
-
-                $now_time = time();
-                $difficulty = isset($val['difficulty']) ? $val['difficulty'] : 1;
-
-                // 试题入库处理
-                try {
-                    $schdbh->beginTransaction(); // 开启事务
-
-                    // topic表
-                    $row = null;
-                    $row = $schdbh->prepare('INSERT INTO `topic`(`topic_type`, `topic_title`, `topic_difficulty`, `folder_id`, `subject_id`,`source_title`, `parse_content`, `creator_id`,`updater_id`, `create_time`,`update_time`,`is_word_topic`) VALUES (:ttype,:ttile,:tdiff,:fid,:sid,:sotitle,:ana,:ceid,:upid,:time,:utime,1)'); // 执行第一个 SQL
-                    $row->execute(array(':ttype' => $type_id, ':ttile' => $val['stem'], ':tdiff' => $difficulty, ':fid' => $folderId, ':sid' => $wordInfo['subject_id'], ':sotitle' => 'word上传试题', ':ana' => $val['analysis'], ':ceid' => $wordInfo['uploader_id'], ':upid' => $wordInfo['uploader_id'], ':time' => $now_time, ':utime' => $now_time));
-                    $resUid = $schdbh->lastInsertId();
-                    if (!$resUid) {
-                        throw new PDOException('插入topic表失败!');
-                    }
-
-                    // topic_item
-                    $rowTwo = null;
-                    $rowTwo = $schdbh->prepare('INSERT INTO `topic_item`(`topic_id`, `topic_type`, `topic_title`) VALUES (:tpid,:type,:title)');
-                    $getRowTwo = $rowTwo->execute(array(':tpid' => $resUid, ':type' => $type_id, ':title' => $val['stem']));
-                    if (!$getRowTwo) {
-                        throw new PDOException('插入topic_item表失败!');
-                    }
-
-                    // 单选题处理
-                    if ($type_id == 1 || $type_id == 2) {
-
-                        // 获取正确答案
-                        $answerNums = array();
-                        $getAnswer = str_replace(array(" ", " ", "\t", "\n", "\r"), '', strip_tags($val['key']));
-                        $getAnswer = strtoupper($getAnswer);
-                        foreach ($this->charToNum as $char => $num) {
-                            if (strpos($getAnswer, $char) !== false) {
-                                $answerNums[] = $num;
-                            }
-                        }
-
-                        $rowThr = null;
-                        $rowThr = $schdbh->prepare('INSERT INTO `topic_item_option`(`topic_id`, `option_content`, `option_correct`) VALUES (:tpid,:content,:correct)');
-                        foreach ($val['options'] as $vk => $option) {
-                            $is_true = 0;
-                            if (in_array($vk, $answerNums)) {
-                                    $is_true = 1;
-                            }
-                            $getRowThr = $rowThr->execute(array(':tpid' => $resUid, ':content' => $option, ':correct' => $is_true));
-                        }
-                    } else {
-                        $rowFiv = null;
-                        $rowFiv = $schdbh->prepare('INSERT INTO `topic_item_option`(`topic_id`, `option_content`) VALUES (:tpid,:content)');
-                        if (is_array($val['key']) && $val['key']) {
-                            foreach ($val['key'] as $topicKey) {
-                                $getRowFiv = $rowFiv->execute(array(':tpid' => $resUid, ':content' => $topicKey));
-                            }
-                        } else {
-                            $getRowFiv = $rowFiv->execute(array(':tpid' => $resUid, ':content' => $val['key']));
-                            if (!$getRowFiv) {
-                                throw new PDOException('插入topic_item_option表失败!');
-                            }
-                        }
-                    }
-
-                    // word与试题关系
-                    $rowFor = null;
-                    $rowFor = $schdbh->prepare('INSERT INTO `word_topic_relation`(`word_id`, `topic_id`) VALUES (:wid,:toid)');
-                    $getRowFor = $rowFor->execute(array(':wid' => $word_id, ':toid' => $resUid));
-                    if (!$getRowFor) {
-                        throw new PDOException('插入word_to_topic表失败!');
-                    }
-
-                    $schdbh->commit();
-                } catch (PDOException $e) {
-                    $schdbh->rollback(); // 执行失败,事务回滚
-                    exit($e->getMessage());
-                }
-            }
-
-            // 处理完
-            $resu = $schdbh->prepare('UPDATE `topic_word` SET `status` = 2,`parse_time`=:time WHERE `word_id` =:wid');
-            $resu->execute(array(':wid' => $word_id, ':time' => time()));
-
-            $schdbh = null;
-            exit('解析完成!');
-        }
-    }
-
-    public function actionCoach()
-    {
-        $apiParam = Yii::app()->params['api'][0];
-        $apiParam['prefix'] .= 'topic_clear_redis/ctopic';
-        $apiTopics = array();
-        // 获取curl过来值
-        $word_id = isset($_GET['wid']) ? intval($_GET['wid']) : 0;
-        $school_id = isset($_GET['sid']) ? intval($_GET['sid']) : 0;
-        if (empty($word_id) || empty($school_id)) {
-            exit('未找到word Id或者学校id');
-        }
-
-        // 连接业务库
-        $busDsn = 'mysql:host=' . Yii::app()->params["default_server"]['addr'] . ';dbname=' . Yii::app()->params["default_db"]['name'] . ';';
-        $busdbh = new PDO($busDsn, Yii::app()->params["default_server"]['username'], Yii::app()->params["default_server"]['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8";'));
-        $getDataBase = $busdbh->query('SELECT * FROM `database` WHERE `school_id`=' . $school_id);
-        $dataBaseInfo = $getDataBase->fetch(PDO::FETCH_ASSOC);
-        if (empty($dataBaseInfo)) {
-            exit('未找到数据库链接信息!');
-        }
-        $busdbh = null;
-        $isQxk = 0;
-        // 连接学校库
-        $schDsn = 'mysql:host=' . $dataBaseInfo['database_host'] . ';dbname=' . $dataBaseInfo['database_name'] . ';';
-        $schdbh = new PDO($schDsn, $dataBaseInfo['database_user'], $dataBaseInfo['database_password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8";'));
-        $wordInfo = $schdbh->query('SELECT `word_id`,`word_name`,`subject_id`,`uploader_id`,`exam_group_id` FROM `topic_word` WHERE `word_id`=' . $word_id)->fetch(PDO::FETCH_ASSOC);
-        if (empty($wordInfo)) {
-            exit('未找到上传word信息!');
-        }
-        $examGroupInfo = $schdbh->query('SELECT `qxk_paper_id` FROM `exam_group` WHERE `exam_group_id`=' . $wordInfo['exam_group_id'])->fetch(PDO::FETCH_ASSOC);
-        if($examGroupInfo && $examGroupInfo['qxk_paper_id']){
-            $isQxk = 1;
-        }
-        
-        $paper_topic_relation_data = $schdbh->query('select pt.*,pp.* from paper_topic_relation pt join  (select p.paper_id ,e.subject_id as subject_id,e.exam_group_id from exam e left JOIN  paper p on e.exam_id = p.exam_id where e.exam_group_id = ' . $wordInfo['exam_group_id'] . ' GROUP BY e.exam_group_id) as pp on pt.paper_id = pp.paper_id order by pt.type asc,pt.order asc')->fetchAll(PDO::FETCH_ASSOC);
-        if (empty($paper_topic_relation_data)) {
-            $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-            $stmt->execute(array(':wid' => $word_id, ':reason' => '此考试无题', ':content' => '', ':time' => time()));
-
-        }
-		$relate_topic_id = array();
-        $p_topic_type_num = array();
-        foreach ($paper_topic_relation_data as $v) {
-			$relate_topic_id[] = $v['topic_id'];
-            $p_topic_type_num[$v['type']][] = $v['topic_id'];
-        }
-
-        $getWordJson = file_get_contents('php://input');
-        $jsonArray = json_decode($getWordJson, true);
-        if (!$jsonArray || $jsonArray['errcode'] > 0) { // 解析失败
-            $docUrl = isset($jsonArray['docurl']) ? $jsonArray['docurl'] : '';
-            $word_down_url = self::downloadWord($wordInfo, $docUrl, $school_id);
-            $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,`file_path` = :path,parse_time=:time WHERE `word_id` =:wid');
-            $stmt->execute(array(':wid' => $word_id, ':reason' => $jsonArray['errmsg'], ':content' => $getWordJson, ':path' => $word_down_url, ':time' => time()));
-            exit('解析失败!');
-        } else {
-
-            if (empty($jsonArray['items'])) {
-                $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                $stmt->execute(array(':wid' => $word_id, ':reason' => '返回word试题内容为空', ':content' => $getWordJson, ':time' => time()));
-                exit('返回试题内容为空');
-            } else {
-                $sctmt = $schdbh->prepare('UPDATE `topic_word` SET `content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                $sctmt->execute(array(':wid' => $word_id, ':time' => time(), ':content' => $getWordJson));
-
-            }
-
-            if (count($paper_topic_relation_data) != count($jsonArray['items'])) {
-
-                $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                $stmt->execute(array(':wid' => $word_id, ':reason' => 'WORD题量与试卷题量不同', ':content' => $getWordJson, ':time' => time()));
-                exit('WORD题量与试卷题量不同');
-            }
-			
-            // 删除已存在试题缓存
-            if ($relate_topic_id) {
-                    self::getApiData($apiParam, 2, json_encode(array('topicIds' => $relate_topic_id)), 3);
-            }
-
-            $topic_type_num = array();
-            foreach ($jsonArray['items'] as $key => $val) {
-                // 试题类型ID
-                $type_id = 0;
-                if ($val['type'] == '选择') {
-                    $type_id = 1;
-                    $topic_type_num[$type_id][] = $type_id;
-                } else if ($val['type'] == '多选') {
-					$type_id = 2;
-                    $topic_type_num[$type_id][] = $type_id;
-				} else if ($val['type'] == '填空') {
-                    $type_id = 5;
-                    $topic_type_num[$type_id][] = $type_id;
-                } else if ($val['type'] == '简答') {
-					if (isset($val['is_optional']) && $val['is_optional']) {
-						$topic_type_num[17][] = 7;
-					} else {
-						$type_id = 7;
-						$topic_type_num[$type_id][] = $type_id;
-					}
-                }
-            }
-
-            //验证题型题量
-            if ($topic_type_num && $p_topic_type_num) {
-                if (isset($topic_type_num[1]) && isset($p_topic_type_num[1])) {
-                    if (count($topic_type_num[1]) != count($p_topic_type_num[1])) {
-
-                        $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                        $stmt->execute(array(':wid' => $word_id, ':reason' => 'word单选题量与试卷的单选题量不同', ':content' => $getWordJson, ':time' => time()));
-                        exit('word单选题量与试卷的单选题量不同');
-
-                    }
-                } elseif (isset($p_topic_type_num[1]) && !isset($topic_type_num[1])) {
-                    $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                    $stmt->execute(array(':wid' => $word_id, ':reason' => 'word单选题量与试卷的单选题量不同', ':content' => $getWordJson, ':time' => time()));
-                    exit('word单选题量与试卷的单选题量不同');
-                }
-
-				if (isset($topic_type_num[2]) && isset($p_topic_type_num[2])) {
-                    if (count($topic_type_num[2]) != count($p_topic_type_num[2])) {
-
-                        $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                        $stmt->execute(array(':wid' => $word_id, ':reason' => 'word多选题量与试卷的多选题量不同', ':content' => $getWordJson, ':time' => time()));
-                        exit('word多选题量与试卷的多选题量不同');
-
-                    }
-                } elseif (isset($p_topic_type_num[2]) && !isset($topic_type_num[2])) {
-                    $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                    $stmt->execute(array(':wid' => $word_id, ':reason' => 'word多选题量与试卷的多选题量不同', ':content' => $getWordJson, ':time' => time()));
-                    exit('word多选题量与试卷的多选题量不同');
-                }
-
-                if (isset($topic_type_num[5]) && isset($p_topic_type_num[5])) {
-                    if (count($topic_type_num[5]) != count($p_topic_type_num[5])) {
-
-                        $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                        $stmt->execute(array(':wid' => $word_id, ':reason' => 'word填空题量与试卷的填空题量不同', ':content' => $getWordJson, ':time' => time()));
-                        exit('word填空题量与试卷的填空题量不同');
-                    }
-                } elseif (isset($p_topic_type_num[5]) && !isset($topic_type_num[5])) {
-                    $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                    $stmt->execute(array(':wid' => $word_id, ':reason' => 'word填空题量与试卷的填空题量不同', ':content' => $getWordJson, ':time' => time()));
-                    exit('word填空题量与试卷的填空题量不同');
-                }
-                if (isset($topic_type_num[7]) && isset($p_topic_type_num[7])) {
-                    if (count($topic_type_num[7]) != count($p_topic_type_num[7])) {
-
-                        $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                        $stmt->execute(array(':wid' => $word_id, ':reason' => 'word解答题量与试卷的解答题量不同', ':content' => $getWordJson, ':time' => time()));
-                        exit('word解答题量与试卷的解答题量不同');
-                    }
-
-                } elseif (isset($p_topic_type_num[7]) && !isset($topic_type_num[7])) {
-                    $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                    $stmt->execute(array(':wid' => $word_id, ':reason' => 'word解答题量与试卷的解答题量不同', ':content' => $getWordJson, ':time' => time()));
-                    exit('word解答题量与试卷的解答题量不同');
-                }
-
-				if (isset($topic_type_num[17]) && isset($p_topic_type_num[17])) {
-					 if (count($topic_type_num[17]) != count($p_topic_type_num[17])) {
-                        $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                        $stmt->execute(array(':wid' => $word_id, ':reason' => 'word选做题量与试卷的选做题量不同', ':content' => $getWordJson, ':time' => time()));
-                        exit('word选做题量与试卷的选做题量不同');
-                    }
-				} elseif (isset($p_topic_type_num[17]) && !isset($topic_type_num[17])) {
-					$stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                    $stmt->execute(array(':wid' => $word_id, ':reason' => '上传Word需包含选做题', ':content' => $getWordJson, ':time' => time()));
-                    exit('上传Word需包含选做题');
-				}
-            }
-
-
-            // 试题入库操作
-            foreach ($jsonArray['items'] as $key => $val) {
-                $apiTopics[] = $paper_topic_relation_data[$key]['topic_id'];
-                // 试题类型ID
-                switch ($val['type']) {
-                    case '选择':
-                        $type_id = 1;
-                        break;
-                    case '多选':
-                        $type_id = 2;
-                        break;
-                    case '填空':
-                        $type_id = 5;
-                        break;
-                    default:
-                        $type_id = 7;
-                }
-
-                //处理答案
-                if (!empty($val['key'])) {
-                    $val['key'] = self::downloadImg($val['key'], $school_id);
-                    $val['key'] = self::strip_content_tags($val['key']);
-                }
-
-                // 处理题干中的公式
-                if (empty($val['stem'])) {
-                    continue;
-                } else {
-                    $val['stem'] = self::downloadImg($val['stem'], $school_id);
-                    $val['stem'] = self::strip_content_tags($val['stem']);
-
-                    // 若是填空题下划线处理
-                    if ($val['type'] == '填空') {
-                        preg_match_all('/_{5,}/', $val['stem'], $matgap);
-                        if (!empty($matgap[0])) {
-                            $nnum = 0;
-                            foreach ($matgap[0] as $km => $vm) {
-                                $nnum = $km + 1;
-                                $val['stem'] = preg_replace('/_{3,}/', '<img class="tiankong" src="/images/list_' . $nnum . '.png">', $val['stem'], 1);
-                            }
-
-                            // 填空题是否多个答案
-                            preg_match_all('/<p>(.*?)<\/p>/', $val['key'], $key_array);
-                            if ($nnum > 1 && $key_array[1]) {
-                                $result_array = array_filter($key_array[1]);
-                                if ($result_array) {
-                                    if (count($result_array) == $nnum) { // 如果填空数与答案数匹配
-                                        $val['key'] = $key_array[1];
-                                    } else { // 出现填空数与答案数不一致情况处理
-                                        $new_array = array();
-                                        $new_nnum = $nnum - 1;
-                                        for ($t = 0; $t <= $new_nnum; $t++) {
-                                            if (isset($result_array[$t])) {
-                                                $new_array[] = $result_array[$t];
-                                            } else {
-                                                $new_array[] = '';
-                                            }
-                                        }
-                                        $val['key'] = $new_array;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-
-                // 试题解析
-                if (!empty($val['analysis'])) {
-                    $val['analysis'] = self::downloadImg($val['analysis'], $school_id);
-                    $val['analysis'] = self::strip_content_tags($val['analysis']);
-                }
-
-                // 单选题处理
-                if (!empty($val['options'])) {
-                    foreach ($val['options'] as $vk => &$vp) {
-                        $vp = self::downloadImg($vp, $school_id);
-                        $vp = self::strip_content_tags($vp);
-                        // $val['options'][$vk] = $vp;
-                    }
-                }
-
-                // 获取默认文件夹id
-                $defaultFolder = $schdbh->query('SELECT `folder_id` FROM `topic_folder` WHERE `is_system`=1')->fetch(PDO::FETCH_ASSOC);
-                $folderId = empty($defaultFolder['folder_id']) ? 0 : $defaultFolder['folder_id'];
-
-                // 获取试题id
-                //$getUid =   $schdbh->query('SELECT UUID_SHORT() AS uuid')->fetch(PDO::FETCH_ASSOC);
-                //$resUid =   substr($getUid['uuid'],-6);
-
-                // 设置默认难度
-                $difficulty = isset($val['difficulty']) ? $val['difficulty'] : 1;
-
-                // 试题入库处理
-                try {
-                    $schdbh->beginTransaction(); // 开启事务
-
-                    $now_time = time();
-
-                    // topic表
-                    $row = null;
-
-                    $stmt = $schdbh->prepare('UPDATE `topic` SET `topic_title` = :topic_title,`topic_difficulty` = :topic_difficulty,`source_title`=:source_title,`parse_content`=:parse_content,`update_time`=:update_time,`is_word_topic`=:is_word_topic WHERE `topic_id` =:topic_id');
-                    $stmt->execute(array(':topic_id' => $paper_topic_relation_data[$key]['topic_id'], ':topic_title' => $val['stem'], ':topic_difficulty' => $difficulty, ':source_title' => 'word上传试题', ':parse_content' => $val['analysis'], ':update_time' => time(), ':is_word_topic' => 0));
-
-                    // topic_item
-                    $stmt = $schdbh->prepare('UPDATE `topic_item` SET `topic_title` = :topic_title WHERE `topic_id` =:topic_id');
-                    $stmt->execute(array(':topic_id' => $paper_topic_relation_data[$key]['topic_id'], ':topic_title' => $val['stem']));
-
-
-                    // 单选题处理
-                    if ($type_id == 1 || $type_id == 2) {
-
-                        // 获取正确答案
-                        $answerNums = array();
-                        $getAnswer = str_replace(array(" ", " ", "\t", "\n", "\r"), '', strip_tags($val['key']));
-                        $getAnswer = strtoupper($getAnswer);
-                        foreach ($this->charToNum as $char => $num) {
-                            if (strpos($getAnswer, $char) !== false) {
-                                $answerNums[] = $num;
-                            }
-                        }
-                        $topic_option_data = $schdbh->query('SELECT * FROM `topic_item_option` WHERE `topic_id`=' . $paper_topic_relation_data[$key]['topic_id'] . ' and option_correct = 1')->fetch(PDO::FETCH_ASSOC);
-                        if ($topic_option_data) {
-                            if (count($val['options']) < ($topic_option_data['sort_order'] + 1)) {
-                                throw new PDOException('此题选项未包含设置的答案项!');
-                            }
-
-                            $stmt = $schdbh->prepare('delete from  `topic_item_option`  WHERE `topic_id` =:topic_id');
-                            $stmt->execute(array(':topic_id' => $paper_topic_relation_data[$key]['topic_id']));
-                            $rowThr = null;
-                            $rowThr = $schdbh->prepare('INSERT INTO `topic_item_option`(`topic_id`, `option_content`, `option_correct`,`sort_order`) VALUES (:tpid,:content,:correct,:sort_order)');
-
-
-                            foreach ($val['options'] as $vk => $option) {
-                                $is_true = 0;
-                                if ($topic_option_data) {
-                                    if (in_array($vk, $answerNums)) {
-										$is_true = 1;
-									}
-                                }
-
-                                $getRowThr = $rowThr->execute(array(':tpid' => $paper_topic_relation_data[$key]['topic_id'], ':content' => $option, ':correct' => $is_true, ':sort_order' => $vk));
-                            }
-                        } else {
-                            if (count($val['options']) < $anserNum + 1) {
-                                throw new PDOException('此题选项未包含设置的答案项!');
-                            }
-                            $stmt = $schdbh->prepare('delete from  `topic_item_option`  WHERE `topic_id` =:topic_id');
-                            $stmt->execute(array(':topic_id' => $paper_topic_relation_data[$key]['topic_id']));
-                            $rowFiv = null;
-                            $rowThr = $schdbh->prepare('INSERT INTO `topic_item_option`(`topic_id`, `option_content`, `option_correct`,`sort_order`) VALUES (:tpid,:content,:correct,:sort_order)');
-
-                            foreach ($val['options'] as $vk => $option) {
-                                $is_true = 0;
-                                if ($anserNum == $vk) {
-                                    $is_true = 1;
-                                }
-
-                                $getRowThr = $rowThr->execute(array(':tpid' => $paper_topic_relation_data[$key]['topic_id'], ':content' => $option, ':correct' => $is_true, ':sort_order' => $vk));
-                            }
-                        }
-
-
-                    } else {
-                        $stmt = $schdbh->prepare('delete from  `topic_item_option`  WHERE `topic_id` =:topic_id');
-                        $stmt->execute(array(':topic_id' => $paper_topic_relation_data[$key]['topic_id']));
-                        $rowFiv = null;
-                        $rowFiv = $schdbh->prepare('INSERT INTO `topic_item_option`(`topic_id`, `option_content`) VALUES (:tpid,:content)');
-                        if (is_array($val['key']) && $val['key']) {
-                            foreach ($val['key'] as $topicKey) {
-                                $getRowFiv = $rowFiv->execute(array(':tpid' => $paper_topic_relation_data[$key]['topic_id'], ':content' => $topicKey));
-                            }
-                        } else {
-                            $getRowFiv = $rowFiv->execute(array(':tpid' => $paper_topic_relation_data[$key]['topic_id'], ':content' => $val['key']));
-                            if (!$getRowFiv) {
-                                throw new PDOException('插入topic_item_option表失败!');
-                            }
-                        }
-                    }
-
-                    // word与试题关系
-                    $rowFor = null;
-                    $rowFor = $schdbh->prepare('INSERT INTO `word_topic_relation`(`word_id`, `topic_id`) VALUES (:wid,:toid)');
-                    $getRowFor = $rowFor->execute(array(':wid' => $word_id, ':toid' => $paper_topic_relation_data[$key]['topic_id']));
-                    if (!$getRowFor) {
-                        throw new PDOException('插入word_to_topic表失败!');
-                    }
-
-                    $schdbh->commit();
-                } catch (PDOException $e) {
-                    $schdbh->rollback(); // 执行失败,事务回滚
-
-                    $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                    $stmt->execute(array(':wid' => $word_id, ':reason' => $e->getMessage(), ':content' => $getWordJson, ':time' => time()));
-
-                    exit($e->getMessage());
-                }
-
-            }
-
-            // 处理完
-            $resu = $schdbh->prepare('UPDATE `topic_word` SET `status` = 2,`parse_time`=:time WHERE `word_id` =:wid');
-            $resu->execute(array(':wid' => $word_id, ':time' => time()));
-
-            $resu = $schdbh->prepare('UPDATE `exam_group` SET `is_answersheet` = 1 WHERE `exam_group_id` =:exam_group_id');
-            $resu->execute(array(':exam_group_id' => $wordInfo['exam_group_id']));
-
-            // 插入解析时间记录
-            $resPro = $schdbh->prepare("INSERT INTO `exam_process` (`exam_group_id`, `action_type`, `action_time`) VALUES (:exam_group_id, :tempType, :time)");
-            $resPro->execute(array(':exam_group_id' => $wordInfo['exam_group_id'], ':tempType' => 4, ':time' => time()));
-
-            // 监控日志
-            //$teachInfo  = $schdbh->query('SELECT `teacher_name` FROM `teacher` WHERE `teacher_id`="'.$wordInfo['uploader_id'].'"')->fetch(PDO::FETCH_ASSOC);
-            BMonitorLog::model()->addLog(array(
-                'school_id' => $school_id,
-                'teacher_id' => $wordInfo['uploader_id'],
-                'log_content' => array(
-                    '助教',
-                    '上传了',
-                    $wordInfo['word_name'],
-                    '试卷'
-                )
-            ));
-
-            $schdbh = null;
-            if($apiTopics && $isQxk){
-                //调用试题检索接口
-                $this->searchTopics($apiTopics,$school_id);
-            }
-            exit('解析完成!');
-        }
-    }
-
-    /**
-     * @param $string
-     * @return mixed
-     * 校本卷库word解析
-     */
-    public function actionXbpaper()
-    {
-
-        // 获取curl过来值
-        $word_id = isset($_GET['wid']) ? intval($_GET['wid']) : 0;
-        $school_id = isset($_GET['sid']) ? intval($_GET['sid']) : 0;
-        if (empty($word_id) || empty($school_id)) {
-            exit('未找到word Id或者学校id');
-        }
-
-        // 连接业务库
-        $busDsn = 'mysql:host=' . Yii::app()->params["default_server"]['addr'] . ';dbname=' . Yii::app()->params["default_db"]['name'] . ';';
-        $busdbh = new PDO($busDsn, Yii::app()->params["default_server"]['username'], Yii::app()->params["default_server"]['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8";'));
-        $getDataBase = $busdbh->query('SELECT * FROM `database` WHERE `school_id`=' . $school_id);
-        $dataBaseInfo = $getDataBase->fetch(PDO::FETCH_ASSOC);
-        if (empty($dataBaseInfo)) {
-            exit('未找到数据库链接信息!');
-        }
-        $busdbh = null;
-
-        // 连接学校库
-        $schDsn = 'mysql:host=' . $dataBaseInfo['database_host'] . ';dbname=' . $dataBaseInfo['database_name'] . ';';
-        $schdbh = new PDO($schDsn, $dataBaseInfo['database_user'], $dataBaseInfo['database_password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8";'));
-        $wordInfo = $schdbh->query('SELECT `word_id`,`word_name`,`subject_id`,`uploader_id`,`topic_paper_id` FROM `topic_word` WHERE `word_id`=' . $word_id)->fetch(PDO::FETCH_ASSOC);
-        if (empty($wordInfo)) {
-            exit('未找到上传word信息!');
-        }
-
-        $getWordJson = file_get_contents('php://input');
-        $jsonArray = json_decode($getWordJson, true);
-        if (!$jsonArray || $jsonArray['errcode'] > 0) { // 解析失败
-            $docUrl = isset($jsonArray['docurl']) ? $jsonArray['docurl'] : '';
-            $word_down_url = self::downloadWord($wordInfo, $docUrl, $school_id);
-            $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,`file_path` = :path,parse_time=:time WHERE `word_id` =:wid');
-            $stmt->execute(array(':wid' => $word_id, ':reason' => $jsonArray['errmsg'], ':content' => $getWordJson, ':path' => $word_down_url, ':time' => time()));
-            exit('解析失败!');
-        } else {
-
-            if (empty($jsonArray['items'])) {
-                $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                $stmt->execute(array(':wid' => $word_id, ':reason' => '返回word试题内容为空', ':content' => $getWordJson, ':time' => time()));
-                exit('返回试题内容为空');
-            } else {
-                $sctmt = $schdbh->prepare('UPDATE `topic_word` SET `content` = :content,parse_time=:time WHERE `word_id` =:wid');
-                $sctmt->execute(array(':wid' => $word_id, ':time' => time(), ':content' => $getWordJson));
-            }
-
-            // 试题入库操作
-            foreach ($jsonArray['items'] as $key => $val) {
-
-                // 试题类型ID
-                switch ($val['type']) {
-                    case '选择':
-                        $type_id = 1;
-                        break;
-                    case '多选':
-                        $type_id = 2;
-                        break;
-                    case '填空':
-                        $type_id = 5;
-                        break;
-                    default:
-                        $type_id = 7;
-                }
-
-                //处理答案
-                if (!empty($val['key'])) {
-                    $val['key'] = self::downloadImg($val['key'], $school_id);
-                    $val['key'] = self::strip_content_tags($val['key']);
-                }
-
-                // 处理题干中的公式
-                if (empty($val['stem'])) {
-                    continue;
-                } else {
-                    $val['stem'] = self::downloadImg($val['stem'], $school_id);
-                    $val['stem'] = self::strip_content_tags($val['stem']);
-
-                    // 若是填空题下划线处理
-                    if ($val['type'] == '填空') {
-                        preg_match_all('/_{5,}/', $val['stem'], $matgap);
-                        if (!empty($matgap[0])) {
-                            $nnum = 0;
-                            foreach ($matgap[0] as $km => $vm) {
-                                $nnum = $km + 1;
-                                $val['stem'] = preg_replace('/_{3,}/', '<img class="tiankong" src="/images/list_' . $nnum . '.png">', $val['stem'], 1);
-                            }
-
-                            // 填空题是否多个答案
-                            preg_match_all('/<p>(.*?)<\/p>/', $val['key'], $key_array);
-                            if ($nnum > 1 && $key_array[1]) {
-                                $result_array = array_filter($key_array[1]);
-                                if ($result_array) {
-                                    if (count($result_array) == $nnum) { // 如果填空数与答案数匹配
-                                        $val['key'] = $key_array[1];
-                                    } else { // 出现填空数与答案数不一致情况处理
-                                        $new_array = array();
-                                        $new_nnum = $nnum - 1;
-                                        for ($t = 0; $t <= $new_nnum; $t++) {
-                                            if (isset($result_array[$t])) {
-                                                $new_array[] = $result_array[$t];
-                                            } else {
-                                                $new_array[] = '';
-                                            }
-                                        }
-                                        $val['key'] = $new_array;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-
-                // 试题解析
-                if (!empty($val['analysis'])) {
-                    $val['analysis'] = self::downloadImg($val['analysis'], $school_id);
-                    $val['analysis'] = self::strip_content_tags($val['analysis']);
-                }
-
-                // 单选题处理
-                if (!empty($val['options'])) {
-                    foreach ($val['options'] as $vk => &$vp) {
-                        $vp = self::downloadImg($vp, $school_id);
-                        $vp = self::strip_content_tags($vp);
-                        // $val['options'][$vk] = $vp;
-                    }
-                }
-
-                // 获取默认文件夹id
-                $folderId = 0;
-
-                // 获取试题id
-                //$getUid =   $schdbh->query('SELECT UUID_SHORT() AS uuid')->fetch(PDO::FETCH_ASSOC);
-                //$resUid =   substr($getUid['uuid'],-6);
-
-                $now_time = time();
-                $difficulty = isset($val['difficulty']) ? $val['difficulty'] : 1;
-
-                // 试题入库处理
-                try {
-                    $schdbh->beginTransaction(); // 开启事务
-
-                    // topic表 topic_from=1 校本卷库的题
-                    $row = null;
-                    $row = $schdbh->prepare('INSERT INTO `topic`(`topic_type`, `topic_title`, `topic_difficulty`, `folder_id`, `subject_id`,`source_title`, `parse_content`, `creator_id`,`updater_id`, `create_time`,`update_time`,`topic_from`) VALUES (:ttype,:ttile,:tdiff,:fid,:sid,:sotitle,:ana,:ceid,:upid,:time,:utime,1)'); // 执行第一个 SQL
-                    $row->execute(array(':ttype' => $type_id, ':ttile' => $val['stem'], ':tdiff' => $difficulty, ':fid' => $folderId, ':sid' => $wordInfo['subject_id'], ':sotitle' => 'word上传试题', ':ana' => $val['analysis'], ':ceid' => $wordInfo['uploader_id'], ':upid' => $wordInfo['uploader_id'], ':time' => $now_time, ':utime' => $now_time));
-                    $resUid = $schdbh->lastInsertId();
-                    if (!$resUid) {
-                        throw new PDOException('插入topic表失败!');
-                    }
-
-                    //topic_paper_relation
-                    $rowTpr = null;
-                    $rowTpr = $schdbh->prepare('INSERT INTO `topic_paper_relation`(`paper_id`, `topic_id`, `topic_type`, `topic_score`, `order`) VALUES (:paperId,:topicId,:topicType,:topicScore,:order)'); // 执行第一个 SQL
-                    $rowTpr->execute(array(':paperId' => $wordInfo['topic_paper_id'], ':topicId' => $resUid, ':topicType' => $type_id, ':topicScore' => $val['score'], ':order' => $key));
-                    $resTpr = $schdbh->lastInsertId();
-                    if (!$resTpr) {
-                        throw new PDOException('插入topic_paper_relation表失败!');
-                    }
-
-
-                    // topic_item
-                    $rowTwo = null;
-                    $rowTwo = $schdbh->prepare('INSERT INTO `topic_item`(`topic_id`, `topic_type`, `topic_title`) VALUES (:tpid,:type,:title)');
-                    $getRowTwo = $rowTwo->execute(array(':tpid' => $resUid, ':type' => $type_id, ':title' => $val['stem']));
-                    if (!$getRowTwo) {
-                        throw new PDOException('插入topic_item表失败!');
-                    }
-
-                    // 单选题处理
-                    if ($type_id == 1 || $type_id == 2) {
-
-                        // 获取正确答案
-                        $answerNums = array();
-                        $getAnswer = str_replace(array(" ", " ", "\t", "\n", "\r"), '', strip_tags($val['key']));
-                        $getAnswer = strtoupper($getAnswer);
-                        foreach ($this->charToNum as $char => $num) {
-                            if (strpos($getAnswer, $char) !== false) {
-                                $answerNums[] = $num;
-                            }
-                        }
-
-                        $rowThr = null;
-                        $rowThr = $schdbh->prepare('INSERT INTO `topic_item_option`(`topic_id`, `option_content`, `option_correct`,`sort_order`) VALUES (:tpid,:content,:correct,:sort_order)');
-                        foreach ($val['options'] as $vk => $option) {
-                            $is_true = 0;
-                            if (in_array($vk, $answerNums)) {
-								$is_true = 1;
-							}
-                            $getRowThr = $rowThr->execute(array(':tpid' => $resUid, ':content' => $option, ':correct' => $is_true, 'sort_order' => $vk));
-                        }
-                    } else {
-                        $rowFiv = null;
-                        $rowFiv = $schdbh->prepare('INSERT INTO `topic_item_option`(`topic_id`, `option_content`) VALUES (:tpid,:content)');
-                        if (is_array($val['key']) && $val['key']) {
-                            foreach ($val['key'] as $topicKey) {
-                                $getRowFiv = $rowFiv->execute(array(':tpid' => $resUid, ':content' => $topicKey));
-                            }
-                        } else {
-                            $getRowFiv = $rowFiv->execute(array(':tpid' => $resUid, ':content' => $val['key']));
-                            if (!$getRowFiv) {
-                                throw new PDOException('插入topic_item_option表失败!');
-                            }
-                        }
-                    }
-
-                    // word与试题关系
-                    $rowFor = null;
-                    $rowFor = $schdbh->prepare('INSERT INTO `word_topic_relation`(`word_id`, `topic_id`) VALUES (:wid,:toid)');
-                    $getRowFor = $rowFor->execute(array(':wid' => $word_id, ':toid' => $resUid));
-                    if (!$getRowFor) {
-                        throw new PDOException('插入word_to_topic表失败!');
-                    }
-
-                    $schdbh->commit();
-                } catch (PDOException $e) {
-                    $schdbh->rollback(); // 执行失败,事务回滚
-                    exit($e->getMessage());
-                }
-            }
-
-            // 处理完
-            $resu = $schdbh->prepare('UPDATE `topic_word` SET `status` = 2,`parse_time`=:time WHERE `word_id` =:wid');
-            $resu->execute(array(':wid' => $word_id, ':time' => time()));
-
-            // 监控日志
-            $teachInfo = $schdbh->query('SELECT `teacher_name` FROM `teacher` WHERE `teacher_id`="' . $wordInfo['uploader_id'] . '"')->fetch(PDO::FETCH_ASSOC);
-            BMonitorLog::model()->addLog(array(
-                'school_id' => $school_id,
-                'teacher_id' => $wordInfo['uploader_id'],
-                'log_content' => array(
-                    $teachInfo['teacher_name'],
-                    '上传了',
-                    $wordInfo['word_name'],
-                    '校本卷库'
-                )
-            ));
-
-            $schdbh = null;
-            exit('解析完成!');
-        }
-    }
 
     /**
      * 全学科第三方试卷解析
@@ -913,12 +42,11 @@ class WordapiController extends CController
         }
 		// 连接业务库
         $busDsn = Yii::app()->businessDb;
-        $dataBaseInfo = $busDsn->createCommand('SELECT * FROM `database` WHERE `school_id`=' . $school_id)->queryOne();
+        $dataBaseInfo = $busDsn->createCommand('SELECT * FROM `database` WHERE `school_id`=' . $school_id)->queryRow();
         if (empty($dataBaseInfo)) {
             exit('未找到数据库链接信息!');
         }
         $busdbh = null;
-
         // 连接学校库
         $schDsn = 'mysql:host=' . $dataBaseInfo['database_host'] . ';dbname=' . $dataBaseInfo['database_name'] . ';';
         $schdbh = new PDO($schDsn, $dataBaseInfo['database_user'], $dataBaseInfo['database_password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8";'));
@@ -969,7 +97,6 @@ class WordapiController extends CController
 				$stmt->execute(array(':wid' => $word_id, ':reason' => '未找到考试试题', ':content' => $getWordJson, ':time' => time()));
 				exit('未找到考试试题');
 			}
-
 			if (count($paper_topic_relation_data) != count($jsonArray['items'])) {
                             $stmt = $schdbh->prepare('UPDATE `topic_word` SET `status`=3,`wrong_reason`=:reason,`content`=:content,parse_time=:time WHERE `word_id`=:wid');
                             $stmt->execute(array(':wid' => $word_id, ':reason' => 'WORD题量与试卷题量不同', ':content' => $getWordJson, ':time' => time()));
@@ -1020,7 +147,6 @@ class WordapiController extends CController
 					}
 				}
 			}
-
 			if ($topic_type_error) {
 				$stmt = $schdbh->prepare('UPDATE `topic_word` SET `status` = 3,`wrong_reason` = :reason,`content` = :content, parse_time=:time WHERE `word_id` =:wid');
 				$stmt->execute(array(':wid' => $word_id, ':reason' => implode('<br/>', $topic_type_error), ':content' => $getWordJson, ':time' => time()));