feat: sku

This commit is contained in:
2025-01-22 11:29:35 +08:00
parent acca7ba7c7
commit 7f09afacaf
2 changed files with 20 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Model;
use App\Constants\Common\GoodCode;
use Hyperf\Collection\Collection;
use Hyperf\Database\Model\Builder;
use Hyperf\DbConnection\Model\Model;
@@ -60,9 +61,13 @@ class Sku extends Model
return $this->where('id',$id)->where('is_del',GoodCode::SKU_IS_NO_DEL)->first();
}
public function getListBySpuIds(array $spuIds): array
/**
* @param array $spuIds
* @return Collection
*/
public function getListBySpuIds(array $spuIds): Collection
{
return $this->skuModel
return $this
->whereIn('spu_id',$spuIds)
->where('is_del',GoodCode::SKU_IS_NO_DEL)
->where('saleable',GoodCode::LISTING)