diff --git a/application/admin/command/Api/library/Extractor.php b/application/admin/command/Api/library/Extractor.php index bf16eb00..49bdf282 100644 --- a/application/admin/command/Api/library/Extractor.php +++ b/application/admin/command/Api/library/Extractor.php @@ -322,7 +322,6 @@ class Extractor if (preg_match_all('/@(?[A-Za-z_-]+)[\s\t]*\((?(?:(?!\)).)*)\)\r?/s', $docblock, $matches)) { $numMatches = count($matches[0]); - for ($i = 0; $i < $numMatches; ++$i) { // annotations has arguments @@ -330,7 +329,12 @@ class Extractor { $argsParts = trim($matches['args'][$i]); $name = $matches['name'][$i]; + $argsParts = preg_replace("/\{(\w+)\}/", '#$1#', $argsParts); $value = self::parseArgs($argsParts); + if(is_string($value)) + { + $value = preg_replace("/\#(\w+)\#/", '{$1}', $argsParts); + } } else { diff --git a/application/admin/command/Api/template/index.html b/application/admin/command/Api/template/index.html index ca21bbd2..aaa73b3d 100755 --- a/application/admin/command/Api/template/index.html +++ b/application/admin/command/Api/template/index.html @@ -382,27 +382,31 @@ //instead of the initial attribute var url = $(form).attr('action'); - var serializedData = new FormData(); + var formData = new FormData(); $(form).find('input').each(function (i, input) { if ($(input).attr('type') == 'file') { - serializedData.append($(input).attr('name'), $(input)[0].files[0]); + formData.append($(input).attr('name'), $(input)[0].files[0]); } else { - serializedData.append($(input).attr('name'), $(input).val()) + formData.append($(input).attr('name'), $(input).val()) } }); var index, key, value; if (matchedParamsInRoute) { + var params = {}; + formData.forEach(function(value, key){ + params[key] = value; + }); for (index = 0; index < matchedParamsInRoute.length; ++index) { try { key = matchedParamsInRoute[index]; - value = serializedData[key]; + value = params[key]; if (typeof value == "undefined") value = ""; - url = url.replace("{" + key + "}", value); - delete serializedData[key]; + url = url.replace("\{" + key + "\}", value); + formData.delete(key); } catch (err) { console.log(err); } @@ -425,7 +429,7 @@ $.ajax({ url: $('#apiUrl').val() + url, - data: $(form).attr('method') == 'get' ? $(form).serialize() : serializedData, + data: $(form).attr('method') == 'get' ? $(form).serialize() : formData, type: $(form).attr('method') + '', dataType: 'json', contentType: false, diff --git a/application/common/view/tpl/think_exception.tpl b/application/common/view/tpl/think_exception.tpl index 7ab0ccce..20fccf65 100755 --- a/application/common/view/tpl/think_exception.tpl +++ b/application/common/view/tpl/think_exception.tpl @@ -1,6 +1,7 @@ '发生错误', @@ -17,83 +18,84 @@ if (isset($_GET['lang'])) { } elseif (isset($_COOKIE['think_var'])) { $langSet = strtolower($_COOKIE['think_var']); } elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { - preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches); +preg_match('/^([a-z\d\-]+)/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $matches); $langSet = strtolower($matches[1]); } $langSet = $langSet && in_array($langSet, ['zh-cn', 'en']) ? $langSet : 'zh-cn'; $langSet == 'en' && $lang = array_combine(array_keys($lang), array_keys($lang)); + ?> - - - <?=$lang['An error occurred']?> - - - - - - -
-
- -
-
- -
-
-
+ + + <?=$lang['An error occurred']?> + + + + + + +
+
+ +
+
+ +
+
+
-

- -

+

+ +

-
-
- - -
-
- +
+
+ + +
+
+ \ No newline at end of file diff --git a/extend/fast/Date.php b/extend/fast/Date.php index b468b9fa..f592a4f5 100644 --- a/extend/fast/Date.php +++ b/extend/fast/Date.php @@ -62,6 +62,7 @@ class Date * @param string $output formatting string * @return string when only a single output is requested * @return array associative list of all outputs requested + * @from https://github.com/kohana/ohanzee-helpers/blob/master/src/Date.php */ public static function span($remote, $local = NULL, $output = 'years,months,weeks,days,hours,minutes,seconds') { diff --git a/extend/fast/Form.php b/extend/fast/Form.php index e76c1864..e503f098 100644 --- a/extend/fast/Form.php +++ b/extend/fast/Form.php @@ -5,6 +5,7 @@ namespace fast; use ArrayAccess; /** + * 表单元素生成 * @class Form * @package fast * @method mixed token() static token @@ -45,6 +46,12 @@ class Form } +/** + * + * 表单元素生成 + * @from https://github.com/illuminate/html + * @package fast + */ class FormBuilder { diff --git a/public/api.html b/public/api.html index 421c59f1..d45f6f80 100755 --- a/public/api.html +++ b/public/api.html @@ -33,7 +33,7 @@ - FastAdmin + FastAdmin @@ -3476,27 +3476,31 @@ //instead of the initial attribute var url = $(form).attr('action'); - var serializedData = new FormData(); + var formData = new FormData(); $(form).find('input').each(function (i, input) { if ($(input).attr('type') == 'file') { - serializedData.append($(input).attr('name'), $(input)[0].files[0]); + formData.append($(input).attr('name'), $(input)[0].files[0]); } else { - serializedData.append($(input).attr('name'), $(input).val()) + formData.append($(input).attr('name'), $(input).val()) } }); var index, key, value; if (matchedParamsInRoute) { + var params = {}; + formData.forEach(function(value, key){ + params[key] = value; + }); for (index = 0; index < matchedParamsInRoute.length; ++index) { try { key = matchedParamsInRoute[index]; - value = serializedData[key]; + value = params[key]; if (typeof value == "undefined") value = ""; - url = url.replace("{" + key + "}", value); - delete serializedData[key]; + url = url.replace("\{" + key + "\}", value); + formData.delete(key); } catch (err) { console.log(err); } @@ -3519,7 +3523,7 @@ $.ajax({ url: $('#apiUrl').val() + url, - data: $(form).attr('method') == 'get' ? $(form).serialize() : serializedData, + data: $(form).attr('method') == 'get' ? $(form).serialize() : formData, type: $(form).attr('method') + '', dataType: 'json', contentType: false,