HdController.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace mall\controllers;
  3. use bizHd\custom\classes\HdClass;
  4. use common\components\imgUtil;
  5. use common\components\util;
  6. use bizHd\custom\classes\CustomClass;
  7. use Yii;
  8. class HdController extends BaseController
  9. {
  10. //花店详情 ssh 20250627
  11. public function actionDetail()
  12. {
  13. $get = Yii::$app->request->get();
  14. $id = $get['id'] ?? 0;
  15. $hd = \bizMall\hd\classes\HdClass::getById($id);
  16. if (empty($hd)) {
  17. util::fail('没有花店信息');
  18. }
  19. if ($hd['userId'] != $this->userId) {
  20. util::fail('不是你的店');
  21. }
  22. $shortAvatar = !empty($val['avatar']) ? $val['avatar'] : 'hhb_small.png';
  23. $smallAvatar = imgUtil::groupImg($shortAvatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
  24. $bigAvatar = imgUtil::groupImg($shortAvatar) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
  25. $hd['shortAvatar'] = $shortAvatar;
  26. $hd['smallAvatar'] = $smallAvatar;
  27. $hd['bigAvatar'] = $bigAvatar;
  28. util::success($hd);
  29. }
  30. //花店信息 ssh 20230111
  31. public function actionInfo()
  32. {
  33. $get = Yii::$app->request->get();
  34. $id = $get['id'] ?? 0;
  35. $user = $this->user;
  36. $shop = $this->shop;
  37. if (empty($user)) {
  38. $hd = [];
  39. if (!empty($shop)) {
  40. $sjName = $shop->merchantName ?? '';
  41. $name = $shop->shopName == '首店' ? $sjName : $sjName . ' ' . $shop->shopName;
  42. $hd = ['name' => $name];
  43. }
  44. $custom = [];
  45. util::success(['hd' => $hd, 'custom' => $custom]);
  46. } else {
  47. if (empty($id)) {
  48. $respond = CustomClass::buildRelation($shop, $user);
  49. $hd = $respond['hd'];
  50. $custom = $respond['custom'];
  51. } else {
  52. $hd = \bizMall\hd\classes\HdClass::getById($id, true);
  53. $customId = $hd->customId;
  54. $custom = \bizMall\custom\classes\CustomClass::getById($customId, true);
  55. }
  56. util::success(['hd' => $hd, 'custom' => $custom]);
  57. }
  58. }
  59. public function actionList()
  60. {
  61. $showGlInfo = getenv('SHOW_GL_INFO');
  62. $info = $showGlInfo === false ? 1 : $showGlInfo;
  63. if (empty($this->userId)) {
  64. util::success(['list' => [], 'showGlInfo' => $info]);
  65. }
  66. $where = [];
  67. $where['userId'] = $this->userId;
  68. $where['delStatus'] = 0;
  69. $respond = HdClass::getHdList($where);
  70. $respond['showGlInfo'] = $info;
  71. util::success($respond);
  72. }
  73. }