|
...
|
...
|
@@ -4,6 +4,7 @@ namespace App\Http\Logic\Bside\Product; |
|
|
|
|
|
|
|
use App\Helper\Arr;
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Product\Product;
|
|
|
|
use App\Models\RouteMap;
|
|
|
|
use App\Models\Product\Keyword;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
...
|
...
|
@@ -28,7 +29,7 @@ class KeywordLogic extends BaseLogic |
|
|
|
try {
|
|
|
|
$res = parent::save($param);
|
|
|
|
//路由映射
|
|
|
|
RouteMap::setRoute($param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $res['id'], $param['project_id']);
|
|
|
|
RouteMap::setRoute($param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $res['id'], $this->user['project_id']);
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
...
|
...
|
@@ -39,17 +40,22 @@ class KeywordLogic extends BaseLogic |
|
|
|
|
|
|
|
public function delete($ids){
|
|
|
|
$ids= array_filter(Arr::splitFilterToArray($ids), 'intval');
|
|
|
|
foreach ($ids as $id){
|
|
|
|
$info = $this->getCacheInfo($id);
|
|
|
|
if(!$info){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
//todo 是否有关联商品
|
|
|
|
DB::beginTransaction();
|
|
|
|
try {
|
|
|
|
parent::delete($ids);
|
|
|
|
|
|
|
|
//todo 删除路由映射 事务
|
|
|
|
foreach ($ids as $id){
|
|
|
|
//删除路由映射
|
|
|
|
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
DB::commit();
|
|
|
|
}catch (\Exception $e){
|
|
|
|
DB::rollBack();
|
|
|
|
$this->fail('删除失败');
|
|
|
|
}
|
|
|
|
return parent::delete($ids);
|
|
|
|
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|