浏览代码

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

Karson 6 年之前
父节点
当前提交
499e43c6d5
共有 3 个文件被更改,包括 11 次插入8 次删除
  1. 7 7
      application/admin/controller/Addon.php
  2. 1 1
      application/admin/lang/zh-cn/addon.php
  3. 3 0
      public/assets/js/backend/addon.js

+ 7 - 7
application/admin/controller/Addon.php

@@ -18,7 +18,6 @@ use think\Exception;
  */
  */
 class Addon extends Backend
 class Addon extends Backend
 {
 {
-
     protected $model = null;
     protected $model = null;
 
 
     public function _initialize()
     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");
         $name = $this->request->get("name");
         if (!$name) {
         if (!$name) {
@@ -54,8 +53,9 @@ class Addon extends Backend
         }
         }
         $info = get_addon_info($name);
         $info = get_addon_info($name);
         $config = get_addon_fullconfig($name);
         $config = get_addon_fullconfig($name);
-        if (!$info)
+        if (!$info) {
             $this->error(__('No Results were found'));
             $this->error(__('No Results were found'));
+        }
         if ($this->request->isPost()) {
         if ($this->request->isPost()) {
             $params = $this->request->post("row/a");
             $params = $this->request->post("row/a");
             if ($params) {
             if ($params) {
@@ -290,7 +290,7 @@ class Addon extends Backend
             $onlineaddons = [];
             $onlineaddons = [];
             $result = Http::sendRequest(config('fastadmin.api_url') . '/addon/index');
             $result = Http::sendRequest(config('fastadmin.api_url') . '/addon/index');
             if ($result['ret']) {
             if ($result['ret']) {
-                $json = json_decode($result['msg'], TRUE);
+                $json = (array)json_decode($result['msg'], true);
                 $rows = isset($json['rows']) ? $json['rows'] : [];
                 $rows = isset($json['rows']) ? $json['rows'] : [];
                 foreach ($rows as $index => $row) {
                 foreach ($rows as $index => $row) {
                     $onlineaddons[$row['name']] = $row;
                     $onlineaddons[$row['name']] = $row;
@@ -302,8 +302,9 @@ class Addon extends Backend
         $addons = get_addon_list();
         $addons = get_addon_list();
         $list = [];
         $list = [];
         foreach ($addons as $k => $v) {
         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;
                 continue;
+            }
 
 
             if (isset($onlineaddons[$v['name']])) {
             if (isset($onlineaddons[$v['name']])) {
                 $v = array_merge($v, $onlineaddons[$v['name']]);
                 $v = array_merge($v, $onlineaddons[$v['name']]);
@@ -314,7 +315,7 @@ class Addon extends Backend
                 $v['image'] = '';
                 $v['image'] = '';
                 $v['donateimage'] = '';
                 $v['donateimage'] = '';
                 $v['demourl'] = '';
                 $v['demourl'] = '';
-                $v['price'] = '0.00';
+                $v['price'] = __('None');
                 $v['screenshots'] = [];
                 $v['screenshots'] = [];
                 $v['releaselist'] = [];
                 $v['releaselist'] = [];
             }
             }
@@ -334,5 +335,4 @@ class Addon extends Backend
         $callback = $this->request->get('callback') ? "jsonp" : "json";
         $callback = $this->request->get('callback') ? "jsonp" : "json";
         return $callback($result);
         return $callback($result);
     }
     }
-
 }
 }

+ 1 - 1
application/admin/lang/zh-cn/addon.php

@@ -69,7 +69,7 @@ return [
     'Setting'                        => '配置',
     'Setting'                        => '配置',
     'Disable'                        => '禁用',
     'Disable'                        => '禁用',
     'Enable'                         => '启用',
     'Enable'                         => '启用',
-    'Your username or email'         => '你的用户名或邮箱',
+    'Your username or email'         => '你的手机号、用户名或邮箱',
     'Your password'                  => '你的密码',
     'Your password'                  => '你的密码',
     'Login FastAdmin'                => '登录FastAdmin',
     'Login FastAdmin'                => '登录FastAdmin',
     'Login'                          => '登录',
     'Login'                          => '登录',

+ 3 - 0
public/assets/js/backend/addon.js

@@ -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>';
                     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) {
                 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>';
                     return parseFloat(value) == 0 ? '<span class="text-success">' + __('Free') + '</span>' : '<span class="text-danger">¥' + value + '</span>';
                 },
                 },
                 downloads: function (value, row, index) {
                 downloads: function (value, row, index) {