feat : sts
This commit is contained in:
@@ -12,4 +12,4 @@ class CategoryCode
|
||||
CONST int EXTRA_STAPLE = 3;
|
||||
|
||||
CONST int SOUP = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Admin\Good;
|
||||
|
||||
use App\Cache\Redis\Api\GoodCache;
|
||||
use App\Constants\Admin\UserCode;
|
||||
use App\Constants\Common\GoodCode;
|
||||
use App\Constants\Common\SiteCode;
|
||||
@@ -190,6 +191,12 @@ class SpuService extends BaseService
|
||||
#[Inject]
|
||||
protected Chef $chefModel;
|
||||
|
||||
/**
|
||||
* @var GoodCache
|
||||
*/
|
||||
#[Inject]
|
||||
protected GoodCache $goodCache;
|
||||
|
||||
/**
|
||||
* 信息检测
|
||||
* @return void
|
||||
@@ -222,7 +229,10 @@ class SpuService extends BaseService
|
||||
|
||||
$this->checkInfo();
|
||||
|
||||
$info->kitchen_id = $this->request->input('kitchen_id');
|
||||
$kitchenId = (int)$this->request->input('kitchen_id');
|
||||
$oldKitchenId = (int)$info->kitchen_id;
|
||||
|
||||
$info->kitchen_id = $kitchenId;
|
||||
// $info->chef_id = $this->request->input('chef_id');
|
||||
$info->title = $this->request->input('title');
|
||||
$info->caterer_id = $this->request->input('caterer_id');
|
||||
@@ -234,6 +244,10 @@ class SpuService extends BaseService
|
||||
|
||||
if (!$info->save()) throw new ErrException('修改菜品失败');
|
||||
|
||||
//删除缓存
|
||||
if ($oldKitchenId != $kitchenId) $this->goodCache->delCache($kitchenId,$info->cycle_id);
|
||||
$this->goodCache->delCache($oldKitchenId,$info->cycle_id);
|
||||
|
||||
return $this->return->success();
|
||||
}
|
||||
|
||||
@@ -258,6 +272,9 @@ class SpuService extends BaseService
|
||||
$info->is_del = GoodCode::SPU_IS_DELETE;
|
||||
$info->save();
|
||||
|
||||
//删除缓存
|
||||
$this->goodCache->delCache($info->kitchen_id,$info->cycle_id);
|
||||
|
||||
return $this->return->success();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user