소스 검색

太阳码

shish 10 달 전
부모
커밋
2feaa09efd
1개의 변경된 파일99개의 추가작업 그리고 24개의 파일을 삭제
  1. 99 24
      app-hd/controllers/MainController.php

+ 99 - 24
app-hd/controllers/MainController.php

@@ -70,10 +70,11 @@ class MainController extends BaseController
         util::success(['info' => $main]);
     }
 
-    //商城海报 ssh 20210610
+    //花束商城太阳 ssh 20210610
     public function actionGetMallPoster()
     {
         $shop = $this->shop;
+        $shopId = $this->shopId;
         $pfShopId = $shop->pfShopId ?? 0;
 
         $merchant = WxOpenClass::getMallWxInfo();
@@ -82,9 +83,6 @@ class MainController extends BaseController
         $scene = 'a=' . $this->shopAdminId . '&s=' . $this->shopId;
         $goodsImgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $goodsPage, $scene, $ptStyle);
 
-        $flowerPage = 'pages/item/item';
-        $flowerImgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $flowerPage, $scene, $ptStyle);
-
         $prefix = imgUtil::getPrefix();
         $titleBase64 = stringUtil::ossBase64('扫码买花');
 
@@ -93,35 +91,112 @@ class MainController extends BaseController
             $goodsMiniCodeBase64 = stringUtil::ossBase64($goodsImgUrl);
             $goodsUrl .= '/watermark,image_' . $goodsMiniCodeBase64 . ',g_north,x_0,y_40';
             $goodsUrl .= '/watermark,text_' . $titleBase64 . ',g_north,x_0,y_530,size_50';
+        } else {
+            $goodsUrl = imgUtil::groupImg($goodsImgUrl);
+        }
+
+        if (getenv('YII_ENV') != 'production' && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) {
+            $goodsLink = 'www.google.com';
+        } else {
+            $goodsShortUrl = 'wx_mini_goods_short_url' . $shopId;
+            $goodsLink = Yii::$app->redis->executeCommand('GET', [$goodsShortUrl]);
+            if (empty($goodsLink)) {
+                $goods = miniUtil::generateShortLink($merchant, 'pages/home/category?account=' . $shopId, '', $ptStyle);
+                $goodsLink = $goods['link'] ?? '';
+                Yii::$app->redis->executeCommand('SETEX', [$goodsShortUrl, 86400 * 3, $goodsLink]);
+            }
+        }
+        $respond = [
+            'goodsUrl' => $goodsUrl,
+            'goodsLink' => $goodsLink,
+        ];
+        util::success($respond);
+    }
+
+    //相册太阳码 ssh
+    public function actionGetAlbumPoster()
+    {
+        $shop = $this->shop;
+        $shopId = $this->shopId;
+        $pfShopId = $shop->pfShopId ?? 0;
+
+        $merchant = WxOpenClass::getMallWxInfo();
+        $goodsPage = 'pages/home/mall';
+        $ptStyle = dict::getDict('ptStyle', 'mall');
+        $scene = 'a=' . $this->shopAdminId . '&s=' . $this->shopId;
+        $goodsImgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $goodsPage, $scene, $ptStyle);
+
+        $prefix = imgUtil::getPrefix();
+        $titleBase64 = stringUtil::ossBase64('相册');
+
+        if ($pfShopId > 0) {
+            $albumUrl = $prefix . 'shop/miniCodeBg.jpg?x-oss-process=image';
+            $goodsMiniCodeBase64 = stringUtil::ossBase64($goodsImgUrl);
+            $albumUrl .= '/watermark,image_' . $goodsMiniCodeBase64 . ',g_north,x_0,y_40';
+            $albumUrl .= '/watermark,text_' . $titleBase64 . ',g_north,x_0,y_530,size_50';
+        } else {
+            $albumUrl = imgUtil::groupImg($goodsImgUrl);
+        }
 
+        if (getenv('YII_ENV') != 'production' && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) {
+            $albumLink = 'www.google.com';
+        } else {
+            $itemShortUrl = 'wx_mini_item_short_url' . $shopId;
+            $albumLink = Yii::$app->redis->executeCommand('GET', [$itemShortUrl]);
+            if (empty($albumLink)) {
+                $image = miniUtil::generateShortLink($merchant, 'pages/home/mall?account=' . $shopId, '', $ptStyle);
+                $albumLink = $image['link'] ?? '';
+                Yii::$app->redis->executeCommand('SETEX', [$itemShortUrl, 86400 * 3, $albumLink]);
+            }
+        }
+        $respond = [
+            'albumUrl' => $albumUrl,
+            'albumLink' => $albumLink,
+        ];
+        util::success($respond);
+    }
+
+    //花材绿植的太阳码 ssh 20250925
+    public function actionGetItemPoster()
+    {
+        $shop = $this->shop;
+        $shopId = $this->shopId;
+        $pfShopId = $shop->pfShopId ?? 0;
+
+        $merchant = WxOpenClass::getMallWxInfo();
+        $ptStyle = dict::getDict('ptStyle', 'mall');
+        $scene = 'a=' . $this->shopAdminId . '&s=' . $this->shopId;
+
+        $flowerPage = 'pages/item/item';
+        $flowerImgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $flowerPage, $scene, $ptStyle);
+
+        $prefix = imgUtil::getPrefix();
+        $titleBase64 = stringUtil::ossBase64('扫码买花');
+
+        if ($pfShopId > 0) {
             $flowerUrl = $prefix . 'shop/miniCodeBg.jpg?x-oss-process=image';
             $flowerMiniCodeBase64 = stringUtil::ossBase64($flowerImgUrl);
             $flowerUrl .= '/watermark,image_' . $flowerMiniCodeBase64 . ',g_north,x_0,y_40';
             $flowerUrl .= '/watermark,text_' . $titleBase64 . ',g_north,x_0,y_530,size_50';
-
-            $respond = [
-                'imgUrl' => $goodsUrl,
-                'flowerImgUrl' => $flowerUrl,
-            ];
         } else {
-            $goodsUrl = imgUtil::groupImg($goodsImgUrl);
             $flowerUrl = imgUtil::groupImg($flowerImgUrl);
-            $respond = [
-                'imgUrl' => $goodsUrl,
-                'flowerImgUrl' => $flowerUrl,
-            ];
         }
 
-        //零交会
-        $merchant = WxOpenClass::getWxInfo();
-        $page = 'admin/ljh/info';
-        $ptStyle = dict::getDict('ptStyle', 'hd');
-        $scene = "sw=1";
-        $imgUrl = miniUtil::generateUnlimitedMiniCode($merchant, $page, $scene, $ptStyle);
-        $apiHost = Yii::$app->params['hdImgHost'];
-        $ljh = $apiHost . $imgUrl;
-        $respond['ljhUrl'] = $ljh;
-
+        if (getenv('YII_ENV') != 'production' && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] != 'on')) {
+            $flowerLink = 'www.google.com';
+        } else {
+            $imageShortUrl = 'wx_mini_image_short_url' . $shopId;
+            $flowerLink = Yii::$app->redis->executeCommand('GET', [$imageShortUrl]);
+            if (empty($flowerLink)) {
+                $item = miniUtil::generateShortLink($merchant, 'pages/item/item?account=' . $shopId, '', $ptStyle);
+                $flowerLink = $item['link'] ?? '';
+                Yii::$app->redis->executeCommand('SETEX', [$imageShortUrl, 86400 * 3, $flowerLink]);
+            }
+        }
+        $respond = [
+            'flowerUrl' => $flowerUrl,
+            'flowerLink' => $flowerLink,
+        ];
         util::success($respond);
     }