合并分支 'master-lyh-edit' 到 'master'
Master lyh edit 查看合并请求 !603
正在显示
7 个修改的文件
包含
213 行增加
和
13 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :PopularTemplateLabel.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/6/3 17:00 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\TemplateLabel; | ||
| 11 | + | ||
| 12 | +use App\Models\Template\Template; | ||
| 13 | +use App\Models\Template\TemplateLabel as TemplateLabelModel; | ||
| 14 | +use App\Models\Template\TemplateModule; | ||
| 15 | +use Illuminate\Console\Command; | ||
| 16 | + | ||
| 17 | +class PopularTemplateLabel extends Command | ||
| 18 | +{ | ||
| 19 | + /** | ||
| 20 | + * The name and signature of the console command. | ||
| 21 | + * | ||
| 22 | + * @var string | ||
| 23 | + */ | ||
| 24 | + protected $signature = 'popular_template_label'; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * The console command description. | ||
| 28 | + * | ||
| 29 | + * @var string | ||
| 30 | + */ | ||
| 31 | + protected $description = '设置热门label'; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * @remark :执行脚本 | ||
| 35 | + * @name :handle | ||
| 36 | + * @author :lyh | ||
| 37 | + * @method :post | ||
| 38 | + * @time :2024/6/3 17:01 | ||
| 39 | + */ | ||
| 40 | + public function handle(){ | ||
| 41 | + $this->setTemplate(); | ||
| 42 | + $this->setTemplateModule(); | ||
| 43 | + return true; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * @remark :公共模块热门模块 | ||
| 48 | + * @name :setTemplate | ||
| 49 | + * @author :lyh | ||
| 50 | + * @method :post | ||
| 51 | + * @time :2024/6/3 15:56 | ||
| 52 | + */ | ||
| 53 | + public function setTemplate(){ | ||
| 54 | + $templateModel = new Template(); | ||
| 55 | + $info = $templateModel->list(['test_model'=>0,'number'=>['<>',0]],'number',['id'],'desc',50); | ||
| 56 | + if(empty($info)){ | ||
| 57 | + return true; | ||
| 58 | + }else{ | ||
| 59 | + //清除当前所有最新标签 | ||
| 60 | + $labelModel = new TemplateLabelModel(); | ||
| 61 | + $labelModel->del(['name'=>'热门','type'=>1]); | ||
| 62 | + $data = []; | ||
| 63 | + foreach ($info as $v){ | ||
| 64 | + $data[] = [ | ||
| 65 | + 'name'=>'热门', | ||
| 66 | + 'type'=>1, | ||
| 67 | + 'template_id'=>$v['id'], | ||
| 68 | + 'manager_id'=>0, | ||
| 69 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 70 | + 'updated_at'=>date('Y-m-d H:i:s') | ||
| 71 | + ]; | ||
| 72 | + } | ||
| 73 | + //设置为最新 | ||
| 74 | + $labelModel->insert($data); | ||
| 75 | + } | ||
| 76 | + return true; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * @remark :左侧模块 | ||
| 81 | + * @name :templateModule | ||
| 82 | + * @author :lyh | ||
| 83 | + * @method :post | ||
| 84 | + * @time :2024/6/3 15:54 | ||
| 85 | + */ | ||
| 86 | + public function setTemplateModule(){ | ||
| 87 | + $templateModuleModel = new TemplateModule(); | ||
| 88 | + $moduleInfo = $templateModuleModel->list(['test_model'=>0,'number'=>['<>',0]],'id',['id']); | ||
| 89 | + if(empty($moduleInfo)){ | ||
| 90 | + return true; | ||
| 91 | + }else{ | ||
| 92 | + //清除当前所有最新标签 | ||
| 93 | + $labelModel = new TemplateLabelModel(); | ||
| 94 | + $labelModel->del(['name'=>'热门','type'=>2]); | ||
| 95 | + $moduleData = []; | ||
| 96 | + foreach ($moduleInfo as $k => $v){ | ||
| 97 | + $moduleData[] = [ | ||
| 98 | + 'name'=>'热门', | ||
| 99 | + 'type'=>2, | ||
| 100 | + 'template_id'=>$v['id'], | ||
| 101 | + 'manager_id'=>0, | ||
| 102 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 103 | + 'updated_at'=>date('Y-m-d H:i:s') | ||
| 104 | + ]; | ||
| 105 | + } | ||
| 106 | + //设置为最新 | ||
| 107 | + $labelModel->insert($moduleData); | ||
| 108 | + } | ||
| 109 | + return true; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | +} |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Console\Commands\TemplateLabel; | 10 | namespace App\Console\Commands\TemplateLabel; |
| 11 | 11 | ||
| 12 | +use App\Models\Template\Template; | ||
| 12 | use App\Models\Template\TemplateModule; | 13 | use App\Models\Template\TemplateModule; |
| 13 | use Illuminate\Console\Command; | 14 | use Illuminate\Console\Command; |
| 14 | use App\Models\Template\TemplateLabel as TemplateLabelModel; | 15 | use App\Models\Template\TemplateLabel as TemplateLabelModel; |
| @@ -37,24 +38,77 @@ class TemplateLabel extends Command | @@ -37,24 +38,77 @@ class TemplateLabel extends Command | ||
| 37 | * @time :2024/6/3 11:35 | 38 | * @time :2024/6/3 11:35 |
| 38 | */ | 39 | */ |
| 39 | public function handle(){ | 40 | public function handle(){ |
| 40 | - //清除当前所有最新标签 | ||
| 41 | - $labelModel = new TemplateLabelModel(); | ||
| 42 | - //获取最近5天左侧的记录 | ||
| 43 | - $start_time = now()->subDays(7)->startOfDay()->toDateString(); | 41 | + //获取最近7天模版的记录 |
| 42 | + $start_time = now()->subDays(90)->startOfDay()->toDateString(); | ||
| 44 | $end_time = now()->startOfDay()->toDateString(); | 43 | $end_time = now()->startOfDay()->toDateString(); |
| 45 | - $templateModuleModel = new TemplateModule(); | ||
| 46 | - $moduleInfo = $templateModuleModel->list(['created_at'=>['between',[$start_time,$end_time]],'type'=>1]); | ||
| 47 | - if($moduleInfo === false){ | ||
| 48 | - return false; | 44 | + $this->setTemplateModule($start_time,$end_time); |
| 45 | + $this->setTemplate($start_time,$end_time); | ||
| 46 | + return true; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * @remark :公共模块 | ||
| 51 | + * @name :setTemplate | ||
| 52 | + * @author :lyh | ||
| 53 | + * @method :post | ||
| 54 | + * @time :2024/6/3 15:56 | ||
| 55 | + */ | ||
| 56 | + public function setTemplate($start_time,$end_time){ | ||
| 57 | + $templateModel = new Template(); | ||
| 58 | + $info = $templateModel->list(['created_at'=>['between',[$start_time,$end_time]],'test_model'=>0],'id',['id']); | ||
| 59 | + if(empty($info)){ | ||
| 60 | + return true; | ||
| 49 | }else{ | 61 | }else{ |
| 62 | + //清除当前所有最新标签 | ||
| 63 | + $labelModel = new TemplateLabelModel(); | ||
| 64 | + $labelModel->del(['name'=>'最新','type'=>1]); | ||
| 50 | $data = []; | 65 | $data = []; |
| 51 | - foreach ($moduleInfo as $k => $v){ | 66 | + foreach ($info as $k => $v){ |
| 52 | $data[] = [ | 67 | $data[] = [ |
| 53 | 'name'=>'最新', | 68 | 'name'=>'最新', |
| 69 | + 'type'=>1, | ||
| 70 | + 'template_id'=>$v['id'], | ||
| 71 | + 'manager_id'=>0, | ||
| 72 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 73 | + 'updated_at'=>date('Y-m-d H:i:s') | ||
| 74 | + ]; | ||
| 75 | + } | ||
| 76 | + //设置为最新 | ||
| 77 | + $labelModel->insert($data); | ||
| 78 | + } | ||
| 79 | + return true; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * @remark :左侧模块 | ||
| 84 | + * @name :templateModule | ||
| 85 | + * @author :lyh | ||
| 86 | + * @method :post | ||
| 87 | + * @time :2024/6/3 15:54 | ||
| 88 | + */ | ||
| 89 | + public function setTemplateModule($start_time,$end_time){ | ||
| 90 | + $templateModuleModel = new TemplateModule(); | ||
| 91 | + $moduleInfo = $templateModuleModel->list(['created_at'=>['between',[$start_time,$end_time]],'test_model'=>0],'id',['id']); | ||
| 92 | + if(empty($moduleInfo)){ | ||
| 93 | + return true; | ||
| 94 | + }else{ | ||
| 95 | + //清除当前所有最新标签 | ||
| 96 | + $labelModel = new TemplateLabelModel(); | ||
| 97 | + $labelModel->del(['name'=>'最新','type'=>2]); | ||
| 98 | + $moduleData = []; | ||
| 99 | + foreach ($moduleInfo as $k => $v){ | ||
| 100 | + $moduleData[] = [ | ||
| 101 | + 'name'=>'最新', | ||
| 102 | + 'type'=>2, | ||
| 103 | + 'template_id'=>$v['id'], | ||
| 104 | + 'manager_id'=>0, | ||
| 105 | + 'created_at'=>date('Y-m-d H:i:s'), | ||
| 106 | + 'updated_at'=>date('Y-m-d H:i:s') | ||
| 54 | ]; | 107 | ]; |
| 55 | } | 108 | } |
| 56 | //设置为最新 | 109 | //设置为最新 |
| 110 | + $labelModel->insert($moduleData); | ||
| 57 | } | 111 | } |
| 58 | - //清空所有的最近标签 | 112 | + return true; |
| 59 | } | 113 | } |
| 60 | } | 114 | } |
| @@ -15,6 +15,9 @@ class Kernel extends ConsoleKernel | @@ -15,6 +15,9 @@ class Kernel extends ConsoleKernel | ||
| 15 | */ | 15 | */ |
| 16 | protected function schedule(Schedule $schedule) | 16 | protected function schedule(Schedule $schedule) |
| 17 | { | 17 | { |
| 18 | + // 每日更新最新模块 | ||
| 19 | +// $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块 | ||
| 20 | +// $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块 | ||
| 18 | // $schedule->command('inspire')->hourly(); | 21 | // $schedule->command('inspire')->hourly(); |
| 19 | $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长 | 22 | $schedule->command('remain_day')->dailyAt('09:00')->withoutOverlapping(1); // 项目剩余服务时长 |
| 20 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 | 23 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 |
| @@ -24,7 +24,7 @@ use App\Models\Template\TemplateLabel; | @@ -24,7 +24,7 @@ use App\Models\Template\TemplateLabel; | ||
| 24 | class BTemplateLabelController extends BaseController | 24 | class BTemplateLabelController extends BaseController |
| 25 | { | 25 | { |
| 26 | /** | 26 | /** |
| 27 | - * @remark :获取左侧模版的标签 | 27 | + * @remark :获取模版的标签 |
| 28 | * @name :lists | 28 | * @name :lists |
| 29 | * @author :lyh | 29 | * @author :lyh |
| 30 | * @method :post | 30 | * @method :post |
| @@ -7,6 +7,7 @@ use App\Http\Controllers\Bside\BaseController; | @@ -7,6 +7,7 @@ use App\Http\Controllers\Bside\BaseController; | ||
| 7 | use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic; | 7 | use App\Http\Logic\Bside\BTemplate\BTemplateModuleLogic; |
| 8 | use App\Http\Logic\Bside\BTemplate\BTemplateModuleProjectLogic; | 8 | use App\Http\Logic\Bside\BTemplate\BTemplateModuleProjectLogic; |
| 9 | use App\Models\Template\BModuleProject; | 9 | use App\Models\Template\BModuleProject; |
| 10 | +use App\Models\Template\TemplateLabel; | ||
| 10 | 11 | ||
| 11 | /** | 12 | /** |
| 12 | * @remark :左侧模块管理 | 13 | * @remark :左侧模块管理 |
| @@ -62,4 +63,21 @@ class BTemplateModuleController extends BaseController | @@ -62,4 +63,21 @@ class BTemplateModuleController extends BaseController | ||
| 62 | $list = $BTemplateModuleLogic->ModuleType($this->map); | 63 | $list = $BTemplateModuleLogic->ModuleType($this->map); |
| 63 | $this->response('success',Code::SUCCESS,$list); | 64 | $this->response('success',Code::SUCCESS,$list); |
| 64 | } | 65 | } |
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * @remark :设置数量 | ||
| 69 | + * @name :setModuleNumber | ||
| 70 | + * @author :lyh | ||
| 71 | + * @method :post | ||
| 72 | + * @time :2024/6/3 16:50 | ||
| 73 | + */ | ||
| 74 | + public function setModuleNumber(){ | ||
| 75 | + $this->request->validate([ | ||
| 76 | + 'id'=>'required', | ||
| 77 | + ],[ | ||
| 78 | + 'id.required' => 'id不能为空', | ||
| 79 | + ]); | ||
| 80 | + $this->model->where('id', $this->param['id'])->increment('number'); | ||
| 81 | + $this->response('success'); | ||
| 82 | + } | ||
| 65 | } | 83 | } |
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | namespace App\Http\Logic\Bside\BTemplate; | 3 | namespace App\Http\Logic\Bside\BTemplate; |
| 4 | 4 | ||
| 5 | use App\Http\Logic\Bside\BaseLogic; | 5 | use App\Http\Logic\Bside\BaseLogic; |
| 6 | +use App\Models\Template\TemplateLabel; | ||
| 6 | use App\Models\Template\TemplateModule; | 7 | use App\Models\Template\TemplateModule; |
| 7 | use App\Models\Template\TemplateType; | 8 | use App\Models\Template\TemplateType; |
| 8 | 9 | ||
| @@ -25,8 +26,13 @@ class BTemplateModuleLogic extends BaseLogic | @@ -25,8 +26,13 @@ class BTemplateModuleLogic extends BaseLogic | ||
| 25 | public function ModuleList($map,$order = 'created_at',$filed = ['id','name','type','sort','status','image','test_model']){ | 26 | public function ModuleList($map,$order = 'created_at',$filed = ['id','name','type','sort','status','image','test_model']){ |
| 26 | $map['deleted_status'] = 0; | 27 | $map['deleted_status'] = 0; |
| 27 | $map['status'] = 0; | 28 | $map['status'] = 0; |
| 28 | - $lists = $this->model->list($map,$order,$filed); | ||
| 29 | - return $this->success($lists); | 29 | + $list = $this->model->list($map,$order,$filed); |
| 30 | + $templateLabel = new TemplateLabel(); | ||
| 31 | + foreach ($list as $k => $v){ | ||
| 32 | + $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc',5); | ||
| 33 | + $list[$k] = $v; | ||
| 34 | + } | ||
| 35 | + return $this->success($list); | ||
| 30 | } | 36 | } |
| 31 | 37 | ||
| 32 | /** | 38 | /** |
| @@ -369,6 +369,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -369,6 +369,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 369 | Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'lists'])->name('template_module_lists'); | 369 | Route::any('/', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'lists'])->name('template_module_lists'); |
| 370 | Route::any('/read', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'read'])->name('template_module_read'); | 370 | Route::any('/read', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'read'])->name('template_module_read'); |
| 371 | Route::any('/type', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'getType'])->name('template_module_getType'); | 371 | Route::any('/type', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'getType'])->name('template_module_getType'); |
| 372 | + Route::any('/setModuleNumber', [\App\Http\Controllers\Bside\Template\BTemplateModuleController::class, 'setModuleNumber'])->name('template_module_setModuleNumber'); | ||
| 372 | }); | 373 | }); |
| 373 | 374 | ||
| 374 | // 保存私有模块 | 375 | // 保存私有模块 |
| @@ -537,6 +538,12 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -537,6 +538,12 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 537 | Route::prefix('tutorial')->group(function () { | 538 | Route::prefix('tutorial')->group(function () { |
| 538 | Route::any('/', [\App\Http\Controllers\Bside\BCom\TutorialController::class, 'lists'])->name('tutorial_lists'); | 539 | Route::any('/', [\App\Http\Controllers\Bside\BCom\TutorialController::class, 'lists'])->name('tutorial_lists'); |
| 539 | }); | 540 | }); |
| 541 | + //oa教程 | ||
| 542 | + Route::prefix('template_label')->group(function () { | ||
| 543 | + Route::any('/getUserLists', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'getUserLists'])->name('template_label_getUserLists'); | ||
| 544 | + Route::any('/save', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'save'])->name('template_label_save'); | ||
| 545 | + Route::any('/del', [\App\Http\Controllers\Bside\Template\BTemplateLabelController::class, 'del'])->name('template_label_del'); | ||
| 546 | + }); | ||
| 540 | }); | 547 | }); |
| 541 | //无需登录验证的路由组 | 548 | //无需登录验证的路由组 |
| 542 | Route::group([], function () { | 549 | Route::group([], function () { |
-
请 注册 或 登录 后发表评论