feat : kitchen
This commit is contained in:
65
app/Model/Site.php
Normal file
65
app/Model/Site.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use App\Constants\Common\SiteCode;
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $pid
|
||||
* @property string $name
|
||||
* @property int $city_id
|
||||
* @property int $kitchen_id
|
||||
* @property string $address
|
||||
* @property string $lng
|
||||
* @property string $lat
|
||||
* @property string $remark
|
||||
* @property string $expected_delivery_time
|
||||
* @property string $distance
|
||||
* @property string $expected_spend_time
|
||||
* @property int $status
|
||||
* @property int $image_id
|
||||
* @property int $delivered_id
|
||||
* @property string $create_time
|
||||
* @property string $update_time
|
||||
* @property int $is_del
|
||||
*/
|
||||
class Site extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected ?string $table = 'site';
|
||||
|
||||
/**
|
||||
* 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', 'pid' => 'integer', 'city_id' => 'integer', 'kitchen_id' => 'integer', 'status' => 'integer', 'image_id' => 'integer', 'delivered_id' => 'integer', 'is_del' => 'integer'];
|
||||
|
||||
const string CREATED_AT = 'create_time';
|
||||
|
||||
const string UPDATED_AT = 'update_time';
|
||||
|
||||
/**
|
||||
* 禁用厨房下所有点
|
||||
* @param int $kitchenId
|
||||
* @return int
|
||||
*/
|
||||
public function disableStatusByKitchenId(int $kitchenId)
|
||||
{
|
||||
return $this
|
||||
->where('kitchen_id',$kitchenId)
|
||||
->where('is_del',SiteCode::SITE_NO_DEL)
|
||||
->update(['status' => SiteCode::SITE_DISABLE]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user