Browse Source

ComposerUpdate

Anyon 4 years ago
parent
commit
5b1b378041

+ 2 - 2
app/data/controller/NewsItem.php

@@ -95,9 +95,9 @@ class NewsItem extends Controller
         if ($this->request->isGet()) {
             $query = $this->app->db->name('DataNewsMark')->where(['deleted' => 0, 'status' => 1]);
             $this->mark = $query->order('sort desc,id desc')->select()->toArray();
-            $data['mark'] = mark_string_array($data['mark'] ?? '');
+            $data['mark'] = str2arr($data['mark'] ?? '');
         } else {
-            $data['mark'] = mark_array_string($data['mark'] ?? []);
+            $data['mark'] = arr2str($data['mark'] ?? []);
         }
     }
 

+ 3 - 3
app/data/controller/ShopGoods.php

@@ -83,7 +83,7 @@ class ShopGoods extends Controller
         $clist = $this->app->db->name('ShopGoodsCate')->whereIn('id', array_column($data, 'cate'))->column('pid,name,status', 'id');
         foreach ($data as &$vo) {
             $vo['cate'] = $clist[$vo['cate']] ?? $vo['cate'];
-            $vo['mark'] = mark_string_array($vo['mark'] ?: '', ',', $this->marks);
+            $vo['mark'] = str2arr($vo['mark'] ?: '', ',', $this->marks);
         }
     }
 
@@ -153,7 +153,7 @@ class ShopGoods extends Controller
             $data['code'] = CodeExtend::uniqidNumber(12, 'G');
         }
         if ($this->request->isGet()) {
-            $data['mark'] = mark_string_array($data['mark'] ?? '');
+            $data['mark'] = str2arr($data['mark'] ?? '');
             $this->marks = GoodsService::instance()->getMarkList();
             $this->cates = GoodsService::instance()->getCateList('arr2table');
             $fields = 'goods_sku `sku`,goods_code,goods_spec `key`,price_selling `selling`,price_market `market`,number_virtual `virtual`,number_express `express`,status';
@@ -163,7 +163,7 @@ class ShopGoods extends Controller
             if (empty($data['cover'])) $this->error('商品图片不能为空!');
             if (empty($data['slider'])) $this->error('轮播图不能为空!');
             // 商品规格保存
-            $data['mark'] = mark_array_string($data['mark'] ?? []);
+            $data['mark'] = arr2str($data['mark'] ?? []);
             [$count, $items] = [0, json_decode($data['data_items'], true)];
             foreach ($items as $item) {
                 $count += intval($item[0]['status']);

+ 2 - 3
app/data/controller/ShopGoodsCate.php

@@ -44,9 +44,8 @@ class ShopGoodsCate extends Controller
     public function index()
     {
         $this->title = "商品分类管理(最大{$this->cateLevel}级)";
-        $query = $this->_query($this->table);
-        $query->like('name')->equal('status')->dateBetween('create_at');
-        $query->where(['deleted' => 0])->order('sort desc,id desc')->page();
+        $query = $this->_query($this->table)->like('name')->dateBetween('create_at');
+        $query->equal('status')->where(['deleted' => 0])->order('sort desc,id desc')->page();
     }
 
     /**

+ 1 - 1
app/data/service/GoodsService.php

@@ -104,7 +104,7 @@ class GoodsService extends Service
         $items = $query->whereIn('goods_code', $codes)->where(['status' => 1])->select()->toArray();
         $marks = $this->app->db->name('ShopGoodsMark')->where(['status' => 1])->column('name');
         foreach ($data as &$vo) {
-            $vo['marks'] = mark_string_array($vo['mark'], ',', $marks);
+            $vo['marks'] = str2arr($vo['mark'], ',', $marks);
             $vo['cates'] = $cates[$vo['cate']] ?? [];
             $vo['slider'] = explode('|', $vo['slider']);
             $vo['specs'] = json_decode($vo['data_specs'], true);

+ 2 - 2
app/data/service/NewsService.php

@@ -42,7 +42,7 @@ class NewsService extends Service
             $cols = 'id,name,cover,mark,status,deleted,create_at,num_like,num_read,num_comment,num_collect';
             $items = $this->app->db->name('DataNewsItem')->whereIn('id', $cids)->column($cols, 'id');
             $marks = $this->app->db->name('DataNewsMark')->where(['status' => 1])->column('name');
-            foreach ($items as &$vo) $vo['mark'] = mark_string_array($vo['mark'] ?: '', ',', $marks);
+            foreach ($items as &$vo) $vo['mark'] = str2arr($vo['mark'] ?: '', ',', $marks);
             /*! 绑定会员数据 */
             $mids = array_unique(array_column($list, 'mid'));
             $cols = 'id,phone,nickname,username,headimg,status';
@@ -72,7 +72,7 @@ class NewsService extends Service
                 $cid2s = $this->app->db->name('DataNewsXCollect')->where($map)->where(['type' => 1])->column('cid');
             }
             foreach ($list as &$vo) {
-                $vo['mark'] = mark_string_array($vo['mark'] ?: '', ',', $marks);
+                $vo['mark'] = str2arr($vo['mark'] ?: '', ',', $marks);
                 $vo['my_like_state'] = in_array($vo['id'], $cid1s) ? 1 : 0;
                 $vo['my_coll_state'] = in_array($vo['id'], $cid2s) ? 1 : 0;
             }

+ 0 - 33
app/data/sys.php

@@ -1,37 +1,4 @@
 <?php
-
-if (!function_exists('mark_string_array')) {
-    /**
-     * 字符串转数组
-     * @param string $text 待转内容
-     * @param string $separ 分隔字符
-     * @param null|array $allow 限定规则
-     * @return array
-     */
-    function mark_string_array(string $text, string $separ = ',', $allow = null): array
-    {
-        $text = trim($text, $separ);
-        $data = $text ? explode($separ, $text) : [];
-        if (is_array($allow)) foreach ($data as $key => $mark) {
-            if (!in_array($mark, $allow)) unset($data[$key]);
-        }
-        return $data;
-    }
-}
-
-if (!function_exists('mark_array_string')) {
-    /**
-     * 数组转字符串
-     * @param array $data 待转数组
-     * @param string $separ 分隔字符
-     * @return string
-     */
-    function mark_array_string(array $data, string $separ = ',')
-    {
-        return join($separ, $data);
-    }
-}
-
 if (!function_exists('show_goods_spec')) {
     /**
      * 商品规格过滤显示

+ 4 - 4
vendor/composer/installed.json

@@ -893,12 +893,12 @@
         "source": {
             "type": "git",
             "url": "https://github.com/zoujingli/ThinkLibrary.git",
-            "reference": "ccf77d245ae379dca22241568abbb19c56676d65"
+            "reference": "cfde47e55fbe2a0d6efb9a7aff91a5c1b11cdfa3"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/ccf77d245ae379dca22241568abbb19c56676d65",
-            "reference": "ccf77d245ae379dca22241568abbb19c56676d65",
+            "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/cfde47e55fbe2a0d6efb9a7aff91a5c1b11cdfa3",
+            "reference": "cfde47e55fbe2a0d6efb9a7aff91a5c1b11cdfa3",
             "shasum": "",
             "mirrors": [
                 {
@@ -915,7 +915,7 @@
             "ext-mbstring": "*",
             "topthink/framework": "^6.0"
         },
-        "time": "2020-10-22T06:22:40+00:00",
+        "time": "2020-10-23T06:18:33+00:00",
         "type": "library",
         "extra": {
             "think": {

+ 1 - 1
vendor/services.php

@@ -1,5 +1,5 @@
 <?php 
-// This file is automatically generated at:2020-10-22 14:44:09
+// This file is automatically generated at:2020-10-23 14:29:29
 declare (strict_types = 1);
 return array (
   0 => 'think\\admin\\Library',

+ 1 - 1
vendor/zoujingli/think-library/src/Library.php

@@ -41,7 +41,7 @@ class Library extends Service
     /**
      * 扩展库版本号
      */
-    const VERSION = '6.0.17';
+    const VERSION = '6.0.18';
 
     /**
      * 启动服务

+ 58 - 25
vendor/zoujingli/think-library/src/common.php

@@ -141,7 +141,41 @@ if (!function_exists('sysoplog')) {
         return SystemService::instance()->setOplog($action, $content);
     }
 }
-
+if (!function_exists('str2arr')) {
+    /**
+     * 字符串转数组
+     * @param string $text 待转内容
+     * @param string $separ 分隔字符
+     * @param null|array $allow 限定规则
+     * @return array
+     */
+    function str2arr(string $text, string $separ = ',', ?array $allow = null): array
+    {
+        $text = trim($text, $separ);
+        $data = strlen($text) ? explode($separ, $text) : [];
+        if (is_array($allow)) foreach ($data as $key => $mark) {
+            if (!in_array($mark, $allow)) unset($data[$key]);
+        }
+        return $data;
+    }
+}
+if (!function_exists('arr2str')) {
+    /**
+     * 数组转字符串
+     * @param array $data 待转数组
+     * @param string $separ 分隔字符
+     * @param null|array $allow 限定规则
+     * @return string
+     */
+    function arr2str(array $data, string $separ = ',', ?array $allow = null)
+    {
+        $temp = $data;
+        if (is_array($allow)) foreach ($data as $item) {
+            if (in_array($item, $allow)) $temp[] = $item;
+        }
+        return $separ . join($separ, $temp) . $separ;
+    }
+}
 if (!function_exists('encode')) {
     /**
      * 加密 UTF8 字符串
@@ -170,6 +204,28 @@ if (!function_exists('decode')) {
         return iconv('GBK//TRANSLIT', 'UTF-8', $chars);
     }
 }
+if (!function_exists('enbase64url')) {
+    /**
+     * Base64安全URL编码
+     * @param string $string
+     * @return string
+     */
+    function enbase64url(string $string): string
+    {
+        return rtrim(strtr(base64_encode($string), '+/', '-_'), '=');
+    }
+}
+if (!function_exists('debase64url')) {
+    /**
+     * Base64安全URL解码
+     * @param string $string
+     * @return string
+     */
+    function debase64url(string $string): string
+    {
+        return base64_decode(str_pad(strtr($string, '-_', '+/'), strlen($string) % 4, '=', STR_PAD_RIGHT));
+    }
+}
 if (!function_exists('http_get')) {
     /**
      * 以get模拟网络请求
@@ -247,28 +303,6 @@ if (!function_exists('format_datetime')) {
         }
     }
 }
-if (!function_exists('enbase64url')) {
-    /**
-     * Base64安全URL编码
-     * @param string $string
-     * @return string
-     */
-    function enbase64url(string $string): string
-    {
-        return rtrim(strtr(base64_encode($string), '+/', '-_'), '=');
-    }
-}
-if (!function_exists('debase64url')) {
-    /**
-     * Base64安全URL解码
-     * @param string $string
-     * @return string
-     */
-    function debase64url(string $string): string
-    {
-        return base64_decode(str_pad(strtr($string, '-_', '+/'), strlen($string) % 4, '=', STR_PAD_RIGHT));
-    }
-}
 if (!function_exists('down_file')) {
     /**
      * 下载远程文件到本地
@@ -279,7 +313,6 @@ if (!function_exists('down_file')) {
      */
     function down_file(string $source, bool $force = false, int $expire = 0)
     {
-        $result = Storage::down($source, $force, $expire);
-        return $result['url'] ?? $source;
+        return Storage::down($source, $force, $expire)['url'] ?? $source;
     }
 }