作者 lyh

gx

... ... @@ -378,8 +378,7 @@ class BTemplateLogic extends BaseLogic
$route = 'all';
}
}
return $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route]);
return $this->success();
return $this->addUpdateNotify($type,$route);
}
/**
... ...
... ... @@ -66,8 +66,8 @@ class CustomTemplateLogic extends BaseLogic
try {
$this->param['url'] = str_replace_url($this->param['url']);
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->param['url'] = $this->editCustomRoute($this->param['url']);
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']);
$this->editCustomRoute($this->param['url']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
... ... @@ -75,9 +75,10 @@ class CustomTemplateLogic extends BaseLogic
}
$this->param['project_id'] = $this->user['project_id'];
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
$this->model->edit(['url'=>$route],['id'=>$id]);
}
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
$this->model->edit(['url'=>$route],['id'=>$id]);
}catch (\Exception $e){
$this->fail('error');
}
... ... @@ -110,8 +111,8 @@ class CustomTemplateLogic extends BaseLogic
if($rs === false){
$this->fail('系统错误,请联系管理');
}
$data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']];
$this->updateNotify($data);
//通知
$this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']);
return $this->success();
}
... ... @@ -210,14 +211,10 @@ class CustomTemplateLogic extends BaseLogic
$this->fail('404页面链接不可修改');
}
if($info['url'] != $route){
//生成一条删除路由记录
$data = [
'source'=>RouteMap::SOURCE_PAGE,
'route'=>$info['url'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
$this->curlDelRoute($info['url']);
}
return $route;
return true;
}
/**
... ... @@ -261,11 +258,7 @@ class CustomTemplateLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id' => $id], ['id', 'url']);
$data = [
'source' => RouteMap::SOURCE_NEWS,
'route' => $info['url'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['url']);
return $this->success();
}
... ...
... ... @@ -142,29 +142,35 @@ class BaseLogic extends Logic
}
/**
* @name :(通知更新)projectUrl
* @name :生成一条新路由记录
* @author :lyh
* @method :post
* @time :2023/6/6 14:09
*/
function updateNotify($data)
public function addUpdateNotify($type,$route)
{
$updateNotifyModel = new UpdateNotify();
if($data['route'] != 'all'){
$info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>1]);
if($info === false){
$param = [
'project_id'=>$data['project_id'],
'type'=>$data['type'],
'route'=>$data['route'],
];
$updateNotifyModel->add($param);
}
//单页面直接通知更新
$url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$data['route'];
$info = $updateNotifyModel->read(['project_id'=>$this->user['project_id'],'route'=>$route,'status'=>1]);
if($info === false){
$param = [
'project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route,'status'=>1
];
$updateNotifyModel->add($param);
}else{
$url = $this->user['domain'].'api/webInfo/?type=clear_website';
$updateNotifyModel->edit(['route'=>$route],['project_id'=>$this->user['project_id'],'type'=>$type,'status'=>1]);
}
return $this->success();
}
/**
* @remark :删除路由通知C端
* @name :curlDelRoute
* @author :lyh
* @method :post
* @time :2023/11/30 14:43
*/
public function curlDelRoute($route){
$url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$route;
curlGet($url);
return $this->success();
}
... ...
... ... @@ -32,8 +32,7 @@ class BlogCategoryLogic extends BaseLogic
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//查看路由是否更新
$id = $this->param['id'];
$this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']);
$this->editCategoryRoute($this->param['id'], $this->param['alias']);
$this->editHandleCategory($this->param['id'],$this->param['pid']);
$this->param['operator_id'] = $this->user['id'];
... ... @@ -46,18 +45,17 @@ class BlogCategoryLogic extends BaseLogic
//拼接参数
$this->param = $this->addParamProcessing($this->param);
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route);
$this->edit(['alias'=>$route],['id'=>$id]);
//处理子集
$this->addProcessingSon($id);
}
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
$this->edit(['alias'=>$route],['id'=>$id]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]);
return $this->success();
}
... ... @@ -114,11 +112,8 @@ class BlogCategoryLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','alias']);
if($info['alias'] != $route){
$data = [
'source'=>RouteMap::SOURCE_NEWS_CATE,
'route'=>$info['alias'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route);
$this->curlDelRoute($info['alias']);
}
return true;
}
... ... @@ -311,11 +306,7 @@ class BlogCategoryLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','alias']);
$data = [
'source'=>RouteMap::SOURCE_BLOG_CATE,
'route'=>$info['alias'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['alias']);
return $this->success();
}
... ... @@ -331,27 +322,22 @@ class BlogCategoryLogic extends BaseLogic
*/
public function importBlogCategory($project_id,$user_id,$category){
$return = [];
$cate_arr = explode('/',$category);
$pid = 0;
foreach ($cate_arr as $v){
if($v){
$category_info = $this->model->read(['name'=>$v,'pid'=>$pid]);
if(!$category_info){
$id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]);
$route = RouteMap::setRoute($v, RouteMap::SOURCE_BLOG_CATE, $id, $project_id);
$this->model->edit(['alias'=>$route],['id'=>$id]);
}else{
$id = $category_info['id'];
}
$return[] = $id;
$pid = $id;
}
}
return $this->getLastCategory($return);
}
... ...
... ... @@ -34,22 +34,20 @@ class BlogLogic extends BaseLogic
try {
$this->param = $this->paramProcessing($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
//是否更新路由
$id = $this->param['id'];
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);
$this->editNewsRoute($this->param['id'],$this->param['url']);
$this->edit($this->param,['id'=>$this->param['id']]);
}else{
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
$this->edit(['url'=>$route],['id'=>$id]);
}
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
$this->edit(['url'=>$route],['id'=>$id]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);
return $this->success();
}
... ... @@ -64,11 +62,8 @@ class BlogLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','url']);
if($info['url'] != $route){
$data = [
'source'=>RouteMap::SOURCE_BLOG,
'route'=>$info['url'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
$this->curlDelRoute($info['url']);
}
return true;
}
... ... @@ -90,10 +85,11 @@ class BlogLogic extends BaseLogic
/**
* @name :获取数据详情
* @return array
* @author :liyuhang
* @method
* @remark :获取数据详情
* @name :blogInfo
* @author :lyh
* @method :post
* @time :2023/11/30 15:17
*/
public function blogInfo(){
$info = $this->model->read($this->param);
... ... @@ -110,11 +106,11 @@ class BlogLogic extends BaseLogic
/**
* @name :修改状态
* @return array
* @throws \App\Exceptions\BsideGlobalException
* @author :liyuhang
* @method
* @remark :修改状态
* @name :blogStatus
* @author :lyh
* @method :post
* @time :2023/11/30 15:16
*/
public function blogStatus(){
$this->param['operator_id'] = $this->user['id'];
... ... @@ -126,10 +122,11 @@ class BlogLogic extends BaseLogic
}
/**
* @name :删除
* @return void
* @author :liyuhang
* @method
* @remark :删除
* @name :blogDel
* @author :lyh
* @method :post
* @time :2023/11/30 15:17
*/
public function blogDel(){
DB::beginTransaction();
... ... @@ -158,11 +155,7 @@ class BlogLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','url']);
$data = [
'source'=>RouteMap::SOURCE_BLOG,
'route'=>$info['url'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['url']);
return $this->success();
}
... ...
... ... @@ -55,7 +55,7 @@ class NavLogic extends BaseLogic
$this->model->add($this->param);
}
//编辑菜单后,通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']);
$this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all');
return $this->success();
}
... ... @@ -97,7 +97,7 @@ class NavLogic extends BaseLogic
$this->fail('error');
}
//编辑菜单后,通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']);
$this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all');
return $this->success();
}
... ...
... ... @@ -44,11 +44,10 @@ class NewsCategoryLogic extends BaseLogic
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->param['operator_id'] = $this->user['id'];
//查看路由是否更新
$id = $this->param['id'];
$this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']);
$this->editCategoryRoute($this->param['id'],$this->param['alias']);
$this->editHandleCategory($this->param['id'],$this->param['pid']);
$this->param['operator_id'] = $this->user['id'];
$this->edit($this->param,['id'=>$this->param['id']]);
}else{
if(!isset($this->param['alias']) || empty($this->param['alias'])){
... ... @@ -56,18 +55,17 @@ class NewsCategoryLogic extends BaseLogic
}
$this->param = $this->addParamProcessing($this->param);
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
$this->model->edit(['alias'=>$route],['id'=>$id]);
//当父级分类拥有产品时,处理子集
$this->addProcessingSon($id);
}
$route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
$this->model->edit(['alias'=>$route],['id'=>$id]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//更新通知记录表
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]);
return $this->success();
}
... ... @@ -124,22 +122,19 @@ class NewsCategoryLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','alias']);
if($info['alias'] != $route){
$data = [
'source'=>RouteMap::SOURCE_NEWS_CATE,
'route'=>$info['alias'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
$this->curlDelRoute($info['alias']);
}
return true;
}
/**
* @name :修改状态
* @return array
* @throws \App\Exceptions\BsideGlobalException
* @author :liyuhang
* @method
* @remark :修改状态
* @name :status_news_category
* @author :lyh
* @method :post
* @time :2023/11/30 15:13
*/
public function status_news_category(){
$this->param['operator_id'] = $this->user['id'];
... ... @@ -291,13 +286,8 @@ class NewsCategoryLogic extends BaseLogic
public function delRoute($id){
//删除路由映射
RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','alias']);
$data = [
'source'=>RouteMap::SOURCE_NEWS_CATE,
'route'=>$info['alias'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['alias']);
return $this->success();
}
... ... @@ -313,22 +303,18 @@ class NewsCategoryLogic extends BaseLogic
*/
public function importNewsCategory($project_id,$user_id,$category){
$return = [];
$cate_arr = explode('/',$category);
$pid = 0;
foreach ($cate_arr as $v){
if($v){
$category_info = $this->model->read(['name'=>$v,'pid'=>$pid]);
if(!$category_info){
$id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]);
$route = RouteMap::setRoute($v, RouteMap::SOURCE_NEWS_CATE, $id, $project_id);
$this->model->edit(['alias'=>$route],['id'=>$id]);
}else{
$id = $category_info['id'];
}
$return[] = $id;
$pid = $id;
}
... ...
... ... @@ -63,23 +63,22 @@ class NewsLogic extends BaseLogic
try {
$this->param = $this->paramProcessing($this->param);
if (isset($this->param['id']) && !empty($this->param['id'])) {
$this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']);
//是否更新路由
$this->editNewsRoute($this->param['id'], $this->param['url']);
$id = $this->param['id'];
$this->edit($this->param, ['id' => $this->param['id']]);
} else {
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
$this->edit(['url' => $route], ['id' => $id]);
}
//更新路由
$route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
$this->edit(['url' => $route], ['id' => $id]);
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//通知更新
$this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]);
return $this->success();
}
... ... @@ -95,11 +94,8 @@ class NewsLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id' => $id], ['id', 'url']);
if ($info['url'] != $route) {
$data = [
'source' => RouteMap::SOURCE_NEWS,
'route' => $info['url'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
$this->curlDelRoute($info['url']);
}
return true;
}
... ... @@ -271,11 +267,7 @@ class NewsLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id' => $id], ['id', 'url']);
$data = [
'source' => RouteMap::SOURCE_NEWS,
'route' => $info['url'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['url']);
return $this->success();
}
... ...
... ... @@ -113,19 +113,20 @@ class CategoryLogic extends BaseLogic
DB::beginTransaction();
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
//是否编辑路由
$id = $this->editCategoryRoute($this->param['id'],$this->param['route']);
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $this->param['id'], $this->user['project_id']);
$this->editCategoryRoute($this->param['id'],$this->param['route']);
//处理子集
$this->editHandleCategory($this->param['id'],$this->param['pid']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
$this->edit(['route'=>$route],['id'=>$id]);
//处理子集
$this->addProcessingSon($id);
}
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
$this->edit(['route'=>$route],['id'=>$id]);
//清除缓存
Common::del_user_cache('product_category',$this->user['project_id']);
DB::commit();
... ... @@ -133,9 +134,6 @@ class CategoryLogic extends BaseLogic
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//通知更新
$notifyData = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route];
$this->updateNotify($notifyData);
return $this->success();
}
... ... @@ -234,13 +232,10 @@ class CategoryLogic extends BaseLogic
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','route']);
if($info['route'] != $route){
$data = [
'source'=>RouteMap::SOURCE_PRODUCT_CATE,
'route'=>$info['route'],
];
$this->setRouteDeleteSave($data);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
$this->curlDelRoute($info['route']);
}
return $id;
return true;
}
/**
... ... @@ -283,11 +278,7 @@ class CategoryLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','route']);
$data = [
'source'=>RouteMap::SOURCE_PRODUCT_CATE,
'route'=>$info['route'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['route']);
return $this->success();
}
... ... @@ -302,27 +293,22 @@ class CategoryLogic extends BaseLogic
*/
public function importProductCategory($project_id,$category){
$return = [];
$cate_arr = explode('/',$category);
$pid = 0;
foreach ($cate_arr as $v){
if($v){
$category_info = $this->model->read(['title'=>$v,'pid'=>$pid]);
if(!$category_info){
$id = $this->model->addReturnId(['title'=>$v,'pid'=>$pid,'project_id'=>$project_id]);
$route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_CATE, $id, $project_id);
$this->model->edit(['route'=>$route],['id'=>$id]);
}else{
$id = $category_info['id'];
}
$return[] = $id;
$pid = $id;
}
}
//清除缓存
Common::del_user_cache('product_category',$project_id);
return $this->getLastCategory($return);
... ...
... ... @@ -56,17 +56,16 @@ class KeywordLogic extends BaseLogic
try {
$this->param = $this->handleSaveParam($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
//TODO::不能修改路由
$this->model->edit($this->param,['id'=>$this->param['id']]);
$id = $this->param['id'];
}else{
$this->param['project_id'] = $this->user['project_id'];
$this->param['created_at'] = date('Y-m-d H:i:s');
$this->param['updated_at'] = $this->param['created_at'];
$this->param = $this->addHandleParam($this->param);
$id = $this->model->insertGetId($this->param);
//路由映射
$route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_KEYWORD,$route);
$this->model->edit(['route'=>$route],['id'=>$id]);
}
//路由映射
$route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
$this->model->edit(['route'=>$route],['id'=>$id]);
//清除缓存
Common::del_user_cache('product_keyword',$this->user['project_id']);
DB::commit();
... ... @@ -74,12 +73,24 @@ class KeywordLogic extends BaseLogic
DB::rollBack();
$this->fail('保存失败');
}
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_KEYWORD, 'route'=>$route]);
return $this->success();
}
/**
* @remark :添加组装数据
* @name :addHandleParam
* @author :lyh
* @method :post
* @time :2023/11/30 15:00
*/
public function addHandleParam($param){
$param['project_id'] = $this->user['project_id'];
$param['created_at'] = date('Y-m-d H:i:s');
$param['updated_at'] = $param['created_at'];
return $this->success($param);
}
/**
* @remark :保存数据时参数处理
* @name :handleSaveParam
* @author :lyh
... ... @@ -174,11 +185,7 @@ class KeywordLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','route']);
$data = [
'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,
'route'=>$info['route'],
];
$this->setRouteDeleteSave($data);
$this->curlDelRoute($info['route']);
return $this->success();
}
... ... @@ -193,9 +200,7 @@ class KeywordLogic extends BaseLogic
*/
public function importProductKeyword($project_id,$keyword){
$return = [];
$keyword_arr = explode(',',$keyword);
foreach ($keyword_arr as $v){
$keyword_info = $this->model->read(['title'=>$v]);
if(!$keyword_info){
... ... @@ -207,7 +212,6 @@ class KeywordLogic extends BaseLogic
}
$return[] = $k_id;
}
//清除缓存
Common::del_user_cache('product_keyword',$project_id);
return ','.implode(',',$return).',';
... ...
... ... @@ -58,12 +58,13 @@ class ProductLogic extends BaseLogic
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
//查看路由是否更新
$this->editProductRoute($this->param['route']);
$this->editProductRoute($this->param['id'],$this->param['route']);
$this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param = $this->addHandleParam($this->param);
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
$this->model->edit(['route'=>$route],['id'=>$id]);
}
//产品分类关联
... ... @@ -288,11 +289,11 @@ class ProductLogic extends BaseLogic
* @method :post
* @time :2023/9/7 10:02
*/
public function editProductRoute($route){
$info = $this->model->read(['id'=>$this->param['id']]);
public function editProductRoute($id,$route){
$info = $this->model->read(['id'=>$id]);
if($info['route'] != $route){
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$info['route']]);
$this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
$this->curlDelRoute($info['route']);
}
return $route;
}
... ... @@ -339,8 +340,7 @@ class ProductLogic extends BaseLogic
RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
//生成一条删除路由记录
$info = $this->model->read(['id'=>$id],['id','route']);
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$info['route']]);
$this->curlDelRoute($info['route']);
return $this->success();
}
... ...