shish пре 5 година
родитељ
комит
e1e4ffceaa
3 измењених фајлова са 190 додато и 145 уклоњено
  1. 165 144
      app-ghs/controllers/ShopController.php
  2. 22 0
      app-hd/controllers/ShopController.php
  3. 3 1
      sql.sql

+ 165 - 144
app-ghs/controllers/ShopController.php

@@ -16,148 +16,169 @@ use yii\web\UrlManager;
 
 class ShopController extends BaseController
 {
-	
-	//门店列表 shish 2021.1.14
-	public function actionList()
-	{
-		$where = [];
-		$where['merchantId'] = $this->sjId;
-		$where['delStatus'] = 0;
-		$list = ShopClass::getShopList($where);
-		util::success($list);
-	}
-	
-	//更新门店 shish 2020.2.29
-	public function actionUpdate()
-	{
-		$data = Yii::$app->request->post();
-		$data['merchantId'] = $this->sjId;
-		$id = $data['id'] ?? 0;
-		$shop = ShopService::getById($id);
-		if (empty($shop)) {
-			util::fail('没有找到门店');
-		}
-		ShopClass::valid($shop, $this->sjId);
-		ShopClass::updateShop($id, $data);
-		util::complete();
-	}
-	
-	//添加门店 shish 2021.1.14
-	public function actionAdd()
-	{
-		$data = Yii::$app->request->post();
-		$data['merchantId'] = $this->sjId;
-		ShopClass::addShop($data);
-		util::complete();
-	}
-	
-	//PC下载微信和支付宝收款码 shish 2020.2.29
-	public function actionGatheringCode()
-	{
-		$id = Yii::$app->request->get('id', 0);
-		$shop = ShopService::getById($id);
-		ShopClass::valid($shop, $this->sjId);
-		$gatheringCode = ShopClass::generateGatheringCode($this->sjId, $id);
-		$file = dirUtil::getImgDir() . $gatheringCode;
-		if (file_exists($file) == false) {
-			util::fail('没有找到收款码');
-		}
-		if (httpUtil::isMiniProgram()) {
-			$imgUrl = imgUtil::getPrefix() . $gatheringCode;
-			util::success(['imgUrl' => $imgUrl]);
-		}
-		$fileName = "门店({$id})收款码.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);
-	}
-	
-	//PC获取小程序的收款码 shish
-	public function actionGatheringMiniCode()
-	{
-		$id = Yii::$app->request->get('id', 0);
-		$extend = MerchantExtendService::getByMerchantId($this->sjId);
-		if ($extend['miniAuth'] == 0) {
-			util::fail('您的小程序还没有授权');
-		}
-		$shop = ShopService::getById($id);
-		ShopClass::valid($shop, $this->sjId);
-		$applyMemberCode = wxUtil::generateGatheringMiniCode($this->sj, $id);
-		$file = dirUtil::getImgDir() . $applyMemberCode;
-		if (file_exists($file) == false) {
-			util::fail('没有找到注册会员码');
-		}
-		if (httpUtil::isMiniProgram()) {
-			$imgUrl = imgUtil::getPrefix() . $applyMemberCode;
-			util::success(['imgUrl' => $imgUrl]);
-		}
-		$fileName = "门店({$id})小程序收款码.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);
-	}
-	
-	//PC下载会员注册码 shish 2020.2.29
-	public function actionApplyMemberCode()
-	{
-		$id = Yii::$app->request->get('id', 0);
-		$extend = MerchantExtendService::getByMerchantId($this->sjId);
-		if ($extend['miniAuth'] == 0) {
-			util::fail('您的小程序还没有授权');
-		}
-		$shop = ShopService::getById($id);
-		ShopClass::valid($shop, $this->sjId);
-		$applyMemberCode = wxUtil::generateMemberCode($this->sj, $id);
-		$file = dirUtil::getImgDir() . $applyMemberCode;
-		if (file_exists($file) == false) {
-			util::fail('没有找到注册会员码');
-		}
-		if (httpUtil::isMiniProgram()) {
-			$imgUrl = imgUtil::getPrefix() . $applyMemberCode;
-			util::success(['imgUrl' => $imgUrl]);
-		}
-		$fileName = "注册会员码{$id}.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.3.1
-	public function actionDelete()
-	{
-		$id = Yii::$app->request->get('id', 0);
-		$shop = ShopService::getById($id);
-		ShopClass::valid($shop, $this->sjId);
-		ShopClass::deleteShop($shop);
-		util::complete();
-	}
-	
-	//获取所有门店linqh 2021.1.31
-	public function actionAll()
-	{
-		$res = [];
-		//adminId 为 super 才有权限看到所有的门店
-		if ($this->admin['super'] == 1) {
-			$res = ShopClass::getAllShop($this->sjId);
-		}
-		util::success($res);
-	}
-	
-	//切换门店 linqh 2021.1.31
-	public function actionToggleShop()
-	{
-		$shopId = Yii::$app->request->post('shopId', 0);
-		$res = AdminClass::toggleShop($this->admin, $shopId, $this->sjId, $this->shopAdmin);
-		util::success($res);
-	}
-	
+
+    //门店列表 shish 2021.1.14
+    public function actionList()
+    {
+        $where = [];
+        $where['merchantId'] = $this->sjId;
+        $where['delStatus'] = 0;
+        $list = ShopClass::getShopList($where);
+        util::success($list);
+    }
+
+    //更新门店 shish 2020.2.29
+    public function actionUpdate()
+    {
+        $data = Yii::$app->request->post();
+        $data['merchantId'] = $this->sjId;
+        $id = $data['id'] ?? 0;
+        $shop = ShopService::getById($id);
+        if (empty($shop)) {
+            util::fail('没有找到门店');
+        }
+        ShopClass::valid($shop, $this->sjId);
+        ShopClass::updateShop($id, $data);
+        util::complete();
+    }
+
+    //添加门店 shish 2021.1.14
+    public function actionAdd()
+    {
+        $data = Yii::$app->request->post();
+        $data['merchantId'] = $this->sjId;
+        ShopClass::addShop($data);
+        util::complete();
+    }
+
+    //PC下载微信和支付宝收款码 shish 2020.2.29
+    public function actionGatheringCode()
+    {
+        $id = Yii::$app->request->get('id', 0);
+        $shop = ShopService::getById($id);
+        ShopClass::valid($shop, $this->sjId);
+        $gatheringCode = ShopClass::generateGatheringCode($this->sjId, $id);
+        $file = dirUtil::getImgDir() . $gatheringCode;
+        if (file_exists($file) == false) {
+            util::fail('没有找到收款码');
+        }
+        if (httpUtil::isMiniProgram()) {
+            $imgUrl = imgUtil::getPrefix() . $gatheringCode;
+            util::success(['imgUrl' => $imgUrl]);
+        }
+        $fileName = "门店({$id})收款码.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);
+    }
+
+    //PC获取小程序的收款码 shish
+    public function actionGatheringMiniCode()
+    {
+        $id = Yii::$app->request->get('id', 0);
+        $extend = MerchantExtendService::getByMerchantId($this->sjId);
+        if ($extend['miniAuth'] == 0) {
+            util::fail('您的小程序还没有授权');
+        }
+        $shop = ShopService::getById($id);
+        ShopClass::valid($shop, $this->sjId);
+        $applyMemberCode = wxUtil::generateGatheringMiniCode($this->sj, $id);
+        $file = dirUtil::getImgDir() . $applyMemberCode;
+        if (file_exists($file) == false) {
+            util::fail('没有找到注册会员码');
+        }
+        if (httpUtil::isMiniProgram()) {
+            $imgUrl = imgUtil::getPrefix() . $applyMemberCode;
+            util::success(['imgUrl' => $imgUrl]);
+        }
+        $fileName = "门店({$id})小程序收款码.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);
+    }
+
+    //PC下载会员注册码 shish 2020.2.29
+    public function actionApplyMemberCode()
+    {
+        $id = Yii::$app->request->get('id', 0);
+        $extend = MerchantExtendService::getByMerchantId($this->sjId);
+        if ($extend['miniAuth'] == 0) {
+            util::fail('您的小程序还没有授权');
+        }
+        $shop = ShopService::getById($id);
+        ShopClass::valid($shop, $this->sjId);
+        $applyMemberCode = wxUtil::generateMemberCode($this->sj, $id);
+        $file = dirUtil::getImgDir() . $applyMemberCode;
+        if (file_exists($file) == false) {
+            util::fail('没有找到注册会员码');
+        }
+        if (httpUtil::isMiniProgram()) {
+            $imgUrl = imgUtil::getPrefix() . $applyMemberCode;
+            util::success(['imgUrl' => $imgUrl]);
+        }
+        $fileName = "注册会员码{$id}.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.3.1
+    public function actionDelete()
+    {
+        $id = Yii::$app->request->get('id', 0);
+        $shop = ShopService::getById($id);
+        ShopClass::valid($shop, $this->sjId);
+        ShopClass::deleteShop($shop);
+        util::complete();
+    }
+
+    //获取所有门店linqh 2021.1.31
+    public function actionAll()
+    {
+        $res = [];
+        //adminId 为 super 才有权限看到所有的门店
+        if ($this->admin['super'] == 1) {
+            $res = ShopClass::getAllShop($this->sjId);
+        }
+        util::success($res);
+    }
+
+    //切换门店 linqh 2021.1.31
+    public function actionToggleShop()
+    {
+        $shopId = Yii::$app->request->post('shopId', 0);
+        $res = AdminClass::toggleShop($this->admin, $shopId, $this->sjId, $this->shopAdmin);
+        util::success($res);
+    }
+
+    //提现信息更新 shish 2021.3.23
+    public function actionCashUpdate()
+    {
+        $get = Yii::$app->request->get();
+        $cashAccount = $get['cashAccount'] ?? '';
+        $cashName = $get['cashName'] ?? '';
+        if (empty($cashName)) {
+            util::fail('请填写姓名');
+        }
+        if (empty($cashAccount)) {
+            util::fail('请填写帐号');
+        }
+        $shopAdmin = $this->shopAdmin;
+        $shopId = $shopAdmin['shopId'];
+        if ($shopAdmin['super'] != 1) {
+            util::fail('您没有权限修改');
+        }
+        ShopClass::updateById($shopId, ['cashAccount' => $cashAccount, 'cashName' => $cashName]);
+        util::complete();
+    }
+
 }

+ 22 - 0
app-hd/controllers/ShopController.php

@@ -2,6 +2,7 @@
 
 namespace hd\controllers;
 
+use biz\shop\classes\ShopClass;
 use biz\sj\services\MerchantExtendService;
 use bizHd\merchant\services\ShopService;
 use common\components\dirUtil;
@@ -159,4 +160,25 @@ class ShopController extends BaseController
         util::success(['ad' => $ad, 'shop' => $shop, 'newUserGift' => $newUserGift]);
     }
 
+    //提现信息更新 shish 2021.3.23
+    public function actionCashUpdate()
+    {
+        $get = Yii::$app->request->get();
+        $cashAccount = $get['cashAccount'] ?? '';
+        $cashName = $get['cashName'] ?? '';
+        if (empty($cashName)) {
+            util::fail('请填写姓名');
+        }
+        if (empty($cashAccount)) {
+            util::fail('请填写帐号');
+        }
+        $shopAdmin = $this->shopAdmin;
+        $shopId = $shopAdmin['shopId'];
+        if ($shopAdmin['super'] != 1) {
+            util::fail('您没有权限修改');
+        }
+        ShopClass::updateById($shopId, ['cashAccount' => $cashAccount, 'cashName' => $cashName]);
+        util::complete();
+    }
+
 }

+ 3 - 1
sql.sql

@@ -1707,4 +1707,6 @@ TRUNCATE `xhUserTagClass`;
 TRUNCATE `xhUserUpgrade`;
 ALTER TABLE xhUser DROP COLUMN `merchantId`;
 ALTER TABLE xhCustom CHANGE `adminId` `userId` INT(11) NOT NULL DEFAULT '0' COMMENT '用户id';
-ALTER TABLE xhCustom ADD UNIQUE INDEX custom(`sjId`,`userId`);
+ALTER TABLE xhCustom ADD UNIQUE INDEX custom(`sjId`,`userId`);
+ALTER TABLE xhShop ADD `cashAccount` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '支付宝提现帐号' AFTER `cancelOrder`;
+ALTER TABLE xhShop ADD `cashName` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '支付宝提现姓名' AFTER `cashAccount`;