|
@@ -3,8 +3,10 @@
|
|
|
namespace ghs\controllers;
|
|
namespace ghs\controllers;
|
|
|
|
|
|
|
|
use biz\merchant\services\MerchantExtendService;
|
|
use biz\merchant\services\MerchantExtendService;
|
|
|
|
|
+use bizGhs\merchant\classes\ShopClass;
|
|
|
use bizGhs\merchant\services\ShopService;
|
|
use bizGhs\merchant\services\ShopService;
|
|
|
use common\components\dirUtil;
|
|
use common\components\dirUtil;
|
|
|
|
|
+use common\components\httpUtil;
|
|
|
use common\components\util;
|
|
use common\components\util;
|
|
|
use common\components\wxUtil;
|
|
use common\components\wxUtil;
|
|
|
use Yii;
|
|
use Yii;
|
|
@@ -12,13 +14,13 @@ use Yii;
|
|
|
class ShopController extends BaseController
|
|
class ShopController extends BaseController
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
- //门店列表 shish 20202.2.29
|
|
|
|
|
|
|
+ //门店列表 shish 2021.1.14
|
|
|
public function actionList()
|
|
public function actionList()
|
|
|
{
|
|
{
|
|
|
$where = [];
|
|
$where = [];
|
|
|
$where['ghsId'] = $this->ghsId;
|
|
$where['ghsId'] = $this->ghsId;
|
|
|
$where['delStatus'] = 0;
|
|
$where['delStatus'] = 0;
|
|
|
- $list = ShopService::getShopList($where);
|
|
|
|
|
|
|
+ $list = ShopClass::getShopList($where);
|
|
|
util::success($list);
|
|
util::success($list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -27,33 +29,40 @@ class ShopController extends BaseController
|
|
|
{
|
|
{
|
|
|
$data = Yii::$app->request->post();
|
|
$data = Yii::$app->request->post();
|
|
|
$data['ghsId'] = $this->ghsId;
|
|
$data['ghsId'] = $this->ghsId;
|
|
|
- $id = isset($data['id']) ? $data['id'] : 0;
|
|
|
|
|
- unset($data['id']);
|
|
|
|
|
|
|
+ $id = $data['id'] ?? 0;
|
|
|
$shop = ShopService::getById($id);
|
|
$shop = ShopService::getById($id);
|
|
|
- ShopService::valid($shop, $this->ghsId);
|
|
|
|
|
- ShopService::updateShop($id, $data);
|
|
|
|
|
|
|
+ if (empty($shop)) {
|
|
|
|
|
+ util::fail('没有找到门店');
|
|
|
|
|
+ }
|
|
|
|
|
+ ShopClass::valid($shop, $this->ghsId);
|
|
|
|
|
+ ShopClass::updateShop($id, $data);
|
|
|
util::complete();
|
|
util::complete();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //添加门店 shish 2021.1.14
|
|
|
public function actionAdd()
|
|
public function actionAdd()
|
|
|
{
|
|
{
|
|
|
$data = Yii::$app->request->post();
|
|
$data = Yii::$app->request->post();
|
|
|
$data['ghsId'] = $this->ghsId;
|
|
$data['ghsId'] = $this->ghsId;
|
|
|
- ShopService::addShop($data);
|
|
|
|
|
|
|
+ ShopClass::addShop($data);
|
|
|
util::complete();
|
|
util::complete();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //下载微信和支付宝收款码 shish 2020.2.29
|
|
|
|
|
|
|
+ //PC下载微信和支付宝收款码 shish 2020.2.29
|
|
|
public function actionGatheringCode()
|
|
public function actionGatheringCode()
|
|
|
{
|
|
{
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
$shop = ShopService::getById($id);
|
|
$shop = ShopService::getById($id);
|
|
|
- ShopService::valid($shop, $this->ghsId);
|
|
|
|
|
- $gatheringCode = ShopService::generateGatheringCode($this->ghsId, $id);
|
|
|
|
|
|
|
+ ShopClass::valid($shop, $this->ghsId);
|
|
|
|
|
+ $gatheringCode = ShopClass::generateGatheringCode($this->ghsId, $id);
|
|
|
$file = dirUtil::getImgDir() . $gatheringCode;
|
|
$file = dirUtil::getImgDir() . $gatheringCode;
|
|
|
if (file_exists($file) == false) {
|
|
if (file_exists($file) == false) {
|
|
|
util::fail('没有找到收款码');
|
|
util::fail('没有找到收款码');
|
|
|
}
|
|
}
|
|
|
|
|
+ if (httpUtil::isMiniProgram()) {
|
|
|
|
|
+ $imgUrl = Yii::$app->params['imgHost'] . $gatheringCode;
|
|
|
|
|
+ util::success(['imgUrl' => $imgUrl]);
|
|
|
|
|
+ }
|
|
|
$fileName = "门店({$id})收款码.jpg";
|
|
$fileName = "门店({$id})收款码.jpg";
|
|
|
$contentType = 'image/jpeg';
|
|
$contentType = 'image/jpeg';
|
|
|
header("Cache-control: private");
|
|
header("Cache-control: private");
|
|
@@ -63,7 +72,7 @@ class ShopController extends BaseController
|
|
|
readfile($file);
|
|
readfile($file);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //获取小程序的收款码 shish
|
|
|
|
|
|
|
+ //PC获取小程序的收款码 shish
|
|
|
public function actionGatheringMiniCode()
|
|
public function actionGatheringMiniCode()
|
|
|
{
|
|
{
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
$id = Yii::$app->request->get('id', 0);
|
|
@@ -72,12 +81,16 @@ class ShopController extends BaseController
|
|
|
util::fail('您的小程序还没有授权');
|
|
util::fail('您的小程序还没有授权');
|
|
|
}
|
|
}
|
|
|
$shop = ShopService::getById($id);
|
|
$shop = ShopService::getById($id);
|
|
|
- ShopService::valid($shop, $this->ghsId);
|
|
|
|
|
|
|
+ ShopClass::valid($shop, $this->ghsId);
|
|
|
$applyMemberCode = wxUtil::generateGatheringMiniCode($this->merchant, $id);
|
|
$applyMemberCode = wxUtil::generateGatheringMiniCode($this->merchant, $id);
|
|
|
$file = dirUtil::getImgDir() . $applyMemberCode;
|
|
$file = dirUtil::getImgDir() . $applyMemberCode;
|
|
|
if (file_exists($file) == false) {
|
|
if (file_exists($file) == false) {
|
|
|
util::fail('没有找到注册会员码');
|
|
util::fail('没有找到注册会员码');
|
|
|
}
|
|
}
|
|
|
|
|
+ if (httpUtil::isMiniProgram()) {
|
|
|
|
|
+ $imgUrl = Yii::$app->params['imgHost'] . $applyMemberCode;
|
|
|
|
|
+ util::success(['imgUrl' => $imgUrl]);
|
|
|
|
|
+ }
|
|
|
$fileName = "门店({$id})小程序收款码.jpg";
|
|
$fileName = "门店({$id})小程序收款码.jpg";
|
|
|
$contentType = 'image/jpeg';
|
|
$contentType = 'image/jpeg';
|
|
|
header("Cache-control: private");
|
|
header("Cache-control: private");
|
|
@@ -87,7 +100,7 @@ class ShopController extends BaseController
|
|
|
readfile($file);
|
|
readfile($file);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //下载会员注册码 shish 2020.2.29
|
|
|
|
|
|
|
+ //PC下载会员注册码 shish 2020.2.29
|
|
|
public function actionApplyMemberCode()
|
|
public function actionApplyMemberCode()
|
|
|
{
|
|
{
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
$id = Yii::$app->request->get('id', 0);
|
|
@@ -96,12 +109,16 @@ class ShopController extends BaseController
|
|
|
util::fail('您的小程序还没有授权');
|
|
util::fail('您的小程序还没有授权');
|
|
|
}
|
|
}
|
|
|
$shop = ShopService::getById($id);
|
|
$shop = ShopService::getById($id);
|
|
|
- ShopService::valid($shop, $this->ghsId);
|
|
|
|
|
|
|
+ ShopClass::valid($shop, $this->ghsId);
|
|
|
$applyMemberCode = wxUtil::generateMemberCode($this->merchant, $id);
|
|
$applyMemberCode = wxUtil::generateMemberCode($this->merchant, $id);
|
|
|
$file = dirUtil::getImgDir() . $applyMemberCode;
|
|
$file = dirUtil::getImgDir() . $applyMemberCode;
|
|
|
if (file_exists($file) == false) {
|
|
if (file_exists($file) == false) {
|
|
|
util::fail('没有找到注册会员码');
|
|
util::fail('没有找到注册会员码');
|
|
|
}
|
|
}
|
|
|
|
|
+ if (httpUtil::isMiniProgram()) {
|
|
|
|
|
+ $imgUrl = Yii::$app->params['imgHost'] . $applyMemberCode;
|
|
|
|
|
+ util::success(['imgUrl' => $imgUrl]);
|
|
|
|
|
+ }
|
|
|
$fileName = "注册会员码{$id}.jpg";
|
|
$fileName = "注册会员码{$id}.jpg";
|
|
|
$contentType = 'image/jpeg';
|
|
$contentType = 'image/jpeg';
|
|
|
header("Cache-control: private");
|
|
header("Cache-control: private");
|
|
@@ -115,11 +132,10 @@ class ShopController extends BaseController
|
|
|
public function actionDelete()
|
|
public function actionDelete()
|
|
|
{
|
|
{
|
|
|
$id = Yii::$app->request->get('id', 0);
|
|
$id = Yii::$app->request->get('id', 0);
|
|
|
- util::fail('功能开发中');
|
|
|
|
|
$shop = ShopService::getById($id);
|
|
$shop = ShopService::getById($id);
|
|
|
- ShopService::valid($shop, $this->ghsId);
|
|
|
|
|
- ShopService::deleteShop($shop);
|
|
|
|
|
|
|
+ ShopClass::valid($shop, $this->ghsId);
|
|
|
|
|
+ ShopClass::deleteShop($shop);
|
|
|
util::complete();
|
|
util::complete();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|