feat : catering

This commit is contained in:
2025-03-14 10:05:12 +08:00
parent 3aa241350c
commit 747e37fc86
11 changed files with 210 additions and 18 deletions

37
app/Model/Caterer.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id
* @property int $user_id
* @property int $type
* @property int $kitchen_id
* @property string $create_time
* @property string $update_time
*/
class Caterer extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'caterer';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
protected array $guarded = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'type' => 'integer', 'kitchen_id' => 'integer'];
const string CREATED_AT = 'create_time';
const string UPDATED_AT = 'update_time';
}

View File

@@ -111,4 +111,19 @@ class Site extends Model
return $res->toArray();
}
/**
* @param int $kitchenId
* @return Builder[]|Collection
*/
public function getListByKitchenId(int $kitchenId): Collection|array
{
return $this
->where('kitchen_id',$kitchenId)
->where('is_del',SiteCode::SITE_NO_DEL)
->where('status',SiteCode::SITE_ENABLE)
->orderBy('sequence')
->select(['name','id','delivered_id','sequence'])
->get();
}
}

View File

@@ -15,6 +15,7 @@ use Hyperf\DbConnection\Model\Model;
* @property int $city_id
* @property int $kitchen_id
* @property int $chef_id
* @property int $caterer_id
* @property string $title
* @property string $sub_title
* @property int $category_id
@@ -42,7 +43,7 @@ class Spu extends Model
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'cycle_id' => 'integer', 'city_id' => 'integer', 'kitchen_id' => 'integer','chef_id' => 'integer', 'category_id' => 'integer', 'saleable' => 'integer','type' => 'integer','sort' => 'integer'];
protected array $casts = ['id' => 'integer', 'cycle_id' => 'integer', 'city_id' => 'integer', 'kitchen_id' => 'integer','chef_id' => 'integer','caterer_id' => 'integer','category_id' => 'integer', 'saleable' => 'integer','type' => 'integer','sort' => 'integer'];
const string CREATED_AT = 'create_time';
const string UPDATED_AT = 'update_time';