瀏覽代碼

商品详情

lizhen_gitee 4 月之前
父節點
當前提交
61e1908537
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. 1 0
      addons/shopro/controller/goods/Goods.php
  2. 14 0
      application/common.php

+ 1 - 0
addons/shopro/controller/goods/Goods.php

@@ -123,6 +123,7 @@ class Goods extends Common
         $skuPrices = $goods['new_sku_prices'];
         $content = $goods['content'];
         $goods = $goods->toArray();
+        $goods['images'] = array_domain_image($goods['images']);
         $goods['sku_prices'] = $skuPrices;
         $goods['content'] = $content;
         unset($goods['new_sku_prices']);

+ 14 - 0
application/common.php

@@ -560,6 +560,20 @@ if (!function_exists('one_domain_image')) {
         return $one;
     }
 }
+if (!function_exists('json_domain_image')) {
+//支持单个字段,需要增加domain_cdnurl
+//支持image,images
+    function array_domain_image($one)
+    {
+        if(!empty($one)){
+            foreach ($one as $key => $val) {
+                $one[$key] = localpath_to_netpath($val);
+            }
+        }
+
+        return $one;
+    }
+}
 if (!function_exists('localpath_to_netpath')) {
 //本地地址转换为网络地址
     function localpath_to_netpath($path)