定制 sparkinzy/laravel-schedule-command 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sparkinzy/laravel-schedule-command

Composer 安装命令:

composer require sparkinzy/laravel-schedule-command

包简介

命令中直接定义定时任务,避免Kernel中大量定义定时任务

README 文档

README

命令中直接定义定时任务,避免Kernel中大量定义定时任务.

Installing

$ composer require sparkinzy/laravel-schedule-command -vvv

Usage

参考示例如下

# 文件 app/Console/Commands/TestCommand.php
<?php

namespace App\Console\Commands;

use Illuminate\Console\Scheduling\Schedule;
use Sparkinzy\LaravelScheduleCommand\Commands\ScheduleCommand;

class AdvertAutoDelete extends ScheduleCommand
{
/**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'test:schedule';
    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '测试命令自带定时任务配置';
    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
    
    }

    /**
     * @param Schedule $schedule
     * 此命令每分钟执行一次
     */
    public function schedule(Schedule $schedule)
    {
        #$schedule->command(static::class)
        #            ->everyMinute()
        #            ->runInBackground();
        # 定时任务执行时带参数
        $schedule->command(static::class,['param1'=>'1'])
                            ->everyMinute()
                            ->runInBackground();
    }
}

安装后,修改命令重新继承 sparkinzy\LaravelScheduleCommand\Commands\ScheduleCommand

并在命令中新增function schedule(Schedule $schedule){

}

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT

统计信息

  • 总下载量: 68
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固