Commit 728ecdcf authored by tufengqi's avatar tufengqi

格式化文件 删除无效代码

parent 2ab88f78
<?php <?php
namespace fpf\response; namespace fpf\response;
class BaseConstant class BaseConstant
......
<?php <?php
namespace fpf\response; namespace fpf\response;
use fpf\response\BaseConstant;
use yii\helpers\Html; use yii\helpers\Html;
use yii\web\Response; use yii\web\Response;
...@@ -24,6 +24,7 @@ class ResponseApi ...@@ -24,6 +24,7 @@ class ResponseApi
* @param string $msg * @param string $msg
* @param int $code * @param int $code
* @param string $flag * @param string $flag
* @return string
*/ */
public static function jsonError($msg = '', $code = -1, $flag = '') public static function jsonError($msg = '', $code = -1, $flag = '')
{ {
...@@ -41,8 +42,9 @@ class ResponseApi ...@@ -41,8 +42,9 @@ class ResponseApi
/** /**
* 成功返回接口 * 成功返回接口
* @param string $msg * @param string $msg
* @param string $flag
* @param int $code * @param int $code
* @param string $flag
* @return string
*/ */
public static function jsonSuccess($msg = '', $code = 0, $flag = '') public static function jsonSuccess($msg = '', $code = 0, $flag = '')
{ {
...@@ -72,7 +74,7 @@ class ResponseApi ...@@ -72,7 +74,7 @@ class ResponseApi
/** /**
* 根据是否为JSONP做特殊处理输出 * 根据是否为JSONP做特殊处理输出
* @param $json * @param $json
* @param string $flag * @return string
*/ */
public static function dumpJsonData($json) public static function dumpJsonData($json)
{ {
...@@ -94,7 +96,8 @@ class ResponseApi ...@@ -94,7 +96,8 @@ class ResponseApi
/** /**
* @param $json_str * @param $json_str
* @param $callback_key * @param string $callback_key
* @return string
*/ */
public static function printByJson($json_str, $callback_key = '') public static function printByJson($json_str, $callback_key = '')
{ {
...@@ -111,9 +114,11 @@ class ResponseApi ...@@ -111,9 +114,11 @@ class ResponseApi
return $json_str; return $json_str;
} }
} }
/** /**
* @param $json_str * @param $arr
* @param $callback_key * @param string $callback_key
* @return string
*/ */
public static function printByArr($arr, $callback_key = '') public static function printByArr($arr, $callback_key = '')
{ {
...@@ -131,10 +136,10 @@ class ResponseApi ...@@ -131,10 +136,10 @@ class ResponseApi
} }
} }
/** /**
* @param $json_str * @param $success_data
* @param $callback_key * @param string $callback_key
* @return string
*/ */
public static function printOldSuccess($success_data, $callback_key = '') public static function printOldSuccess($success_data, $callback_key = '')
{ {
......
...@@ -120,7 +120,7 @@ class ThriftAsyncServiceFactoryProxy ...@@ -120,7 +120,7 @@ class ThriftAsyncServiceFactoryProxy
$protocol = $this->protocol_factory_instanse->getProtocol($transport); $protocol = $this->protocol_factory_instanse->getProtocol($transport);
$bin_accel = ($protocol instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); $bin_accel = ($protocol instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary');
if ($bin_accel) { if ($bin_accel) {
thrift_protocol_write_binary($protocol, $func_name, TMessageType::CALL, $argsObj, 0, $protocol->isStrictWrite()); thrift_protocol_write_binary($protocol, $func_name, TMessageType::CALL, $args_obj, 0, $protocol->isStrictWrite());
} else { } else {
$protocol->writeMessageBegin($func_name, TMessageType::CALL, 0); $protocol->writeMessageBegin($func_name, TMessageType::CALL, 0);
$args_obj->write($protocol); $args_obj->write($protocol);
......
<?php <?php
namespace fpf\yii_component; namespace fpf\yii_component;
use Yii; use Yii;
...@@ -12,19 +13,22 @@ class Application extends Component ...@@ -12,19 +13,22 @@ class Application extends Component
public $terry; public $terry;
private $configures = []; private $configures = [];
private $debug_config = []; private $debug_config = [];
const APP_SELF_CONFIG_PREFIX = 'appself_';
public function __construct($config = []) public function __construct($config = [])
{ {
$this->trace_config = isset($_GET["__config"]); $this->trace_config = isset($_GET["__config"]);
} }
public function getDebugConfig() public function getDebugConfig()
{ {
return $this->debug_config; return $this->debug_config;
} }
public function welcome() public function welcome()
{ {
echo $this->terry . "Hello Welcome to MyComponent"; echo $this->terry . "Hello Welcome to MyComponent";
} }
/** /**
* 获取配置信息 * 获取配置信息
* @param string $name 配置名 * @param string $name 配置名
...@@ -58,6 +62,7 @@ class Application extends Component ...@@ -58,6 +62,7 @@ class Application extends Component
} }
return $config; return $config;
} }
/** /**
* 导入配置文件 * 导入配置文件
* @param string $file 配置文件名 * @param string $file 配置文件名
...@@ -68,7 +73,6 @@ class Application extends Component ...@@ -68,7 +73,6 @@ class Application extends Component
$config = []; $config = [];
foreach ($G_CONF_PATH as $path) { foreach ($G_CONF_PATH as $path) {
$fullpath = "$path$file.php"; $fullpath = "$path$file.php";
$exists = false;
if (!file_exists($fullpath)) { if (!file_exists($fullpath)) {
continue; continue;
} }
...@@ -92,17 +96,13 @@ class Application extends Component ...@@ -92,17 +96,13 @@ class Application extends Component
{ {
$set_cookie_val = Yii::$app->request->get('set_cookie_val', ''); $set_cookie_val = Yii::$app->request->get('set_cookie_val', '');
if ($set_cookie_val) { if ($set_cookie_val) {
$cookies = Yii::$app->response->cookies;
setcookie(VERSION_KEY, $set_cookie_val, time() + 3600 * 24 * 7); setcookie(VERSION_KEY, $set_cookie_val, time() + 3600 * 24 * 7);
\Yii::$app->response->format = Response::FORMAT_RAW; \Yii::$app->response->format = Response::FORMAT_RAW;
\Yii::$app->response->headers->add('Content-type', 'application/javascript;charset=utf-8'); \Yii::$app->response->headers->add('Content-type', 'application/javascript;charset=utf-8');
\Yii::$app->response->send(); \Yii::$app->response->send();
return; return;
} }
$app_self_config = Yii::$app->fpf->getConfig(self::APP_SELF_CONFIG_PREFIX . APP_NAME, 'common');
$user_ip = Yii::$app->request->userIP; $user_ip = Yii::$app->request->userIP;
$host_name = Yii::$app->request->getHostName();
$is_online_host = $this->isOnlineHost($host_name);
if ($this->isAllowIp($user_ip)) { if ($this->isAllowIp($user_ip)) {
\Yii::$app->response->headers->add('Content-type', 'text/html'); \Yii::$app->response->headers->add('Content-type', 'text/html');
\Yii::$app->response->send(); \Yii::$app->response->send();
...@@ -124,6 +124,7 @@ class Application extends Component ...@@ -124,6 +124,7 @@ class Application extends Component
} }
return $ret; return $ret;
} }
private function isAllowIp($user_ip) private function isAllowIp($user_ip)
{ {
$company_ip_list = Yii::$app->fpf->getConfig('company_ip_list', 'ip'); $company_ip_list = Yii::$app->fpf->getConfig('company_ip_list', 'ip');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment