소스 검색

收款码

shish 5 년 전
부모
커밋
37a9bb247e
4개의 변경된 파일19개의 추가작업 그리고 11개의 파일을 삭제
  1. 16 4
      app-hd/controllers/ShopController.php
  2. 2 1
      biz-hd/merchant/classes/ShopClass.php
  3. 0 5
      biz-hd/merchant/services/ShopService.php
  4. 1 1
      common/components/qrCodeUtil.php

+ 16 - 4
app-hd/controllers/ShopController.php

@@ -91,11 +91,10 @@ class ShopController extends BaseController
         if (empty($shop)) {
             util::fail('没有找到门店');
         }
-        ShopService::valid($shop->attributes, $this->sjId);
-        $gatheringCode = ShopService::generateGatheringCode($this->sjId, $id);
-        $filename = Yii::$app->params['hdImgHost'] . 'gathering/1.jpg?x-oss-process=image/watermark,image_' . base64_encode($gatheringCode . '?x-oss-process=image/resize,P_55') . ',g_nw,x_278,y_465/watermark,image_' . base64_encode('gathering/logo.jpg') . ',g_nw,x_510,y_685';
+        ShopClass::valid($shop->attributes, $this->sjId);
+        $imgUrl = ShopClass::generateGatheringCode($this->sjId, $id);
         $shopName = $shop->shopName ?? '';
-        $file = fopen($filename, "rb");
+        $file = fopen($imgUrl, "rb");
         Header("Content-type:  application/octet-stream ");
         Header("Accept-Ranges:  bytes ");
         Header("Content-Disposition:  attachment;filename={$shopName}收款码.jpg");
@@ -107,6 +106,19 @@ class ShopController extends BaseController
         fclose($file);
     }
 
+    //获取二维码
+    public function actionGetGatheringCodeUrl()
+    {
+        $id = Yii::$app->request->get('id', 0);
+        $shop = ShopService::getById($id, true);
+        if (empty($shop)) {
+            util::fail('没有找到门店');
+        }
+        ShopClass::valid($shop->attributes, $this->sjId);
+        $imgUrl = ShopClass::generateGatheringCode($this->sjId, $id);
+        util::success(['url' => $imgUrl]);
+    }
+
     //获取小程序的收款码 ssh
     public function actionGatheringMiniCode()
     {

+ 2 - 1
biz-hd/merchant/classes/ShopClass.php

@@ -90,7 +90,8 @@ class ShopClass extends BaseClass
         //强制转成https
         $url = httpUtil::becomeHttps($url);
         $gatheringCode = qrCodeUtil::generateGatheringQrCode($url, $sjId, $shopId, '', 10);
-        return $gatheringCode;
+        $imgUrl = Yii::$app->params['hdImgHost'] . 'gathering/1.jpg?x-oss-process=image/watermark,image_' . base64_encode($gatheringCode . '?x-oss-process=image/resize,P_55') . ',g_nw,x_278,y_465/watermark,image_' . base64_encode('gathering/logo.jpg') . ',g_nw,x_510,y_685';
+        return $imgUrl;
     }
 
 }

+ 0 - 5
biz-hd/merchant/services/ShopService.php

@@ -66,10 +66,5 @@ class ShopService extends BaseService
 		return ShopClass::deleteShop($shop);
 	}
 
-	//获取收款码 ssh 2020.3.9
-	public static function generateGatheringCode($sjId, $shopId)
-	{
-		return ShopClass::generateGatheringCode($sjId, $shopId);
-	}
 
 }

+ 1 - 1
common/components/qrCodeUtil.php

@@ -184,8 +184,8 @@ class qrCodeUtil
         $saveFile = $prefix . $behind;
         if (file_exists($saveFile) == false) {
             \QRcode::png($url, $saveFile, $errorCorrectionLevel, $matrixPointSize, 1);//最后的参数1表示空白间距
+            oss::uploadImage($behind, $saveFile);
         }
-        oss::uploadImage($behind, $saveFile);
         return $behind;
     }