shish 6 anni fa
parent
commit
d98f3b4d23
1 ha cambiato i file con 42 aggiunte e 1 eliminazioni
  1. 42 1
      app/business/controllers/ShopController.php

+ 42 - 1
app/business/controllers/ShopController.php

@@ -3,6 +3,7 @@
 namespace business\controllers;
 
 use biz\merchant\services\ShopService;
+use common\components\dirUtil;
 use common\components\util;
 
 class ShopController extends BaseController
@@ -15,5 +16,45 @@ class ShopController extends BaseController
 		$list = ShopService::getShopList($where);
 		util::success($list);
 	}
-
+	
+	//下载收款码 shish 2020.2.29
+	public function actionDownloadGatheringCode()
+	{
+		$id = Yii::$app->request->get('id', 0);
+		$shop = ShopService::getById($id);
+		ShopService::valid($shop, $this->merchantId);
+		$gatheringCode = isset($shop['gatheringCode']) ? $shop['gatheringCode'] : '';
+		$file = dirUtil::getImgDir() . $gatheringCode;
+		if (file_exists($file) == false) {
+			util::fail('没有找到收款码');
+		}
+		$fileName = '收款码.jpg';
+		$contentType = 'image/jpeg';
+		header("Cache-control: private");
+		header("Content-type: $contentType"); //设置要下载的文件类型
+		header("Content-Length:" . filesize($file)); //设置要下载文件的文件大小
+		header("Content-Disposition: attachment; filename=" . urldecode($fileName)); //设置要下载文件的文件名
+		readfile($file);
+	}
+	
+	//下载注册会员码 shish 2020.2.29
+	public function actionDownloadApplyMemberCode()
+	{
+		$id = Yii::$app->request->get('id', 0);
+		$shop = ShopService::getById($id);
+		ShopService::valid($shop, $this->merchantId);
+		$applyMemberCode = isset($shop['applyMemberCode']) ? $shop['applyMemberCode'] : '';
+		$file = dirUtil::getImgDir() . $applyMemberCode;
+		if (file_exists($file) == false) {
+			util::fail('没有找到注册会员码');
+		}
+		$fileName = '注册会员码.jpg';
+		$contentType = 'image/jpeg';
+		header("Cache-control: private");
+		header("Content-type: $contentType"); //设置要下载的文件类型
+		header("Content-Length:" . filesize($file)); //设置要下载文件的文件大小
+		header("Content-Disposition: attachment; filename=" . urldecode($fileName)); //设置要下载文件的文件名
+		readfile($file);
+	}
+	
 }