Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into develop
正在显示
21 个修改的文件
包含
438 行增加
和
738 行删除
| @@ -404,3 +404,53 @@ if (!function_exists('getDateArray')) { | @@ -404,3 +404,53 @@ if (!function_exists('getDateArray')) { | ||
| 404 | return $days; | 404 | return $days; |
| 405 | } | 405 | } |
| 406 | } | 406 | } |
| 407 | +/** | ||
| 408 | + * @param $str | ||
| 409 | + * @remark :判断是否为中文 | ||
| 410 | + * @name :isChinese | ||
| 411 | + * @author :lyh | ||
| 412 | + * @method :post | ||
| 413 | + * @time :2023/6/28 16:15 | ||
| 414 | + */ | ||
| 415 | +function isChinese($str) { | ||
| 416 | + return preg_match('/^[\x{4e00}-\x{9fa5}]+$/u', $str); | ||
| 417 | +} | ||
| 418 | + | ||
| 419 | +/** | ||
| 420 | + * @param $str | ||
| 421 | + * @remark :判断是否为英文 | ||
| 422 | + * @name :isEnglish | ||
| 423 | + * @author :lyh | ||
| 424 | + * @method :post | ||
| 425 | + * @time :2023/6/28 16:15 | ||
| 426 | + */ | ||
| 427 | +function isEnglish($str) { | ||
| 428 | + return preg_match('/^[a-zA-Z]+$/u', $str); | ||
| 429 | +} | ||
| 430 | + | ||
| 431 | +/** | ||
| 432 | + * @remark :字符串截取 | ||
| 433 | + * @name :characterTruncation | ||
| 434 | + * @author :lyh | ||
| 435 | + * @method :post | ||
| 436 | + * @time :2023/6/28 17:39 | ||
| 437 | + */ | ||
| 438 | +function characterTruncation($str,$rule = 1){ | ||
| 439 | + switch ($rule){ | ||
| 440 | + case 1: | ||
| 441 | + $rule_str = '/<head>(.*?)<\/head>/'; | ||
| 442 | + break; | ||
| 443 | + case 2: | ||
| 444 | + $rule_str = '/<main>(.*?)<\/main>/'; | ||
| 445 | + break; | ||
| 446 | + case 3: | ||
| 447 | + $rule_str = '/<footer>(.*?)<\/footer>/'; | ||
| 448 | + break; | ||
| 449 | + } | ||
| 450 | + preg_match($rule_str, $str, $result); | ||
| 451 | + if (isset($result[1])) { | ||
| 452 | + $result = $result[1]; | ||
| 453 | + return $result; | ||
| 454 | + } | ||
| 455 | + return $result; | ||
| 456 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Aside\Template; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Http\Controllers\Aside\BaseController; | ||
| 7 | +use App\Http\Logic\Aside\Template\ATemplateLogic; | ||
| 8 | +use App\Http\Requests\Aside\Template\ATemplateRequest; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @remark :A端主题模板管理 | ||
| 12 | + * @name :ATemplateController | ||
| 13 | + * @author :lyh | ||
| 14 | + * @time :2023/6/28 16:33 | ||
| 15 | + */ | ||
| 16 | +class ATemplateController extends BaseController | ||
| 17 | +{ | ||
| 18 | + /** | ||
| 19 | + * @remark :公共模板详情 | ||
| 20 | + * @name :lists | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2023/6/28 16:34 | ||
| 24 | + */ | ||
| 25 | + public function lists(ATemplateLogic $aTemplateLogic){ | ||
| 26 | + $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order); | ||
| 27 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 28 | + } | ||
| 29 | + /** | ||
| 30 | + * @remark :保存主题模块 | ||
| 31 | + * @name :save | ||
| 32 | + * @author :lyh | ||
| 33 | + * @method :post | ||
| 34 | + * @time :2023/6/28 16:40 | ||
| 35 | + */ | ||
| 36 | + public function save(ATemplateRequest $aTemplateRequest,ATemplateLogic $aTemplateLogic){ | ||
| 37 | + if(isset($this->param['id'])){ | ||
| 38 | + $this->request->validate([ | ||
| 39 | + 'id'=>'required' | ||
| 40 | + ],[ | ||
| 41 | + 'id.required' => 'ID不能为空' | ||
| 42 | + ]); | ||
| 43 | + } | ||
| 44 | + $aTemplateRequest->validated(); | ||
| 45 | + $aTemplateLogic->aTemplateSave(); | ||
| 46 | + $this->response('success'); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * @remark :修改模块状态 | ||
| 51 | + * @name :status | ||
| 52 | + * @author :lyh | ||
| 53 | + * @method :post | ||
| 54 | + * @time :2023/6/28 16:41 | ||
| 55 | + */ | ||
| 56 | + public function status(ATemplateLogic $aTemplateLogic){ | ||
| 57 | + $this->request->validate([ | ||
| 58 | + 'id'=>'required' | ||
| 59 | + ],[ | ||
| 60 | + 'id.required' => 'ID不能为空' | ||
| 61 | + ]); | ||
| 62 | + $aTemplateLogic->aTemplateStatus(); | ||
| 63 | + $this->response('success'); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * @remark :执行逻辑删除 | ||
| 68 | + * @name :del | ||
| 69 | + * @author :lyh | ||
| 70 | + * @method :post | ||
| 71 | + * @time :2023/6/28 16:41 | ||
| 72 | + */ | ||
| 73 | + public function del(ATemplateLogic $aTemplateLogic){ | ||
| 74 | + $this->request->validate([ | ||
| 75 | + 'id'=>'required' | ||
| 76 | + ],[ | ||
| 77 | + 'id.required' => 'ID不能为空' | ||
| 78 | + ]); | ||
| 79 | + $aTemplateLogic->aTemplateDel(); | ||
| 80 | + $this->response('success'); | ||
| 81 | + } | ||
| 82 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Aside\Template; | ||
| 4 | + | ||
| 5 | +use App\Http\Controllers\Aside\BaseController; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @remark :左侧模块管理 | ||
| 9 | + * @name :ATemplateModuleController | ||
| 10 | + * @author :lyh | ||
| 11 | + * @time :2023/6/28 16:54 | ||
| 12 | + */ | ||
| 13 | +class ATemplateModuleController extends BaseController | ||
| 14 | +{ | ||
| 15 | + /** | ||
| 16 | + * @remark :左侧模块列表 | ||
| 17 | + * @name :lists | ||
| 18 | + * @author :lyh | ||
| 19 | + * @method :post | ||
| 20 | + * @time :2023/6/28 16:54 | ||
| 21 | + */ | ||
| 22 | + public function lists(){ | ||
| 23 | + | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * @remark :左侧模块保存 | ||
| 28 | + * @name :save | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2023/6/28 16:55 | ||
| 32 | + */ | ||
| 33 | + public function save(){ | ||
| 34 | + | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * @remark :编辑状态 | ||
| 40 | + * @name :status | ||
| 41 | + * @author :lyh | ||
| 42 | + * @method :post | ||
| 43 | + * @time :2023/6/28 16:55 | ||
| 44 | + */ | ||
| 45 | + public function status(){ | ||
| 46 | + | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * @remark :逻辑删除模块 | ||
| 51 | + * @name :del | ||
| 52 | + * @author :lyh | ||
| 53 | + * @method :post | ||
| 54 | + * @time :2023/6/28 16:55 | ||
| 55 | + */ | ||
| 56 | + public function del(){ | ||
| 57 | + | ||
| 58 | + } | ||
| 59 | +} |
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | namespace App\Http\Controllers\Bside; | 3 | namespace App\Http\Controllers\Bside; |
| 4 | 4 | ||
| 5 | use App\Enums\Common\Code; | 5 | use App\Enums\Common\Code; |
| 6 | +use App\Helper\Translate; | ||
| 6 | use App\Http\Logic\Bside\User\UserLogic; | 7 | use App\Http\Logic\Bside\User\UserLogic; |
| 7 | use App\Http\Logic\Bside\User\UserLoginLogic; | 8 | use App\Http\Logic\Bside\User\UserLoginLogic; |
| 8 | use App\Models\Project\Project; | 9 | use App\Models\Project\Project; |
| @@ -145,4 +146,16 @@ class ComController extends BaseController | @@ -145,4 +146,16 @@ class ComController extends BaseController | ||
| 145 | public function ceshi(){ | 146 | public function ceshi(){ |
| 146 | return $this->request->route()->getAction(); | 147 | return $this->request->route()->getAction(); |
| 147 | } | 148 | } |
| 149 | + | ||
| 150 | + /** | ||
| 151 | + * @remark :根据关键字生成链接 | ||
| 152 | + * @name :pubLink | ||
| 153 | + * @author :lyh | ||
| 154 | + * @method :post | ||
| 155 | + * @time :2023/6/28 16:13 | ||
| 156 | + */ | ||
| 157 | + public function stringTranslation(){ | ||
| 158 | + $str = Translate::tran($this->param['str'], 'en'); | ||
| 159 | + $this->response('success',Code::SUCCESS,$str); | ||
| 160 | + } | ||
| 148 | } | 161 | } |
| @@ -4,15 +4,7 @@ namespace App\Http\Controllers\Bside\Template; | @@ -4,15 +4,7 @@ namespace App\Http\Controllers\Bside\Template; | ||
| 4 | 4 | ||
| 5 | use App\Http\Controllers\Bside\BaseController; | 5 | use App\Http\Controllers\Bside\BaseController; |
| 6 | 6 | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * 模板header footer | ||
| 10 | - * @author:dc | ||
| 11 | - * @time 2023/4/26 11:10 | ||
| 12 | - * Class HeaderFooterController | ||
| 13 | - * @package App\Http\Controllers\Bside\Template | ||
| 14 | - */ | ||
| 15 | -class HeaderFooterController extends BaseController | 7 | +class BTemplateController extends BaseController |
| 16 | { | 8 | { |
| 17 | 9 | ||
| 18 | } | 10 | } |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside\Template; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 6 | +use App\Models\Template\ATemplate; | ||
| 7 | +use App\Models\Template\BSetting; | ||
| 8 | + | ||
| 9 | +class ATemplateLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + $this->model = new ATemplate(); | ||
| 15 | + $this->param = $this->requestAll; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @remark :公共模块模板 | ||
| 20 | + * @name :aTemplateList | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2023/6/28 17:03 | ||
| 24 | + */ | ||
| 25 | + public function aTemplateList($map,$page,$row,$order = ['created_at'],$filed = ['*']){ | ||
| 26 | + $lists = $this->model->lists($map,$page,$row,$order,$filed); | ||
| 27 | + return $this->success($lists); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * @remark :添加或编辑模块 | ||
| 32 | + * @name :aTemplateSave | ||
| 33 | + * @author :lyh | ||
| 34 | + * @method :post | ||
| 35 | + * @time :2023/6/28 17:13 | ||
| 36 | + */ | ||
| 37 | + public function aTemplateSave(){ | ||
| 38 | + //字符串截取 | ||
| 39 | + $this->param['head_html'] = characterTruncation($this->param['html']); | ||
| 40 | + $this->param['main_html'] = characterTruncation($this->param['html'],2); | ||
| 41 | + $this->param['footer_html'] = characterTruncation($this->param['html'],3); | ||
| 42 | + if(isset($this->param['id'])){ | ||
| 43 | + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 44 | + }else{ | ||
| 45 | + $rs = $this->model->add($this->param); | ||
| 46 | + } | ||
| 47 | + if($rs === false){ | ||
| 48 | + $this->fail('error'); | ||
| 49 | + } | ||
| 50 | + return $this->success(); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * @remark :修改模块状态 | ||
| 55 | + * @name :aTemplateStatus | ||
| 56 | + * @author :lyh | ||
| 57 | + * @method :post | ||
| 58 | + * @time :2023/6/28 17:15 | ||
| 59 | + */ | ||
| 60 | + public function aTemplateStatus(){ | ||
| 61 | + $rs = $this->model->edit(['status'=>$this->param['status']],['id'=>$this->param['id']]); | ||
| 62 | + if($rs === false){ | ||
| 63 | + $this->fail('error'); | ||
| 64 | + } | ||
| 65 | + return $this->success(); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * @remark :逻辑删除模板数据 | ||
| 71 | + * @name :aTemplateDel | ||
| 72 | + * @author :lyh | ||
| 73 | + * @method :post | ||
| 74 | + * @time :2023/6/28 17:17 | ||
| 75 | + */ | ||
| 76 | + public function aTemplateDel(){ | ||
| 77 | + //查看当前模板是否有模板在使用 | ||
| 78 | + $BSettingModel = new BSetting(); | ||
| 79 | + $info = $BSettingModel->read(['template_id'=>$this->param['id']]); | ||
| 80 | + if($info !== false){ | ||
| 81 | + $this->fail('当前模板有项目在使用,不允许删除'); | ||
| 82 | + } | ||
| 83 | + $rs = $this->model->edit(['deleted_status'=>$this->param['deleted_status'],'deleted_at'=>date('Y-m-d H:i:s')],['id'=>$this->param['id']]); | ||
| 84 | + if($rs === false){ | ||
| 85 | + $this->fail('error'); | ||
| 86 | + } | ||
| 87 | + return $this->success(); | ||
| 88 | + } | ||
| 89 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside\Template; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 6 | +use App\Models\Template\ATemplateModule; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @remark :左侧模块管理 | ||
| 10 | + * @name :ATemplateModuleLogic | ||
| 11 | + * @author :lyh | ||
| 12 | + * @time :2023/6/28 16:58 | ||
| 13 | + */ | ||
| 14 | +class ATemplateModuleLogic extends BaseLogic | ||
| 15 | +{ | ||
| 16 | + public function __construct() | ||
| 17 | + { | ||
| 18 | + parent::__construct(); | ||
| 19 | + $this->model = new ATemplateModule(); | ||
| 20 | + $this->param = $this->requestAll; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * @remark :左侧模块列表 | ||
| 25 | + * @name :aTemplateModuleLists | ||
| 26 | + * @author :lyh | ||
| 27 | + * @method :post | ||
| 28 | + * @time :2023/6/28 18:01 | ||
| 29 | + */ | ||
| 30 | + public function aTemplateModuleLists(){ | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * @remark :保存左侧模块 | ||
| 36 | + * @name :aTemplateModuleSave | ||
| 37 | + * @author :lyh | ||
| 38 | + * @method :post | ||
| 39 | + * @time :2023/6/28 18:01 | ||
| 40 | + */ | ||
| 41 | + public function aTemplateModuleSave(){ | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @remark :修改左侧模块状态 | ||
| 47 | + * @name :aTemplateModuleStatus | ||
| 48 | + * @author :lyh | ||
| 49 | + * @method :post | ||
| 50 | + * @time :2023/6/28 18:02 | ||
| 51 | + */ | ||
| 52 | + public function aTemplateModuleStatus(){ | ||
| 53 | + | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + /** | ||
| 57 | + * @remark :逻辑删除左侧模块 | ||
| 58 | + * @name :aTemplateModuleDel | ||
| 59 | + * @author :lyh | ||
| 60 | + * @method :post | ||
| 61 | + * @time :2023/6/28 18:02 | ||
| 62 | + */ | ||
| 63 | + public function aTemplateModuleDel(){ | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | +} |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Logic\Aside\Template; | ||
| 4 | - | ||
| 5 | - | ||
| 6 | -use App\Http\Logic\Aside\BaseLogic; | ||
| 7 | -use App\Models\Template\ATemplateChunk; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * 自定义块 模板 | ||
| 11 | - * @author:dc | ||
| 12 | - * @time 2023/5/29 10:46 | ||
| 13 | - * Class TemplateChunkLogic | ||
| 14 | - * @package App\Http\Logic\Aside\Template | ||
| 15 | - */ | ||
| 16 | -class TemplateChunkLogic extends BaseLogic { | ||
| 17 | - | ||
| 18 | - public function __construct() | ||
| 19 | - { | ||
| 20 | - parent::__construct(); | ||
| 21 | - | ||
| 22 | - $this->model = new ATemplateChunk(); | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - public function save($param) | ||
| 29 | - { | ||
| 30 | - | ||
| 31 | - $param['images'] = is_array($param['images']??'') ? json_encode($param['images']): '[]'; | ||
| 32 | - $param['video'] = is_array($param['video']??'') ? json_encode($param['video']): '[]'; | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - return parent::save($param); // TODO: Change the autogenerated stub | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - | ||
| 39 | -} |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Logic\Aside\Template; | ||
| 4 | - | ||
| 5 | - | ||
| 6 | -use App\Http\Logic\Aside\BaseLogic; | ||
| 7 | -use App\Models\Template\ATemplate; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * @author:dc | ||
| 11 | - * @time 2023/5/11 14:35 | ||
| 12 | - * Class TemplateLogic | ||
| 13 | - * @package App\Http\Logic\Aside\Template | ||
| 14 | - */ | ||
| 15 | -class TemplateLogic extends BaseLogic { | ||
| 16 | - | ||
| 17 | - public function __construct() | ||
| 18 | - { | ||
| 19 | - parent::__construct(); | ||
| 20 | - | ||
| 21 | - $this->model = new ATemplate(); | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | -} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Bside\BTemplate; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Bside\BaseLogic; | ||
| 6 | +use App\Models\Template\BTemplate; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @remark :b端模块 | ||
| 10 | + * @name :BTemplateLogic | ||
| 11 | + * @author :lyh | ||
| 12 | + * @time :2023/6/28 17:00 | ||
| 13 | + */ | ||
| 14 | +class BTemplateLogic extends BaseLogic | ||
| 15 | +{ | ||
| 16 | + public function __construct() | ||
| 17 | + { | ||
| 18 | + parent::__construct(); | ||
| 19 | + $this->model = new BTemplate(); | ||
| 20 | + $this->param = $this->requestAll; | ||
| 21 | + } | ||
| 22 | +} |
| @@ -3,17 +3,15 @@ | @@ -3,17 +3,15 @@ | ||
| 3 | namespace App\Http\Requests\Aside\Template; | 3 | namespace App\Http\Requests\Aside\Template; |
| 4 | 4 | ||
| 5 | use Illuminate\Foundation\Http\FormRequest; | 5 | use Illuminate\Foundation\Http\FormRequest; |
| 6 | -use Illuminate\Validation\Rule; | ||
| 7 | 6 | ||
| 8 | /** | 7 | /** |
| 9 | - * @author:dc | ||
| 10 | - * @time 2023/5/11 14:38 | ||
| 11 | - * Class TemplateRequest | ||
| 12 | - * @package App\Http\Requests\Aside\Template | 8 | + * @remark :左侧模块参数验证 |
| 9 | + * @name :ATemplateModuleRequest | ||
| 10 | + * @author :lyh | ||
| 11 | + * @time :2023/6/28 18:04 | ||
| 13 | */ | 12 | */ |
| 14 | -class TemplateRequest extends FormRequest | 13 | +class ATemplateModuleRequest extends FormRequest |
| 15 | { | 14 | { |
| 16 | - | ||
| 17 | /** | 15 | /** |
| 18 | * Determine if the user is authorized to make this request. | 16 | * Determine if the user is authorized to make this request. |
| 19 | * | 17 | * |
| @@ -31,43 +29,19 @@ class TemplateRequest extends FormRequest | @@ -31,43 +29,19 @@ class TemplateRequest extends FormRequest | ||
| 31 | */ | 29 | */ |
| 32 | public function rules() | 30 | public function rules() |
| 33 | { | 31 | { |
| 34 | - $rule = [ | ||
| 35 | - 'id' => ['required','integer'], | ||
| 36 | - 'name' => ['required'], | ||
| 37 | - 'status' => ['required',Rule::in(0,1)], | ||
| 38 | - 'is_default' => ['required',Rule::in(0,1)], | ||
| 39 | - 'sort' => ['required','integer'], | ||
| 40 | - 'thumb' => ['required'], | ||
| 41 | - 'url' => ['required'], | ||
| 42 | - 'html' => ['required'], | 32 | + return [ |
| 33 | + 'name'=>'required', | ||
| 34 | + 'image'=>'required', | ||
| 35 | + 'html'=>'required', | ||
| 43 | ]; | 36 | ]; |
| 44 | - | ||
| 45 | - // 更新场景 | ||
| 46 | - if($this->is('a/template/insert')){ | ||
| 47 | - unset($rule['id']); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - return $rule; | ||
| 51 | } | 37 | } |
| 52 | 38 | ||
| 53 | - | ||
| 54 | - | ||
| 55 | public function messages() | 39 | public function messages() |
| 56 | { | 40 | { |
| 57 | return [ | 41 | return [ |
| 58 | - 'id.required' => 'id必须', | ||
| 59 | - 'id.integer' => 'id必须', | ||
| 60 | - | ||
| 61 | - 'name.required' => '名称必须', | ||
| 62 | - 'status.integer' => '状态错误', | ||
| 63 | - 'status.in' => '状态错误', | ||
| 64 | - 'is_default.integer' => '是否默认', | ||
| 65 | - 'is_default.in' => '是否默认', | ||
| 66 | - 'sort.required' => '排序必须', | ||
| 67 | - 'sort.integer' => '排序必须', | ||
| 68 | - 'thumb.required' => '缩略图必须', | ||
| 69 | - 'url.required' => '预览链接必须', | 42 | + 'name.required'=>'名称不能为空', |
| 43 | + 'image.required' => '图片不能为空', | ||
| 44 | + 'html.required'=>'代码不能为空', | ||
| 70 | ]; | 45 | ]; |
| 71 | } | 46 | } |
| 72 | - | ||
| 73 | } | 47 | } |
| @@ -3,18 +3,9 @@ | @@ -3,18 +3,9 @@ | ||
| 3 | namespace App\Http\Requests\Aside\Template; | 3 | namespace App\Http\Requests\Aside\Template; |
| 4 | 4 | ||
| 5 | use Illuminate\Foundation\Http\FormRequest; | 5 | use Illuminate\Foundation\Http\FormRequest; |
| 6 | -use Illuminate\Validation\Rule; | ||
| 7 | 6 | ||
| 8 | -/** | ||
| 9 | - * 自定义模板 块 | ||
| 10 | - * @author:dc | ||
| 11 | - * @time 2023/5/29 10:57 | ||
| 12 | - * Class TemplateChunkRequest | ||
| 13 | - * @package App\Http\Requests\Aside\Template | ||
| 14 | - */ | ||
| 15 | -class TemplateChunkRequest extends FormRequest | 7 | +class ATemplateRequest extends FormRequest |
| 16 | { | 8 | { |
| 17 | - | ||
| 18 | /** | 9 | /** |
| 19 | * Determine if the user is authorized to make this request. | 10 | * Determine if the user is authorized to make this request. |
| 20 | * | 11 | * |
| @@ -32,51 +23,19 @@ class TemplateChunkRequest extends FormRequest | @@ -32,51 +23,19 @@ class TemplateChunkRequest extends FormRequest | ||
| 32 | */ | 23 | */ |
| 33 | public function rules() | 24 | public function rules() |
| 34 | { | 25 | { |
| 35 | - $rule = [ | ||
| 36 | - 'id' => ['required','integer'], | ||
| 37 | - 'name' => ['required'], | ||
| 38 | - 'type' => ['required'], | ||
| 39 | - 'status' => ['required',Rule::in(0,1)], | ||
| 40 | - 'sort' => ['required','integer'], | ||
| 41 | - 'thumb' => ['required'], | ||
| 42 | - 'html' => ['required'], | ||
| 43 | - 'attr' => [], | ||
| 44 | - 'images' => [], | ||
| 45 | - 'video' => [], | 26 | + return [ |
| 27 | + 'name'=>'required', | ||
| 28 | + 'image'=>'required', | ||
| 29 | + 'html'=>'required', | ||
| 46 | ]; | 30 | ]; |
| 47 | - | ||
| 48 | - // 更新场景 | ||
| 49 | - if($this->is('a/template/chunk/create')){ | ||
| 50 | - unset($rule['id']); | ||
| 51 | - } | ||
| 52 | - if($this->is('b/template/chunk/create')){ | ||
| 53 | - unset($rule['id']); | ||
| 54 | - } | ||
| 55 | - | ||
| 56 | - return $rule; | ||
| 57 | } | 31 | } |
| 58 | 32 | ||
| 59 | - | ||
| 60 | - | ||
| 61 | public function messages() | 33 | public function messages() |
| 62 | { | 34 | { |
| 63 | return [ | 35 | return [ |
| 64 | - 'id.required' => 'id必须', | ||
| 65 | - 'id.integer' => 'id必须', | ||
| 66 | - | ||
| 67 | - 'name.required' => '名称必须', | ||
| 68 | - 'type.required' => '类型必须', | ||
| 69 | - 'status.integer' => '状态错误', | ||
| 70 | - 'status.in' => '状态错误', | ||
| 71 | - | ||
| 72 | - 'sort.required' => '排序必须', | ||
| 73 | - 'sort.integer' => '排序必须', | ||
| 74 | - 'thumb.required' => '缩略图必须', | ||
| 75 | - | ||
| 76 | - 'html.required' => 'html代码必须', | ||
| 77 | -// 'attr.required' => '其他必须', | ||
| 78 | - | 36 | + 'name.required'=>'名称不能为空', |
| 37 | + 'image.required' => '图片不能为空', | ||
| 38 | + 'html.required'=>'代码不能为空', | ||
| 79 | ]; | 39 | ]; |
| 80 | } | 40 | } |
| 81 | - | ||
| 82 | } | 41 | } |
| @@ -3,122 +3,14 @@ | @@ -3,122 +3,14 @@ | ||
| 3 | namespace App\Models\Template; | 3 | namespace App\Models\Template; |
| 4 | 4 | ||
| 5 | use App\Models\Base; | 5 | use App\Models\Base; |
| 6 | -use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 7 | 6 | ||
| 8 | /** | 7 | /** |
| 9 | - * 由 A端增删改 | ||
| 10 | - * 模板 | ||
| 11 | - * @author:dc | ||
| 12 | - * @time 2023/5/9 13:56 | ||
| 13 | - * Class ATemplate | ||
| 14 | - * @package App\Models\Template | 8 | + * @remark :公共模块 |
| 9 | + * @name :ATemplate | ||
| 10 | + * @author :lyh | ||
| 11 | + * @time :2023/6/28 16:51 | ||
| 15 | */ | 12 | */ |
| 16 | -class ATemplate extends Base{ | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - protected $table = 'gl_aside_template'; | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - protected $hidden = ['deleted_at']; | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - use SoftDeletes; | ||
| 26 | - | ||
| 27 | - /** | ||
| 28 | - * 显示 | ||
| 29 | - */ | ||
| 30 | - const STATUS_ACTIVE = 1; | ||
| 31 | - | ||
| 32 | - /** | ||
| 33 | - * 隐藏 | ||
| 34 | - */ | ||
| 35 | - const STATUS_DISABLED = 0; | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - /** | ||
| 39 | - * b 端调用 | ||
| 40 | - * @param int $limit | ||
| 41 | - * @return mixed | ||
| 42 | - * @author:dc | ||
| 43 | - * @time 2023/5/9 14:14 | ||
| 44 | - */ | ||
| 45 | - public static function _bAll(int $limit = 20) | ||
| 46 | - { | ||
| 47 | - return static::where(function ($query){ | ||
| 48 | - | ||
| 49 | - $query->where('status',static::STATUS_ACTIVE); | ||
| 50 | - | ||
| 51 | - }) | ||
| 52 | - ->select(['id','name','url','thumb','created_at','updated_at']) | ||
| 53 | - ->orderBy('sort') | ||
| 54 | - ->paginate($limit); | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - /** | ||
| 58 | - * @param $id | ||
| 59 | - * @return array | ||
| 60 | - * @author:dc | ||
| 61 | - * @time 2023/5/9 15:16 | ||
| 62 | - */ | ||
| 63 | - public static function _bFind($id) | ||
| 64 | - { | ||
| 65 | - $data = static::where('id',$id)->first(); | ||
| 66 | - if(!$data || $data->status === static::STATUS_DISABLED){ | ||
| 67 | - return []; | ||
| 68 | - } | ||
| 69 | - return $data; | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - | ||
| 73 | - /** | ||
| 74 | - * 获取默认模板 | ||
| 75 | - * @return mixed | ||
| 76 | - * @author:dc | ||
| 77 | - * @time 2023/5/9 15:09 | ||
| 78 | - */ | ||
| 79 | - public static function _default() | ||
| 80 | - { | ||
| 81 | - return static::where(['status'=>static::STATUS_ACTIVE,'is_default'=>1])->first(); | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - | ||
| 85 | - /** | ||
| 86 | - * 查询 | ||
| 87 | - * @param $id | ||
| 88 | - * @return mixed | ||
| 89 | - * @author:dc | ||
| 90 | - * @time 2023/5/10 10:15 | ||
| 91 | - */ | ||
| 92 | - public static function _find($id) | ||
| 93 | - { | ||
| 94 | - return static::where('id',$id)->first(); | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - | ||
| 98 | -// /** | ||
| 99 | -// * @param array $data | ||
| 100 | -// * @param int $id | ||
| 101 | -// * @author:dc | ||
| 102 | -// * @time 2023/5/11 10:08 | ||
| 103 | -// */ | ||
| 104 | -// public static function _save(array $data,int $id=0){ | ||
| 105 | -// if($id){ | ||
| 106 | -// $model = static::where('id',$id)->first(); | ||
| 107 | -// } | ||
| 108 | -// if(empty($model)) $model = new static(); | ||
| 109 | -// | ||
| 110 | -// $model->name = $data['name']; | ||
| 111 | -// $model->status = $data['status']; | ||
| 112 | -// $model->is_default = $data['is_default']; | ||
| 113 | -// $model->sort = $data['sort']; | ||
| 114 | -// $model->thumb = $data['thumb']; | ||
| 115 | -// $model->url = $data['url']; | ||
| 116 | -// | ||
| 117 | -// $model->save(); | ||
| 118 | -// | ||
| 119 | -// return $model->id; | ||
| 120 | -// } | ||
| 121 | - | ||
| 122 | - | ||
| 123 | - | 13 | +class ATemplate extends Base |
| 14 | +{ | ||
| 15 | + protected $table = 'gl_public_template'; | ||
| 124 | } | 16 | } |
app/Models/Template/ATemplateChunk.php
已删除
100644 → 0
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Models\Template; | ||
| 4 | - | ||
| 5 | -use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * 自定义块 模板块 | ||
| 9 | - * @author:dc | ||
| 10 | - * @time 2023/5/29 10:39 | ||
| 11 | - * Class ATemplateChunk | ||
| 12 | - * @package App\Models\Template | ||
| 13 | - */ | ||
| 14 | -class ATemplateChunk extends \App\Models\Base{ | ||
| 15 | - | ||
| 16 | - | ||
| 17 | - protected $table = 'gl_aside_template_chunk'; | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - protected $hidden = ['deleted_at']; | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - use SoftDeletes; | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - public static $typeMap = [ | ||
| 27 | - 'index' => '首页', | ||
| 28 | - 'product' => '商品列表', | ||
| 29 | - 'product_info' => '商品详情', | ||
| 30 | - 'blogs' => '博客列表', | ||
| 31 | - 'blogs_info' => '博客详情', | ||
| 32 | - 'page' => '单页', | ||
| 33 | - 'news' => '新闻列表', | ||
| 34 | - 'news_info' => '新闻详情', | ||
| 35 | - ]; | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - public function getImagesAttribute($val) | ||
| 40 | - { | ||
| 41 | - return $val ? json_decode($val,true) : []; | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - public function getVideoAttribute($val) | ||
| 45 | - { | ||
| 46 | - return $val ? json_decode($val,true) : []; | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - | ||
| 50 | -} |
app/Models/Template/ATemplateHtml.php
已删除
100644 → 0
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Models\Template; | ||
| 4 | - | ||
| 5 | -use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * 由 A端增删改 | ||
| 9 | - * 模板 | ||
| 10 | - * @author:dc | ||
| 11 | - * @time 2023/5/9 13:56 | ||
| 12 | - * Class ATemplate | ||
| 13 | - * @package App\Models\Template | ||
| 14 | - */ | ||
| 15 | -class ATemplateHtml extends \App\Models\Base{ | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - protected $table = 'gl_aside_template_html'; | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - protected $hidden = ['deleted_at']; | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - use SoftDeletes; | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - public static $sourceMap = [ | ||
| 28 | - // 数据表/数据类型 =》 模板类型/模板名称 | ||
| 29 | - 'index' => [ | ||
| 30 | - 'template' => 'index', | ||
| 31 | - 'name'=>'首页' | ||
| 32 | - ], | ||
| 33 | - 'product' => [ | ||
| 34 | - 'template' => 'product', | ||
| 35 | - 'name'=>'商品列表' | ||
| 36 | - ], | ||
| 37 | - 'product_info' => [ | ||
| 38 | - 'template' => 'product_info', | ||
| 39 | - 'name'=>'商品详情' | ||
| 40 | - ], | ||
| 41 | - 'blogs' => [ | ||
| 42 | - 'template' => 'blogs', | ||
| 43 | - 'name'=>'博客列表' | ||
| 44 | - ], | ||
| 45 | - 'blogs_info' => [ | ||
| 46 | - 'template' => 'blogs_info', | ||
| 47 | - 'name'=>'博客详情' | ||
| 48 | - ], | ||
| 49 | - 'page' => [ | ||
| 50 | - 'template' => 'page', | ||
| 51 | - 'name'=>'单页' | ||
| 52 | - ], | ||
| 53 | - 'news' => [ | ||
| 54 | - 'template' => 'news', | ||
| 55 | - 'name'=>'新闻列表' | ||
| 56 | - ], | ||
| 57 | - 'news_info' => [ | ||
| 58 | - 'template' => 'news_info', | ||
| 59 | - 'name'=>'新闻详情' | ||
| 60 | - ], | ||
| 61 | - ]; | ||
| 62 | - | ||
| 63 | - public static $typeMap = [ | ||
| 64 | - 'index' => '首页', | ||
| 65 | - 'product' => '商品列表', | ||
| 66 | - 'product_info' => '商品详情', | ||
| 67 | - 'blogs' => '博客列表', | ||
| 68 | - 'blogs_info' => '博客详情', | ||
| 69 | - 'page' => '单页', | ||
| 70 | - 'news' => '新闻列表', | ||
| 71 | - 'news_info' => '新闻详情', | ||
| 72 | - ]; | ||
| 73 | - | ||
| 74 | - | ||
| 75 | - /** | ||
| 76 | - * 模板中的数据 | ||
| 77 | - * @param $template_id | ||
| 78 | - * @return mixed | ||
| 79 | - * @author:dc | ||
| 80 | - * @time 2023/5/10 10:30 | ||
| 81 | - */ | ||
| 82 | - public static function _all($template_id){ | ||
| 83 | - return static::where(['template_id'=>$template_id])->get(); | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - | ||
| 87 | - /** | ||
| 88 | - * 是否存在type | ||
| 89 | - * @param int $template_id | ||
| 90 | - * @param $type | ||
| 91 | - * @return mixed | ||
| 92 | - * @author:dc | ||
| 93 | - * @time 2023/5/10 16:03 | ||
| 94 | - */ | ||
| 95 | - public static function _typeExist(int $template_id,$type){ | ||
| 96 | - return static::where(['template_id'=>$template_id,'type'=>$type])->limit(1)->count(); | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - | ||
| 100 | - public static function _bAll($template_id){ | ||
| 101 | - return static::where(['template_id'=>$template_id,'status'=>1])->get(); | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - | ||
| 105 | - public static function _find($id){ | ||
| 106 | - $data = static::where('id',$id)->first(); | ||
| 107 | - return $data ? $data->toArray() : []; | ||
| 108 | - } | ||
| 109 | - | ||
| 110 | - /** | ||
| 111 | - * @param array $data | ||
| 112 | - * @param int $id | ||
| 113 | - * @return mixed | ||
| 114 | - * @author:dc | ||
| 115 | - * @time 2023/5/11 10:20 | ||
| 116 | - */ | ||
| 117 | - public static function _save(int $template_id, array $data,int $id = 0){ | ||
| 118 | - if($id){ | ||
| 119 | - $model = static::where('id',$id)->first(); | ||
| 120 | - } | ||
| 121 | - if(empty($model)) $model = new static(); | ||
| 122 | - | ||
| 123 | - $model->template_id = $template_id; | ||
| 124 | - | ||
| 125 | - $model->name = $data['name']; | ||
| 126 | - $model->type = $data['type']; | ||
| 127 | - $model->css = $data['css']; | ||
| 128 | - $model->script = $data['script']; | ||
| 129 | - $model->html = $data['html']; | ||
| 130 | - | ||
| 131 | - | ||
| 132 | - $model->save(); | ||
| 133 | - | ||
| 134 | - return $model->id; | ||
| 135 | - } | ||
| 136 | - | ||
| 137 | - | ||
| 138 | - | ||
| 139 | - | ||
| 140 | - | ||
| 141 | -} |
app/Models/Template/ATemplateModule.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Template; | ||
| 4 | + | ||
| 5 | +use App\Models\Base; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @remark :左侧模块管理 | ||
| 9 | + * @name :ATemplateModuleController | ||
| 10 | + * @author :lyh | ||
| 11 | + * @time :2023/6/28 16:51 | ||
| 12 | + */ | ||
| 13 | +class ATemplateModule extends Base | ||
| 14 | +{ | ||
| 15 | + protected $table = 'gl_public_template_module'; | ||
| 16 | +} |
| @@ -3,105 +3,14 @@ | @@ -3,105 +3,14 @@ | ||
| 3 | namespace App\Models\Template; | 3 | namespace App\Models\Template; |
| 4 | 4 | ||
| 5 | use App\Models\Base; | 5 | use App\Models\Base; |
| 6 | -use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 7 | -use Illuminate\Support\Facades\DB; | ||
| 8 | 6 | ||
| 9 | /** | 7 | /** |
| 10 | - * 当前用户的模板 | ||
| 11 | - * @author:dc | ||
| 12 | - * @time 2023/5/9 15:03 | ||
| 13 | - * Class BSetting | ||
| 14 | - * @package App\Models\Template | 8 | + * @remark :默认主题 |
| 9 | + * @name :BSetting | ||
| 10 | + * @author :lyh | ||
| 11 | + * @time :2023/6/28 16:51 | ||
| 15 | */ | 12 | */ |
| 16 | -class BSetting extends Base { | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | 13 | +class BSetting extends Base |
| 14 | +{ | ||
| 20 | protected $table = 'gl_web_setting_template'; | 15 | protected $table = 'gl_web_setting_template'; |
| 21 | - | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - /** | ||
| 25 | - * b 端调用 | ||
| 26 | - * @param int $limit | ||
| 27 | - * @return mixed | ||
| 28 | - * @author:dc | ||
| 29 | - * @time 2023/5/9 14:14 | ||
| 30 | - */ | ||
| 31 | - public static function _get(int $project_id) | ||
| 32 | - { | ||
| 33 | - $data = static::where('project_id',$project_id)->first(); | ||
| 34 | - | ||
| 35 | - if($data){ | ||
| 36 | - return [ | ||
| 37 | - 'template_id' => $data['template_id'], | ||
| 38 | - 'time' => $data['updated_at'] | ||
| 39 | - ]; | ||
| 40 | - } | ||
| 41 | - | ||
| 42 | - // 米有数据 | ||
| 43 | - // 读取默认的模板 | ||
| 44 | - $temp = ATemplate::_default(); | ||
| 45 | - // 保存 | ||
| 46 | - self::_save($project_id,$temp['id']); | ||
| 47 | - | ||
| 48 | - return [ | ||
| 49 | - 'template_id' => $temp['id'], | ||
| 50 | - 'time' => date('Y-m-d H:i:s') | ||
| 51 | - ]; | ||
| 52 | - } | ||
| 53 | - | ||
| 54 | - | ||
| 55 | - /** | ||
| 56 | - * 模板保存 | ||
| 57 | - * @param int $project_id | ||
| 58 | - * @param int $template_id | ||
| 59 | - * @return mixed | ||
| 60 | - * @author:dc | ||
| 61 | - * @time 2023/5/9 15:13 | ||
| 62 | - */ | ||
| 63 | - public static function _save(int $project_id, int $template_id) | ||
| 64 | - { | ||
| 65 | - | ||
| 66 | - $data = static::where('project_id',$project_id)->first(); | ||
| 67 | - if(!$data){ | ||
| 68 | - $data = new static(); | ||
| 69 | - $data->project_id = $project_id; | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - $data->template_id = $template_id; | ||
| 73 | - | ||
| 74 | - $data->save(); | ||
| 75 | - | ||
| 76 | - // 是否有模板 | ||
| 77 | -// if(!BTemplate::_isExist($project_id,$template_id)){ | ||
| 78 | -// // 没有模板 | ||
| 79 | -// $aData = ATemplate::_find($template_id); | ||
| 80 | -// // 保存到自己的数据中 | ||
| 81 | -// BTemplate::_insert($project_id,$aData); | ||
| 82 | -// | ||
| 83 | -// $aDataHtml = ATemplateHtml::_all($template_id); | ||
| 84 | -// DB::beginTransaction(); | ||
| 85 | -// foreach ($aDataHtml as $item){ | ||
| 86 | -// try { | ||
| 87 | -// // 插入子数据 | ||
| 88 | -// BTemplateHtml::_insert($project_id,$item); | ||
| 89 | -// }catch (\Throwable $e){ | ||
| 90 | -// DB::rollBack(); | ||
| 91 | -// | ||
| 92 | -// return $data->id; | ||
| 93 | -// break; | ||
| 94 | -// } | ||
| 95 | -// | ||
| 96 | -// } | ||
| 97 | -// DB::commit(); | ||
| 98 | -// } | ||
| 99 | - | ||
| 100 | - return $data->id; | ||
| 101 | - | ||
| 102 | - } | ||
| 103 | - | ||
| 104 | - | ||
| 105 | - | ||
| 106 | - | ||
| 107 | } | 16 | } |
| @@ -5,54 +5,12 @@ namespace App\Models\Template; | @@ -5,54 +5,12 @@ namespace App\Models\Template; | ||
| 5 | use App\Models\Base; | 5 | use App\Models\Base; |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | - * 自定义 界面 | ||
| 9 | - * @author:dc | ||
| 10 | - * @time 2023/5/8 13:52 | ||
| 11 | - * Class BTemplate | ||
| 12 | - * @package App\Models\Template | 8 | + * @remark :用户模块 |
| 9 | + * @name :BTemplate | ||
| 10 | + * @author :lyh | ||
| 11 | + * @time :2023/6/28 16:52 | ||
| 13 | */ | 12 | */ |
| 14 | -class BTemplate extends Base { | ||
| 15 | - | 13 | +class BTemplate extends Base |
| 14 | +{ | ||
| 16 | protected $table = 'gl_web_template'; | 15 | protected $table = 'gl_web_template'; |
| 17 | - | ||
| 18 | - protected $hidden = ['project_id']; | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - /** | ||
| 22 | - * 是否存在模板 | ||
| 23 | - * @param int $template_id | ||
| 24 | - * @author:dc | ||
| 25 | - * @time 2023/5/10 10:00 | ||
| 26 | - */ | ||
| 27 | - public static function _isExist(int $project_id, int $template_id) | ||
| 28 | - { | ||
| 29 | - return static::where(['project_id'=>$project_id,'template_id'=>$template_id])->limit(1)->count(); | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - /** | ||
| 34 | - * 插入 | ||
| 35 | - * @param $project_id | ||
| 36 | - * @param $data | ||
| 37 | - * @return mixed | ||
| 38 | - * @author:dc | ||
| 39 | - * @time 2023/5/10 10:23 | ||
| 40 | - */ | ||
| 41 | - public static function _insert($project_id,$data) | ||
| 42 | - { | ||
| 43 | - $model = new static(); | ||
| 44 | - | ||
| 45 | - $model->project_id = $project_id; | ||
| 46 | - $model->template_id = $data['id']; | ||
| 47 | - $model->name = $data['name']; | ||
| 48 | - $model->thumb = $data['thumb']; | ||
| 49 | - $model->html = $data['html']; | ||
| 50 | - | ||
| 51 | - $model->save(); | ||
| 52 | - | ||
| 53 | - return $model->id; | ||
| 54 | - | ||
| 55 | - } | ||
| 56 | - | ||
| 57 | - | ||
| 58 | } | 16 | } |
app/Models/Template/BTemplateData.php
已删除
100644 → 0
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Models\Template; | ||
| 4 | - | ||
| 5 | -use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * @author:dc | ||
| 9 | - * @time 2023/5/10 14:31 | ||
| 10 | - * Class BTemplateData | ||
| 11 | - * @package App\Models\Template | ||
| 12 | - */ | ||
| 13 | -class BTemplateData extends \App\Models\Base{ | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - protected $table = 'gl_web_template_data'; | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - protected $hidden = ['project_id']; | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 插入/修改 | ||
| 25 | - * @param int $project_id | ||
| 26 | - * @param array $data | ||
| 27 | - * @return mixed | ||
| 28 | - * @author:dc | ||
| 29 | - * @time 2023/5/10 10:23 | ||
| 30 | - */ | ||
| 31 | - public static function _save(int $project_id, array $data) | ||
| 32 | - { | ||
| 33 | - | ||
| 34 | - $model = static::where([ | ||
| 35 | - 'project_id'=>$project_id, | ||
| 36 | - 'template_id'=>$data['template_id'], | ||
| 37 | - 'type' => $data['type'], | ||
| 38 | - 'tag' => $data['tag'], | ||
| 39 | - ])->first(); | ||
| 40 | - | ||
| 41 | - if(!$model){ | ||
| 42 | - $model = new static(); | ||
| 43 | - $model->project_id = $project_id; | ||
| 44 | - $model->template_id = $data['template_id']; | ||
| 45 | - $model->type = $data['type']; | ||
| 46 | - $model->tag = $data['tag']; | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - $model->css = $data['css']??''; | ||
| 50 | - $model->script = $data['script']??''; | ||
| 51 | - $model->html = $data['html']??''; | ||
| 52 | - $model->data_ext = $data['data_ext']??''; | ||
| 53 | - $model->data_source = $data['data_source']??'all'; | ||
| 54 | - $model->data_source_id = $data['data_source_id']??0; | ||
| 55 | - | ||
| 56 | - $model->save(); | ||
| 57 | - | ||
| 58 | - return $model->id; | ||
| 59 | - | ||
| 60 | - } | ||
| 61 | - | ||
| 62 | - | ||
| 63 | -} |
app/Models/Template/BTemplateHtml.php
已删除
100644 → 0
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Models\Template; | ||
| 4 | - | ||
| 5 | -use Illuminate\Database\Eloquent\SoftDeletes; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * | ||
| 9 | - * 模板 | ||
| 10 | - * @author:dc | ||
| 11 | - * @time 2023/5/9 13:56 | ||
| 12 | - * Class ATemplate | ||
| 13 | - * @package App\Models\Template | ||
| 14 | - */ | ||
| 15 | -class BTemplateHtml extends \App\Models\Base{ | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - protected $table = 'gl_web_template_html'; | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - protected $hidden = ['deleted_at','project_id']; | ||
| 22 | - | ||
| 23 | - | ||
| 24 | - use SoftDeletes; | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - | ||
| 29 | - /** | ||
| 30 | - * 插入 | ||
| 31 | - * @param $project_id | ||
| 32 | - * @param $data | ||
| 33 | - * @return mixed | ||
| 34 | - * @author:dc | ||
| 35 | - * @time 2023/5/10 10:23 | ||
| 36 | - */ | ||
| 37 | - public static function _insert($project_id,$data) | ||
| 38 | - { | ||
| 39 | - | ||
| 40 | - $model = new static(); | ||
| 41 | - | ||
| 42 | - $model->project_id = $project_id; | ||
| 43 | - | ||
| 44 | - $model->template_id = $data['template_id']; | ||
| 45 | - | ||
| 46 | - $model->name = $data['name']; | ||
| 47 | - $model->type = $data['type']; | ||
| 48 | - $model->is_edit = $data['is_edit']; | ||
| 49 | - $model->css = $data['css']; | ||
| 50 | - $model->script = $data['script']; | ||
| 51 | - $model->html = $data['html']; | ||
| 52 | - $model->data_ext = $data['data_ext']; | ||
| 53 | - | ||
| 54 | - $model->save(); | ||
| 55 | - | ||
| 56 | - return $model->id; | ||
| 57 | - | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - | ||
| 61 | -} |
| @@ -318,6 +318,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -318,6 +318,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 318 | //无需登录验证的路由组 | 318 | //无需登录验证的路由组 |
| 319 | Route::group([], function () { | 319 | Route::group([], function () { |
| 320 | Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); | 320 | Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login'); |
| 321 | + Route::any('/stringTranslation', [\App\Http\Controllers\Bside\ComController::class, 'stringTranslation'])->name('com_stringTranslation'); | ||
| 321 | Route::any('/ceshi', [\App\Http\Controllers\Bside\ComController::class, 'ceshi'])->name('com_ceshi'); | 322 | Route::any('/ceshi', [\App\Http\Controllers\Bside\ComController::class, 'ceshi'])->name('com_ceshi'); |
| 322 | Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\ComController::class, 'sendLoginSms'])->name('sendLoginSms'); | 323 | Route::any('/sendLoginSms', [\App\Http\Controllers\Bside\ComController::class, 'sendLoginSms'])->name('sendLoginSms'); |
| 323 | Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); | 324 | Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download'); |
-
请 注册 或 登录 后发表评论