Browse Source

fix:单页面

super-yimizi 2 months ago
parent
commit
fbd595a76f
3 changed files with 15 additions and 3 deletions
  1. 12 0
      addons/shop/config.php
  2. 1 1
      application/api/controller/Page.php
  3. 2 2
      application/common/model/Page.php

+ 12 - 0
addons/shop/config.php

@@ -194,6 +194,18 @@ return [
         'extend' => '',
     ],
     [
+        'name' => 'default_page_img',
+        'title' => '单页默认图片',
+        'type' => 'image',
+        'content' => [],
+        'value' => '/uploads/20250625/71bc5284f9de0e8ed7bf138c9fc5664e.jpg',
+        'rule' => '',
+        'msg' => '',
+        'tip' => '',
+        'ok' => '',
+        'extend' => '',
+    ],
+    [
         'name' => 'phone',
         'title' => '客服联系电话',
         'type' => 'string',

+ 1 - 1
application/api/controller/Page.php

@@ -29,7 +29,7 @@ class Page extends Base
         $image = $page->getData('image');
         $fields = explode(',', 'id,title,content,image,description,status,createtime');
         $page = array_intersect_key($page->toArray(), array_flip($fields));
-        $page['content'] = \addons\shop\library\Service::formatTplToUniapp($page['content']);
+        $page['content'] = \app\common\library\Service::formatTplToUniapp($page['content']);
         $page['image'] = $image ? cdnurl($image, true) : $image;
         $this->success('获取成功', $page);
     }

+ 2 - 2
application/common/model/Page.php

@@ -41,7 +41,7 @@ class Page extends Model
 
     public function getImageAttr($value, $data)
     {
-        $value = $value ? $value : self::$config['default_page_img'];
+        $value = $value ? $value : self::$config['default_page_img'] ?? '';
         return cdnurl($value, true);
     }
 
@@ -67,7 +67,7 @@ class Page extends Model
             ':month'   => date("m", $time),
             ':day'     => date("d", $time)
         ];
-        $suffix = static::$config['moduleurlsuffix']['page'] ?? static::$config['urlsuffix'];
+        $suffix = static::$config['moduleurlsuffix']['page'] ?? "";
         return addon_url('shop/page/index', $vars, $suffix, $domain);
     }