| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace business\controllers;
- use biz\merchant\services\ShopService;
- use common\components\dirUtil;
- use common\components\util;
- class ShopController extends BaseController
- {
- //门店列表 shish 20202.2.29
- public function actionList()
- {
- $where = [];
- $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);
- }
-
- }
|