3 Commits 4fcab9db6b ... bd1bf5e415

Author SHA1 Message Date
  yanghz bd1bf5e415 Merge branch 'yhz_paper_paser_v1' into li_huaweicloud 5 months ago
  hwz 6c424a10ba 调整解析问题 5 months ago
  yanghz a4dc104561 feat:试卷解析 5 months ago

+ 5 - 12
protected/commands/WordPushCommand.php

@@ -19,11 +19,8 @@ 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";');
         $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);
         $busDbh = Yii::app()->businessDb;
         // 获取所有可用的学校
         if ($school_id) {
@@ -31,10 +28,8 @@ class WordPushCommand extends CConsoleCommand
         } else {
             $dataSql = "SELECT {$databaseFields} FROM `database` WHERE `school_id` IN (SELECT school_id FROM `school` WHERE `status`=0)";
         }
-
         // 找出学校的链接信息
-        $dataObj = $busDbh->query($dataSql);
-        $dataInfo = $dataObj->fetchAll(PDO::FETCH_ASSOC);
+        $dataInfo = $busDbh->createCommand($dataSql)->queryAll();
         if (empty($dataInfo)) {
             exit('未找到学校数据库链接信息!');
         }
@@ -47,15 +42,13 @@ class WordPushCommand extends CConsoleCommand
         }
 
 		$schoolIdString = implode(',', $schoolIds);
-        $schoolObj = $busDbh->query("SELECT s.school_id,r.region_name FROM `school` s LEFT JOIN `region` r ON r.region_id = s.province_id WHERE s.`school_id` IN ({$schoolIdString})");
-        $schoolInfo = $schoolObj->fetchAll(PDO::FETCH_ASSOC);
+        $schoolInfo = $busDbh->createCommand("SELECT s.school_id,r.region_name FROM `school` s LEFT JOIN `region` r ON r.region_id = s.province_id WHERE s.`school_id` IN ({$schoolIdString})")->queryAll();
         foreach ($schoolInfo as $key => $tempProvince) {
             $schoolProvince[$tempProvince['school_id']] = $tempProvince['region_name'];
         }
 
 		// 获取所有学科
-        $packSubject = array();
-        $subjectObj = $busDbh->query('SELECT subject_id,subject_name,section FROM `subject`')->fetchAll(PDO::FETCH_ASSOC);
+        $subjectObj = $busDbh->createCommand('SELECT subject_id,subject_name,section FROM `subject`')->queryAll();
         foreach($subjectObj as $tempSubject) {
             $packSubject[$tempSubject['subject_id']]['name'] = $tempSubject['subject_name'];
             $packSubject[$tempSubject['subject_id']]['section'] = $tempSubject['section'];
@@ -95,7 +88,7 @@ class WordPushCommand extends CConsoleCommand
 						if (empty($callbackUrl) || empty($analysisUrl)) continue;
 						echo $analysisUrl.'----'.$callbackUrl. "\n";
 
-						if (false !== strpos($info['word_path'], 'http://')) {
+						if (false !== strpos($info['word_path'], 'https://') || false !== strpos($info['word_path'], 'http://')) {
 							$time = time();
 							$arr = self::getFile($info['word_path'], '/tem', $info['uploader_id'] . $time . '.docx');
 							if ($arr && file_exists($arr['save_path'])) {

+ 1 - 2
protected/controllers/ParseapiController.php

@@ -29,8 +29,7 @@ class ParseapiController extends CController
 //        $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);
+        $dataBaseInfo = $busDbh->createCommand('SELECT * FROM `database` WHERE `school_id`=' . $schoolId)->queryOne();
         if (empty($dataBaseInfo)) {
             exit('未找到数据库链接信息!');
         }

File diff suppressed because it is too large
+ 23 - 935
protected/controllers/WordapiController.php


+ 10 - 1
protected/yiic.php

@@ -1,7 +1,16 @@
 <?php
 
 // change the following paths if necessary
+foreach ($_SERVER['argv'] as $k => $v) {
+    if (strpos($v, '--YII_ENV=') !== FALSE) {
+        $env = substr($v, strlen('--YII_ENV='));
+    }
+}
 $yiic=dirname(__FILE__).'/../framework/yiic.php';
-$config=dirname(__FILE__).'/config/console.php';
+$configFile = dirname(__FILE__)."/config/cache/console.{$env}.php";
+if (! file_exists($configFile)) {
+    $configFile=dirname(__FILE__)."/config/console.{$env}.php";;
+}
+$config=$configFile;
 
 require_once($yiic);

Some files were not shown because too many files changed in this diff