Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
9 个修改的文件
包含
262 行增加
和
23 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :TemplateLabel.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/6/3 11:33 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\TemplateLabel; | ||
| 11 | + | ||
| 12 | +use Illuminate\Console\Command; | ||
| 13 | +use App\Models\Template\TemplateLabel as TemplateLabelModel; | ||
| 14 | + | ||
| 15 | +class TemplateLabel extends Command | ||
| 16 | +{ | ||
| 17 | + /** | ||
| 18 | + * The name and signature of the console command. | ||
| 19 | + * | ||
| 20 | + * @var string | ||
| 21 | + */ | ||
| 22 | + protected $signature = 'template_label'; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * The console command description. | ||
| 26 | + * | ||
| 27 | + * @var string | ||
| 28 | + */ | ||
| 29 | + protected $description = '设置label'; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * @remark :执行脚本 | ||
| 33 | + * @name :handle | ||
| 34 | + * @author :lyh | ||
| 35 | + * @method :post | ||
| 36 | + * @time :2024/6/3 11:35 | ||
| 37 | + */ | ||
| 38 | + public function handle(){ | ||
| 39 | + //清除当前所有最新标签 | ||
| 40 | + $labelModel = new TemplateLabelModel(); | ||
| 41 | + //获取最近5天左侧的记录 | ||
| 42 | + $start_time = now()->subDays(7)->startOfDay()->toDateString(); | ||
| 43 | + $end_time = now()->startOfDay()->toDateString(); | ||
| 44 | + $info = $labelModel->read(['created_at'=>['between',[$start_time,$end_time]]]); | ||
| 45 | + if($info === false){ | ||
| 46 | + return false; | ||
| 47 | + } | ||
| 48 | + //清空所有的最近标签 | ||
| 49 | + } | ||
| 50 | +} |
| @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command | @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command | ||
| 50 | public function handle(){ | 50 | public function handle(){ |
| 51 | //获取所有项目 | 51 | //获取所有项目 |
| 52 | $projectModel = new Project(); | 52 | $projectModel = new Project(); |
| 53 | - $list = $projectModel->list(['id'=>['in',[621]]],'id',['id']); | 53 | + $list = $projectModel->list(['id'=>['in',[1077]]],'id',['id']); |
| 54 | echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; | 54 | echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; |
| 55 | try { | 55 | try { |
| 56 | foreach ($list as $v) { | 56 | foreach ($list as $v) { |
| @@ -25,17 +25,14 @@ class ATemplateController extends BaseController | @@ -25,17 +25,14 @@ class ATemplateController extends BaseController | ||
| 25 | * @method :post | 25 | * @method :post |
| 26 | * @time :2023/6/28 16:34 | 26 | * @time :2023/6/28 16:34 |
| 27 | */ | 27 | */ |
| 28 | - public function lists(ATemplateLogic $aTemplateLogic,TemplateLabel $templateLabel){ | ||
| 29 | - if(isset($this->map['label_name']) && !empty($this->map['label_name'])){ | ||
| 30 | - $id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%']])->pluck('template_id')->toArray(); | ||
| 31 | - $this->map['id'] = ['in',$id_arr]; | ||
| 32 | - unset($this->map['label_name']); | ||
| 33 | - } | 28 | + public function lists(ATemplateLogic $aTemplateLogic){ |
| 29 | + $templateLabel = new TemplateLabel(); | ||
| 30 | + $this->searchLabelName($templateLabel); | ||
| 34 | $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; | 31 | $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; |
| 35 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); | 32 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); |
| 36 | if(!empty($lists) && !empty($lists['list'])){ | 33 | if(!empty($lists) && !empty($lists['list'])){ |
| 37 | foreach ($lists['list'] as $k => $v){ | 34 | foreach ($lists['list'] as $k => $v){ |
| 38 | - $v['label'] = $templateLabel->list(['template_id'=>$v['id']],'id',['id','name'],'desc',5); | 35 | + $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>1],'id',['id','name'],'desc',5); |
| 39 | $v['image_link'] = getImageUrl($v['image']); | 36 | $v['image_link'] = getImageUrl($v['image']); |
| 40 | $lists['list'][$k] = $v; | 37 | $lists['list'][$k] = $v; |
| 41 | } | 38 | } |
| @@ -44,6 +41,22 @@ class ATemplateController extends BaseController | @@ -44,6 +41,22 @@ class ATemplateController extends BaseController | ||
| 44 | } | 41 | } |
| 45 | 42 | ||
| 46 | /** | 43 | /** |
| 44 | + * @remark :搜索label | ||
| 45 | + * @name :searchLabelName | ||
| 46 | + * @author :lyh | ||
| 47 | + * @method :post | ||
| 48 | + * @time :2024/6/3 11:11 | ||
| 49 | + */ | ||
| 50 | + public function searchLabelName($templateLabel){ | ||
| 51 | + if(isset($this->map['label_name']) && !empty($this->map['label_name'])){ | ||
| 52 | + $id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%'],'type'=>1])->pluck('template_id')->toArray(); | ||
| 53 | + $this->map['id'] = ['in',$id_arr]; | ||
| 54 | + unset($this->map['label_name']); | ||
| 55 | + } | ||
| 56 | + return true; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 47 | * @remark :获取选择的模版 | 60 | * @remark :获取选择的模版 |
| 48 | * @name :getTemplateInfo | 61 | * @name :getTemplateInfo |
| 49 | * @author :lyh | 62 | * @author :lyh |
| @@ -8,6 +8,8 @@ use App\Http\Logic\Aside\Template\ATemplateLogic; | @@ -8,6 +8,8 @@ use App\Http\Logic\Aside\Template\ATemplateLogic; | ||
| 8 | use App\Http\Logic\Aside\Template\ATemplateModuleLogic; | 8 | use App\Http\Logic\Aside\Template\ATemplateModuleLogic; |
| 9 | use App\Http\Requests\Aside\Template\ATemplateModuleRequest; | 9 | use App\Http\Requests\Aside\Template\ATemplateModuleRequest; |
| 10 | use App\Models\Project\Project; | 10 | use App\Models\Project\Project; |
| 11 | +use App\Models\Template\TemplateLabel; | ||
| 12 | +use App\Models\Template\TemplateModule; | ||
| 11 | 13 | ||
| 12 | /** | 14 | /** |
| 13 | * @remark :左侧模块管理 | 15 | * @remark :左侧模块管理 |
| @@ -24,12 +26,38 @@ class ATemplateModuleController extends BaseController | @@ -24,12 +26,38 @@ class ATemplateModuleController extends BaseController | ||
| 24 | * @method :post | 26 | * @method :post |
| 25 | * @time :2023/6/28 16:54 | 27 | * @time :2023/6/28 16:54 |
| 26 | */ | 28 | */ |
| 27 | - public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ | ||
| 28 | - $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); | 29 | + public function lists(TemplateModule $templateModule){ |
| 30 | + $templateLabel = new TemplateLabel(); | ||
| 31 | + $this->map['deleted_status'] = 0; | ||
| 32 | + $this->searchLabelName($templateLabel); | ||
| 33 | + $lists = $templateModule->lists($this->map,$this->page,$this->row,$this->order); | ||
| 34 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 35 | + foreach ($lists['list'] as $k => $v){ | ||
| 36 | + $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc',5); | ||
| 37 | + $lists['list'][$k] = $v; | ||
| 38 | + } | ||
| 39 | + } | ||
| 29 | $this->response('success',Code::SUCCESS,$lists); | 40 | $this->response('success',Code::SUCCESS,$lists); |
| 30 | } | 41 | } |
| 31 | 42 | ||
| 32 | /** | 43 | /** |
| 44 | + * @remark :搜索label | ||
| 45 | + * @name :searchLabelName | ||
| 46 | + * @author :lyh | ||
| 47 | + * @method :post | ||
| 48 | + * @time :2024/6/3 11:11 | ||
| 49 | + */ | ||
| 50 | + public function searchLabelName($templateLabel){ | ||
| 51 | + if(isset($this->map['label_name']) && !empty($this->map['label_name'])){ | ||
| 52 | + $id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%'],'type'=>2])->pluck('template_id')->toArray(); | ||
| 53 | + $this->map['id'] = ['in',$id_arr]; | ||
| 54 | + unset($this->map['label_name']); | ||
| 55 | + } | ||
| 56 | + return true; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + /** | ||
| 33 | * @remark :左侧模块保存 | 61 | * @remark :左侧模块保存 |
| 34 | * @name :save | 62 | * @name :save |
| 35 | * @author :lyh | 63 | * @author :lyh |
| @@ -34,8 +34,10 @@ class TemplateLabelController extends BaseController | @@ -34,8 +34,10 @@ class TemplateLabelController extends BaseController | ||
| 34 | public function getUserLists(TemplateLabel $templateLabel){ | 34 | public function getUserLists(TemplateLabel $templateLabel){ |
| 35 | $this->request->validate([ | 35 | $this->request->validate([ |
| 36 | 'template_id'=>'required', | 36 | 'template_id'=>'required', |
| 37 | + 'type'=>'required', | ||
| 37 | ],[ | 38 | ],[ |
| 38 | 'template_id.required' => '模版id不能为空', | 39 | 'template_id.required' => '模版id不能为空', |
| 40 | + 'type.required' => '模版类型不能为空不能为空', | ||
| 39 | ]); | 41 | ]); |
| 40 | $data = $templateLabel->list($this->map); | 42 | $data = $templateLabel->list($this->map); |
| 41 | $this->response('success',Code::SUCCESS,$data); | 43 | $this->response('success',Code::SUCCESS,$data); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :TemplateLabelController.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/5/16 9:51 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Controllers\Bside\Template; | ||
| 11 | + | ||
| 12 | +use App\Enums\Common\Code; | ||
| 13 | +use App\Http\Controllers\Bside\BaseController; | ||
| 14 | +use App\Http\Logic\Bside\BTemplate\BTemplateLabelLogic; | ||
| 15 | +use App\Models\Template\TemplateLabel; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @remark : | ||
| 19 | + * @name :TemplateLabelController | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2024/5/16 9:51 | ||
| 23 | + */ | ||
| 24 | +class BTemplateLabelController extends BaseController | ||
| 25 | +{ | ||
| 26 | + /** | ||
| 27 | + * @remark :获取左侧模版的标签 | ||
| 28 | + * @name :lists | ||
| 29 | + * @author :lyh | ||
| 30 | + * @method :post | ||
| 31 | + * @time :2024/5/16 10:15 | ||
| 32 | + */ | ||
| 33 | + public function getUserLists(TemplateLabel $templateLabel){ | ||
| 34 | + $this->request->validate([ | ||
| 35 | + 'template_id'=>'required', | ||
| 36 | + 'type'=>'required', | ||
| 37 | + ],[ | ||
| 38 | + 'template_id.required' => '模版id不能为空', | ||
| 39 | + 'type.required' => '模版类型不能为空不能为空', | ||
| 40 | + ]); | ||
| 41 | + $data = $templateLabel->list($this->map); | ||
| 42 | + $this->response('success',Code::SUCCESS,$data); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * @remark :保存标签 | ||
| 47 | + * @name :save | ||
| 48 | + * @author :lyh | ||
| 49 | + * @method :post | ||
| 50 | + * @time :2024/5/16 9:53 | ||
| 51 | + */ | ||
| 52 | + public function save(BTemplateLabelLogic $labelLogic){ | ||
| 53 | + $this->request->validate([ | ||
| 54 | + 'name'=>'required | max:200', | ||
| 55 | + 'type'=>'required', | ||
| 56 | + 'template_id'=>'required', | ||
| 57 | + ],[ | ||
| 58 | + 'name.required' => '标签名称不能为空', | ||
| 59 | + 'type.required' => '模版类型不能为空不能为空', | ||
| 60 | + 'template_id.required' => '模版ID不能为空不能为空', | ||
| 61 | + ]); | ||
| 62 | + $data = $labelLogic->saveLabel(); | ||
| 63 | + $this->response('success',Code::SUCCESS,$data); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * @remark :删除数据 | ||
| 68 | + * @name :del | ||
| 69 | + * @author :lyh | ||
| 70 | + * @method :post | ||
| 71 | + * @time :2024/5/16 10:08 | ||
| 72 | + */ | ||
| 73 | + public function del(BTemplateLabelLogic $labelLogic){ | ||
| 74 | + $this->request->validate([ | ||
| 75 | + 'id'=>'required', | ||
| 76 | + ],[ | ||
| 77 | + 'id.required' => '主键不能为空', | ||
| 78 | + ]); | ||
| 79 | + $data = $labelLogic->delLabel(); | ||
| 80 | + $this->response('success',Code::SUCCESS,$data); | ||
| 81 | + } | ||
| 82 | +} |
| @@ -22,19 +22,6 @@ class ATemplateModuleLogic extends BaseLogic | @@ -22,19 +22,6 @@ class ATemplateModuleLogic extends BaseLogic | ||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | - * @remark :左侧模块列表 | ||
| 26 | - * @name :aTemplateModuleLists | ||
| 27 | - * @author :lyh | ||
| 28 | - * @method :post | ||
| 29 | - * @time :2023/6/28 18:01 | ||
| 30 | - */ | ||
| 31 | - public function aTemplateModuleLists($map,$page,$row,$order = 'created_at',$filed = ['*']){ | ||
| 32 | - $map['deleted_status'] = 0; | ||
| 33 | - $lists = $this->model->lists($map,$page,$row,$order,$filed); | ||
| 34 | - return $this->success($lists); | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | - /** | ||
| 38 | * @remark :保存左侧模块 | 25 | * @remark :保存左侧模块 |
| 39 | * @name :aTemplateModuleSave | 26 | * @name :aTemplateModuleSave |
| 40 | * @author :lyh | 27 | * @author :lyh |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :TemplateLabelLogic.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/5/16 9:54 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Http\Logic\Bside\BTemplate; | ||
| 11 | + | ||
| 12 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 13 | +use App\Models\Template\TemplateLabel; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * @remark :模版标签 | ||
| 17 | + * @name :TemplateLabelLogic | ||
| 18 | + * @author :lyh | ||
| 19 | + * @method :post | ||
| 20 | + * @time :2024/5/16 9:54 | ||
| 21 | + */ | ||
| 22 | +class BTemplateLabelLogic extends BaseLogic | ||
| 23 | +{ | ||
| 24 | + /** | ||
| 25 | + * 初始化数据 | ||
| 26 | + */ | ||
| 27 | + public function __construct() | ||
| 28 | + { | ||
| 29 | + parent::__construct(); | ||
| 30 | + $this->model = new TemplateLabel(); | ||
| 31 | + $this->param = $this->requestAll; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * @remark :保存标签 | ||
| 37 | + * @name :saveLabel | ||
| 38 | + * @author :lyh | ||
| 39 | + * @method :post | ||
| 40 | + * @time :2024/5/16 9:55 | ||
| 41 | + */ | ||
| 42 | + public function saveLabel(){ | ||
| 43 | + if(isset($this->param['id']) && !empty($this->param['id'])){ | ||
| 44 | + $id = $this->param['id']; | ||
| 45 | + $info = $this->model->read(['name'=>$this->param['name'],'template_id'=>$this->param['template_id'],'id'=>['!=',$id]],['id']); | ||
| 46 | + if($info === false){ | ||
| 47 | + $this->model->edit($this->param,['id'=>$id]); | ||
| 48 | + } | ||
| 49 | + }else{ | ||
| 50 | + $info = $this->model->read(['name'=>$this->param['name'],'template_id'=>$this->param['template_id']],['id']); | ||
| 51 | + if($info === false){ | ||
| 52 | + $this->param['manager_id'] = $this->manager['id']; | ||
| 53 | + $id = $this->model->addReturnId($this->param); | ||
| 54 | + }else{ | ||
| 55 | + $id = $info['id']; | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + return $this->success(['id'=>$id]); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * @remark :删除标签 | ||
| 63 | + * @name :delLabel | ||
| 64 | + * @author :lyh | ||
| 65 | + * @method :post | ||
| 66 | + * @time :2024/5/16 10:03 | ||
| 67 | + */ | ||
| 68 | + public function delLabel(){ | ||
| 69 | + $rs = $this->model->del($this->param); | ||
| 70 | + if($rs === false){ | ||
| 71 | + $this->fail('删除失败,请联系管理员'); | ||
| 72 | + } | ||
| 73 | + return $this->success(); | ||
| 74 | + } | ||
| 75 | +} |
| @@ -14,6 +14,7 @@ class Notify extends Base | @@ -14,6 +14,7 @@ class Notify extends Base | ||
| 14 | const STATUS_FINISH_ROUTE = 1; | 14 | const STATUS_FINISH_ROUTE = 1; |
| 15 | const STATUS_FINISH_PAGE = 2; | 15 | const STATUS_FINISH_PAGE = 2; |
| 16 | const STATUS_FINISH_SITEMAP = 3; | 16 | const STATUS_FINISH_SITEMAP = 3; |
| 17 | + const STATUS_ERROR = 9; | ||
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| 19 | * 类型 1:主站, 2:小语种, 3:amp | 20 | * 类型 1:主站, 2:小语种, 3:amp |
| @@ -78,6 +79,7 @@ class Notify extends Base | @@ -78,6 +79,7 @@ class Notify extends Base | ||
| 78 | self::STATUS_FINISH_ROUTE => '页面生成中', | 79 | self::STATUS_FINISH_ROUTE => '页面生成中', |
| 79 | self::STATUS_FINISH_PAGE => 'sitemap生成中', | 80 | self::STATUS_FINISH_PAGE => 'sitemap生成中', |
| 80 | self::STATUS_FINISH_SITEMAP => '完成', | 81 | self::STATUS_FINISH_SITEMAP => '完成', |
| 82 | + self::STATUS_ERROR => 'sitemap生成失败', | ||
| 81 | ]; | 83 | ]; |
| 82 | } | 84 | } |
| 83 | } | 85 | } |
-
请 注册 或 登录 后发表评论