作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -129,25 +129,23 @@ class OnlineController extends BaseController
* @time :2023/8/18 10:58
*/
public function searchParam(&$query){
if(isset($this->map['id'])){
$query->where('gl_project.id',$this->map['id']);
}
if(!empty($this->map['message']) && !empty($this->map['type'])){
// 搜索域名
if($this->map['type'] == 'test_domain'){
$query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['message'].'%');
} else {
// 搜索名称
$query->where('gl_project.title', 'like', '%' . $this->map['message'] . '%');
}
}
if(isset($this->map['qa_status'])){
// 搜索状态
$query->where('gl_project_online_check.qa_status',$this->map['qa_status']);
}
if(isset($this->map['all_status'])){
// 搜索状态
$query->where('gl_project_online_check.qa_status',$this->map['all_status']);
}
if(isset($this->map['optimist_status'])){
// 搜索状态
$query->where('gl_project_online_check.optimist_status',$this->map['optimist_status']);
}
$query = $query->where('gl_project.status',1);//TODO::已提交审核
... ...
... ... @@ -24,7 +24,7 @@ class BlogController extends BaseController
* @time :2023/9/14 10:45
*/
public function lists(BlogModel $blogModel){
$filed = ['id','category_id','operator_id','status','created_at','label_id','image','updated_at','name','sort','url','release_at','is_upgrade'];
$filed = ['id','category_id','operator_id','status','created_at','label_id','image','updated_at','name','sort','url','release_at','is_upgrade','six_read'];
$this->order = 'sort';
$query = $blogModel->orderBy($this->order ,'desc')->orderBy('id','desc');
$query = $this->searchParam($query);
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Http\Controllers\Bside\CustomModule;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\CustomModule\CustomModuleCategoryLogic;
use App\Models\CustomModule\CustomModuleCategory;
... ... @@ -16,7 +17,7 @@ use App\Models\CustomModule\CustomModuleCategory;
class CustomModuleCategoryController extends BaseController
{
/**
* @remark :获取自定义模块列表
* @remark :获取自定义模块分类列表
* @name :ModuleList
* @author :lyh
* @method :post
... ... @@ -29,8 +30,35 @@ class CustomModuleCategoryController extends BaseController
'module_id.required' => 'module_id不能为空',
]);
$this->map['project_id'] = $this->user['project_id'];
$lists = $customModuleCategory->lists($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
$this->map['status'] = 0;
$list = $customModuleCategory->list($this->map);
if(!empty($list)){
foreach ($list as $k => $v){
$v['url'] = $this->user['domain'].$v['route'];
$list[$k] = $v;
}
}
$data = $this->getListSon($list);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :无分页子集处理
* @name :getListSon
* @author :lyh
* @method :post
* @time :2023/8/17 11:12
*/
public function getListSon($list){
$data = array();
foreach ($list as $v){
$v = (array)$v;
if ($v['pid'] == 0) {
$v['sub'] = _get_child($v['id'], $list);
$data[] = $v;
}
}
return $data;
}
/**
... ... @@ -73,11 +101,13 @@ class CustomModuleCategoryController extends BaseController
$this->request->validate([
'name'=>['required'],
'route'=>['required'],
'module_id'=>['required']
'module_id'=>['required'],
'pid'=>['required']
],[
'name.required' => '分类名称不能为空',
'route.required' => '分类路由不能为空',
'module_id.required' => '所选模块id不能为空'
'module_id.required' => '所选模块id不能为空',
'pid.required' => '上级不能为空'
]);
$logic->categorySave();
$this->response('success');
... ...
... ... @@ -11,6 +11,7 @@ namespace App\Http\Controllers\Bside\CustomModule;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
class CustomModuleContentController extends BaseController
... ... @@ -34,6 +35,19 @@ class CustomModuleContentController extends BaseController
}
/**
* @remark :添加/编辑内容时获取分类
* @name :getCategoryList
* @author :lyh
* @method :post
* @time :2023/12/7 15:19
*/
public function getCategoryList(){
$categoryModel = new CustomModuleCategory();
$list = $categoryModel->list(['project_id'=>$this->user['project_id'],'module_id'=>$this->param['module_id']],['id','name']);
$this->response('success',Code::SUCCESS,$list);
}
/**
* @remark :获取当前数据详情
* @name :info
* @author :lyh
... ... @@ -46,7 +60,7 @@ class CustomModuleContentController extends BaseController
],[
'id.required' => 'ID不能为空',
]);
$info = $logic->getCustomModuleContentInfo();
$info = $logic->getContentInfo();
$this->response('success',Code::SUCCESS,$info);
}
... ... @@ -67,7 +81,7 @@ class CustomModuleContentController extends BaseController
'route.required' => '分类路由不能为空',
'module_id.required' => '所选模块id不能为空'
]);
$logic->customModuleContentSave();
$logic->contentSave();
$this->response('success');
}
... ... @@ -84,7 +98,7 @@ class CustomModuleContentController extends BaseController
],[
'id.required' => 'ID不能为空',
]);
$logic->customModuleContentDel();
$logic->contentDel();
$this->response('success');
}
}
... ...
... ... @@ -32,6 +32,7 @@ class CustomModuleController extends BaseController
*/
public function lists(CustomModule $customModule){
$this->map['project_id'] = $this->user['project_id'];
$this->map['status'] = 0;
$lists = $customModule->lists($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
... ...
... ... @@ -22,9 +22,15 @@ class CustomModuleExtentController extends BaseController
* @method :post
* @time :2023/12/4 15:43
*/
public function list(CustomModuleExtend $customModuleExtend){
public function lists(CustomModuleExtend $customModuleExtend){
$this->request->validate([
'module_id'=>['required'],
],[
'module_id.required' => 'module_id不能为空',
]);
$this->map['project_id'] = $this->user['project_id'];
$lists = $customModuleExtend->lists($this->map,$this->page,$this->row,$this->order);
$filed = ['id','title','status','type','operator_id','project_id','module_id','created_at','updated_at'];
$lists = $customModuleExtend->lists($this->map,$this->page,$this->row,$this->order,$filed);
$this->response('success',Code::SUCCESS,$lists);
}
... ... @@ -41,7 +47,7 @@ class CustomModuleExtentController extends BaseController
],[
'id.required' => 'ID不能为空',
]);
$info = $logic->getCustomModuleExtendInfo();
$info = $logic->getExtendInfo();
$this->response('success',Code::SUCCESS,$info);
}
... ... @@ -53,7 +59,7 @@ class CustomModuleExtentController extends BaseController
* @time :2023/12/4 15:45
*/
public function save(CustomModuleExtendLogic $logic){
$logic->customModuleExtendSave();
$logic->extendSave();
$this->response('success');
}
... ... @@ -70,7 +76,7 @@ class CustomModuleExtentController extends BaseController
],[
'id.required' => 'ID不能为空',
]);
$logic->customModuleExtendDel();
$logic->extendDel();
$this->response('success');
}
}
... ...
... ... @@ -24,7 +24,7 @@ class NewsController extends BaseController
* @method
*/
public function lists(NewsModel $news){
$filed = ['id','category_id','operator_id','status','created_at','image','updated_at','name','sort','url', 'release_at','is_upgrade'];
$filed = ['id','category_id','operator_id','status','created_at','image','updated_at','name','sort','url', 'release_at','is_upgrade','six_read'];
$this->order = 'sort';
$query = $news->orderBy($this->order ,'desc')->orderBy('id','desc');
$query = $this->searchParam($query);
... ...
... ... @@ -43,7 +43,7 @@ class ProductController extends BaseController
public function index(Product $product)
{
$filed = ['id', 'project_id', 'title', 'sort' ,'thumb', 'gallery' ,'product_type' , 'route' ,
'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at'];
'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read'];
$this->order = 'sort';
$query = $product->orderBy($this->order ,'desc')->orderBy('id','desc');
$query = $this->searchParam($query);
... ...
... ... @@ -82,6 +82,7 @@ class CustomModuleCategoryLogic extends BaseLogic
if($info === false){
$this->fail('当前数据不存在或已被删除');
}
$info['image_link'] = getImageUrl($info['image']);
return $this->success($info);
}
... ... @@ -93,6 +94,7 @@ class CustomModuleCategoryLogic extends BaseLogic
* @time :2023/12/4 15:47
*/
public function categorySave(){
$this->param = $this->handleParam($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->categoryEdit();
}else{
... ... @@ -102,6 +104,24 @@ class CustomModuleCategoryLogic extends BaseLogic
}
/**
* @name :(参数处理)paramProcessing
* @author :lyh
* @method :post
* @time :2023/6/13 11:30
*/
public function handleParam($param)
{
$param['operator_id'] = $this->user['id'];
if(!isset($param['id']) || empty($param['id'])){
$param['project_id'] = $this->user['project_id'];
}
if(isset($param['image']) && !empty($param['image'])){
$param['image'] = str_replace_url($param['image']);
}
return $this->success($param);
}
/**
* @remark :添加分类
* @name :categoryAdd
* @author :lyh
... ... @@ -116,7 +136,7 @@ class CustomModuleCategoryLogic extends BaseLogic
$this->handleAddSon($id);
$this->addUpdateNotify(RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'],$route);
$this->curlDelRoute(['new_route'=>$route]);
$this->edit(['url' => $route], ['id' => $id]);
$this->edit(['route' => $route], ['id' => $id]);
//处理上级分类商品
$this->handleAddSon($id);
}catch (\Exception $e){
... ... @@ -135,7 +155,8 @@ class CustomModuleCategoryLogic extends BaseLogic
public function categoryEdit(){
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'],
$this->param['id'], $this->user['project_id']);
$this->editNewsRoute($this->param['id'],$route);
$this->editHandleCategory($this->param['id'],$this->param['pid']);
$this->editRoute($this->param['id'],$route);
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请连续管理员');
... ... @@ -153,16 +174,16 @@ class CustomModuleCategoryLogic extends BaseLogic
public function editHandleCategory($id,$pid){
$info = $this->model->read(['id'=>$id],['id','pid']);
if($info['pid'] != $pid){
//修改勒上级,先查看上级是否拥有博客
//修改勒上级,先查看上级是否拥有产品
$contentModel = new CustomModuleContent();
$newsCount = $contentModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count();
//随机获取最后一级id
$replacement = $this->getLastId($id);
if($newsCount > 0){
$contentCount = $contentModel->formatQuery(['category_id'=>['like','%,'.$pid.',%']])->count();
if($contentCount > 0){
//随机获取最后一级id
$replacement = $this->getLastId($id);
//存在博客时,移动所有博客到当前分类最后一级
$newsCount->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%')
$contentModel->where('category_id', 'like', '%,' . $pid . ',%')->where('category_id', 'like', '%,' . $replacement . ',%')
->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',')")]);
$newsCount->where('category_id', 'like', '%,' . $pid . ',%')
$contentModel->where('category_id', 'like', '%,' . $pid . ',%')
->update(['category_id' => DB::raw("REPLACE(category_id, ',$pid,', ',$replacement,')")]);
}
}
... ... @@ -170,13 +191,29 @@ class CustomModuleCategoryLogic extends BaseLogic
}
/**
* @remark :随机获取当前id下最后一级的id
* @name :getLastId
* @author :lyh
* @method :post
* @time :2023/10/20 9:45
*/
public function getLastId($id){
$info = $this->model->read(['pid'=>$id],['id']);
if($info !== false){
return $this->getLastId($info['id']);
}else{
return $id;
}
}
/**
* @remark :查看是否编辑路由
* @name :editCategoryRoute
* @author :lyh
* @method :post
* @time :2023/9/7 11:05
*/
public function editNewsRoute($id, $route)
public function editRoute($id, $route)
{
//生成一条删除路由记录
$info = $this->model->read(['id' => $id], ['id', 'route']);
... ... @@ -235,14 +272,37 @@ class CustomModuleCategoryLogic extends BaseLogic
* @time :2023/12/4 15:47
*/
public function categoryDel(){
$info = $this->model->read(['pid' => $this->param['id']], ['id', 'route']);
if($info === false){
$this->fail('当前分类拥有下级');
}
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('系统错误,请连续管理员');
$ids = $this->param['id'];
foreach ($ids as $id){
$info = $this->model->read(['pid'=>$id],['id']);
if($info !== false){
$this->fail('分类id:'.$id.'拥有子集不允许删除');
}
$contentModel = new CustomModuleContent();
$contentInfo = $contentModel->read(['category_id'=>['like','%,'.$id.',%']]);
if($contentInfo !== false){
$this->fail('当前分类拥有产品不允许删除');
}
//删除路由
$this->delRoute($id);
$this->model->del(['id'=>$id]);
}
return $this->success();
}
/**
* @remark :删除路由
* @name :delRoute
* @author :lyh
* @method :post
* @time :2023/9/7 10:50
*/
public function delRoute($id)
{
RouteMap::delRoute(RouteMap::SOURCE_MODULE_CATE.$this->param['module_id'], $id, $this->user['project_id']);
//通知
$info = $this->model->read(['id' => $id], ['id', 'route']);
$this->curlDelRoute(['route'=>$info['route']]);
return $this->success();
}
}
... ...
... ... @@ -10,7 +10,15 @@
namespace App\Http\Logic\Bside\CustomModule;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\CustomModule\CustomModuleExtend;
use App\Models\CustomModule\CustomModuleExtentContent;
use App\Models\Product\Extend;
use App\Models\Product\ExtendInfo;
use App\Models\RouteMap\RouteMap;
use Illuminate\Support\Facades\DB;
use mysql_xdevapi\Exception;
class CustomModuleContentLogic extends BaseLogic
{
... ... @@ -28,23 +36,257 @@ class CustomModuleContentLogic extends BaseLogic
* @method :post
* @time :2023/12/4 16:10
*/
public function getCustomModuleContentInfo(){
public function getContentInfo(){
$info = $this->model->read($this->param);
if($info === false){
$this->fail('当前数据不存在或已被删除');
}
$info['image_link'] = getImageUrl($info['image']);
$info['extend'] = $this->getExtendInfo($info['module_id'],$info['id']);
return $this->success($info);
}
/**
* @remark :获取扩展字段详情
* @name :getExtendInfo
* @author :lyh
* @method :post
* @time :2023/11/14 9:45
*/
public function getExtendInfo($module_id,$content_id){
$extendModel = new CustomModuleExtend();
$list = $extendModel->list(['module_id'=>$module_id],'id',['id','type','key','title']);
if(empty($list)){
return [];
}
$extendContentModel = new CustomModuleExtentContent();
foreach ($list as $k=>$v){
$info = $extendContentModel->read(['key'=>$v['key'],'content_id'=>$content_id]);
if($info === false){
if($v['type'] == 3 || $v['type'] == 4){
$v['values'] = [];
}else{
$v['values'] = '';
}
}else{
$v = $this->setTypValues($v,$info);
}
$list[$k] = $v;
}
return $this->success($list);
}
/**
* @remark :扩展字段根据type返回类型
* @name :setTypValues
* @author :lyh
* @method :post
* @time :2023/12/6 14:43
*/
public function setTypValues($v,$info){
if($v['type'] == 3){
$arr = json_decode($info['values']);
foreach ($arr as $k1=>$v1){
$v1 = (array)$v1;
$v1['url'] = getImageUrl($v1['url']);
$arr[$k1] = $v1;
}
$v['values'] = $arr;
}elseif($v['type'] == 4){
$arr1 = json_decode($info['values']);
foreach ($arr1 as $k1=>$v1){
$v1 = getFileUrl($v1);
$arr1[$k1] = $v1;
}
$v['values'] = $arr1;
}else{
$v['values'] = $info['values'];
}
return $this->success($v);
}
/**
* @remark :保存数据
* @name :ModuleSave
* @author :lyh
* @method :post
* @time :2023/12/4 15:47
*/
public function customModuleContentSave(){
public function contentSave(){
$extend = $this->handleExtent();
$this->param = $this->handleParam($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->contentEdit();
}else{
$id = $this->contentAdd();
}
//保存扩展字段
$this->saveExtendInfo($id,$extend);
return $this->success();
}
/**
* @remark :处理扩展字段
* @name :handleExtent
* @author :lyh
* @method :post
* @time :2023/12/6 15:06
*/
public function handleExtent(){
//扩展字段
$extend = [];
if(!empty($this->param['extend'])){
$extend = $this->param['extend'];
unset($this->param['extend']);
}
return $extend;
}
/**
* @remark :添加数据
* @name :contentAdd
* @author :lyh
* @method :post
* @time :2023/12/7 15:04
*/
public function contentAdd(){
try {
$id = $this->model->addReturnId($this->param);
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE.$this->param['module_id'],
$id, $this->user['project_id']);
$this->addUpdateNotify(RouteMap::SOURCE_MODULE.$this->param['module_id'],$route);
$this->curlDelRoute(['new_route'=>$route]);
$this->edit(['route' => $route], ['id' => $id]);
}catch (\Exception $e){
$this->fail('系统错误,请联系管理员');
}
return $id;
}
/**
* @remark :编辑数据
* @name :contentEdit
* @author :lyh
* @method :post
* @time :2023/12/7 15:04
*/
public function contentEdit(){
$route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE.$this->param['module_id'],
$this->param['id'], $this->user['project_id']);
$this->editRoute($this->param['id'],$route);
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请连续管理员');
}
return $this->param['id'];
}
/**
* @name :(参数处理)paramProcessing
* @author :lyh
* @method :post
* @time :2023/6/13 11:30
*/
public function handleParam($param)
{
$param['operator_id'] = $this->user['id'];
if(!isset($param['id']) || empty($param['id'])){
$param['project_id'] = $this->user['project_id'];
}
if(isset($param['category_id']) && !empty($param['category_id'])){
$param['category_id'] = $this->getLastCategory($param['category_id']);
}
if(isset($param['image']) && !empty($param['image'])){
$param['image'] = str_replace_url($param['image']);
}
return $this->success($param);
}
/**
* @remark :查看是否编辑路由
* @name :editCategoryRoute
* @author :lyh
* @method :post
* @time :2023/9/7 11:05
*/
public function editRoute($id, $route)
{
//生成一条删除路由记录
$info = $this->model->read(['id' => $id], ['id', 'route']);
if ($info['route'] != $route) {
$this->addUpdateNotify(RouteMap::SOURCE_MODULE.$this->param['module_id'],$route);
$this->curlDelRoute(['route'=>$info['route'],'new_route'=>$route]);
}
return true;
}
/**
* @remark :获取最后一级分类id
* @name :getLastCategory
* @author :lyh
* @method :post
* @time :2023/10/20 9:02
*/
public function getLastCategory($category){
$str = '';
$cateModel = new CustomModuleCategory();
foreach ($category as $v){
$info = $cateModel->read(['pid'=>$v]);
if($info === false){
$str .= $v.',';
}
}
return ','.$str;
}
/**
* @remark :保存扩展字段
* @name :saveExtend
* @author :lyh
* @method :post
* @time :2023/11/9 15:02
*/
public function saveExtendInfo($content_id,$extend){
//先删除以前的数据
$extendInfoModel = new ExtendInfo();
$extendInfoModel->del(['content_id'=>$content_id]);
if(empty($extend)) {
return $this->success();
}
foreach ($extend as $v){
if(empty($v['values'])){
continue;
}
$v = $this->saveHandleExtend($v,$content_id);
$extendInfoModel->add($v);
}
return $this->success();
}
/**
* @remark :保存扩展字段时处理数据
* @name :saveHandleExtend
* @author :lyh
* @method :post
* @time :2023/12/6 15:11
*/
public function saveHandleExtend(&$v,$content_id){
if($v['type'] == 3){
foreach ($v['values'] as $k1=>$v1){
$v1['url'] = str_replace_url($v1['url']);
$v['values'][$k1] = $v1;
}
$v['values'] = json_encode($v['values']);
}elseif ($v['type'] == 4){
foreach ($v['values'] as $k1=>$v1){
$v1 = str_replace_url($v1);
$v['values'][$k1] = $v1;
}
$v['values'] = json_encode($v['values']);
}
$v['project_id'] = $this->user['project_id'];
$v['content_id'] = $content_id;
return $this->success($v);
}
/**
... ... @@ -54,7 +296,34 @@ class CustomModuleContentLogic extends BaseLogic
* @method :post
* @time :2023/12/4 15:47
*/
public function customModuleContentDel(){
public function contentDel(){
DB::beginTransaction();
try {
foreach ($this->param['id'] as $id) {
$this->delRoute($id);
$this->model->del(['id' => $id]);
}
DB::commit();
} catch (Exception $e) {
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
/**
* @remark :删除路由
* @name :delRoute
* @author :lyh
* @method :post
* @time :2023/9/7 10:50
*/
public function delRoute($id)
{
RouteMap::delRoute(RouteMap::SOURCE_MODULE.$this->param['module_id'], $id, $this->user['project_id']);
//通知
$info = $this->model->read(['id' => $id], ['id', 'url']);
$this->curlDelRoute(['route'=>$info['url']]);
return $this->success();
}
}
... ...
... ... @@ -28,8 +28,12 @@ class CustomModuleExtendLogic extends BaseLogic
* @method :post
* @time :2023/12/4 16:10
*/
public function getCustomModuleExtendInfo(){
public function getExtendInfo(){
$info = $this->model->read($this->param,['id','title','status','type','operator_id','project_id','module_id']);
if($info === false){
$this->fail('当前数据不存在或者已被删除');
}
return $this->success($info);
}
/**
... ... @@ -39,8 +43,68 @@ class CustomModuleExtendLogic extends BaseLogic
* @method :post
* @time :2023/12/4 15:47
*/
public function customModuleExtendSave(){
public function extendSave(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->extendEdit();
}else{
$this->extendAdd();
}
return $this->success();
}
/**
* @remark :添加
* @name :extendAdd
* @author :lyh
* @method :post
* @time :2023/12/7 14:09
*/
public function extendAdd(){
$info = $this->model->read(['title'=>$this->param['title']]);
if($info !== false){
$this->fail('当前扩展名称已存在');
}
$key = 'pd_extended_field_';
$this->param['key'] = $this->getKey($key);
$this->param['project_id'] = $this->user['project_id'];
$this->param['operator_id'] = $this->user['id'];
$rs = $this->model->add($this->param);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
/**
* @remark :获取唯一key
* @name :getKey
* @author :lyh
* @method :post
* @time :2023/11/9 15:55
*/
public function getKey($key,$i = 1){
$info = $this->model->read(['key'=>$key.$i]);
if($info !== false){
return $this->getKey($key,$i+1);
}else{
return $key.$i;
}
}
/**
* @remark :编辑
* @name :extendEdit
* @author :lyh
* @method :post
* @time :2023/12/7 14:09
*/
public function extendEdit(){
$this->param['operator_id'] = $this->user['id'];
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
/**
... ... @@ -50,7 +114,11 @@ class CustomModuleExtendLogic extends BaseLogic
* @method :post
* @time :2023/12/4 15:47
*/
public function customModuleExtendDel(){
public function extendDel(){
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('系统错误,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -46,6 +46,7 @@ class CustomModuleLogic extends BaseLogic
* @time :2023/12/4 15:47
*/
public function customModuleSave(){
$this->param = $this->handleParam($this->param);
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->moduleEdit();
}else{
... ... @@ -55,6 +56,21 @@ class CustomModuleLogic extends BaseLogic
}
/**
* @name :(参数处理)paramProcessing
* @author :lyh
* @method :post
* @time :2023/6/13 11:30
*/
public function handleParam($param)
{
$param['operator_id'] = $this->user['id'];
if(!isset($param['id']) || empty($param['id'])){
$param['project_id'] = $this->user['project_id'];
}
return $this->success($param);
}
/**
* @remark :新增
* @name :moduleAdd
* @author :lyh
... ... @@ -62,7 +78,6 @@ class CustomModuleLogic extends BaseLogic
* @time :2023/12/5 9:39
*/
public function moduleAdd(){
$this->param['project_id'] = $this->user['project_id'];
$rs = $this->model->add($this->param);
if($rs === false){
$this->fail('系统错误,请联系管理员');
... ...
... ... @@ -106,6 +106,7 @@ class ProductLogic extends BaseLogic
}
return $category_ids;
}
/**
* @remark :新增时处理字段
* @name :addHandleParam
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Models\CustomModule;
use App\Helper\Arr;
use App\Models\Base;
class CustomModuleContent extends Base
... ... @@ -16,4 +17,8 @@ class CustomModuleContent extends Base
protected $table = 'gl_custom_module_content';
//连接数据库
protected $connection = 'custom_mysql';
public function getCategoryIdAttribute($value){
return Arr::setToArr(trim($value,','));
}
}
... ...
<?php
/**
* @remark :
* @name :CustomModuleExtentContent.php
* @author :lyh
* @method :post
* @time :2023/12/7 14:38
*/
namespace App\Models\CustomModule;
use App\Models\Base;
class CustomModuleExtentContent extends Base
{
protected $table = 'gl_custom_module_extent_content';
//连接数据库
protected $connection = 'custom_mysql';
}
... ...
... ... @@ -164,14 +164,13 @@ class RouteMap extends Base
* @time :2023/11/21 18:48
*/
public static function setProductRoute($route,$i = 0){
$routes = $route.'-product';
$routes = $route.'-'.$i.'-product';
$routeMapModel = new RouteMap();
$routeInfo = $routeMapModel->read(['route'=>$routes]);
if($routeInfo === false){
return $routes;
}else{
$i = $i + 1;
$route = $route.'-'.$i;
return self::setProductRoute($route,$i);
}
}
... ... @@ -184,14 +183,13 @@ class RouteMap extends Base
* @time :2023/11/21 18:48
*/
public static function setKeywordRoute($route,$i = 0){
$routes = $route.'-tag';
$routes = $route.'-'.$i.'-tag';
$routeMapModel = new RouteMap();
$routeInfo = $routeMapModel->read(['route'=>$routes]);
if($routeInfo === false){
return $routes;
}else{
$i = $i + 1;
$route = $route.'-'.$i;
return self::setProductRoute($route,$i);
}
}
... ...
... ... @@ -440,10 +440,18 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('content')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'lists'])->name('custom_content_lists');
Route::any('/getCategoryList', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'getCategoryList'])->name('custom_content_getCategoryList');
Route::any('/info', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'info'])->name('custom_content_info');
Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'save'])->name('custom_content_save');
Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleContentController::class, 'del'])->name('custom_content_del');
});
Route::prefix('extend')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\CustomModule\CustomModuleExtentController::class, 'lists'])->name('custom_extend_lists');
Route::any('/info', [\App\Http\Controllers\Bside\CustomModule\CustomModuleExtentController::class, 'info'])->name('custom_extend_info');
Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleExtentController::class, 'save'])->name('custom_extend_save');
Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleExtentController::class, 'del'])->name('custom_extend_del');
});
});
});
//无需登录验证的路由组
... ...