From 2c02ed019b28a5073328b16de074080aa3d95ef8 Mon Sep 17 00:00:00 2001 From: Karson Date: Thu, 9 Mar 2023 17:42:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9C=AC=E5=9C=B0=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0cdnurl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复移动端站点配置不可见的问题 优化代码和注释 --- application/admin/controller/Ajax.php | 6 +- application/admin/view/addon/config.html | 4 +- .../admin/view/general/config/index.html | 9 --- extend/fast/Form.php | 8 +-- extend/fast/Random.php | 61 ------------------- 5 files changed, 10 insertions(+), 78 deletions(-) diff --git a/application/admin/controller/Ajax.php b/application/admin/controller/Ajax.php index 158082f8..3513eb16 100644 --- a/application/admin/controller/Ajax.php +++ b/application/admin/controller/Ajax.php @@ -59,8 +59,10 @@ class Ajax extends Backend public function upload() { Config::set('default_return_type', 'json'); - //必须设定cdnurl为空,否则cdnurl函数计算错误 - Config::set('upload.cdnurl', ''); + + //必须还原upload配置,否则分片及cdnurl函数计算错误 + Config::load(APP_PATH . 'extra/upload.php', 'upload'); + $chunkid = $this->request->post("chunkid"); if ($chunkid) { if (!Config::get('upload.chunking')) { diff --git a/application/admin/view/addon/config.html b/application/admin/view/addon/config.html index 036afad4..e5220cdd 100644 --- a/application/admin/view/addon/config.html +++ b/application/admin/view/addon/config.html @@ -70,13 +70,13 @@ {foreach name="item.content" item="vo"} {/foreach} - + {/case} {case radio} {foreach name="item.content" item="vo"} {/foreach} - + {/case} {case value="select" break="0"}{/case} {case value="selects"} diff --git a/application/admin/view/general/config/index.html b/application/admin/view/general/config/index.html index c8a39abb..b93f9aa2 100644 --- a/application/admin/view/general/config/index.html +++ b/application/admin/view/general/config/index.html @@ -21,15 +21,6 @@ visibility: visible; } - @media (max-width: 767px) { - .edit-form table tr th:nth-last-child(-n + 2), .edit-form table tr td:nth-last-child(-n + 2) { - display: none; - } - - .edit-form table tr td .msg-box { - display: none; - } - }
diff --git a/extend/fast/Form.php b/extend/fast/Form.php index 92f343dc..173b7380 100644 --- a/extend/fast/Form.php +++ b/extend/fast/Form.php @@ -42,10 +42,10 @@ use ArrayAccess; * @method static string checkboxs(string $name, array $list = [], string $checked = null, array $options = []) 一组复选框 * @method static string radio(string $name, string $value = null, string $checked = null, array $options = [])) 单个单选框 * @method static string radios(string $name, array $list = [], string $checked = null, array $options = [])) 一组单选框 - * @method static string image(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传图片组件 - * @method static string images(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传图片组件(多图)) - * @method static string upload(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传文件组件 - * @method static string uploads(string $name = null, string $value, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传文件组件(多文件)) + * @method static string image(string $name = null, string $value = null, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传图片组件 + * @method static string images(string $name = null, string $value = null, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传图片组件(多图)) + * @method static string upload(string $name = null, string $value = null, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传文件组件 + * @method static string uploads(string $name = null, string $value = null, array $inputAttr = [], array $uploadAttr = [], array $chooseAttr = [], array $previewAttr = []) 上传文件组件(多文件)) * @method static string button(string $value = null, array $options = []) 表单button */ class Form diff --git a/extend/fast/Random.php b/extend/fast/Random.php index 1e25a1d9..88109171 100644 --- a/extend/fast/Random.php +++ b/extend/fast/Random.php @@ -89,67 +89,6 @@ class Random } } - /** - * 根据数组元素的概率获得键名 - * - * @param array $ps array('p1'=>20, 'p2'=>30, 'p3'=>50); - * @param int $num 默认为1,即随机出来的数量 - * @param bool $unique 默认为true,即当num>1时,随机出的数量是否唯一 - * @return mixed 当num为1时返回键名,反之返回一维数组 - */ - public static function lottery($ps, $num = 1, $unique = true) - { - if (!$ps) { - return $num == 1 ? '' : []; - } - if ($num >= count($ps) && $unique) { - $res = array_keys($ps); - return $num == 1 ? $res[0] : $res; - } - $max_exp = 0; - $res = []; - foreach ($ps as $key => $value) { - $value = substr($value, 0, stripos($value, ".") + 6); - $exp = strlen(strchr($value, '.')) - 1; - if ($exp > $max_exp) { - $max_exp = $exp; - } - } - $pow_exp = pow(10, $max_exp); - if ($pow_exp > 1) { - reset($ps); - foreach ($ps as $key => $value) { - $ps[$key] = $value * $pow_exp; - } - } - $pro_sum = array_sum($ps); - if ($pro_sum < 1) { - return $num == 1 ? '' : []; - } - for ($i = 0; $i < $num; $i++) { - $rand_num = mt_rand(1, $pro_sum); - reset($ps); - foreach ($ps as $key => $value) { - if ($rand_num <= $value) { - break; - } else { - $rand_num -= $value; - } - } - if ($num == 1) { - $res = $key; - break; - } else { - $res[$i] = $key; - } - if ($unique) { - $pro_sum -= $value; - unset($ps[$key]); - } - } - return $res; - } - /** * 获取全球唯一标识 * @return string