GoodsImage.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\store\model;
  13. use app\common\model\GoodsImage as GoodsImageModel;
  14. /**
  15. * 商品图片模型
  16. * Class GoodsImage
  17. * @package app\store\model
  18. */
  19. class GoodsImage extends GoodsImageModel
  20. {
  21. /**
  22. * 更新关系记录
  23. * @param int $goodsId
  24. * @param array $imageIds 新的图片集
  25. * @return array|false
  26. */
  27. public static function updates(int $goodsId, array $imageIds)
  28. {
  29. // 删除所有的sku记录
  30. static::deleteAll(['goods_id' => $goodsId]);
  31. // 批量写入商品图片记录
  32. return static::increased($goodsId, $imageIds);
  33. }
  34. }