feat: sku

This commit is contained in:
2025-01-07 17:55:58 +08:00
parent fd18cffeab
commit fd70dfabf5
8 changed files with 295 additions and 21 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Model;
use App\Constants\Common\GoodCode;
use Hyperf\Database\Model\Builder;
use Hyperf\DbConnection\Model\Model;
@@ -16,7 +17,8 @@ use Hyperf\DbConnection\Model\Model;
* @property string $title
* @property string $sub_title
* @property int $category_id
* @property int $saleable
* @property int $saleable
* @property int $is_del
* @property string $create_time
* @property string $update_time
*/
@@ -45,11 +47,12 @@ class Spu extends Model
/**
* @param int $cityId
* @param int $cycleId
* @param string $title
* @return Builder|\Hyperf\Database\Model\Model|null
*/
public function getInfoByCityIdAndCycleId(int $cityId, int $cycleId): \Hyperf\Database\Model\Model|Builder|null
public function getInfoByCityIdAndCycleId(int $cityId, int $cycleId,string $title): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('city_id', $cityId)->where('cycle_id', $cycleId)->first();
return $this->where('city_id', $cityId)->where('cycle_id', $cycleId)->where('title',$title)->where('is_del',GoodCode::SPU_IS_NO_DEL)->first();
}
/**
@@ -58,6 +61,6 @@ class Spu extends Model
*/
public function getInfoById(int $id): \Hyperf\Database\Model\Model|Builder|null
{
return $this->where('id', $id)->first();
return $this->where('id', $id)->where('is_del',GoodCode::SPU_IS_NO_DEL)->first();
}
}