| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?php
- namespace mall\controllers;
- use bizHd\recharge\classes\RechargeShbClass;
- use bizHd\recharge\classes\RechargeSqClass;
- use bizMall\hd\classes\HdClass;
- use common\components\imgUtil;
- use common\components\util;
- use bizHd\custom\classes\CustomClass;
- use Yii;
- class HdController extends BaseController
- {
- public $guestAccess = ['list', 'info'];
- public function actionRecover()
- {
- $get = Yii::$app->request->get();
- $id = $get['id'] ?? 0;
- $hd = HdClass::getById($id, true);
- if (empty($hd)) {
- util::fail('没有花店信息');
- }
- if ($hd['userId'] != $this->userId) {
- util::fail('不是你的店');
- }
- $hd->delStatus = 0;
- $hd->save();
- util::complete('已恢复');
- }
- public function actionDel()
- {
- $get = Yii::$app->request->get();
- $id = $get['id'] ?? 0;
- $hd = HdClass::getById($id, true);
- if (empty($hd)) {
- util::fail('没有花店信息');
- }
- if ($hd['userId'] != $this->userId) {
- util::fail('不是你的店');
- }
- $hd->delStatus = 1;
- $hd->save();
- util::complete('删除成功');
- }
- //花店详情 ssh 20250627
- public function actionDetail()
- {
- $get = Yii::$app->request->get();
- $id = $get['id'] ?? 0;
- $hd = HdClass::getById($id);
- if (empty($hd)) {
- util::fail('没有花店信息');
- }
- if ($hd['userId'] != $this->userId) {
- util::fail('不是你的店');
- }
- $shortAvatar = !empty($val['avatar']) ? $val['avatar'] : 'hhb_small.png';
- $smallAvatar = imgUtil::groupImg($shortAvatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
- $bigAvatar = imgUtil::groupImg($shortAvatar) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
- $hd['shortAvatar'] = $shortAvatar;
- $hd['smallAvatar'] = $smallAvatar;
- $hd['bigAvatar'] = $bigAvatar;
- util::success($hd);
- }
- //花店信息 ssh 20230111
- public function actionInfo()
- {
- $get = Yii::$app->request->get();
- $id = $get['id'] ?? 0;
- $user = $this->user;
- $shop = $this->shop;
- if (empty($user)) {
- $hd = [];
- if (!empty($shop)) {
- $sjName = $shop->merchantName ?? '';
- $name = $shop->shopName == '首店' ? $sjName : $sjName . ' ' . $shop->shopName;
- $hd = ['name' => $name];
- }
- $custom = [];
- util::success(['hd' => $hd, 'custom' => $custom]);
- } else {
- if (empty($id)) {
- $respond = CustomClass::buildRelation($shop, $user);
- $hd = $respond['hd'];
- $custom = $respond['custom'];
- } else {
- $hd = HdClass::getById($id, true);
- $customId = $hd->customId;
- $custom = \bizMall\custom\classes\CustomClass::getById($customId, true);
- }
- // 根据 xhShop 中的 `rechargeWeal`来选择返回快捷充值选项
- if ($shop->rechargeWeal == 1) {
- $itemType = 'money'; //送钱
- $itemList = [];
- $weal = RechargeSqClass::getAllByCondition(['mainId' => $shop->mainId], 'recharge asc', '*', null, true);
- if (!empty($weal)) {
- foreach ($weal as $key => $val) {
- $recharge = floatval($val->recharge);
- $give = floatval($val->give);
- $itemList[] = ['recharge' => $recharge, 'give' => $give];
- }
- }
- } else if ($shop->rechargeWeal == 2 || $shop->rechargeWeal == 3) {
- $itemType = 'hb'; //送红包
- $itemList = RechargeShbClass::getList('*', ['shopId' => $shop->id]);
- }
- util::success(['hd' => $hd, 'custom' => $custom, 'itemType' => $itemType, 'itemList' => $itemList]);
- }
- }
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $delStatus = $get['delStatus'] ?? 0;
- $userId = $this->userId;
- $respond = ['list' => [],'moreData'=>0,'totalNum'=>0,'totalPage'=>0];
- if ($userId > 0) {
- $mallUpgrading = getenv('MALL_UPGRADING') == false ? 0 : getenv('MALL_UPGRADING');
- if ($mallUpgrading == 1) {
- $allowShopAdminIdsStr = getenv('MALL_UPGRADE_ALLOW_USER_IDS') ?: '';
- $allowShopAdminIds = !empty($allowShopAdminIdsStr) ? explode(',', $allowShopAdminIdsStr) : [];
- if (!in_array($userId, $allowShopAdminIds)) {
- util::fail('系统升级中,稍后再试,编号:' . $userId);
- }
- }
- $where = [];
- $where['userId'] = $userId;
- $where['delStatus'] = $delStatus;
- $respond = HdClass::getHdList($where);
- }
- util::success($respond);
- }
- }
|