ShopController.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace mall\controllers;
  3. use bizHd\custom\classes\CustomClass;
  4. use bizHd\custom\classes\HdClass;
  5. use bizHd\shop\classes\ShopClass;
  6. use bizMall\ad\services\AdService;
  7. use bizMall\goods\services\CategoryService;
  8. use bizMall\goods\services\GoodsCategoryService;
  9. use bizMall\invite\services\InviteService;
  10. use bizMall\merchant\services\MerchantService;
  11. use bizMall\merchant\services\ShopService;
  12. use bizMall\user\classes\UserClass;
  13. use bizMall\user\services\UserService;
  14. use common\components\imgUtil;
  15. use Yii;
  16. use yii\web\Controller;
  17. use common\components\util;
  18. class ShopController extends BaseController
  19. {
  20. //门店详情 ssh 20230210
  21. public function actionInfo()
  22. {
  23. $get = Yii::$app->request->get();
  24. $hdId = $get['hdId'] ?? 0;
  25. $shop = $this->shop;
  26. $info = !empty($shop) ? $shop->attributes : [];
  27. if (isset($info['superWx'])) {
  28. $superWx = $info['superWx'];
  29. $info['superWx'] = imgUtil::groupImg($superWx) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
  30. } else {
  31. $info['superWx'] = '';
  32. }
  33. $shortAvatar = $info['avatar']??'';
  34. $avatar = imgUtil::groupImg($shortAvatar). "?x-oss-process=image/resize,m_fill,h_300,w_300";
  35. $info['avatar'] = $avatar;
  36. $info['shortAvatar'] = $shortAvatar;
  37. if (empty($hdId)) {
  38. $user = $this->user;
  39. $shop = $this->shop;
  40. $respond = CustomClass::buildRelation($shop, $user);
  41. $hd = $respond['hd'];
  42. $custom = $respond['custom'];
  43. }else{
  44. $hd = HdClass::getById($hdId, true);
  45. $customId = $hd->customId;
  46. $custom = CustomClass::getById($customId, true);
  47. }
  48. util::success(['info' => $info, 'hd' => $hd, 'custom' => $custom]);
  49. }
  50. //获取商家的默认门店 ssh 2019.12.6
  51. public function actionDetail()
  52. {
  53. $introUserId = Yii::$app->request->get('introUserId');
  54. $shop = isset($this->shop) && !empty($this->shop) ? $this->shop->attributes : [];
  55. $ad = [];
  56. if (isset($this->shop->img) && !empty($this->shop->img) && $this->shop->img != '[]') {
  57. $arr = json_decode($this->shop->img, true);
  58. if (!empty($arr)) {
  59. foreach ($arr as $img) {
  60. $imgUrl = imgUtil::groupImg($img);
  61. $ad[] = ['adImgUrl' => $imgUrl];
  62. }
  63. }
  64. }
  65. //新人专享礼物
  66. $newUserGift = [];
  67. if (!empty($introUserId)) {
  68. $userInfo = UserService::getUserInfo($this->userId);
  69. $newUserGift = InviteService::hasNewGift($userInfo);
  70. }
  71. util::success(['ad' => $ad, 'shop' => $shop, 'newUserGift' => $newUserGift]);
  72. }
  73. }