Commit 499661ec authored by tufengqi's avatar tufengqi

输出帮助类修改

parent 89dc771c
...@@ -35,7 +35,7 @@ class ResponseApi ...@@ -35,7 +35,7 @@ class ResponseApi
'msg' => $msg, 'msg' => $msg,
]; ];
$json = json_encode($view); $json = json_encode($view);
self::dumpJsonData($json, $flag); return self::dumpJsonData($json, $flag);
} }
/** /**
...@@ -52,7 +52,7 @@ class ResponseApi ...@@ -52,7 +52,7 @@ class ResponseApi
BaseConstant::VAL => $msg BaseConstant::VAL => $msg
]; ];
$json = json_encode($view); $json = json_encode($view);
self::dumpJsonData($json, $flag); return self::dumpJsonData($json, $flag);
} }
/** /**
...@@ -74,7 +74,7 @@ class ResponseApi ...@@ -74,7 +74,7 @@ class ResponseApi
* @param $json * @param $json
* @param string $flag * @param string $flag
*/ */
public static function dumpJsonData($json, $flag = '') public static function dumpJsonData($json)
{ {
$callback = ''; $callback = '';
if (true === self::$is_support_jsonp) { if (true === self::$is_support_jsonp) {
...@@ -89,10 +89,7 @@ class ResponseApi ...@@ -89,10 +89,7 @@ class ResponseApi
if (!$callback) { if (!$callback) {
self::header('Content-type', 'application/json'); self::header('Content-type', 'application/json');
} }
echo $json; return $json;
if (BaseConstant::FINALTAG === $flag) {
exit;
}
} }
/** /**
...@@ -108,10 +105,10 @@ class ResponseApi ...@@ -108,10 +105,10 @@ class ResponseApi
if ($callback) { if ($callback) {
$callback = Html::encode($callback_key); $callback = Html::encode($callback_key);
self::header('Content-type', 'application/javascript'); self::header('Content-type', 'application/javascript');
echo $callback . '(' . $json_str . ')'; return $callback . '(' . $json_str . ')';
} else { } else {
self::header('Content-type', 'application/json'); self::header('Content-type', 'application/json');
echo $json_str; return $json_str;
} }
} }
/** /**
...@@ -127,10 +124,10 @@ class ResponseApi ...@@ -127,10 +124,10 @@ class ResponseApi
if ($callback) { if ($callback) {
$callback = Html::encode($callback_key); $callback = Html::encode($callback_key);
self::header('Content-type', 'application/javascript'); self::header('Content-type', 'application/javascript');
echo $callback . '(' . json_encode($arr) . ')'; return $callback . '(' . json_encode($arr) . ')';
} else { } else {
self::header('Content-type', 'application/json'); self::header('Content-type', 'application/json');
echo json_encode($arr); return json_encode($arr);
} }
} }
...@@ -149,10 +146,10 @@ class ResponseApi ...@@ -149,10 +146,10 @@ class ResponseApi
if ($callback) { if ($callback) {
$callback = Html::encode($callback_key); $callback = Html::encode($callback_key);
self::header('Content-type', 'application/javascript'); self::header('Content-type', 'application/javascript');
echo $callback . '(' . json_encode($arr) . ')'; return $callback . '(' . json_encode($arr) . ')';
} else { } else {
self::header('Content-type', 'application/json'); self::header('Content-type', 'application/json');
echo json_encode($arr); return json_encode($arr);
} }
} }
......
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