Commit 728ecdcf authored by tufengqi's avatar tufengqi

格式化文件 删除无效代码

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