HdClass.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace bizHd\custom\classes;
  3. use bizHd\shop\classes\ShopClass;
  4. use common\components\imgUtil;
  5. use common\components\util;
  6. use Yii;
  7. use bizHd\base\classes\BaseClass;
  8. class HdClass extends BaseClass
  9. {
  10. public static $baseFile = '\bizHd\custom\models\Hd';
  11. public static function addData($data)
  12. {
  13. return self::add($data, true);
  14. }
  15. public static function getHdList($where)
  16. {
  17. $data = self::getList('*', $where, 'inTurn DESC,addTime DESC');
  18. $data['list'] = self::groupBaseInfo($data['list']);
  19. return $data;
  20. }
  21. public static function groupBaseInfo($list)
  22. {
  23. if (!empty($list)) {
  24. $ids = array_column($list, 'shopId');
  25. $shopList = ShopClass::getAllByCondition(['id' => ['in', $ids]], null, '*', 'id');
  26. foreach ($list as $key => $val) {
  27. $shortAvatar = $val['avatar'] ?? '';
  28. $smallAvatar = imgUtil::groupImg($shortAvatar) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
  29. $list[$key]['shortAvatar'] = $shortAvatar;
  30. $list[$key]['smallAvatar'] = $smallAvatar;
  31. $shopId = $val['shopId'];
  32. $currentShop = $shopList[$shopId] ?? [];
  33. //是否设置了充值福利 ssh 2025031
  34. $rechargeWeal = $currentShop['rechargeWeal'] ?? 0;
  35. $list[$key]['rechargeWeal'] = $rechargeWeal;
  36. }
  37. }
  38. return $list;
  39. }
  40. }