作者 Karson

优化本地插件插件的价格显示

... ... @@ -18,7 +18,6 @@ use think\Exception;
*/
class Addon extends Backend
{
protected $model = null;
public function _initialize()
... ... @@ -43,7 +42,7 @@ class Addon extends Backend
/**
* 配置
*/
public function config($ids = NULL)
public function config($ids = null)
{
$name = $this->request->get("name");
if (!$name) {
... ... @@ -54,8 +53,9 @@ class Addon extends Backend
}
$info = get_addon_info($name);
$config = get_addon_fullconfig($name);
if (!$info)
if (!$info) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
... ... @@ -290,7 +290,7 @@ class Addon extends Backend
$onlineaddons = [];
$result = Http::sendRequest(config('fastadmin.api_url') . '/addon/index');
if ($result['ret']) {
$json = json_decode($result['msg'], TRUE);
$json = (array)json_decode($result['msg'], true);
$rows = isset($json['rows']) ? $json['rows'] : [];
foreach ($rows as $index => $row) {
$onlineaddons[$row['name']] = $row;
... ... @@ -302,8 +302,9 @@ class Addon extends Backend
$addons = get_addon_list();
$list = [];
foreach ($addons as $k => $v) {
if ($search && stripos($v['name'], $search) === FALSE && stripos($v['intro'], $search) === FALSE)
if ($search && stripos($v['name'], $search) === false && stripos($v['intro'], $search) === false) {
continue;
}
if (isset($onlineaddons[$v['name']])) {
$v = array_merge($v, $onlineaddons[$v['name']]);
... ... @@ -314,7 +315,7 @@ class Addon extends Backend
$v['image'] = '';
$v['donateimage'] = '';
$v['demourl'] = '';
$v['price'] = '0.00';
$v['price'] = __('None');
$v['screenshots'] = [];
$v['releaselist'] = [];
}
... ... @@ -334,5 +335,4 @@ class Addon extends Backend
$callback = $this->request->get('callback') ? "jsonp" : "json";
return $callback($result);
}
}
... ...
... ... @@ -69,7 +69,7 @@ return [
'Setting' => '配置',
'Disable' => '禁用',
'Enable' => '启用',
'Your username or email' => '你的用户名或邮箱',
'Your username or email' => '你的手机号、用户名或邮箱',
'Your password' => '你的密码',
'Login FastAdmin' => '登录FastAdmin',
'Login' => '登录',
... ...
... ... @@ -521,6 +521,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
return '<a href="https://wpa.qq.com/msgrd?v=3&uin=' + row.qq + '&site=fastadmin.net&menu=yes" target="_blank" data-toggle="tooltip" title="' + __('Click to contact developer') + '" class="text-primary">' + value + '</a>';
},
price: function (value, row, index) {
if (isNaN(value)) {
return value;
}
return parseFloat(value) == 0 ? '<span class="text-success">' + __('Free') + '</span>' : '<span class="text-danger">¥' + value + '</span>';
},
downloads: function (value, row, index) {
... ...