Exemple #1
0
 /**
  *  执行Action
  */
 public static function run($class)
 {
     $instance = new $class();
     $instance->run();
     YLog::Write('System Run Class<run>:' . $class, YLog::DEBUG);
     ob_get_flush();
     return $instance;
 }
Exemple #2
0
 /**
  * 主动上报
  * @param $code
  * @param string $content
  * @internal param $details
  * @internal param array $data
  */
 static function report($code, $content = '')
 {
     $client = new YucRequest(YApp::getConfig('YUC_SERVICE_NAME'), YApp::getConfig('YUC_SERVICE_PORT'));
     $client->setTimeout(YApp::getConfig('YUC_CLIENT_TIMEOUT'));
     //设置超时
     $client->post(YApp::getConfig('YUC_MONITOR_PATH'), array('site_key' => YApp::getConfig('YUC_SITE_KEY'), 'code' => $code, 'content' => $content, 'datetime' => date("Y-m-d H:i:s"), 'server' => $_SERVER));
     $result = json_decode($client->getContent(), TRUE);
     YLog::Write(var_export($result, TRUE), YLog::DEBUG);
     if ($client->getStatus() == 200 && is_array($result) && count($result) == 2 && $result['result'] == 1) {
         YLog::Write('主动上报信息成功!Code:' . $code . ';Content:' . $content, YLog::DEBUG);
     } else {
         YLog::Write('主动上报信息失败!', YLog::DEBUG);
     }
 }
Exemple #3
0
 /**
  *  POST发送请求数据
  * @return array
  */
 private function doPost()
 {
     $client = new YucRequest(YApp::getConfig('YUC_SERVICE_NAME'), YApp::getConfig('YUC_SERVICE_PORT'));
     $client->setTimeout(YApp::getConfig('YUC_CLIENT_TIMEOUT'));
     //设置超时
     $client->post(YApp::getConfig('YUC_REQUEST_PATH'), $this->_local->getPostData());
     YLog::Write('请求:' . YApp::getConfig('YUC_SERVICE_NAME') . YApp::getConfig('YUC_REQUEST_PATH') . ';返回状态 :' . $client->getStatus() . ';POST请求返回的数据:' . $client->getContent(), YLog::DEBUG);
     $ret_back = json_decode($client->getContent(), TRUE);
     if (!is_array($ret_back)) {
         YucMonitor::report("REPORT_0004", $client->getContent());
     }
     return array('status' => $client->getStatus(), 'content' => $ret_back);
 }
Exemple #4
0
 /**
  *  析构函数
  */
 public function __destruct()
 {
     YLog::Write('System Run Time >>>>:' . (microtime(TRUE) - M_START_TIME), YLog::DEBUG);
 }
Exemple #5
0
 /**
  * 错误处理
  * @param $code
  * @param $message
  * @param $file
  * @param $line
  * @internal param $ <type> $e
  */
 public static function comError($code, $message, $file, $line)
 {
     $errors['Message'] = $message;
     $errors['Code'] = $code;
     $errors['Line'] = $line;
     $errors['File'] = $file;
     foreach ($errors as $key => $value) {
         YLog::Write("Error:{$key}:{$value}", Log::EMERG);
     }
 }
Exemple #6
0
 /**
  *  本地验证
  * @param type $ssid
  * @param type $result
  * @return type
  */
 public static function sendVerifyLocalRequest($ssid, $result)
 {
     $mass = self::context('yuc_mass', NULL, '');
     $code = YucCrypt::decrypt(base64_decode(urldecode($mass)), YucMath::erypt_key());
     $code = str_replace(",", "", $code);
     if ($code != '' && strtolower($code) === strtolower($result)) {
         self::$_result = 1;
         self::$_code = '';
         self::$_details = '验证码输入正确';
     } else {
         self::$_result = 0;
         self::$_code = 'E_LOCALVALID_001';
         self::$_details = '验证码验证失败';
     }
     YLog::Write('本地验证完成,输入结果为:' . $result . ';' . '', YLog::DEBUG);
 }