| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace mall\controllers;
- 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'];
- //花店详情 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);
- }
- util::success(['hd' => $hd, 'custom' => $custom]);
- }
- }
- public function actionList()
- {
- $where = [];
- $where['userId'] = $this->userId;
- $where['delStatus'] = 0;
- $respond = HdClass::getHdList($where);
- util::success($respond);
- }
- }
|