mirror of https://gitee.com/karson/fastadmin.git
Compare commits
No commits in common. "7c9841cee9411886dfe20f3103f24ec4865d41c0" and "c5d26b7f3a60508f5cad8403ee2eb1b99d1eb9b3" have entirely different histories.
7c9841cee9
...
c5d26b7f3a
|
|
@ -152,7 +152,7 @@ class Crud extends Command
|
|||
/**
|
||||
* JSON后缀
|
||||
*/
|
||||
protected $jsonSuffix = ['json', 'array'];
|
||||
protected $jsonSuffix = ['json'];
|
||||
|
||||
/**
|
||||
* 标签后缀
|
||||
|
|
@ -879,7 +879,7 @@ class Crud extends Command
|
|||
$formEditElement = Form::input('text', $fieldName, $editValue, $attrArr);
|
||||
} elseif ($inputType == 'fieldlist') {
|
||||
$itemArr = $this->getItemArray($itemArr, $field, $v['COLUMN_COMMENT']);
|
||||
$templateName = !isset($itemArr['key']) && count($itemArr) > 0 ? (isset($itemArr['value']) && count($itemArr) === 1 ? 'fieldlist-array' : 'fieldlist-template') : 'fieldlist';
|
||||
$templateName = !isset($itemArr['key']) && !isset($itemArr['value']) && count($itemArr) > 0 ? 'fieldlist-template' : 'fieldlist';
|
||||
$itemKey = isset($itemArr['key']) ? ucfirst($itemArr['key']) : 'Key';
|
||||
$itemValue = isset($itemArr['value']) ? ucfirst($itemArr['value']) : 'Value';
|
||||
$theadListArr = $tbodyListArr = [];
|
||||
|
|
@ -1542,7 +1542,7 @@ EOD;
|
|||
{
|
||||
$itemArr = [];
|
||||
$comment = str_replace(',', ',', $comment);
|
||||
if (stripos($comment, ':') !== false && stripos($comment, '=') !== false) {
|
||||
if (stripos($comment, ':') !== false && stripos($comment, ',') && stripos($comment, '=') !== false) {
|
||||
list($fieldLang, $item) = explode(':', $comment);
|
||||
$itemArr = [];
|
||||
foreach (explode(',', $item) as $k => $v) {
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
|
||||
<dl class="list-unstyled fieldlist" data-name="{%fieldName%}" data-template="{%fieldName%}tpl">
|
||||
<dd>
|
||||
<ins>{:__('{%itemValue%}')}</ins>
|
||||
</dd>
|
||||
<dd>
|
||||
<ins><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></ins>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<textarea name="{%fieldName%}" class="form-control hide" cols="30" rows="5">{%fieldValue%}</textarea>
|
||||
<script id="{%fieldName%}tpl" type="text/html">
|
||||
<dd class="form-inline">
|
||||
<ins><input type="text" name="<%=name%>[<%=index%>][value]" class="form-control" size="15" value="<%=row%>"/></ins>
|
||||
<ins>
|
||||
<span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span>
|
||||
<span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span>
|
||||
</ins>
|
||||
</dd>
|
||||
</script>
|
||||
|
||||
|
|
@ -399,8 +399,7 @@ CREATE TABLE `fa_test` (
|
|||
`keywords` varchar(255) DEFAULT '' COMMENT '关键字',
|
||||
`description` varchar(255) DEFAULT '' COMMENT '描述',
|
||||
`city` varchar(100) DEFAULT '' COMMENT '省市',
|
||||
`array` varchar(255) DEFAULT '' COMMENT '数组:value=值',
|
||||
`json` varchar(255) DEFAULT '' COMMENT '配置:key=名称,value=值',
|
||||
`json` varchar(255) DEFAULT NULL COMMENT '配置:key=名称,value=值',
|
||||
`multiplejson` varchar(1500) DEFAULT '' COMMENT '二维数组:title=标题,intro=介绍,author=作者,age=年龄',
|
||||
`price` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '价格',
|
||||
`views` int(10) unsigned DEFAULT '0' COMMENT '点击',
|
||||
|
|
|
|||
|
|
@ -248,10 +248,9 @@ if (!function_exists('addtion')) {
|
|||
if ($v['model']) {
|
||||
$model = new $v['model'];
|
||||
} else {
|
||||
// 优先判断使用table的配置
|
||||
$model = $v['table'] ? \think\Db::table($v['table']) : \think\Db::name($v['name']);
|
||||
$model = $v['name'] ? \think\Db::name($v['name']) : \think\Db::table($v['table']);
|
||||
}
|
||||
$primary = $v['primary'] ?: $model->getPk();
|
||||
$primary = $v['primary'] ? $v['primary'] : $model->getPk();
|
||||
$result[$v['field']] = isset($ids[$v['field']]) ? $model->where($primary, 'in', $ids[$v['field']])->column($v['column'], $primary) : [];
|
||||
}
|
||||
|
||||
|
|
@ -280,6 +279,60 @@ if (!function_exists('var_export_short')) {
|
|||
function var_export_short($data, $return = true)
|
||||
{
|
||||
return var_export($data, $return);
|
||||
$replaced = [];
|
||||
$count = 0;
|
||||
|
||||
//判断是否是对象
|
||||
if (is_resource($data) || is_object($data)) {
|
||||
return var_export($data, $return);
|
||||
}
|
||||
|
||||
//判断是否有特殊的键名
|
||||
$specialKey = false;
|
||||
array_walk_recursive($data, function (&$value, &$key) use (&$specialKey) {
|
||||
if (is_string($key) && (stripos($key, "\n") !== false || stripos($key, "array (") !== false)) {
|
||||
$specialKey = true;
|
||||
}
|
||||
});
|
||||
if ($specialKey) {
|
||||
return var_export($data, $return);
|
||||
}
|
||||
array_walk_recursive($data, function (&$value, &$key) use (&$replaced, &$count, &$stringcheck) {
|
||||
if (is_object($value) || is_resource($value)) {
|
||||
$replaced[$count] = var_export($value, true);
|
||||
$value = "##<{$count}>##";
|
||||
} else {
|
||||
if (is_string($value) && (stripos($value, "\n") !== false || stripos($value, "array (") !== false)) {
|
||||
$index = array_search($value, $replaced);
|
||||
if ($index === false) {
|
||||
$replaced[$count] = var_export($value, true);
|
||||
$value = "##<{$count}>##";
|
||||
} else {
|
||||
$value = "##<{$index}>##";
|
||||
}
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
});
|
||||
|
||||
$dump = var_export($data, true);
|
||||
|
||||
$dump = preg_replace('#(?:\A|\n)([ ]*)array \(#i', '[', $dump); // Starts
|
||||
$dump = preg_replace('#\n([ ]*)\),#', "\n$1],", $dump); // Ends
|
||||
$dump = preg_replace('#=> \[\n\s+\],\n#', "=> [],\n", $dump); // Empties
|
||||
$dump = preg_replace('#\)$#', "]", $dump); //End
|
||||
|
||||
if ($replaced) {
|
||||
$dump = preg_replace_callback("/'##<(\d+)>##'/", function ($matches) use ($replaced) {
|
||||
return $replaced[$matches[1]] ?? "''";
|
||||
}, $dump);
|
||||
}
|
||||
|
||||
if ($return === true) {
|
||||
return $dump;
|
||||
} else {
|
||||
echo $dump;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ class Http
|
|||
} else {
|
||||
$defaults[CURLOPT_CUSTOMREQUEST] = $method;
|
||||
}
|
||||
$defaults[CURLOPT_POSTFIELDS] = is_array($params) && count(array_filter($params, 'is_array')) > 0 ? $query_string : $params;
|
||||
$defaults[CURLOPT_POSTFIELDS] = $params;
|
||||
}
|
||||
|
||||
$defaults[CURLOPT_HEADER] = false;
|
||||
|
|
|
|||
|
|
@ -115,14 +115,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
|||
align: 'left',
|
||||
formatter: Controller.api.formatter.title
|
||||
},
|
||||
{
|
||||
field: 'intro',
|
||||
title: __('Intro'),
|
||||
operate: 'LIKE',
|
||||
align: 'left',
|
||||
class: 'visible-lg',
|
||||
formatter: Controller.api.formatter.intro
|
||||
},
|
||||
{field: 'intro', title: __('Intro'), operate: 'LIKE', align: 'left', class: 'visible-lg'},
|
||||
{
|
||||
field: 'author',
|
||||
title: __('Author'),
|
||||
|
|
@ -717,15 +710,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
|||
if ($(".btn-switch.active").data("type") == "local") {
|
||||
// return value;
|
||||
}
|
||||
var title = '<a class="title" href="' + row.url + '" data-toggle="tooltip" title="' + __('View addon home page') + '" target="_blank"><span class="' + Fast.api.escape(row.color) + '">' + value + '</span></a>';
|
||||
var title = '<a class="title" href="' + row.url + '" data-toggle="tooltip" title="' + __('View addon home page') + '" target="_blank">' + value + '</a>';
|
||||
if (row.screenshots && row.screenshots.length > 0) {
|
||||
title += ' <a href="javascript:;" data-index="' + index + '" class="view-screenshots text-success" title="' + __('View addon screenshots') + '" data-toggle="tooltip"><i class="fa fa-image"></i></a>';
|
||||
}
|
||||
return title;
|
||||
},
|
||||
intro: function (value, row, index) {
|
||||
return row.intro + (row.extend ? "<a href='" + Fast.api.escape(row.extend[1]) + "' class='" + Fast.api.escape(row.extend[2]) + "'>" + Fast.api.escape(row.extend[0]) + "</a>" : "");
|
||||
},
|
||||
operate: function (value, row, index) {
|
||||
return Template("operatetpl", {item: row, index: index});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -278,18 +278,6 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
|
|||
time: 2000
|
||||
}, callback);
|
||||
},
|
||||
escape: function (text) {
|
||||
if (typeof text === 'string') {
|
||||
return text
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''')
|
||||
.replace(/`/g, '`');
|
||||
}
|
||||
return text;
|
||||
},
|
||||
toastr: Toastr,
|
||||
layer: Layer
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue