作者 李宇航

合并分支 'master-server' 到 'master'

Master server修改分类统计数据



查看合并请求 !888
... ... @@ -9,6 +9,7 @@ use App\Http\Logic\Bside\BaseLogic;
use App\Models\Com\NoticeLog;
use App\Models\News\News;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\RouteMap\RouteMap;
use Illuminate\Support\Facades\DB;
... ... @@ -207,6 +208,7 @@ class KeywordLogic extends BaseLogic
$this->delRoute($id);
$this->model->del(['id'=>$id]);
}
(new KeywordRelated())->del(['keyword_id'=>['in',$ids]]);
//清除缓存
Common::del_user_cache('product_keyword',$this->user['project_id']);
return $this->success();
... ... @@ -270,11 +272,23 @@ class KeywordLogic extends BaseLogic
*/
public function batchDel(){
try {
$productModel = new Product();
foreach ($this->param['title'] as $v){
$info = $this->model->read(['title'=>$v]);
if($info){
$this->delRoute($info['id']);
$this->model->del(['id'=>$info['id']]);
$id = $info['id'];
$replace_id = ','.$id.',';
$productModel->where('keyword_id', 'like', '%,' . $id . ',%')
->update([
'keyword_id' => DB::raw("REPLACE(keyword_id, '$replace_id' , ',')")
]);
$productModel->where('keyword_id', ',')
->update([
'keyword_id' => DB::raw("REPLACE(keyword_id, ',' , '')")
]);
(new KeywordRelated())->del(['keyword_id'=>$id]);
}
}
//清除缓存
... ...
... ... @@ -66,6 +66,7 @@ class ProductLogic extends BaseLogic
}
//产品分类关联
CategoryRelated::saveRelated($id, $category_ids);
KeywordRelated::saveRelated($id,$category_ids);
//保存扩展字段
$this->saveExtendInfo($id,$extend);
}catch (\Exception $e){
... ...
... ... @@ -124,7 +124,7 @@ class Category extends Base
$str[] = $cate_id;
$cate_ids = $this->getAllSub($list,$cate_id,$str);
$productArr = CategoryRelated::whereIn('cate_id',$cate_ids)->pluck('product_id')->unique()->toArray();
$count = count($productArr);
$count = count($productArr) - 1;
return $count;
}
... ...
... ... @@ -62,8 +62,8 @@ class RouteMap extends Base
$i=1;
$sign = generateRoute($title);
$length = strlen($sign);
if($length > 100){
$sign = trim(mb_substr($sign, 0, 100, 'UTF-8'),'-');
if($length > 180){
$sign = trim(mb_substr($sign, 0, 180, 'UTF-8'),'-');
}
$info = self::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first();
$suffix = '';
... ...