作者 lyh

gx

@@ -49,6 +49,25 @@ class ATemplateTypeController extends BaseController @@ -49,6 +49,25 @@ class ATemplateTypeController extends BaseController
49 } 49 }
50 50
51 /** 51 /**
  52 + * @remark :排序
  53 + * @name :sort
  54 + * @author :lyh
  55 + * @method :post
  56 + * @time :2023/8/23 10:58
  57 + */
  58 + public function sort(ATemplateTypeLogic $ATemplateTypeLogic){
  59 + $this->request->validate([
  60 + 'id'=>'required',
  61 + 'sort'=>'required'
  62 + ],[
  63 + 'id.required' => '产品ID不能为空',
  64 + 'sort.required'=>'排序字段不能为空'
  65 + ]);
  66 + $ATemplateTypeLogic->setSort();
  67 + $this->response('success');
  68 + }
  69 +
  70 + /**
52 * @remark :逻辑删除模块 71 * @remark :逻辑删除模块
53 * @name :del 72 * @name :del
54 * @author :lyh 73 * @author :lyh
1 <?php 1 <?php
2 /** 2 /**
3 * @remark : 3 * @remark :
4 - * @name :BTemplateLog.php 4 + * @name :BTemplateLogController.php
5 * @author :lyh 5 * @author :lyh
6 * @method :post 6 * @method :post
7 - * @time :2023/8/23 10:31 7 + * @time :2023/8/23 10:42
8 */ 8 */
9 9
10 namespace App\Http\Controllers\Bside\Template; 10 namespace App\Http\Controllers\Bside\Template;
11 11
12 use App\Http\Controllers\Bside\BaseController; 12 use App\Http\Controllers\Bside\BaseController;
13 13
14 -class BTemplateLog extends BaseController 14 +/**
  15 + * @remark :用户编辑模版记录
  16 + * @name :BTemplateLogController
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2023/8/23 10:42
  20 + */
  21 +class BTemplateLogController extends BaseController
15 { 22 {
16 - public function lists(){  
17 23
18 - }  
19 } 24 }
@@ -65,4 +65,19 @@ class ATemplateTypeLogic extends BaseLogic @@ -65,4 +65,19 @@ class ATemplateTypeLogic extends BaseLogic
65 } 65 }
66 return $this->success(); 66 return $this->success();
67 } 67 }
  68 +
  69 + /**
  70 + * @remark :排序
  71 + * @name :setSort
  72 + * @author :lyh
  73 + * @method :post
  74 + * @time :2023/8/19 11:16
  75 + */
  76 + public function setSort(){
  77 + $rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
  78 + if($rs === false){
  79 + $this->fail('error');
  80 + }
  81 + return $this->success();
  82 + }
68 } 83 }
@@ -173,14 +173,12 @@ class BTemplateLogic extends BaseLogic @@ -173,14 +173,12 @@ class BTemplateLogic extends BaseLogic
173 public function templateSave(){ 173 public function templateSave(){
174 //查询当前模版是否已保存 174 //查询当前模版是否已保存
175 $info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']); 175 $info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']);
176 - if($info === false){  
177 //字符串截取 176 //字符串截取
178 - $this->StringProcessing();  
179 - $this->templateSaveParam($this->param['template_id']); 177 + $this->param = $this->stringProcessing($this->param);
  178 + $this->param = $this->templateSaveParam($this->param);
  179 + if($info === false){
180 $rs = $this->model->add($this->param); 180 $rs = $this->model->add($this->param);
181 }else{ 181 }else{
182 - $this->StringProcessing();  
183 - $this->templateSaveParam($this->param['template_id']);  
184 $rs = $this->model->edit($this->param,['id'=>$info['id']]); 182 $rs = $this->model->edit($this->param,['id'=>$info['id']]);
185 } 183 }
186 if($rs === false){ 184 if($rs === false){
@@ -218,13 +216,14 @@ class BTemplateLogic extends BaseLogic @@ -218,13 +216,14 @@ class BTemplateLogic extends BaseLogic
218 * @method :post 216 * @method :post
219 * @time :2023/7/21 16:30 217 * @time :2023/7/21 16:30
220 */ 218 */
221 - public function templateSaveParam($template_id){  
222 - $this->param['project_id'] = $this->user['project_id'];  
223 - if($this->param['source'] == 1){//首页  
224 - $this->param['html'] = characterTruncation($this->param['html'],'/<style id="globalsojs-header">(.*?)<\/footer>/s'); 219 + public function templateSaveParam($param){
  220 + $param['project_id'] = $this->user['project_id'];
  221 + if($param['source'] == 1){//首页
  222 + $param['html'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/footer>/s');
225 }else{ 223 }else{
226 - $this->param['html'] = $this->param['main_html']; 224 + $param['html'] = $param['main_html'];
227 } 225 }
  226 + return $this->success($param);
228 } 227 }
229 228
230 /** 229 /**
@@ -257,16 +256,30 @@ class BTemplateLogic extends BaseLogic @@ -257,16 +256,30 @@ class BTemplateLogic extends BaseLogic
257 * @method :post 256 * @method :post
258 * @time :2023/6/29 15:35 257 * @time :2023/6/29 15:35
259 */ 258 */
260 - public function StringProcessing(){ 259 + public function stringProcessing($param){
261 //字符串截取 260 //字符串截取
262 - $this->param['head_html'] = characterTruncation($this->param['html'],'/<header\b[^>]*>(.*?)<\/header>/s');  
263 - $this->param['main_html'] = characterTruncation($this->param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');  
264 - $this->param['footer_html'] = characterTruncation($this->param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s');  
265 - $this->param['head_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s');  
266 - $this->param['main_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');  
267 - $this->param['footer_css'] = characterTruncation($this->param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s'); 261 + $param['head_html'] = characterTruncation($param['html'],'/<header\b[^>]*>(.*?)<\/header>/s');
  262 + $param['main_html'] = characterTruncation($param['html'],'/<main\b[^>]*>(.*?)<\/main>/s');
  263 + $param['footer_html'] = characterTruncation($param['html'],'/<footer\b[^>]*>(.*?)<\/footer>/s');
  264 + $param['head_css'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s');
  265 + $param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
  266 + $param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s');
  267 + return $this->success($param);
268 } 268 }
269 269
  270 + /**
  271 + * @remark :默认产品模块
  272 + * @name :getProductModule
  273 + * @author :lyh
  274 + * @method :post
  275 + * @time :2023/7/27 15:08
  276 + */
  277 + public function getProductModule(){
  278 + //获取公共主题头部底部
  279 + $serviceSettingModel = new ServiceSettingModel();
  280 + $info = $serviceSettingModel->read(['type'=>$serviceSettingModel::TYPE_PRODUCT]);
  281 + return $info['values'];
  282 + }
270 283
271 284
272 /** 285 /**
@@ -361,17 +374,4 @@ class BTemplateLogic extends BaseLogic @@ -361,17 +374,4 @@ class BTemplateLogic extends BaseLogic
361 return $this->success($data); 374 return $this->success($data);
362 } 375 }
363 376
364 - /**  
365 - * @remark :默认产品模块  
366 - * @name :getProductModule  
367 - * @author :lyh  
368 - * @method :post  
369 - * @time :2023/7/27 15:08  
370 - */  
371 - public function getProductModule(){  
372 - //获取公共主题头部底部  
373 - $serviceSettingModel = new ServiceSettingModel();  
374 - $info = $serviceSettingModel->read(['type'=>3]);  
375 - return $info['values'];  
376 - }  
377 } 377 }
@@ -12,5 +12,7 @@ use App\Models\Base; @@ -12,5 +12,7 @@ use App\Models\Base;
12 */ 12 */
13 class Service extends Base 13 class Service extends Base
14 { 14 {
  15 + const TYPE_PRODUCT = 3;
  16 +
15 protected $table = 'gl_service_setting'; 17 protected $table = 'gl_service_setting';
16 } 18 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :BTemplateLog.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/8/23 10:39
  8 + */
  9 +
  10 +namespace App\Models\Template;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :用户模版编辑记录
  16 + * @name :BTemplateLog
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2023/8/23 10:40
  20 + */
  21 +class BTemplateLog extends Base
  22 +{
  23 + protected $table = 'gl_template_log';
  24 +}
@@ -282,6 +282,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -282,6 +282,7 @@ Route::middleware(['aloginauth'])->group(function () {
282 Route::prefix('type')->group(function () { 282 Route::prefix('type')->group(function () {
283 Route::any('/', [Aside\Template\ATemplateTypeController::class, 'getType'])->name('admin.ATemplateType_getType'); 283 Route::any('/', [Aside\Template\ATemplateTypeController::class, 'getType'])->name('admin.ATemplateType_getType');
284 Route::any('/save', [Aside\Template\ATemplateTypeController::class, 'save'])->name('admin.ATemplateType_save'); 284 Route::any('/save', [Aside\Template\ATemplateTypeController::class, 'save'])->name('admin.ATemplateType_save');
  285 + Route::any('/sort', [Aside\Template\ATemplateTypeController::class, 'sort'])->name('admin.ATemplateType_sort');
285 Route::any('/del', [Aside\Template\ATemplateTypeController::class, 'del'])->name('admin.ATemplateType_del'); 286 Route::any('/del', [Aside\Template\ATemplateTypeController::class, 'del'])->name('admin.ATemplateType_del');
286 }); 287 });
287 }); 288 });