Browse Source

feat:试卷解析

yanghz 6 months ago
parent
commit
99f19039a1

+ 5 - 5
protected/commands/WordPushCommand.php

@@ -19,12 +19,12 @@ class WordPushCommand extends CConsoleCommand
     public function actionIndex($school_id = '', $YII_ENV = 'development')
     {
 		// 连接业务库
-        $pdoParam = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8";');
-        $businessServer = Yii::app()->params["businessDb"];
+//        $pdoParam = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES "utf8";');
+//        $businessServer = Yii::app()->params["businessDb"];
         $databaseFields = 'database_host,database_name,database_user,database_password,school_id';
-        $busDsn = 'mysql:host=' . $businessServer['addr'] . ';dbname=' . Yii::app()->params["default_db"]['name'] . ';';
-        $busDbh = new PDO($busDsn, $businessServer['username'], $businessServer['password'], $pdoParam);
-
+//        $busDsn = 'mysql:host=' . $businessServer['addr'] . ';dbname=' . Yii::app()->params["default_db"]['name'] . ';';
+//        $busDbh = new PDO($busDsn, $businessServer['username'], $businessServer['password'], $pdoParam);
+        $busDbh = Yii::app()->businessDb;
         // 获取所有可用的学校
         if ($school_id) {
             $dataSql = "SELECT {$databaseFields} FROM `database` WHERE `school_id` IN ({$school_id})";

+ 5 - 4
protected/controllers/ParseapiController.php

@@ -26,8 +26,9 @@ class ParseapiController extends CController
         }
         
         // 连接业务库
-        $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";'));
+//        $busDsn = 'mysql:host=' . Yii::app()->params["businessDb"]['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;
         $getDataBase = $busDbh->query('SELECT * FROM `database` WHERE `school_id`=' . $schoolId);
         $dataBaseInfo = $getDataBase->fetch(PDO::FETCH_ASSOC);
         if (empty($dataBaseInfo)) {
@@ -370,7 +371,7 @@ class ParseapiController extends CController
                 }
 
                 // 如果是全学科题库标注任务推送给题库
-                $zsyapiParam = Yii::app()->params['api'][3];
+                $zsyapiParam = Yii::app()->params['api'][1];
                 $zsyapiParam['prefix'] .= 'task_exam/check_topic';
                 self::getApiData($zsyapiParam, 2, json_encode(array('examGroupId' => $word['exam_group_id'], 'topics' => $taskCheckTopics)), 5);
 
@@ -575,7 +576,7 @@ class ParseapiController extends CController
         
         //全学科试题调用java检索缓存接口
         public function searchTopics($topicIds = array(),$schoolId = 0){
-            $apiParam = Yii::app()->params['api'][4];
+            $apiParam = Yii::app()->params['api'][3];
             if($apiParam && $topicIds && $schoolId){
                 $url = $apiParam['prefix'].'cgi/teacher/schtk/qxk/school-topic-flush/'.$schoolId;
                 self::getApiData(array(

+ 4 - 4
protected/controllers/WordapiController.php

@@ -9,7 +9,6 @@ header("Content-type: text/html; charset=utf-8");
  */
 class WordapiController extends CController
 {
-    public $mtUrl = 'http://mt.zhixinhuixue.net/cgi-bin/mathtex.cgi?';
     public $ucloud = '';
     public $webSiteUrl = '';
     public $charToNum = array('A'=>0,'B'=>1,'C'=>2,'D'=>3,'E'=>4,'F'=>5);
@@ -36,8 +35,9 @@ class WordapiController extends CController
         }
         
         // 连接业务库
-        $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";'));
+//        $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;
         $getDataBase = $busdbh->query('SELECT * FROM `database` WHERE `school_id`=' . $school_id);
         $dataBaseInfo = $getDataBase->fetch(PDO::FETCH_ASSOC);
         if (empty($dataBaseInfo)) {
@@ -1414,7 +1414,7 @@ class WordapiController extends CController
     
     //全学科试题调用java检索缓存接口
     public function searchTopics($topicIds = array(),$schoolId = 0){
-        $apiParam = Yii::app()->params['api'][4];
+        $apiParam = Yii::app()->params['api'][3];
         if($apiParam && $topicIds && $schoolId){
             $url = $apiParam['prefix'].'cgi/teacher/schtk/qxk/school-topic-flush/'.$schoolId;
             self::getApiData(array(