GoodsCategoryService.php 618 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace bizMall\goods\services;
  3. use bizMall\base\services\BaseService;
  4. use bizMall\goods\classes\GoodsCategoryClass;
  5. class GoodsCategoryService extends BaseService
  6. {
  7. public static $baseFile = '\bizMall\goods\classes\GoodsCategoryClass';
  8. //获取商品所属的分类id ssh 201917
  9. public static function getGoodsHasCategoryIds($goodsId)
  10. {
  11. $categoryIdList = GoodsCategoryClass::getAllByCondition(['gId' => $goodsId], null, 'cId', 'cId');
  12. if (empty($categoryIdList)) {
  13. return [];
  14. }
  15. $ids = array_keys($categoryIdList);
  16. return $ids;
  17. }
  18. }