소스 검색

Merge branch 'li_huaweicloud' of http://gitz.zhixinhuixue.net:18880/zxhx/xiaoben-as2-php into li_huaweicloud

24753255@qq.com 5 달 전
부모
커밋
ec00acb82f
4개의 변경된 파일39개의 추가작업 그리고 950개의 파일을 삭제
  1. 5 12
      protected/commands/WordPushCommand.php
  2. 1 2
      protected/controllers/ParseapiController.php
  3. 23 935
      protected/controllers/WordapiController.php
  4. 10 1
      protected/yiic.php

+ 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('未找到数据库链接信息!');
         }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 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);

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.