|
@@ -9,6 +9,7 @@ use App\Http\Logic\Bside\BaseLogic; |
|
@@ -9,6 +9,7 @@ use App\Http\Logic\Bside\BaseLogic; |
|
9
|
use App\Models\Com\NoticeLog;
|
9
|
use App\Models\Com\NoticeLog;
|
|
10
|
use App\Models\News\News;
|
10
|
use App\Models\News\News;
|
|
11
|
use App\Models\Product\Keyword;
|
11
|
use App\Models\Product\Keyword;
|
|
|
|
12
|
+use App\Models\Product\KeywordRelated;
|
|
12
|
use App\Models\Product\Product;
|
13
|
use App\Models\Product\Product;
|
|
13
|
use App\Models\RouteMap\RouteMap;
|
14
|
use App\Models\RouteMap\RouteMap;
|
|
14
|
use Illuminate\Support\Facades\DB;
|
15
|
use Illuminate\Support\Facades\DB;
|
|
@@ -207,6 +208,7 @@ class KeywordLogic extends BaseLogic |
|
@@ -207,6 +208,7 @@ class KeywordLogic extends BaseLogic |
|
207
|
$this->delRoute($id);
|
208
|
$this->delRoute($id);
|
|
208
|
$this->model->del(['id'=>$id]);
|
209
|
$this->model->del(['id'=>$id]);
|
|
209
|
}
|
210
|
}
|
|
|
|
211
|
+ (new KeywordRelated())->del(['keyword_id'=>['in',$ids]]);
|
|
210
|
//清除缓存
|
212
|
//清除缓存
|
|
211
|
Common::del_user_cache('product_keyword',$this->user['project_id']);
|
213
|
Common::del_user_cache('product_keyword',$this->user['project_id']);
|
|
212
|
return $this->success();
|
214
|
return $this->success();
|
|
@@ -270,11 +272,23 @@ class KeywordLogic extends BaseLogic |
|
@@ -270,11 +272,23 @@ class KeywordLogic extends BaseLogic |
|
270
|
*/
|
272
|
*/
|
|
271
|
public function batchDel(){
|
273
|
public function batchDel(){
|
|
272
|
try {
|
274
|
try {
|
|
|
|
275
|
+ $productModel = new Product();
|
|
273
|
foreach ($this->param['title'] as $v){
|
276
|
foreach ($this->param['title'] as $v){
|
|
274
|
$info = $this->model->read(['title'=>$v]);
|
277
|
$info = $this->model->read(['title'=>$v]);
|
|
275
|
if($info){
|
278
|
if($info){
|
|
276
|
$this->delRoute($info['id']);
|
279
|
$this->delRoute($info['id']);
|
|
277
|
$this->model->del(['id'=>$info['id']]);
|
280
|
$this->model->del(['id'=>$info['id']]);
|
|
|
|
281
|
+ $id = $info['id'];
|
|
|
|
282
|
+ $replace_id = ','.$id.',';
|
|
|
|
283
|
+ $productModel->where('keyword_id', 'like', '%,' . $id . ',%')
|
|
|
|
284
|
+ ->update([
|
|
|
|
285
|
+ 'keyword_id' => DB::raw("REPLACE(keyword_id, '$replace_id' , ',')")
|
|
|
|
286
|
+ ]);
|
|
|
|
287
|
+ $productModel->where('keyword_id', ',')
|
|
|
|
288
|
+ ->update([
|
|
|
|
289
|
+ 'keyword_id' => DB::raw("REPLACE(keyword_id, ',' , '')")
|
|
|
|
290
|
+ ]);
|
|
|
|
291
|
+ (new KeywordRelated())->del(['keyword_id'=>$id]);
|
|
278
|
}
|
292
|
}
|
|
279
|
}
|
293
|
}
|
|
280
|
//清除缓存
|
294
|
//清除缓存
|