├── .gitignore ├── LICENSE ├── README.md ├── composer.json ├── forsun.thrift └── src ├── Builder.php ├── Client ├── ForsunClient.php ├── ForsunIf.php ├── ForsunPlan.php ├── ForsunPlanError.php ├── Forsun_createTimeout_args.php ├── Forsun_createTimeout_result.php ├── Forsun_create_args.php ├── Forsun_create_result.php ├── Forsun_forsun_call_args.php ├── Forsun_forsun_call_result.php ├── Forsun_getCurrent_args.php ├── Forsun_getCurrent_result.php ├── Forsun_getKeys_args.php ├── Forsun_getKeys_result.php ├── Forsun_getTime_args.php ├── Forsun_getTime_result.php ├── Forsun_get_args.php ├── Forsun_get_result.php ├── Forsun_ping_args.php ├── Forsun_ping_result.php ├── Forsun_remove_args.php └── Forsun_remove_result.php ├── Commands ├── ScheduleRegisterCommand.php └── ScheduleUnregisterCommand.php ├── Facade.php ├── Forsun.php ├── Jobs ├── CommandRunHandler.php ├── EventFireHandler.php ├── JobDispatchHandler.php └── ScheduleRunHandler.php ├── ManagesFrequencies.php ├── Plan.php ├── ServiceProvider.php ├── UnsupportedQueueException.php └── config.php /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | node_modules/ 3 | npm-debug.log 4 | 5 | # Laravel 4 specific 6 | bootstrap/compiled.php 7 | app/storage/ 8 | 9 | # Laravel 5 & Lumen specific 10 | public/storage 11 | public/hot 12 | storage/*.key 13 | .env.*.php 14 | .env.php 15 | .env 16 | Homestead.yaml 17 | Homestead.json 18 | 19 | # Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer 20 | .rocketeer/ 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 snower 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # forsun-laravel # 2 | 3 | [![Software license][ico-license]](LICENSE) 4 | [![Latest stable][ico-version-stable]][link-packagist] 5 | [![Latest development][ico-version-dev]][link-packagist] 6 | [![Monthly installs][ico-downloads-monthly]][link-downloads] 7 | 8 | 使用高性能的定时调度服务Forsun的Laravel组件。 9 | 10 | 11 | ## Main features ## 12 | 13 | * 轻松支持千万级定时任务调度。 14 | * 定时任务触发推送到Queue,轻松支持跨机器和共性能分布式。 15 | * 支持任务到期触发command、Job、Shell、Http和Event。 16 | * 支持驱动原生Laravel Schedule运行。 17 | * 支持创建延时任务和定时到期任务,和原生Laravel Schedule保持相同接口,轻松使用。 18 | 19 | ## Install ## 20 | 21 | * 安装启动forsun服务,详情请看[forsun](https://github.com/snower/forsun)。 22 | * composer安装forsun-laravel。 23 | 24 | ``` 25 | composer require "snower/forsun-laravel" 26 | ``` 27 | 28 | ## Config ## 29 | 30 | * 在 config/app.php 注册 ServiceProvider 和 Facade 31 | 32 | ``` 33 | 'providers' => [ 34 | // ... 35 | Snower\LaravelForsun\ServiceProvider::class, 36 | ], 37 | 'aliases' => [ 38 | // ... 39 | 'Forsun' => Snower\LaravelForsun\Facade::class, 40 | ], 41 | ``` 42 | 43 | * 创建配置文件 44 | 45 | ``` 46 | php artisan vendor:publish --provider="Snower\LaravelForsun\ServiceProvider" 47 | ``` 48 | 49 | * 修改应用根目录下的 config/forsun.php 中对应的参数即可。 50 | 51 | ## Used ## 52 | 53 | ### 定义调度 54 | 55 | * Artisan 命令调度。 56 | 57 | ``` 58 | 59 | //不指定name是自动生成 60 | Forsun::plan()->command('emails:send --force')->daily(); 61 | 62 | //指定name 63 | Forsun::plan('email')->command(EmailsCommand::class, ['--force'])->daily(); 64 | ``` 65 | 66 | * 队列任务调度 67 | 68 | ``` 69 | Forsun::plan()->job(new Heartbeat)->everyFiveMinutes(); 70 | ``` 71 | 72 | * Shell 命令调度 73 | 74 | ``` 75 | Forsun::plan()->exec('node /home/forge/script.js')->daily(); 76 | ``` 77 | 78 | * Event事件调度 79 | 80 | ``` 81 | Forsun::plan()->fire('testevent', [])->everyMinute(); 82 | ``` 83 | 84 | * Http事件调度 85 | 86 | ``` 87 | Forsun::plan()->http('http://www.baidu.com')->everyMinute(); 88 | ``` 89 | 90 | 注意: 91 | 92 | * 每个任务只能设置一次调度频率。 93 | * 不支持任务输出、任务钩子及维护模式。 94 | * Forsun::plan是不指定任务名时自动生成,每个任务名必须唯一,相同任务名重复定义将会自动覆盖。 95 | 96 | ### 移除调度 97 | 98 | ``` 99 | $plan = Forsun::plan()->command('emails:send --force')->daily(); 100 | $plan->remove(); 101 | 102 | $plan = Forsun::plan()->command('emails:send --force')->daily(); 103 | $plan_name = $plan->getName(); 104 | Forsun::remove($plan_name); 105 | ``` 106 | 107 | ### 调度频率设置 108 | 109 | | 方法 | 描述 | 110 | | ---------- | --- | 111 | | ->hourly(); | 每小时运行 | 112 | | ->hourlyAt(17); | 每小时的第 17 分钟执行一次任务 | 113 | | ->daily(); | 每天午夜执行一次任务 | 114 | | ->dailyAt('13:00'); | 每天的 13:00 执行一次任务 | 115 | | ->monthly(); | 每月执行一次任务 | 116 | | ->monthlyOn(4, '15:00'); | 在每个月的第四天的 15:00 执行一次任务 | 117 | | ->everyMinute(); | 每分钟执行一次任务 | 118 | | ->everyFiveMinutes(); | 每五分钟执行一次任务 | 119 | | ->everyTenMinutes(); | 每十分钟执行一次任务 | 120 | | ->everyFifteenMinutes(); | 每十五分钟执行一次任务 | 121 | | ->everyThirtyMinutes(); | 每半小时执行一次任务 | 122 | | ->at(strtoetime("2018-03-05 12:32:12")); | 在指定时间2018-03-05 12:32:12运行一次 | 123 | | ->interval(10); | 从当前时间开始计算每10秒运行一次 | 124 | | ->later(5); | 从当前时间开始计算稍后5秒运行一次 | 125 | | ->delay(30); | 从当前时间开始计算稍后30秒运行一次 | 126 | 127 | 需要复杂定时控制建议生成多个定时任务或是在处理器中再次发起定时任务计划更简便同时也性能更高。 128 | 129 | 调度器应该尽可能使用Event或是Job通过Queue Work可以更高性能运行。 130 | 131 | ### 驱动原生Laravel Schedule运行 132 | 133 | ``` 134 | #注册 135 | php artisan forsun:schedule:register 136 | 137 | #取消注册 138 | php artisan forsun:schedule:unregister 139 | ``` 140 | 141 | ## Author ## 142 | 143 | - [snower](mailto:sujian199@gmail.com) ([twitter](http://twitter.com/snower199)) 144 | 145 | 146 | ## License ## 147 | 148 | The code for Predis is distributed under the terms of the MIT license (see [LICENSE](LICENSE)). 149 | 150 | [ico-license]: https://img.shields.io/github/license/snower/forsun-laravel.svg?style=flat-square 151 | [ico-version-stable]: https://img.shields.io/packagist/v/snower/forsun-laravel.svg?style=flat-square 152 | [ico-version-dev]: https://img.shields.io/packagist/vpre/snower/forsun-laravel.svg?style=flat-square 153 | [ico-downloads-monthly]: https://img.shields.io/packagist/dm/snower/forsun-laravel.svg?style=flat-square 154 | 155 | [link-packagist]: https://packagist.org/packages/snower/forsun-laravel 156 | [link-downloads]: https://packagist.org/packages/snower/forsun-laravel/stats 157 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "snower/forsun-laravel", 3 | "description": "高性能定时服务", 4 | "keywords": ["forsun", "laravel", "sdk"], 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "snower", 9 | "email": "snower199@gmail.com" 10 | } 11 | ], 12 | "require": { 13 | "leric/php-thrift": "0.9.*" 14 | }, 15 | "require-dev": { 16 | "laravel/framework": ">=5.4" 17 | }, 18 | "autoload": { 19 | "psr-4": { 20 | "Snower\\LaravelForsun\\": "src/" 21 | } 22 | }, 23 | "minimum-stability" : "dev", 24 | "extra": { 25 | "laravel": { 26 | "providers": [ 27 | "Snower\\LaravelForsun\\ServiceProvider" 28 | ], 29 | "aliases": { 30 | "Forsun": "Snower\\LaravelForsun\\Facade" 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /forsun.thrift: -------------------------------------------------------------------------------- 1 | namespace php Snower.LaravelForsun.Client 2 | 3 | exception ForsunPlanError{ 4 | 1:i16 code, 5 | 2:string message 6 | } 7 | 8 | struct ForsunPlan { 9 | 1: required bool is_time_out, 10 | 2: required string key, 11 | 3: required i16 second, 12 | 4: i16 minute = -1, 13 | 5: i16 hour = -1, 14 | 6: i16 day = -1, 15 | 7: i16 month = -1, 16 | 8: i16 week = -1, 17 | 9: required i32 next_time, 18 | 10: i16 status = 0, 19 | 11: i16 count = 0, 20 | 12: i16 current_count = 0, 21 | 13: i32 last_timeout = 0, 22 | 14:string action = "shell", 23 | 15:map params = {} 24 | } 25 | 26 | service Forsun{ 27 | i16 ping(), 28 | ForsunPlan create(1:string key, 2:i16 second, 3:i16 minute = -1, 4:i16 hour = -1, 5:i16 day = -1, 6:i16 month = -1, 7:i16 week = -1, 8:string action="shell", 9:map params={}) throws (1:ForsunPlanError err), 29 | ForsunPlan createTimeout(1:string key, 2:i16 second, 3:i16 minute = -1, 4:i16 hour = -1, 5:i16 day = -1, 6:i16 month = -1, 7:i16 week = -1, 8:i16 count=1, 9:string action="shell", 10:map params={}) throws (1:ForsunPlanError err), 30 | ForsunPlan remove(1:string key) throws (1:ForsunPlanError err), 31 | ForsunPlan get(1:string key) throws (1:ForsunPlanError err), 32 | list getCurrent(), 33 | list getTime(1:i32 timestamp), 34 | list getKeys(1:string prefix), 35 | void forsun_call(1:string key, 2:i32 ts, 3:map params) 36 | } -------------------------------------------------------------------------------- /src/Builder.php: -------------------------------------------------------------------------------- 1 | forsun = $forsun; 31 | $this->name = $name; 32 | $this->second = 1; 33 | $this->minute = 0; 34 | $this->hour = 0; 35 | $this->day = 0; 36 | $this->month = 0; 37 | $this->week = 0; 38 | $this->is_timeout = true; 39 | $this->timeout_count = 1; 40 | $this->action = ''; 41 | $this->params = []; 42 | $this->queue_name = ''; 43 | 44 | $this->timed = false; 45 | $this->paramsed = false; 46 | $this->scheduled = false; 47 | 48 | if(empty($this->name)){ 49 | $this->genName(); 50 | }else{ 51 | $this->name = config('forsun.prefix') . $this->name; 52 | } 53 | } 54 | 55 | protected function genName(){ 56 | $this->name = config('forsun.prefix') . Carbon::now()->format("YmdHis") . str_random(26); 57 | } 58 | 59 | protected function initAction(){ 60 | $database_config = config("database"); 61 | $queue_config = config("queue"); 62 | 63 | if($queue_config["default"] !== 'redis' && $queue_config["default"] !== 'database' && $queue_config["default"] !== 'beanstalkd'){ 64 | throw new UnsupportedQueueException(); 65 | } 66 | 67 | if($queue_config["default"] === 'database'){ 68 | $this->action = 'mysql'; 69 | 70 | $connection = Arr::get(Arr::get($queue_config["connections"], 'database', []), 'connection', Arr::get($database_config, 'default', 'default')); 71 | $database_config = Arr::get($database_config['connections'], $connection, []); 72 | $this->params = [ 73 | 'host' => Arr::get($database_config, 'host', '127.0.0.1'), 74 | 'port' => strval(Arr::get($database_config, 'port', 3306)), 75 | 'db' => Arr::get($database_config, 'database', 'mysql'), 76 | 'user' => Arr::get($database_config, 'user', 'root'), 77 | 'passwd' => Arr::get($database_config, 'password', ''), 78 | 'table' => Arr::get($queue_config["connections"]["database"], 'table', 'jobs'), 79 | ]; 80 | $this->queue_name = Arr::get($queue_config["connections"]["database"], 'queue', 'default'); 81 | }else if($queue_config["default"] === 'beanstalkd'){ 82 | $this->action = 'beanstalk'; 83 | 84 | $this->params = [ 85 | 'host' => Arr::get($queue_config["connections"]["beanstalkd"], 'host', '127.0.0.1'), 86 | 'port' => strval(Arr::get($queue_config["connections"]["beanstalkd"], 'port', 11300)), 87 | 'name' => Arr::get($queue_config["connections"]["beanstalkd"], 'queue', 'default'), 88 | ]; 89 | $this->queue_name = Arr::get($queue_config["connections"]["beanstalkd"], 'queue', 'default'); 90 | }else{ 91 | $this->action = 'redis'; 92 | 93 | $connection = Arr::get(Arr::get($queue_config["connections"], 'redis', []), 'connection', Arr::get($database_config, 'default', 'default')); 94 | $database_config = Arr::get($database_config['redis'], $connection, []); 95 | $this->params = [ 96 | 'host' => Arr::get($database_config, 'host', '127.0.0.1'), 97 | 'port' => strval(Arr::get($database_config, 'port', 6379)), 98 | 'selected_db' => strval(Arr::get($database_config, 'database', 0)), 99 | ]; 100 | 101 | $password = strval(Arr::get($database_config, 'password', null)); 102 | if($password !== '' && $password !== null){ 103 | $this->params['password'] = $password; 104 | } 105 | $this->queue_name = Arr::get($queue_config["connections"]["redis"], 'queue', 'default'); 106 | } 107 | } 108 | 109 | /** 110 | * Add a new Artisan command event to the schedule. 111 | * 112 | * @param string $command 113 | * @param array $parameters 114 | * @return \Illuminate\Console\Scheduling\Event 115 | */ 116 | public function command($command, array $parameters = []) 117 | { 118 | if (class_exists($command)) { 119 | $command = Container::getInstance()->make($command)->getName(); 120 | } 121 | 122 | return $this->exec( 123 | Application::formatCommandString($command), $parameters 124 | ); 125 | } 126 | 127 | /** 128 | * Add a new job callback event to the schedule. 129 | * 130 | * @param object|string $job 131 | * @return \Illuminate\Console\Scheduling\CallbackEvent 132 | */ 133 | public function job($job) 134 | { 135 | $this->initAction(); 136 | $this->createPayload(new JobDispatchHandler($job)); 137 | return $this->schedule(); 138 | } 139 | 140 | /** 141 | * Add a new command event to the schedule. 142 | * 143 | * @param string $command 144 | * @param array $parameters 145 | * @return \Illuminate\Console\Scheduling\Event 146 | */ 147 | public function exec($command, array $parameters = []) 148 | { 149 | $this->initAction(); 150 | if (count($parameters)) { 151 | $command .= ' '.$this->compileParameters($parameters); 152 | } 153 | 154 | $this->createPayload(new CommandRunHandler($command)); 155 | return $this->schedule(); 156 | } 157 | 158 | public function fire($event, $payload = [], $halt = false){ 159 | $this->initAction(); 160 | $this->createPayload(new EventFireHandler($event, $payload, $halt)); 161 | return $this->schedule(); 162 | } 163 | 164 | public function http($url, $method = "GET", $body = '', $headers = [], $options = []){ 165 | $this->action = "http"; 166 | $this->params = [ 167 | 'url' => $url, 168 | 'method' => $method, 169 | 'body' => $body, 170 | ]; 171 | 172 | foreach ($headers as $key => $value){ 173 | $this->params['header_' . $key] = $value; 174 | } 175 | 176 | $option_keys = ['auth_username', 'auth_password', 'auth_mode', 'user_agent', 'connect_timeout', 'request_timeout']; 177 | foreach ($option_keys as $key){ 178 | if(isset($options[$key])){ 179 | $this->params[$key] = $options[$key]; 180 | } 181 | } 182 | $this->paramsed = true; 183 | return $this->schedule(); 184 | } 185 | 186 | protected function compileParameters(array $parameters) 187 | { 188 | return collect($parameters)->map(function ($value, $key) { 189 | if (is_array($value)) { 190 | $value = collect($value)->map(function ($value) { 191 | return ProcessUtils::escapeArgument($value); 192 | })->implode(' '); 193 | } elseif (! is_numeric($value) && ! preg_match('/^(-.$|--.*)/i', $value)) { 194 | $value = ProcessUtils::escapeArgument($value); 195 | } 196 | 197 | return is_numeric($key) ? $value : "{$key}={$value}"; 198 | })->implode(' '); 199 | } 200 | 201 | protected function createPayload($command){ 202 | $data = [ 203 | "job" => "Illuminate\\Queue\\CallQueuedHandler@call", 204 | 'displayName' => "Illuminate\\Queue\\CallQueuedHandler", 205 | 'maxTries' => null, 206 | 'timeout' => null, 207 | "data" => [ 208 | "commandName" => get_class($command), 209 | "command" => serialize($command) 210 | ] 211 | ]; 212 | 213 | if($this->action == 'redis') { 214 | $data['id'] = Str::random(32); 215 | $data['attempts'] = 0; 216 | } 217 | $data = json_encode($data); 218 | 219 | if($this->action === 'mysql') { 220 | $now = Carbon::now()->getTimestamp(); 221 | $table = $this->params["table"]; 222 | $data = addslashes($data); 223 | $this->params['sql'] = "INSERT INTO `{$table}` (`queue`,`payload`,`attempts`,`reserved`,`reserved_at`,`available_at`,`created_at`) VALUES ('{$this->queue_name}','{$data}',0,0,0,{$now},{$now})"; 224 | } 225 | else if($this->action === 'beanstalk') { 226 | $this->params['body'] = $data; 227 | } 228 | else{ 229 | $data = addcslashes($data, '\''); 230 | $this->params['command'] = "RPUSH 'queues:{$this->queue_name}' '{$data}'"; 231 | } 232 | 233 | $this->paramsed = true; 234 | } 235 | 236 | public function schedule(){ 237 | if($this->timed && $this->paramsed){ 238 | if($this->is_timeout){ 239 | $plan = $this->forsun->createTimeout($this->name, $this->second, $this->minute, $this->hour, $this->day, $this->month, $this->week, $this->timeout_count, $this->action, $this->params); 240 | }else{ 241 | $plan = $this->forsun->create($this->name, $this->second, $this->minute, $this->hour, $this->day, $this->month, $this->week, $this->action, $this->params); 242 | } 243 | $this->scheduled = true; 244 | return $plan; 245 | } 246 | return $this; 247 | } 248 | } -------------------------------------------------------------------------------- /src/Client/ForsunClient.php: -------------------------------------------------------------------------------- 1 | input_ = $input; 27 | $this->output_ = $output ? $output : $input; 28 | } 29 | 30 | public function ping() 31 | { 32 | $this->send_ping(); 33 | return $this->recv_ping(); 34 | } 35 | 36 | public function send_ping() 37 | { 38 | $args = new \Snower\LaravelForsun\Client\Forsun_ping_args(); 39 | $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); 40 | if ($bin_accel) 41 | { 42 | thrift_protocol_write_binary($this->output_, 'ping', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 43 | } 44 | else 45 | { 46 | $this->output_->writeMessageBegin('ping', TMessageType::CALL, $this->seqid_); 47 | $args->write($this->output_); 48 | $this->output_->writeMessageEnd(); 49 | $this->output_->getTransport()->flush(); 50 | } 51 | } 52 | 53 | public function recv_ping() 54 | { 55 | $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); 56 | if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Snower\LaravelForsun\Client\Forsun_ping_result', $this->input_->isStrictRead()); 57 | else 58 | { 59 | $rseqid = 0; 60 | $fname = null; 61 | $mtype = 0; 62 | 63 | $this->input_->readMessageBegin($fname, $mtype, $rseqid); 64 | if ($mtype == TMessageType::EXCEPTION) { 65 | $x = new TApplicationException(); 66 | $x->read($this->input_); 67 | $this->input_->readMessageEnd(); 68 | throw $x; 69 | } 70 | $result = new \Snower\LaravelForsun\Client\Forsun_ping_result(); 71 | $result->read($this->input_); 72 | $this->input_->readMessageEnd(); 73 | } 74 | if ($result->success !== null) { 75 | return $result->success; 76 | } 77 | throw new \Exception("ping failed: unknown result"); 78 | } 79 | 80 | public function create($key, $second, $minute, $hour, $day, $month, $week, $action, array $params) 81 | { 82 | $this->send_create($key, $second, $minute, $hour, $day, $month, $week, $action, $params); 83 | return $this->recv_create(); 84 | } 85 | 86 | public function send_create($key, $second, $minute, $hour, $day, $month, $week, $action, array $params) 87 | { 88 | $args = new \Snower\LaravelForsun\Client\Forsun_create_args(); 89 | $args->key = $key; 90 | $args->second = $second; 91 | $args->minute = $minute; 92 | $args->hour = $hour; 93 | $args->day = $day; 94 | $args->month = $month; 95 | $args->week = $week; 96 | $args->action = $action; 97 | $args->params = $params; 98 | $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); 99 | if ($bin_accel) 100 | { 101 | thrift_protocol_write_binary($this->output_, 'create', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 102 | } 103 | else 104 | { 105 | $this->output_->writeMessageBegin('create', TMessageType::CALL, $this->seqid_); 106 | $args->write($this->output_); 107 | $this->output_->writeMessageEnd(); 108 | $this->output_->getTransport()->flush(); 109 | } 110 | } 111 | 112 | public function recv_create() 113 | { 114 | $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); 115 | if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Snower\LaravelForsun\Client\Forsun_create_result', $this->input_->isStrictRead()); 116 | else 117 | { 118 | $rseqid = 0; 119 | $fname = null; 120 | $mtype = 0; 121 | 122 | $this->input_->readMessageBegin($fname, $mtype, $rseqid); 123 | if ($mtype == TMessageType::EXCEPTION) { 124 | $x = new TApplicationException(); 125 | $x->read($this->input_); 126 | $this->input_->readMessageEnd(); 127 | throw $x; 128 | } 129 | $result = new \Snower\LaravelForsun\Client\Forsun_create_result(); 130 | $result->read($this->input_); 131 | $this->input_->readMessageEnd(); 132 | } 133 | if ($result->success !== null) { 134 | return $result->success; 135 | } 136 | if ($result->err !== null) { 137 | throw $result->err; 138 | } 139 | throw new \Exception("create failed: unknown result"); 140 | } 141 | 142 | public function createTimeout($key, $second, $minute, $hour, $day, $month, $week, $count, $action, array $params) 143 | { 144 | $this->send_createTimeout($key, $second, $minute, $hour, $day, $month, $week, $count, $action, $params); 145 | return $this->recv_createTimeout(); 146 | } 147 | 148 | public function send_createTimeout($key, $second, $minute, $hour, $day, $month, $week, $count, $action, array $params) 149 | { 150 | $args = new \Snower\LaravelForsun\Client\Forsun_createTimeout_args(); 151 | $args->key = $key; 152 | $args->second = $second; 153 | $args->minute = $minute; 154 | $args->hour = $hour; 155 | $args->day = $day; 156 | $args->month = $month; 157 | $args->week = $week; 158 | $args->count = $count; 159 | $args->action = $action; 160 | $args->params = $params; 161 | $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); 162 | if ($bin_accel) 163 | { 164 | thrift_protocol_write_binary($this->output_, 'createTimeout', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 165 | } 166 | else 167 | { 168 | $this->output_->writeMessageBegin('createTimeout', TMessageType::CALL, $this->seqid_); 169 | $args->write($this->output_); 170 | $this->output_->writeMessageEnd(); 171 | $this->output_->getTransport()->flush(); 172 | } 173 | } 174 | 175 | public function recv_createTimeout() 176 | { 177 | $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); 178 | if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Snower\LaravelForsun\Client\Forsun_createTimeout_result', $this->input_->isStrictRead()); 179 | else 180 | { 181 | $rseqid = 0; 182 | $fname = null; 183 | $mtype = 0; 184 | 185 | $this->input_->readMessageBegin($fname, $mtype, $rseqid); 186 | if ($mtype == TMessageType::EXCEPTION) { 187 | $x = new TApplicationException(); 188 | $x->read($this->input_); 189 | $this->input_->readMessageEnd(); 190 | throw $x; 191 | } 192 | $result = new \Snower\LaravelForsun\Client\Forsun_createTimeout_result(); 193 | $result->read($this->input_); 194 | $this->input_->readMessageEnd(); 195 | } 196 | if ($result->success !== null) { 197 | return $result->success; 198 | } 199 | if ($result->err !== null) { 200 | throw $result->err; 201 | } 202 | throw new \Exception("createTimeout failed: unknown result"); 203 | } 204 | 205 | public function remove($key) 206 | { 207 | $this->send_remove($key); 208 | return $this->recv_remove(); 209 | } 210 | 211 | public function send_remove($key) 212 | { 213 | $args = new \Snower\LaravelForsun\Client\Forsun_remove_args(); 214 | $args->key = $key; 215 | $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); 216 | if ($bin_accel) 217 | { 218 | thrift_protocol_write_binary($this->output_, 'remove', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 219 | } 220 | else 221 | { 222 | $this->output_->writeMessageBegin('remove', TMessageType::CALL, $this->seqid_); 223 | $args->write($this->output_); 224 | $this->output_->writeMessageEnd(); 225 | $this->output_->getTransport()->flush(); 226 | } 227 | } 228 | 229 | public function recv_remove() 230 | { 231 | $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); 232 | if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Snower\LaravelForsun\Client\Forsun_remove_result', $this->input_->isStrictRead()); 233 | else 234 | { 235 | $rseqid = 0; 236 | $fname = null; 237 | $mtype = 0; 238 | 239 | $this->input_->readMessageBegin($fname, $mtype, $rseqid); 240 | if ($mtype == TMessageType::EXCEPTION) { 241 | $x = new TApplicationException(); 242 | $x->read($this->input_); 243 | $this->input_->readMessageEnd(); 244 | throw $x; 245 | } 246 | $result = new \Snower\LaravelForsun\Client\Forsun_remove_result(); 247 | $result->read($this->input_); 248 | $this->input_->readMessageEnd(); 249 | } 250 | if ($result->success !== null) { 251 | return $result->success; 252 | } 253 | if ($result->err !== null) { 254 | throw $result->err; 255 | } 256 | throw new \Exception("remove failed: unknown result"); 257 | } 258 | 259 | public function get($key) 260 | { 261 | $this->send_get($key); 262 | return $this->recv_get(); 263 | } 264 | 265 | public function send_get($key) 266 | { 267 | $args = new \Snower\LaravelForsun\Client\Forsun_get_args(); 268 | $args->key = $key; 269 | $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); 270 | if ($bin_accel) 271 | { 272 | thrift_protocol_write_binary($this->output_, 'get', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 273 | } 274 | else 275 | { 276 | $this->output_->writeMessageBegin('get', TMessageType::CALL, $this->seqid_); 277 | $args->write($this->output_); 278 | $this->output_->writeMessageEnd(); 279 | $this->output_->getTransport()->flush(); 280 | } 281 | } 282 | 283 | public function recv_get() 284 | { 285 | $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); 286 | if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Snower\LaravelForsun\Client\Forsun_get_result', $this->input_->isStrictRead()); 287 | else 288 | { 289 | $rseqid = 0; 290 | $fname = null; 291 | $mtype = 0; 292 | 293 | $this->input_->readMessageBegin($fname, $mtype, $rseqid); 294 | if ($mtype == TMessageType::EXCEPTION) { 295 | $x = new TApplicationException(); 296 | $x->read($this->input_); 297 | $this->input_->readMessageEnd(); 298 | throw $x; 299 | } 300 | $result = new \Snower\LaravelForsun\Client\Forsun_get_result(); 301 | $result->read($this->input_); 302 | $this->input_->readMessageEnd(); 303 | } 304 | if ($result->success !== null) { 305 | return $result->success; 306 | } 307 | if ($result->err !== null) { 308 | throw $result->err; 309 | } 310 | throw new \Exception("get failed: unknown result"); 311 | } 312 | 313 | public function getCurrent() 314 | { 315 | $this->send_getCurrent(); 316 | return $this->recv_getCurrent(); 317 | } 318 | 319 | public function send_getCurrent() 320 | { 321 | $args = new \Snower\LaravelForsun\Client\Forsun_getCurrent_args(); 322 | $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); 323 | if ($bin_accel) 324 | { 325 | thrift_protocol_write_binary($this->output_, 'getCurrent', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 326 | } 327 | else 328 | { 329 | $this->output_->writeMessageBegin('getCurrent', TMessageType::CALL, $this->seqid_); 330 | $args->write($this->output_); 331 | $this->output_->writeMessageEnd(); 332 | $this->output_->getTransport()->flush(); 333 | } 334 | } 335 | 336 | public function recv_getCurrent() 337 | { 338 | $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); 339 | if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Snower\LaravelForsun\Client\Forsun_getCurrent_result', $this->input_->isStrictRead()); 340 | else 341 | { 342 | $rseqid = 0; 343 | $fname = null; 344 | $mtype = 0; 345 | 346 | $this->input_->readMessageBegin($fname, $mtype, $rseqid); 347 | if ($mtype == TMessageType::EXCEPTION) { 348 | $x = new TApplicationException(); 349 | $x->read($this->input_); 350 | $this->input_->readMessageEnd(); 351 | throw $x; 352 | } 353 | $result = new \Snower\LaravelForsun\Client\Forsun_getCurrent_result(); 354 | $result->read($this->input_); 355 | $this->input_->readMessageEnd(); 356 | } 357 | if ($result->success !== null) { 358 | return $result->success; 359 | } 360 | throw new \Exception("getCurrent failed: unknown result"); 361 | } 362 | 363 | public function getTime($timestamp) 364 | { 365 | $this->send_getTime($timestamp); 366 | return $this->recv_getTime(); 367 | } 368 | 369 | public function send_getTime($timestamp) 370 | { 371 | $args = new \Snower\LaravelForsun\Client\Forsun_getTime_args(); 372 | $args->timestamp = $timestamp; 373 | $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); 374 | if ($bin_accel) 375 | { 376 | thrift_protocol_write_binary($this->output_, 'getTime', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 377 | } 378 | else 379 | { 380 | $this->output_->writeMessageBegin('getTime', TMessageType::CALL, $this->seqid_); 381 | $args->write($this->output_); 382 | $this->output_->writeMessageEnd(); 383 | $this->output_->getTransport()->flush(); 384 | } 385 | } 386 | 387 | public function recv_getTime() 388 | { 389 | $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); 390 | if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Snower\LaravelForsun\Client\Forsun_getTime_result', $this->input_->isStrictRead()); 391 | else 392 | { 393 | $rseqid = 0; 394 | $fname = null; 395 | $mtype = 0; 396 | 397 | $this->input_->readMessageBegin($fname, $mtype, $rseqid); 398 | if ($mtype == TMessageType::EXCEPTION) { 399 | $x = new TApplicationException(); 400 | $x->read($this->input_); 401 | $this->input_->readMessageEnd(); 402 | throw $x; 403 | } 404 | $result = new \Snower\LaravelForsun\Client\Forsun_getTime_result(); 405 | $result->read($this->input_); 406 | $this->input_->readMessageEnd(); 407 | } 408 | if ($result->success !== null) { 409 | return $result->success; 410 | } 411 | throw new \Exception("getTime failed: unknown result"); 412 | } 413 | 414 | public function getKeys($prefix) 415 | { 416 | $this->send_getKeys($prefix); 417 | return $this->recv_getKeys(); 418 | } 419 | 420 | public function send_getKeys($prefix) 421 | { 422 | $args = new \Snower\LaravelForsun\Client\Forsun_getKeys_args(); 423 | $args->prefix = $prefix; 424 | $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); 425 | if ($bin_accel) 426 | { 427 | thrift_protocol_write_binary($this->output_, 'getKeys', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 428 | } 429 | else 430 | { 431 | $this->output_->writeMessageBegin('getKeys', TMessageType::CALL, $this->seqid_); 432 | $args->write($this->output_); 433 | $this->output_->writeMessageEnd(); 434 | $this->output_->getTransport()->flush(); 435 | } 436 | } 437 | 438 | public function recv_getKeys() 439 | { 440 | $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); 441 | if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Snower\LaravelForsun\Client\Forsun_getKeys_result', $this->input_->isStrictRead()); 442 | else 443 | { 444 | $rseqid = 0; 445 | $fname = null; 446 | $mtype = 0; 447 | 448 | $this->input_->readMessageBegin($fname, $mtype, $rseqid); 449 | if ($mtype == TMessageType::EXCEPTION) { 450 | $x = new TApplicationException(); 451 | $x->read($this->input_); 452 | $this->input_->readMessageEnd(); 453 | throw $x; 454 | } 455 | $result = new \Snower\LaravelForsun\Client\Forsun_getKeys_result(); 456 | $result->read($this->input_); 457 | $this->input_->readMessageEnd(); 458 | } 459 | if ($result->success !== null) { 460 | return $result->success; 461 | } 462 | throw new \Exception("getKeys failed: unknown result"); 463 | } 464 | 465 | public function forsun_call($key, $ts, array $params) 466 | { 467 | $this->send_forsun_call($key, $ts, $params); 468 | $this->recv_forsun_call(); 469 | } 470 | 471 | public function send_forsun_call($key, $ts, array $params) 472 | { 473 | $args = new \Snower\LaravelForsun\Client\Forsun_forsun_call_args(); 474 | $args->key = $key; 475 | $args->ts = $ts; 476 | $args->params = $params; 477 | $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); 478 | if ($bin_accel) 479 | { 480 | thrift_protocol_write_binary($this->output_, 'forsun_call', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); 481 | } 482 | else 483 | { 484 | $this->output_->writeMessageBegin('forsun_call', TMessageType::CALL, $this->seqid_); 485 | $args->write($this->output_); 486 | $this->output_->writeMessageEnd(); 487 | $this->output_->getTransport()->flush(); 488 | } 489 | } 490 | 491 | public function recv_forsun_call() 492 | { 493 | $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); 494 | if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Snower\LaravelForsun\Client\Forsun_forsun_call_result', $this->input_->isStrictRead()); 495 | else 496 | { 497 | $rseqid = 0; 498 | $fname = null; 499 | $mtype = 0; 500 | 501 | $this->input_->readMessageBegin($fname, $mtype, $rseqid); 502 | if ($mtype == TMessageType::EXCEPTION) { 503 | $x = new TApplicationException(); 504 | $x->read($this->input_); 505 | $this->input_->readMessageEnd(); 506 | throw $x; 507 | } 508 | $result = new \Snower\LaravelForsun\Client\Forsun_forsun_call_result(); 509 | $result->read($this->input_); 510 | $this->input_->readMessageEnd(); 511 | } 512 | return; 513 | } 514 | 515 | } 516 | 517 | 518 | -------------------------------------------------------------------------------- /src/Client/ForsunIf.php: -------------------------------------------------------------------------------- 1 | array( 89 | 'var' => 'is_time_out', 90 | 'type' => TType::BOOL, 91 | ), 92 | 2 => array( 93 | 'var' => 'key', 94 | 'type' => TType::STRING, 95 | ), 96 | 3 => array( 97 | 'var' => 'second', 98 | 'type' => TType::I16, 99 | ), 100 | 4 => array( 101 | 'var' => 'minute', 102 | 'type' => TType::I16, 103 | ), 104 | 5 => array( 105 | 'var' => 'hour', 106 | 'type' => TType::I16, 107 | ), 108 | 6 => array( 109 | 'var' => 'day', 110 | 'type' => TType::I16, 111 | ), 112 | 7 => array( 113 | 'var' => 'month', 114 | 'type' => TType::I16, 115 | ), 116 | 8 => array( 117 | 'var' => 'week', 118 | 'type' => TType::I16, 119 | ), 120 | 9 => array( 121 | 'var' => 'next_time', 122 | 'type' => TType::I32, 123 | ), 124 | 10 => array( 125 | 'var' => 'status', 126 | 'type' => TType::I16, 127 | ), 128 | 11 => array( 129 | 'var' => 'count', 130 | 'type' => TType::I16, 131 | ), 132 | 12 => array( 133 | 'var' => 'current_count', 134 | 'type' => TType::I16, 135 | ), 136 | 13 => array( 137 | 'var' => 'last_timeout', 138 | 'type' => TType::I32, 139 | ), 140 | 14 => array( 141 | 'var' => 'action', 142 | 'type' => TType::STRING, 143 | ), 144 | 15 => array( 145 | 'var' => 'params', 146 | 'type' => TType::MAP, 147 | 'ktype' => TType::STRING, 148 | 'vtype' => TType::STRING, 149 | 'key' => array( 150 | 'type' => TType::STRING, 151 | ), 152 | 'val' => array( 153 | 'type' => TType::STRING, 154 | ), 155 | ), 156 | ); 157 | } 158 | if (is_array($vals)) { 159 | if (isset($vals['is_time_out'])) { 160 | $this->is_time_out = $vals['is_time_out']; 161 | } 162 | if (isset($vals['key'])) { 163 | $this->key = $vals['key']; 164 | } 165 | if (isset($vals['second'])) { 166 | $this->second = $vals['second']; 167 | } 168 | if (isset($vals['minute'])) { 169 | $this->minute = $vals['minute']; 170 | } 171 | if (isset($vals['hour'])) { 172 | $this->hour = $vals['hour']; 173 | } 174 | if (isset($vals['day'])) { 175 | $this->day = $vals['day']; 176 | } 177 | if (isset($vals['month'])) { 178 | $this->month = $vals['month']; 179 | } 180 | if (isset($vals['week'])) { 181 | $this->week = $vals['week']; 182 | } 183 | if (isset($vals['next_time'])) { 184 | $this->next_time = $vals['next_time']; 185 | } 186 | if (isset($vals['status'])) { 187 | $this->status = $vals['status']; 188 | } 189 | if (isset($vals['count'])) { 190 | $this->count = $vals['count']; 191 | } 192 | if (isset($vals['current_count'])) { 193 | $this->current_count = $vals['current_count']; 194 | } 195 | if (isset($vals['last_timeout'])) { 196 | $this->last_timeout = $vals['last_timeout']; 197 | } 198 | if (isset($vals['action'])) { 199 | $this->action = $vals['action']; 200 | } 201 | if (isset($vals['params'])) { 202 | $this->params = $vals['params']; 203 | } 204 | } 205 | } 206 | 207 | public function getName() { 208 | return 'ForsunPlan'; 209 | } 210 | 211 | public function read($input) 212 | { 213 | $xfer = 0; 214 | $fname = null; 215 | $ftype = 0; 216 | $fid = 0; 217 | $xfer += $input->readStructBegin($fname); 218 | while (true) 219 | { 220 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 221 | if ($ftype == TType::STOP) { 222 | break; 223 | } 224 | switch ($fid) 225 | { 226 | case 1: 227 | if ($ftype == TType::BOOL) { 228 | $xfer += $input->readBool($this->is_time_out); 229 | } else { 230 | $xfer += $input->skip($ftype); 231 | } 232 | break; 233 | case 2: 234 | if ($ftype == TType::STRING) { 235 | $xfer += $input->readString($this->key); 236 | } else { 237 | $xfer += $input->skip($ftype); 238 | } 239 | break; 240 | case 3: 241 | if ($ftype == TType::I16) { 242 | $xfer += $input->readI16($this->second); 243 | } else { 244 | $xfer += $input->skip($ftype); 245 | } 246 | break; 247 | case 4: 248 | if ($ftype == TType::I16) { 249 | $xfer += $input->readI16($this->minute); 250 | } else { 251 | $xfer += $input->skip($ftype); 252 | } 253 | break; 254 | case 5: 255 | if ($ftype == TType::I16) { 256 | $xfer += $input->readI16($this->hour); 257 | } else { 258 | $xfer += $input->skip($ftype); 259 | } 260 | break; 261 | case 6: 262 | if ($ftype == TType::I16) { 263 | $xfer += $input->readI16($this->day); 264 | } else { 265 | $xfer += $input->skip($ftype); 266 | } 267 | break; 268 | case 7: 269 | if ($ftype == TType::I16) { 270 | $xfer += $input->readI16($this->month); 271 | } else { 272 | $xfer += $input->skip($ftype); 273 | } 274 | break; 275 | case 8: 276 | if ($ftype == TType::I16) { 277 | $xfer += $input->readI16($this->week); 278 | } else { 279 | $xfer += $input->skip($ftype); 280 | } 281 | break; 282 | case 9: 283 | if ($ftype == TType::I32) { 284 | $xfer += $input->readI32($this->next_time); 285 | } else { 286 | $xfer += $input->skip($ftype); 287 | } 288 | break; 289 | case 10: 290 | if ($ftype == TType::I16) { 291 | $xfer += $input->readI16($this->status); 292 | } else { 293 | $xfer += $input->skip($ftype); 294 | } 295 | break; 296 | case 11: 297 | if ($ftype == TType::I16) { 298 | $xfer += $input->readI16($this->count); 299 | } else { 300 | $xfer += $input->skip($ftype); 301 | } 302 | break; 303 | case 12: 304 | if ($ftype == TType::I16) { 305 | $xfer += $input->readI16($this->current_count); 306 | } else { 307 | $xfer += $input->skip($ftype); 308 | } 309 | break; 310 | case 13: 311 | if ($ftype == TType::I32) { 312 | $xfer += $input->readI32($this->last_timeout); 313 | } else { 314 | $xfer += $input->skip($ftype); 315 | } 316 | break; 317 | case 14: 318 | if ($ftype == TType::STRING) { 319 | $xfer += $input->readString($this->action); 320 | } else { 321 | $xfer += $input->skip($ftype); 322 | } 323 | break; 324 | case 15: 325 | if ($ftype == TType::MAP) { 326 | $this->params = array(); 327 | $_size0 = 0; 328 | $_ktype1 = 0; 329 | $_vtype2 = 0; 330 | $xfer += $input->readMapBegin($_ktype1, $_vtype2, $_size0); 331 | for ($_i4 = 0; $_i4 < $_size0; ++$_i4) 332 | { 333 | $key5 = ''; 334 | $val6 = ''; 335 | $xfer += $input->readString($key5); 336 | $xfer += $input->readString($val6); 337 | $this->params[$key5] = $val6; 338 | } 339 | $xfer += $input->readMapEnd(); 340 | } else { 341 | $xfer += $input->skip($ftype); 342 | } 343 | break; 344 | default: 345 | $xfer += $input->skip($ftype); 346 | break; 347 | } 348 | $xfer += $input->readFieldEnd(); 349 | } 350 | $xfer += $input->readStructEnd(); 351 | return $xfer; 352 | } 353 | 354 | public function write($output) { 355 | $xfer = 0; 356 | $xfer += $output->writeStructBegin('ForsunPlan'); 357 | if ($this->is_time_out !== null) { 358 | $xfer += $output->writeFieldBegin('is_time_out', TType::BOOL, 1); 359 | $xfer += $output->writeBool($this->is_time_out); 360 | $xfer += $output->writeFieldEnd(); 361 | } 362 | if ($this->key !== null) { 363 | $xfer += $output->writeFieldBegin('key', TType::STRING, 2); 364 | $xfer += $output->writeString($this->key); 365 | $xfer += $output->writeFieldEnd(); 366 | } 367 | if ($this->second !== null) { 368 | $xfer += $output->writeFieldBegin('second', TType::I16, 3); 369 | $xfer += $output->writeI16($this->second); 370 | $xfer += $output->writeFieldEnd(); 371 | } 372 | if ($this->minute !== null) { 373 | $xfer += $output->writeFieldBegin('minute', TType::I16, 4); 374 | $xfer += $output->writeI16($this->minute); 375 | $xfer += $output->writeFieldEnd(); 376 | } 377 | if ($this->hour !== null) { 378 | $xfer += $output->writeFieldBegin('hour', TType::I16, 5); 379 | $xfer += $output->writeI16($this->hour); 380 | $xfer += $output->writeFieldEnd(); 381 | } 382 | if ($this->day !== null) { 383 | $xfer += $output->writeFieldBegin('day', TType::I16, 6); 384 | $xfer += $output->writeI16($this->day); 385 | $xfer += $output->writeFieldEnd(); 386 | } 387 | if ($this->month !== null) { 388 | $xfer += $output->writeFieldBegin('month', TType::I16, 7); 389 | $xfer += $output->writeI16($this->month); 390 | $xfer += $output->writeFieldEnd(); 391 | } 392 | if ($this->week !== null) { 393 | $xfer += $output->writeFieldBegin('week', TType::I16, 8); 394 | $xfer += $output->writeI16($this->week); 395 | $xfer += $output->writeFieldEnd(); 396 | } 397 | if ($this->next_time !== null) { 398 | $xfer += $output->writeFieldBegin('next_time', TType::I32, 9); 399 | $xfer += $output->writeI32($this->next_time); 400 | $xfer += $output->writeFieldEnd(); 401 | } 402 | if ($this->status !== null) { 403 | $xfer += $output->writeFieldBegin('status', TType::I16, 10); 404 | $xfer += $output->writeI16($this->status); 405 | $xfer += $output->writeFieldEnd(); 406 | } 407 | if ($this->count !== null) { 408 | $xfer += $output->writeFieldBegin('count', TType::I16, 11); 409 | $xfer += $output->writeI16($this->count); 410 | $xfer += $output->writeFieldEnd(); 411 | } 412 | if ($this->current_count !== null) { 413 | $xfer += $output->writeFieldBegin('current_count', TType::I16, 12); 414 | $xfer += $output->writeI16($this->current_count); 415 | $xfer += $output->writeFieldEnd(); 416 | } 417 | if ($this->last_timeout !== null) { 418 | $xfer += $output->writeFieldBegin('last_timeout', TType::I32, 13); 419 | $xfer += $output->writeI32($this->last_timeout); 420 | $xfer += $output->writeFieldEnd(); 421 | } 422 | if ($this->action !== null) { 423 | $xfer += $output->writeFieldBegin('action', TType::STRING, 14); 424 | $xfer += $output->writeString($this->action); 425 | $xfer += $output->writeFieldEnd(); 426 | } 427 | if ($this->params !== null) { 428 | if (!is_array($this->params)) { 429 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 430 | } 431 | $xfer += $output->writeFieldBegin('params', TType::MAP, 15); 432 | { 433 | $output->writeMapBegin(TType::STRING, TType::STRING, count($this->params)); 434 | { 435 | foreach ($this->params as $kiter7 => $viter8) 436 | { 437 | $xfer += $output->writeString($kiter7); 438 | $xfer += $output->writeString($viter8); 439 | } 440 | } 441 | $output->writeMapEnd(); 442 | } 443 | $xfer += $output->writeFieldEnd(); 444 | } 445 | $xfer += $output->writeFieldStop(); 446 | $xfer += $output->writeStructEnd(); 447 | return $xfer; 448 | } 449 | 450 | } 451 | 452 | -------------------------------------------------------------------------------- /src/Client/ForsunPlanError.php: -------------------------------------------------------------------------------- 1 | array( 36 | 'var' => 'code', 37 | 'type' => TType::I16, 38 | ), 39 | 2 => array( 40 | 'var' => 'message', 41 | 'type' => TType::STRING, 42 | ), 43 | ); 44 | } 45 | if (is_array($vals)) { 46 | if (isset($vals['code'])) { 47 | $this->code = $vals['code']; 48 | } 49 | if (isset($vals['message'])) { 50 | $this->message = $vals['message']; 51 | } 52 | } 53 | } 54 | 55 | public function getName() { 56 | return 'ForsunPlanError'; 57 | } 58 | 59 | public function read($input) 60 | { 61 | $xfer = 0; 62 | $fname = null; 63 | $ftype = 0; 64 | $fid = 0; 65 | $xfer += $input->readStructBegin($fname); 66 | while (true) 67 | { 68 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 69 | if ($ftype == TType::STOP) { 70 | break; 71 | } 72 | switch ($fid) 73 | { 74 | case 1: 75 | if ($ftype == TType::I16) { 76 | $xfer += $input->readI16($this->code); 77 | } else { 78 | $xfer += $input->skip($ftype); 79 | } 80 | break; 81 | case 2: 82 | if ($ftype == TType::STRING) { 83 | $xfer += $input->readString($this->message); 84 | } else { 85 | $xfer += $input->skip($ftype); 86 | } 87 | break; 88 | default: 89 | $xfer += $input->skip($ftype); 90 | break; 91 | } 92 | $xfer += $input->readFieldEnd(); 93 | } 94 | $xfer += $input->readStructEnd(); 95 | return $xfer; 96 | } 97 | 98 | public function write($output) { 99 | $xfer = 0; 100 | $xfer += $output->writeStructBegin('ForsunPlanError'); 101 | if ($this->code !== null) { 102 | $xfer += $output->writeFieldBegin('code', TType::I16, 1); 103 | $xfer += $output->writeI16($this->code); 104 | $xfer += $output->writeFieldEnd(); 105 | } 106 | if ($this->message !== null) { 107 | $xfer += $output->writeFieldBegin('message', TType::STRING, 2); 108 | $xfer += $output->writeString($this->message); 109 | $xfer += $output->writeFieldEnd(); 110 | } 111 | $xfer += $output->writeFieldStop(); 112 | $xfer += $output->writeStructEnd(); 113 | return $xfer; 114 | } 115 | 116 | } 117 | 118 | -------------------------------------------------------------------------------- /src/Client/Forsun_createTimeout_args.php: -------------------------------------------------------------------------------- 1 | array( 68 | 'var' => 'key', 69 | 'type' => TType::STRING, 70 | ), 71 | 2 => array( 72 | 'var' => 'second', 73 | 'type' => TType::I16, 74 | ), 75 | 3 => array( 76 | 'var' => 'minute', 77 | 'type' => TType::I16, 78 | ), 79 | 4 => array( 80 | 'var' => 'hour', 81 | 'type' => TType::I16, 82 | ), 83 | 5 => array( 84 | 'var' => 'day', 85 | 'type' => TType::I16, 86 | ), 87 | 6 => array( 88 | 'var' => 'month', 89 | 'type' => TType::I16, 90 | ), 91 | 7 => array( 92 | 'var' => 'week', 93 | 'type' => TType::I16, 94 | ), 95 | 8 => array( 96 | 'var' => 'count', 97 | 'type' => TType::I16, 98 | ), 99 | 9 => array( 100 | 'var' => 'action', 101 | 'type' => TType::STRING, 102 | ), 103 | 10 => array( 104 | 'var' => 'params', 105 | 'type' => TType::MAP, 106 | 'ktype' => TType::STRING, 107 | 'vtype' => TType::STRING, 108 | 'key' => array( 109 | 'type' => TType::STRING, 110 | ), 111 | 'val' => array( 112 | 'type' => TType::STRING, 113 | ), 114 | ), 115 | ); 116 | } 117 | if (is_array($vals)) { 118 | if (isset($vals['key'])) { 119 | $this->key = $vals['key']; 120 | } 121 | if (isset($vals['second'])) { 122 | $this->second = $vals['second']; 123 | } 124 | if (isset($vals['minute'])) { 125 | $this->minute = $vals['minute']; 126 | } 127 | if (isset($vals['hour'])) { 128 | $this->hour = $vals['hour']; 129 | } 130 | if (isset($vals['day'])) { 131 | $this->day = $vals['day']; 132 | } 133 | if (isset($vals['month'])) { 134 | $this->month = $vals['month']; 135 | } 136 | if (isset($vals['week'])) { 137 | $this->week = $vals['week']; 138 | } 139 | if (isset($vals['count'])) { 140 | $this->count = $vals['count']; 141 | } 142 | if (isset($vals['action'])) { 143 | $this->action = $vals['action']; 144 | } 145 | if (isset($vals['params'])) { 146 | $this->params = $vals['params']; 147 | } 148 | } 149 | } 150 | 151 | public function getName() { 152 | return 'Forsun_createTimeout_args'; 153 | } 154 | 155 | public function read($input) 156 | { 157 | $xfer = 0; 158 | $fname = null; 159 | $ftype = 0; 160 | $fid = 0; 161 | $xfer += $input->readStructBegin($fname); 162 | while (true) 163 | { 164 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 165 | if ($ftype == TType::STOP) { 166 | break; 167 | } 168 | switch ($fid) 169 | { 170 | case 1: 171 | if ($ftype == TType::STRING) { 172 | $xfer += $input->readString($this->key); 173 | } else { 174 | $xfer += $input->skip($ftype); 175 | } 176 | break; 177 | case 2: 178 | if ($ftype == TType::I16) { 179 | $xfer += $input->readI16($this->second); 180 | } else { 181 | $xfer += $input->skip($ftype); 182 | } 183 | break; 184 | case 3: 185 | if ($ftype == TType::I16) { 186 | $xfer += $input->readI16($this->minute); 187 | } else { 188 | $xfer += $input->skip($ftype); 189 | } 190 | break; 191 | case 4: 192 | if ($ftype == TType::I16) { 193 | $xfer += $input->readI16($this->hour); 194 | } else { 195 | $xfer += $input->skip($ftype); 196 | } 197 | break; 198 | case 5: 199 | if ($ftype == TType::I16) { 200 | $xfer += $input->readI16($this->day); 201 | } else { 202 | $xfer += $input->skip($ftype); 203 | } 204 | break; 205 | case 6: 206 | if ($ftype == TType::I16) { 207 | $xfer += $input->readI16($this->month); 208 | } else { 209 | $xfer += $input->skip($ftype); 210 | } 211 | break; 212 | case 7: 213 | if ($ftype == TType::I16) { 214 | $xfer += $input->readI16($this->week); 215 | } else { 216 | $xfer += $input->skip($ftype); 217 | } 218 | break; 219 | case 8: 220 | if ($ftype == TType::I16) { 221 | $xfer += $input->readI16($this->count); 222 | } else { 223 | $xfer += $input->skip($ftype); 224 | } 225 | break; 226 | case 9: 227 | if ($ftype == TType::STRING) { 228 | $xfer += $input->readString($this->action); 229 | } else { 230 | $xfer += $input->skip($ftype); 231 | } 232 | break; 233 | case 10: 234 | if ($ftype == TType::MAP) { 235 | $this->params = array(); 236 | $_size18 = 0; 237 | $_ktype19 = 0; 238 | $_vtype20 = 0; 239 | $xfer += $input->readMapBegin($_ktype19, $_vtype20, $_size18); 240 | for ($_i22 = 0; $_i22 < $_size18; ++$_i22) 241 | { 242 | $key23 = ''; 243 | $val24 = ''; 244 | $xfer += $input->readString($key23); 245 | $xfer += $input->readString($val24); 246 | $this->params[$key23] = $val24; 247 | } 248 | $xfer += $input->readMapEnd(); 249 | } else { 250 | $xfer += $input->skip($ftype); 251 | } 252 | break; 253 | default: 254 | $xfer += $input->skip($ftype); 255 | break; 256 | } 257 | $xfer += $input->readFieldEnd(); 258 | } 259 | $xfer += $input->readStructEnd(); 260 | return $xfer; 261 | } 262 | 263 | public function write($output) { 264 | $xfer = 0; 265 | $xfer += $output->writeStructBegin('Forsun_createTimeout_args'); 266 | if ($this->key !== null) { 267 | $xfer += $output->writeFieldBegin('key', TType::STRING, 1); 268 | $xfer += $output->writeString($this->key); 269 | $xfer += $output->writeFieldEnd(); 270 | } 271 | if ($this->second !== null) { 272 | $xfer += $output->writeFieldBegin('second', TType::I16, 2); 273 | $xfer += $output->writeI16($this->second); 274 | $xfer += $output->writeFieldEnd(); 275 | } 276 | if ($this->minute !== null) { 277 | $xfer += $output->writeFieldBegin('minute', TType::I16, 3); 278 | $xfer += $output->writeI16($this->minute); 279 | $xfer += $output->writeFieldEnd(); 280 | } 281 | if ($this->hour !== null) { 282 | $xfer += $output->writeFieldBegin('hour', TType::I16, 4); 283 | $xfer += $output->writeI16($this->hour); 284 | $xfer += $output->writeFieldEnd(); 285 | } 286 | if ($this->day !== null) { 287 | $xfer += $output->writeFieldBegin('day', TType::I16, 5); 288 | $xfer += $output->writeI16($this->day); 289 | $xfer += $output->writeFieldEnd(); 290 | } 291 | if ($this->month !== null) { 292 | $xfer += $output->writeFieldBegin('month', TType::I16, 6); 293 | $xfer += $output->writeI16($this->month); 294 | $xfer += $output->writeFieldEnd(); 295 | } 296 | if ($this->week !== null) { 297 | $xfer += $output->writeFieldBegin('week', TType::I16, 7); 298 | $xfer += $output->writeI16($this->week); 299 | $xfer += $output->writeFieldEnd(); 300 | } 301 | if ($this->count !== null) { 302 | $xfer += $output->writeFieldBegin('count', TType::I16, 8); 303 | $xfer += $output->writeI16($this->count); 304 | $xfer += $output->writeFieldEnd(); 305 | } 306 | if ($this->action !== null) { 307 | $xfer += $output->writeFieldBegin('action', TType::STRING, 9); 308 | $xfer += $output->writeString($this->action); 309 | $xfer += $output->writeFieldEnd(); 310 | } 311 | if ($this->params !== null) { 312 | if (!is_array($this->params)) { 313 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 314 | } 315 | $xfer += $output->writeFieldBegin('params', TType::MAP, 10); 316 | { 317 | $output->writeMapBegin(TType::STRING, TType::STRING, count($this->params)); 318 | { 319 | foreach ($this->params as $kiter25 => $viter26) 320 | { 321 | $xfer += $output->writeString($kiter25); 322 | $xfer += $output->writeString($viter26); 323 | } 324 | } 325 | $output->writeMapEnd(); 326 | } 327 | $xfer += $output->writeFieldEnd(); 328 | } 329 | $xfer += $output->writeFieldStop(); 330 | $xfer += $output->writeStructEnd(); 331 | return $xfer; 332 | } 333 | 334 | } 335 | 336 | -------------------------------------------------------------------------------- /src/Client/Forsun_createTimeout_result.php: -------------------------------------------------------------------------------- 1 | array( 35 | 'var' => 'success', 36 | 'type' => TType::STRUCT, 37 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlan', 38 | ), 39 | 1 => array( 40 | 'var' => 'err', 41 | 'type' => TType::STRUCT, 42 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlanError', 43 | ), 44 | ); 45 | } 46 | if (is_array($vals)) { 47 | if (isset($vals['success'])) { 48 | $this->success = $vals['success']; 49 | } 50 | if (isset($vals['err'])) { 51 | $this->err = $vals['err']; 52 | } 53 | } 54 | } 55 | 56 | public function getName() { 57 | return 'Forsun_createTimeout_result'; 58 | } 59 | 60 | public function read($input) 61 | { 62 | $xfer = 0; 63 | $fname = null; 64 | $ftype = 0; 65 | $fid = 0; 66 | $xfer += $input->readStructBegin($fname); 67 | while (true) 68 | { 69 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 70 | if ($ftype == TType::STOP) { 71 | break; 72 | } 73 | switch ($fid) 74 | { 75 | case 0: 76 | if ($ftype == TType::STRUCT) { 77 | $this->success = new \Snower\LaravelForsun\Client\ForsunPlan(); 78 | $xfer += $this->success->read($input); 79 | } else { 80 | $xfer += $input->skip($ftype); 81 | } 82 | break; 83 | case 1: 84 | if ($ftype == TType::STRUCT) { 85 | $this->err = new \Snower\LaravelForsun\Client\ForsunPlanError(); 86 | $xfer += $this->err->read($input); 87 | } else { 88 | $xfer += $input->skip($ftype); 89 | } 90 | break; 91 | default: 92 | $xfer += $input->skip($ftype); 93 | break; 94 | } 95 | $xfer += $input->readFieldEnd(); 96 | } 97 | $xfer += $input->readStructEnd(); 98 | return $xfer; 99 | } 100 | 101 | public function write($output) { 102 | $xfer = 0; 103 | $xfer += $output->writeStructBegin('Forsun_createTimeout_result'); 104 | if ($this->success !== null) { 105 | if (!is_object($this->success)) { 106 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 107 | } 108 | $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0); 109 | $xfer += $this->success->write($output); 110 | $xfer += $output->writeFieldEnd(); 111 | } 112 | if ($this->err !== null) { 113 | $xfer += $output->writeFieldBegin('err', TType::STRUCT, 1); 114 | $xfer += $this->err->write($output); 115 | $xfer += $output->writeFieldEnd(); 116 | } 117 | $xfer += $output->writeFieldStop(); 118 | $xfer += $output->writeStructEnd(); 119 | return $xfer; 120 | } 121 | 122 | } 123 | 124 | -------------------------------------------------------------------------------- /src/Client/Forsun_create_args.php: -------------------------------------------------------------------------------- 1 | array( 64 | 'var' => 'key', 65 | 'type' => TType::STRING, 66 | ), 67 | 2 => array( 68 | 'var' => 'second', 69 | 'type' => TType::I16, 70 | ), 71 | 3 => array( 72 | 'var' => 'minute', 73 | 'type' => TType::I16, 74 | ), 75 | 4 => array( 76 | 'var' => 'hour', 77 | 'type' => TType::I16, 78 | ), 79 | 5 => array( 80 | 'var' => 'day', 81 | 'type' => TType::I16, 82 | ), 83 | 6 => array( 84 | 'var' => 'month', 85 | 'type' => TType::I16, 86 | ), 87 | 7 => array( 88 | 'var' => 'week', 89 | 'type' => TType::I16, 90 | ), 91 | 8 => array( 92 | 'var' => 'action', 93 | 'type' => TType::STRING, 94 | ), 95 | 9 => array( 96 | 'var' => 'params', 97 | 'type' => TType::MAP, 98 | 'ktype' => TType::STRING, 99 | 'vtype' => TType::STRING, 100 | 'key' => array( 101 | 'type' => TType::STRING, 102 | ), 103 | 'val' => array( 104 | 'type' => TType::STRING, 105 | ), 106 | ), 107 | ); 108 | } 109 | if (is_array($vals)) { 110 | if (isset($vals['key'])) { 111 | $this->key = $vals['key']; 112 | } 113 | if (isset($vals['second'])) { 114 | $this->second = $vals['second']; 115 | } 116 | if (isset($vals['minute'])) { 117 | $this->minute = $vals['minute']; 118 | } 119 | if (isset($vals['hour'])) { 120 | $this->hour = $vals['hour']; 121 | } 122 | if (isset($vals['day'])) { 123 | $this->day = $vals['day']; 124 | } 125 | if (isset($vals['month'])) { 126 | $this->month = $vals['month']; 127 | } 128 | if (isset($vals['week'])) { 129 | $this->week = $vals['week']; 130 | } 131 | if (isset($vals['action'])) { 132 | $this->action = $vals['action']; 133 | } 134 | if (isset($vals['params'])) { 135 | $this->params = $vals['params']; 136 | } 137 | } 138 | } 139 | 140 | public function getName() { 141 | return 'Forsun_create_args'; 142 | } 143 | 144 | public function read($input) 145 | { 146 | $xfer = 0; 147 | $fname = null; 148 | $ftype = 0; 149 | $fid = 0; 150 | $xfer += $input->readStructBegin($fname); 151 | while (true) 152 | { 153 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 154 | if ($ftype == TType::STOP) { 155 | break; 156 | } 157 | switch ($fid) 158 | { 159 | case 1: 160 | if ($ftype == TType::STRING) { 161 | $xfer += $input->readString($this->key); 162 | } else { 163 | $xfer += $input->skip($ftype); 164 | } 165 | break; 166 | case 2: 167 | if ($ftype == TType::I16) { 168 | $xfer += $input->readI16($this->second); 169 | } else { 170 | $xfer += $input->skip($ftype); 171 | } 172 | break; 173 | case 3: 174 | if ($ftype == TType::I16) { 175 | $xfer += $input->readI16($this->minute); 176 | } else { 177 | $xfer += $input->skip($ftype); 178 | } 179 | break; 180 | case 4: 181 | if ($ftype == TType::I16) { 182 | $xfer += $input->readI16($this->hour); 183 | } else { 184 | $xfer += $input->skip($ftype); 185 | } 186 | break; 187 | case 5: 188 | if ($ftype == TType::I16) { 189 | $xfer += $input->readI16($this->day); 190 | } else { 191 | $xfer += $input->skip($ftype); 192 | } 193 | break; 194 | case 6: 195 | if ($ftype == TType::I16) { 196 | $xfer += $input->readI16($this->month); 197 | } else { 198 | $xfer += $input->skip($ftype); 199 | } 200 | break; 201 | case 7: 202 | if ($ftype == TType::I16) { 203 | $xfer += $input->readI16($this->week); 204 | } else { 205 | $xfer += $input->skip($ftype); 206 | } 207 | break; 208 | case 8: 209 | if ($ftype == TType::STRING) { 210 | $xfer += $input->readString($this->action); 211 | } else { 212 | $xfer += $input->skip($ftype); 213 | } 214 | break; 215 | case 9: 216 | if ($ftype == TType::MAP) { 217 | $this->params = array(); 218 | $_size9 = 0; 219 | $_ktype10 = 0; 220 | $_vtype11 = 0; 221 | $xfer += $input->readMapBegin($_ktype10, $_vtype11, $_size9); 222 | for ($_i13 = 0; $_i13 < $_size9; ++$_i13) 223 | { 224 | $key14 = ''; 225 | $val15 = ''; 226 | $xfer += $input->readString($key14); 227 | $xfer += $input->readString($val15); 228 | $this->params[$key14] = $val15; 229 | } 230 | $xfer += $input->readMapEnd(); 231 | } else { 232 | $xfer += $input->skip($ftype); 233 | } 234 | break; 235 | default: 236 | $xfer += $input->skip($ftype); 237 | break; 238 | } 239 | $xfer += $input->readFieldEnd(); 240 | } 241 | $xfer += $input->readStructEnd(); 242 | return $xfer; 243 | } 244 | 245 | public function write($output) { 246 | $xfer = 0; 247 | $xfer += $output->writeStructBegin('Forsun_create_args'); 248 | if ($this->key !== null) { 249 | $xfer += $output->writeFieldBegin('key', TType::STRING, 1); 250 | $xfer += $output->writeString($this->key); 251 | $xfer += $output->writeFieldEnd(); 252 | } 253 | if ($this->second !== null) { 254 | $xfer += $output->writeFieldBegin('second', TType::I16, 2); 255 | $xfer += $output->writeI16($this->second); 256 | $xfer += $output->writeFieldEnd(); 257 | } 258 | if ($this->minute !== null) { 259 | $xfer += $output->writeFieldBegin('minute', TType::I16, 3); 260 | $xfer += $output->writeI16($this->minute); 261 | $xfer += $output->writeFieldEnd(); 262 | } 263 | if ($this->hour !== null) { 264 | $xfer += $output->writeFieldBegin('hour', TType::I16, 4); 265 | $xfer += $output->writeI16($this->hour); 266 | $xfer += $output->writeFieldEnd(); 267 | } 268 | if ($this->day !== null) { 269 | $xfer += $output->writeFieldBegin('day', TType::I16, 5); 270 | $xfer += $output->writeI16($this->day); 271 | $xfer += $output->writeFieldEnd(); 272 | } 273 | if ($this->month !== null) { 274 | $xfer += $output->writeFieldBegin('month', TType::I16, 6); 275 | $xfer += $output->writeI16($this->month); 276 | $xfer += $output->writeFieldEnd(); 277 | } 278 | if ($this->week !== null) { 279 | $xfer += $output->writeFieldBegin('week', TType::I16, 7); 280 | $xfer += $output->writeI16($this->week); 281 | $xfer += $output->writeFieldEnd(); 282 | } 283 | if ($this->action !== null) { 284 | $xfer += $output->writeFieldBegin('action', TType::STRING, 8); 285 | $xfer += $output->writeString($this->action); 286 | $xfer += $output->writeFieldEnd(); 287 | } 288 | if ($this->params !== null) { 289 | if (!is_array($this->params)) { 290 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 291 | } 292 | $xfer += $output->writeFieldBegin('params', TType::MAP, 9); 293 | { 294 | $output->writeMapBegin(TType::STRING, TType::STRING, count($this->params)); 295 | { 296 | foreach ($this->params as $kiter16 => $viter17) 297 | { 298 | $xfer += $output->writeString($kiter16); 299 | $xfer += $output->writeString($viter17); 300 | } 301 | } 302 | $output->writeMapEnd(); 303 | } 304 | $xfer += $output->writeFieldEnd(); 305 | } 306 | $xfer += $output->writeFieldStop(); 307 | $xfer += $output->writeStructEnd(); 308 | return $xfer; 309 | } 310 | 311 | } 312 | 313 | -------------------------------------------------------------------------------- /src/Client/Forsun_create_result.php: -------------------------------------------------------------------------------- 1 | array( 35 | 'var' => 'success', 36 | 'type' => TType::STRUCT, 37 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlan', 38 | ), 39 | 1 => array( 40 | 'var' => 'err', 41 | 'type' => TType::STRUCT, 42 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlanError', 43 | ), 44 | ); 45 | } 46 | if (is_array($vals)) { 47 | if (isset($vals['success'])) { 48 | $this->success = $vals['success']; 49 | } 50 | if (isset($vals['err'])) { 51 | $this->err = $vals['err']; 52 | } 53 | } 54 | } 55 | 56 | public function getName() { 57 | return 'Forsun_create_result'; 58 | } 59 | 60 | public function read($input) 61 | { 62 | $xfer = 0; 63 | $fname = null; 64 | $ftype = 0; 65 | $fid = 0; 66 | $xfer += $input->readStructBegin($fname); 67 | while (true) 68 | { 69 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 70 | if ($ftype == TType::STOP) { 71 | break; 72 | } 73 | switch ($fid) 74 | { 75 | case 0: 76 | if ($ftype == TType::STRUCT) { 77 | $this->success = new \Snower\LaravelForsun\Client\ForsunPlan(); 78 | $xfer += $this->success->read($input); 79 | } else { 80 | $xfer += $input->skip($ftype); 81 | } 82 | break; 83 | case 1: 84 | if ($ftype == TType::STRUCT) { 85 | $this->err = new \Snower\LaravelForsun\Client\ForsunPlanError(); 86 | $xfer += $this->err->read($input); 87 | } else { 88 | $xfer += $input->skip($ftype); 89 | } 90 | break; 91 | default: 92 | $xfer += $input->skip($ftype); 93 | break; 94 | } 95 | $xfer += $input->readFieldEnd(); 96 | } 97 | $xfer += $input->readStructEnd(); 98 | return $xfer; 99 | } 100 | 101 | public function write($output) { 102 | $xfer = 0; 103 | $xfer += $output->writeStructBegin('Forsun_create_result'); 104 | if ($this->success !== null) { 105 | if (!is_object($this->success)) { 106 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 107 | } 108 | $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0); 109 | $xfer += $this->success->write($output); 110 | $xfer += $output->writeFieldEnd(); 111 | } 112 | if ($this->err !== null) { 113 | $xfer += $output->writeFieldBegin('err', TType::STRUCT, 1); 114 | $xfer += $this->err->write($output); 115 | $xfer += $output->writeFieldEnd(); 116 | } 117 | $xfer += $output->writeFieldStop(); 118 | $xfer += $output->writeStructEnd(); 119 | return $xfer; 120 | } 121 | 122 | } 123 | 124 | -------------------------------------------------------------------------------- /src/Client/Forsun_forsun_call_args.php: -------------------------------------------------------------------------------- 1 | array( 39 | 'var' => 'key', 40 | 'type' => TType::STRING, 41 | ), 42 | 2 => array( 43 | 'var' => 'ts', 44 | 'type' => TType::I32, 45 | ), 46 | 3 => array( 47 | 'var' => 'params', 48 | 'type' => TType::MAP, 49 | 'ktype' => TType::STRING, 50 | 'vtype' => TType::STRING, 51 | 'key' => array( 52 | 'type' => TType::STRING, 53 | ), 54 | 'val' => array( 55 | 'type' => TType::STRING, 56 | ), 57 | ), 58 | ); 59 | } 60 | if (is_array($vals)) { 61 | if (isset($vals['key'])) { 62 | $this->key = $vals['key']; 63 | } 64 | if (isset($vals['ts'])) { 65 | $this->ts = $vals['ts']; 66 | } 67 | if (isset($vals['params'])) { 68 | $this->params = $vals['params']; 69 | } 70 | } 71 | } 72 | 73 | public function getName() { 74 | return 'Forsun_forsun_call_args'; 75 | } 76 | 77 | public function read($input) 78 | { 79 | $xfer = 0; 80 | $fname = null; 81 | $ftype = 0; 82 | $fid = 0; 83 | $xfer += $input->readStructBegin($fname); 84 | while (true) 85 | { 86 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 87 | if ($ftype == TType::STOP) { 88 | break; 89 | } 90 | switch ($fid) 91 | { 92 | case 1: 93 | if ($ftype == TType::STRING) { 94 | $xfer += $input->readString($this->key); 95 | } else { 96 | $xfer += $input->skip($ftype); 97 | } 98 | break; 99 | case 2: 100 | if ($ftype == TType::I32) { 101 | $xfer += $input->readI32($this->ts); 102 | } else { 103 | $xfer += $input->skip($ftype); 104 | } 105 | break; 106 | case 3: 107 | if ($ftype == TType::MAP) { 108 | $this->params = array(); 109 | $_size48 = 0; 110 | $_ktype49 = 0; 111 | $_vtype50 = 0; 112 | $xfer += $input->readMapBegin($_ktype49, $_vtype50, $_size48); 113 | for ($_i52 = 0; $_i52 < $_size48; ++$_i52) 114 | { 115 | $key53 = ''; 116 | $val54 = ''; 117 | $xfer += $input->readString($key53); 118 | $xfer += $input->readString($val54); 119 | $this->params[$key53] = $val54; 120 | } 121 | $xfer += $input->readMapEnd(); 122 | } else { 123 | $xfer += $input->skip($ftype); 124 | } 125 | break; 126 | default: 127 | $xfer += $input->skip($ftype); 128 | break; 129 | } 130 | $xfer += $input->readFieldEnd(); 131 | } 132 | $xfer += $input->readStructEnd(); 133 | return $xfer; 134 | } 135 | 136 | public function write($output) { 137 | $xfer = 0; 138 | $xfer += $output->writeStructBegin('Forsun_forsun_call_args'); 139 | if ($this->key !== null) { 140 | $xfer += $output->writeFieldBegin('key', TType::STRING, 1); 141 | $xfer += $output->writeString($this->key); 142 | $xfer += $output->writeFieldEnd(); 143 | } 144 | if ($this->ts !== null) { 145 | $xfer += $output->writeFieldBegin('ts', TType::I32, 2); 146 | $xfer += $output->writeI32($this->ts); 147 | $xfer += $output->writeFieldEnd(); 148 | } 149 | if ($this->params !== null) { 150 | if (!is_array($this->params)) { 151 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 152 | } 153 | $xfer += $output->writeFieldBegin('params', TType::MAP, 3); 154 | { 155 | $output->writeMapBegin(TType::STRING, TType::STRING, count($this->params)); 156 | { 157 | foreach ($this->params as $kiter55 => $viter56) 158 | { 159 | $xfer += $output->writeString($kiter55); 160 | $xfer += $output->writeString($viter56); 161 | } 162 | } 163 | $output->writeMapEnd(); 164 | } 165 | $xfer += $output->writeFieldEnd(); 166 | } 167 | $xfer += $output->writeFieldStop(); 168 | $xfer += $output->writeStructEnd(); 169 | return $xfer; 170 | } 171 | 172 | } 173 | 174 | -------------------------------------------------------------------------------- /src/Client/Forsun_forsun_call_result.php: -------------------------------------------------------------------------------- 1 | readStructBegin($fname); 41 | while (true) 42 | { 43 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 44 | if ($ftype == TType::STOP) { 45 | break; 46 | } 47 | switch ($fid) 48 | { 49 | default: 50 | $xfer += $input->skip($ftype); 51 | break; 52 | } 53 | $xfer += $input->readFieldEnd(); 54 | } 55 | $xfer += $input->readStructEnd(); 56 | return $xfer; 57 | } 58 | 59 | public function write($output) { 60 | $xfer = 0; 61 | $xfer += $output->writeStructBegin('Forsun_forsun_call_result'); 62 | $xfer += $output->writeFieldStop(); 63 | $xfer += $output->writeStructEnd(); 64 | return $xfer; 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/Client/Forsun_getCurrent_args.php: -------------------------------------------------------------------------------- 1 | readStructBegin($fname); 41 | while (true) 42 | { 43 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 44 | if ($ftype == TType::STOP) { 45 | break; 46 | } 47 | switch ($fid) 48 | { 49 | default: 50 | $xfer += $input->skip($ftype); 51 | break; 52 | } 53 | $xfer += $input->readFieldEnd(); 54 | } 55 | $xfer += $input->readStructEnd(); 56 | return $xfer; 57 | } 58 | 59 | public function write($output) { 60 | $xfer = 0; 61 | $xfer += $output->writeStructBegin('Forsun_getCurrent_args'); 62 | $xfer += $output->writeFieldStop(); 63 | $xfer += $output->writeStructEnd(); 64 | return $xfer; 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/Client/Forsun_getCurrent_result.php: -------------------------------------------------------------------------------- 1 | array( 31 | 'var' => 'success', 32 | 'type' => TType::LST, 33 | 'etype' => TType::STRUCT, 34 | 'elem' => array( 35 | 'type' => TType::STRUCT, 36 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlan', 37 | ), 38 | ), 39 | ); 40 | } 41 | if (is_array($vals)) { 42 | if (isset($vals['success'])) { 43 | $this->success = $vals['success']; 44 | } 45 | } 46 | } 47 | 48 | public function getName() { 49 | return 'Forsun_getCurrent_result'; 50 | } 51 | 52 | public function read($input) 53 | { 54 | $xfer = 0; 55 | $fname = null; 56 | $ftype = 0; 57 | $fid = 0; 58 | $xfer += $input->readStructBegin($fname); 59 | while (true) 60 | { 61 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 62 | if ($ftype == TType::STOP) { 63 | break; 64 | } 65 | switch ($fid) 66 | { 67 | case 0: 68 | if ($ftype == TType::LST) { 69 | $this->success = array(); 70 | $_size27 = 0; 71 | $_etype30 = 0; 72 | $xfer += $input->readListBegin($_etype30, $_size27); 73 | for ($_i31 = 0; $_i31 < $_size27; ++$_i31) 74 | { 75 | $elem32 = null; 76 | $elem32 = new \Snower\LaravelForsun\Client\ForsunPlan(); 77 | $xfer += $elem32->read($input); 78 | $this->success []= $elem32; 79 | } 80 | $xfer += $input->readListEnd(); 81 | } else { 82 | $xfer += $input->skip($ftype); 83 | } 84 | break; 85 | default: 86 | $xfer += $input->skip($ftype); 87 | break; 88 | } 89 | $xfer += $input->readFieldEnd(); 90 | } 91 | $xfer += $input->readStructEnd(); 92 | return $xfer; 93 | } 94 | 95 | public function write($output) { 96 | $xfer = 0; 97 | $xfer += $output->writeStructBegin('Forsun_getCurrent_result'); 98 | if ($this->success !== null) { 99 | if (!is_array($this->success)) { 100 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 101 | } 102 | $xfer += $output->writeFieldBegin('success', TType::LST, 0); 103 | { 104 | $output->writeListBegin(TType::STRUCT, count($this->success)); 105 | { 106 | foreach ($this->success as $iter33) 107 | { 108 | $xfer += $iter33->write($output); 109 | } 110 | } 111 | $output->writeListEnd(); 112 | } 113 | $xfer += $output->writeFieldEnd(); 114 | } 115 | $xfer += $output->writeFieldStop(); 116 | $xfer += $output->writeStructEnd(); 117 | return $xfer; 118 | } 119 | 120 | } 121 | 122 | -------------------------------------------------------------------------------- /src/Client/Forsun_getKeys_args.php: -------------------------------------------------------------------------------- 1 | array( 31 | 'var' => 'prefix', 32 | 'type' => TType::STRING, 33 | ), 34 | ); 35 | } 36 | if (is_array($vals)) { 37 | if (isset($vals['prefix'])) { 38 | $this->prefix = $vals['prefix']; 39 | } 40 | } 41 | } 42 | 43 | public function getName() { 44 | return 'Forsun_getKeys_args'; 45 | } 46 | 47 | public function read($input) 48 | { 49 | $xfer = 0; 50 | $fname = null; 51 | $ftype = 0; 52 | $fid = 0; 53 | $xfer += $input->readStructBegin($fname); 54 | while (true) 55 | { 56 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 57 | if ($ftype == TType::STOP) { 58 | break; 59 | } 60 | switch ($fid) 61 | { 62 | case 1: 63 | if ($ftype == TType::STRING) { 64 | $xfer += $input->readString($this->prefix); 65 | } else { 66 | $xfer += $input->skip($ftype); 67 | } 68 | break; 69 | default: 70 | $xfer += $input->skip($ftype); 71 | break; 72 | } 73 | $xfer += $input->readFieldEnd(); 74 | } 75 | $xfer += $input->readStructEnd(); 76 | return $xfer; 77 | } 78 | 79 | public function write($output) { 80 | $xfer = 0; 81 | $xfer += $output->writeStructBegin('Forsun_getKeys_args'); 82 | if ($this->prefix !== null) { 83 | $xfer += $output->writeFieldBegin('prefix', TType::STRING, 1); 84 | $xfer += $output->writeString($this->prefix); 85 | $xfer += $output->writeFieldEnd(); 86 | } 87 | $xfer += $output->writeFieldStop(); 88 | $xfer += $output->writeStructEnd(); 89 | return $xfer; 90 | } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /src/Client/Forsun_getKeys_result.php: -------------------------------------------------------------------------------- 1 | array( 31 | 'var' => 'success', 32 | 'type' => TType::LST, 33 | 'etype' => TType::STRING, 34 | 'elem' => array( 35 | 'type' => TType::STRING, 36 | ), 37 | ), 38 | ); 39 | } 40 | if (is_array($vals)) { 41 | if (isset($vals['success'])) { 42 | $this->success = $vals['success']; 43 | } 44 | } 45 | } 46 | 47 | public function getName() { 48 | return 'Forsun_getKeys_result'; 49 | } 50 | 51 | public function read($input) 52 | { 53 | $xfer = 0; 54 | $fname = null; 55 | $ftype = 0; 56 | $fid = 0; 57 | $xfer += $input->readStructBegin($fname); 58 | while (true) 59 | { 60 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 61 | if ($ftype == TType::STOP) { 62 | break; 63 | } 64 | switch ($fid) 65 | { 66 | case 0: 67 | if ($ftype == TType::LST) { 68 | $this->success = array(); 69 | $_size41 = 0; 70 | $_etype44 = 0; 71 | $xfer += $input->readListBegin($_etype44, $_size41); 72 | for ($_i45 = 0; $_i45 < $_size41; ++$_i45) 73 | { 74 | $elem46 = null; 75 | $xfer += $input->readString($elem46); 76 | $this->success []= $elem46; 77 | } 78 | $xfer += $input->readListEnd(); 79 | } else { 80 | $xfer += $input->skip($ftype); 81 | } 82 | break; 83 | default: 84 | $xfer += $input->skip($ftype); 85 | break; 86 | } 87 | $xfer += $input->readFieldEnd(); 88 | } 89 | $xfer += $input->readStructEnd(); 90 | return $xfer; 91 | } 92 | 93 | public function write($output) { 94 | $xfer = 0; 95 | $xfer += $output->writeStructBegin('Forsun_getKeys_result'); 96 | if ($this->success !== null) { 97 | if (!is_array($this->success)) { 98 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 99 | } 100 | $xfer += $output->writeFieldBegin('success', TType::LST, 0); 101 | { 102 | $output->writeListBegin(TType::STRING, count($this->success)); 103 | { 104 | foreach ($this->success as $iter47) 105 | { 106 | $xfer += $output->writeString($iter47); 107 | } 108 | } 109 | $output->writeListEnd(); 110 | } 111 | $xfer += $output->writeFieldEnd(); 112 | } 113 | $xfer += $output->writeFieldStop(); 114 | $xfer += $output->writeStructEnd(); 115 | return $xfer; 116 | } 117 | 118 | } 119 | 120 | -------------------------------------------------------------------------------- /src/Client/Forsun_getTime_args.php: -------------------------------------------------------------------------------- 1 | array( 31 | 'var' => 'timestamp', 32 | 'type' => TType::I32, 33 | ), 34 | ); 35 | } 36 | if (is_array($vals)) { 37 | if (isset($vals['timestamp'])) { 38 | $this->timestamp = $vals['timestamp']; 39 | } 40 | } 41 | } 42 | 43 | public function getName() { 44 | return 'Forsun_getTime_args'; 45 | } 46 | 47 | public function read($input) 48 | { 49 | $xfer = 0; 50 | $fname = null; 51 | $ftype = 0; 52 | $fid = 0; 53 | $xfer += $input->readStructBegin($fname); 54 | while (true) 55 | { 56 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 57 | if ($ftype == TType::STOP) { 58 | break; 59 | } 60 | switch ($fid) 61 | { 62 | case 1: 63 | if ($ftype == TType::I32) { 64 | $xfer += $input->readI32($this->timestamp); 65 | } else { 66 | $xfer += $input->skip($ftype); 67 | } 68 | break; 69 | default: 70 | $xfer += $input->skip($ftype); 71 | break; 72 | } 73 | $xfer += $input->readFieldEnd(); 74 | } 75 | $xfer += $input->readStructEnd(); 76 | return $xfer; 77 | } 78 | 79 | public function write($output) { 80 | $xfer = 0; 81 | $xfer += $output->writeStructBegin('Forsun_getTime_args'); 82 | if ($this->timestamp !== null) { 83 | $xfer += $output->writeFieldBegin('timestamp', TType::I32, 1); 84 | $xfer += $output->writeI32($this->timestamp); 85 | $xfer += $output->writeFieldEnd(); 86 | } 87 | $xfer += $output->writeFieldStop(); 88 | $xfer += $output->writeStructEnd(); 89 | return $xfer; 90 | } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /src/Client/Forsun_getTime_result.php: -------------------------------------------------------------------------------- 1 | array( 31 | 'var' => 'success', 32 | 'type' => TType::LST, 33 | 'etype' => TType::STRUCT, 34 | 'elem' => array( 35 | 'type' => TType::STRUCT, 36 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlan', 37 | ), 38 | ), 39 | ); 40 | } 41 | if (is_array($vals)) { 42 | if (isset($vals['success'])) { 43 | $this->success = $vals['success']; 44 | } 45 | } 46 | } 47 | 48 | public function getName() { 49 | return 'Forsun_getTime_result'; 50 | } 51 | 52 | public function read($input) 53 | { 54 | $xfer = 0; 55 | $fname = null; 56 | $ftype = 0; 57 | $fid = 0; 58 | $xfer += $input->readStructBegin($fname); 59 | while (true) 60 | { 61 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 62 | if ($ftype == TType::STOP) { 63 | break; 64 | } 65 | switch ($fid) 66 | { 67 | case 0: 68 | if ($ftype == TType::LST) { 69 | $this->success = array(); 70 | $_size34 = 0; 71 | $_etype37 = 0; 72 | $xfer += $input->readListBegin($_etype37, $_size34); 73 | for ($_i38 = 0; $_i38 < $_size34; ++$_i38) 74 | { 75 | $elem39 = null; 76 | $elem39 = new \Snower\LaravelForsun\Client\ForsunPlan(); 77 | $xfer += $elem39->read($input); 78 | $this->success []= $elem39; 79 | } 80 | $xfer += $input->readListEnd(); 81 | } else { 82 | $xfer += $input->skip($ftype); 83 | } 84 | break; 85 | default: 86 | $xfer += $input->skip($ftype); 87 | break; 88 | } 89 | $xfer += $input->readFieldEnd(); 90 | } 91 | $xfer += $input->readStructEnd(); 92 | return $xfer; 93 | } 94 | 95 | public function write($output) { 96 | $xfer = 0; 97 | $xfer += $output->writeStructBegin('Forsun_getTime_result'); 98 | if ($this->success !== null) { 99 | if (!is_array($this->success)) { 100 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 101 | } 102 | $xfer += $output->writeFieldBegin('success', TType::LST, 0); 103 | { 104 | $output->writeListBegin(TType::STRUCT, count($this->success)); 105 | { 106 | foreach ($this->success as $iter40) 107 | { 108 | $xfer += $iter40->write($output); 109 | } 110 | } 111 | $output->writeListEnd(); 112 | } 113 | $xfer += $output->writeFieldEnd(); 114 | } 115 | $xfer += $output->writeFieldStop(); 116 | $xfer += $output->writeStructEnd(); 117 | return $xfer; 118 | } 119 | 120 | } 121 | 122 | -------------------------------------------------------------------------------- /src/Client/Forsun_get_args.php: -------------------------------------------------------------------------------- 1 | array( 31 | 'var' => 'key', 32 | 'type' => TType::STRING, 33 | ), 34 | ); 35 | } 36 | if (is_array($vals)) { 37 | if (isset($vals['key'])) { 38 | $this->key = $vals['key']; 39 | } 40 | } 41 | } 42 | 43 | public function getName() { 44 | return 'Forsun_get_args'; 45 | } 46 | 47 | public function read($input) 48 | { 49 | $xfer = 0; 50 | $fname = null; 51 | $ftype = 0; 52 | $fid = 0; 53 | $xfer += $input->readStructBegin($fname); 54 | while (true) 55 | { 56 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 57 | if ($ftype == TType::STOP) { 58 | break; 59 | } 60 | switch ($fid) 61 | { 62 | case 1: 63 | if ($ftype == TType::STRING) { 64 | $xfer += $input->readString($this->key); 65 | } else { 66 | $xfer += $input->skip($ftype); 67 | } 68 | break; 69 | default: 70 | $xfer += $input->skip($ftype); 71 | break; 72 | } 73 | $xfer += $input->readFieldEnd(); 74 | } 75 | $xfer += $input->readStructEnd(); 76 | return $xfer; 77 | } 78 | 79 | public function write($output) { 80 | $xfer = 0; 81 | $xfer += $output->writeStructBegin('Forsun_get_args'); 82 | if ($this->key !== null) { 83 | $xfer += $output->writeFieldBegin('key', TType::STRING, 1); 84 | $xfer += $output->writeString($this->key); 85 | $xfer += $output->writeFieldEnd(); 86 | } 87 | $xfer += $output->writeFieldStop(); 88 | $xfer += $output->writeStructEnd(); 89 | return $xfer; 90 | } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /src/Client/Forsun_get_result.php: -------------------------------------------------------------------------------- 1 | array( 35 | 'var' => 'success', 36 | 'type' => TType::STRUCT, 37 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlan', 38 | ), 39 | 1 => array( 40 | 'var' => 'err', 41 | 'type' => TType::STRUCT, 42 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlanError', 43 | ), 44 | ); 45 | } 46 | if (is_array($vals)) { 47 | if (isset($vals['success'])) { 48 | $this->success = $vals['success']; 49 | } 50 | if (isset($vals['err'])) { 51 | $this->err = $vals['err']; 52 | } 53 | } 54 | } 55 | 56 | public function getName() { 57 | return 'Forsun_get_result'; 58 | } 59 | 60 | public function read($input) 61 | { 62 | $xfer = 0; 63 | $fname = null; 64 | $ftype = 0; 65 | $fid = 0; 66 | $xfer += $input->readStructBegin($fname); 67 | while (true) 68 | { 69 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 70 | if ($ftype == TType::STOP) { 71 | break; 72 | } 73 | switch ($fid) 74 | { 75 | case 0: 76 | if ($ftype == TType::STRUCT) { 77 | $this->success = new \Snower\LaravelForsun\Client\ForsunPlan(); 78 | $xfer += $this->success->read($input); 79 | } else { 80 | $xfer += $input->skip($ftype); 81 | } 82 | break; 83 | case 1: 84 | if ($ftype == TType::STRUCT) { 85 | $this->err = new \Snower\LaravelForsun\Client\ForsunPlanError(); 86 | $xfer += $this->err->read($input); 87 | } else { 88 | $xfer += $input->skip($ftype); 89 | } 90 | break; 91 | default: 92 | $xfer += $input->skip($ftype); 93 | break; 94 | } 95 | $xfer += $input->readFieldEnd(); 96 | } 97 | $xfer += $input->readStructEnd(); 98 | return $xfer; 99 | } 100 | 101 | public function write($output) { 102 | $xfer = 0; 103 | $xfer += $output->writeStructBegin('Forsun_get_result'); 104 | if ($this->success !== null) { 105 | if (!is_object($this->success)) { 106 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 107 | } 108 | $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0); 109 | $xfer += $this->success->write($output); 110 | $xfer += $output->writeFieldEnd(); 111 | } 112 | if ($this->err !== null) { 113 | $xfer += $output->writeFieldBegin('err', TType::STRUCT, 1); 114 | $xfer += $this->err->write($output); 115 | $xfer += $output->writeFieldEnd(); 116 | } 117 | $xfer += $output->writeFieldStop(); 118 | $xfer += $output->writeStructEnd(); 119 | return $xfer; 120 | } 121 | 122 | } 123 | 124 | -------------------------------------------------------------------------------- /src/Client/Forsun_ping_args.php: -------------------------------------------------------------------------------- 1 | readStructBegin($fname); 41 | while (true) 42 | { 43 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 44 | if ($ftype == TType::STOP) { 45 | break; 46 | } 47 | switch ($fid) 48 | { 49 | default: 50 | $xfer += $input->skip($ftype); 51 | break; 52 | } 53 | $xfer += $input->readFieldEnd(); 54 | } 55 | $xfer += $input->readStructEnd(); 56 | return $xfer; 57 | } 58 | 59 | public function write($output) { 60 | $xfer = 0; 61 | $xfer += $output->writeStructBegin('Forsun_ping_args'); 62 | $xfer += $output->writeFieldStop(); 63 | $xfer += $output->writeStructEnd(); 64 | return $xfer; 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/Client/Forsun_ping_result.php: -------------------------------------------------------------------------------- 1 | array( 31 | 'var' => 'success', 32 | 'type' => TType::I16, 33 | ), 34 | ); 35 | } 36 | if (is_array($vals)) { 37 | if (isset($vals['success'])) { 38 | $this->success = $vals['success']; 39 | } 40 | } 41 | } 42 | 43 | public function getName() { 44 | return 'Forsun_ping_result'; 45 | } 46 | 47 | public function read($input) 48 | { 49 | $xfer = 0; 50 | $fname = null; 51 | $ftype = 0; 52 | $fid = 0; 53 | $xfer += $input->readStructBegin($fname); 54 | while (true) 55 | { 56 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 57 | if ($ftype == TType::STOP) { 58 | break; 59 | } 60 | switch ($fid) 61 | { 62 | case 0: 63 | if ($ftype == TType::I16) { 64 | $xfer += $input->readI16($this->success); 65 | } else { 66 | $xfer += $input->skip($ftype); 67 | } 68 | break; 69 | default: 70 | $xfer += $input->skip($ftype); 71 | break; 72 | } 73 | $xfer += $input->readFieldEnd(); 74 | } 75 | $xfer += $input->readStructEnd(); 76 | return $xfer; 77 | } 78 | 79 | public function write($output) { 80 | $xfer = 0; 81 | $xfer += $output->writeStructBegin('Forsun_ping_result'); 82 | if ($this->success !== null) { 83 | $xfer += $output->writeFieldBegin('success', TType::I16, 0); 84 | $xfer += $output->writeI16($this->success); 85 | $xfer += $output->writeFieldEnd(); 86 | } 87 | $xfer += $output->writeFieldStop(); 88 | $xfer += $output->writeStructEnd(); 89 | return $xfer; 90 | } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /src/Client/Forsun_remove_args.php: -------------------------------------------------------------------------------- 1 | array( 31 | 'var' => 'key', 32 | 'type' => TType::STRING, 33 | ), 34 | ); 35 | } 36 | if (is_array($vals)) { 37 | if (isset($vals['key'])) { 38 | $this->key = $vals['key']; 39 | } 40 | } 41 | } 42 | 43 | public function getName() { 44 | return 'Forsun_remove_args'; 45 | } 46 | 47 | public function read($input) 48 | { 49 | $xfer = 0; 50 | $fname = null; 51 | $ftype = 0; 52 | $fid = 0; 53 | $xfer += $input->readStructBegin($fname); 54 | while (true) 55 | { 56 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 57 | if ($ftype == TType::STOP) { 58 | break; 59 | } 60 | switch ($fid) 61 | { 62 | case 1: 63 | if ($ftype == TType::STRING) { 64 | $xfer += $input->readString($this->key); 65 | } else { 66 | $xfer += $input->skip($ftype); 67 | } 68 | break; 69 | default: 70 | $xfer += $input->skip($ftype); 71 | break; 72 | } 73 | $xfer += $input->readFieldEnd(); 74 | } 75 | $xfer += $input->readStructEnd(); 76 | return $xfer; 77 | } 78 | 79 | public function write($output) { 80 | $xfer = 0; 81 | $xfer += $output->writeStructBegin('Forsun_remove_args'); 82 | if ($this->key !== null) { 83 | $xfer += $output->writeFieldBegin('key', TType::STRING, 1); 84 | $xfer += $output->writeString($this->key); 85 | $xfer += $output->writeFieldEnd(); 86 | } 87 | $xfer += $output->writeFieldStop(); 88 | $xfer += $output->writeStructEnd(); 89 | return $xfer; 90 | } 91 | 92 | } 93 | 94 | -------------------------------------------------------------------------------- /src/Client/Forsun_remove_result.php: -------------------------------------------------------------------------------- 1 | array( 35 | 'var' => 'success', 36 | 'type' => TType::STRUCT, 37 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlan', 38 | ), 39 | 1 => array( 40 | 'var' => 'err', 41 | 'type' => TType::STRUCT, 42 | 'class' => '\Snower\LaravelForsun\Client\ForsunPlanError', 43 | ), 44 | ); 45 | } 46 | if (is_array($vals)) { 47 | if (isset($vals['success'])) { 48 | $this->success = $vals['success']; 49 | } 50 | if (isset($vals['err'])) { 51 | $this->err = $vals['err']; 52 | } 53 | } 54 | } 55 | 56 | public function getName() { 57 | return 'Forsun_remove_result'; 58 | } 59 | 60 | public function read($input) 61 | { 62 | $xfer = 0; 63 | $fname = null; 64 | $ftype = 0; 65 | $fid = 0; 66 | $xfer += $input->readStructBegin($fname); 67 | while (true) 68 | { 69 | $xfer += $input->readFieldBegin($fname, $ftype, $fid); 70 | if ($ftype == TType::STOP) { 71 | break; 72 | } 73 | switch ($fid) 74 | { 75 | case 0: 76 | if ($ftype == TType::STRUCT) { 77 | $this->success = new \Snower\LaravelForsun\Client\ForsunPlan(); 78 | $xfer += $this->success->read($input); 79 | } else { 80 | $xfer += $input->skip($ftype); 81 | } 82 | break; 83 | case 1: 84 | if ($ftype == TType::STRUCT) { 85 | $this->err = new \Snower\LaravelForsun\Client\ForsunPlanError(); 86 | $xfer += $this->err->read($input); 87 | } else { 88 | $xfer += $input->skip($ftype); 89 | } 90 | break; 91 | default: 92 | $xfer += $input->skip($ftype); 93 | break; 94 | } 95 | $xfer += $input->readFieldEnd(); 96 | } 97 | $xfer += $input->readStructEnd(); 98 | return $xfer; 99 | } 100 | 101 | public function write($output) { 102 | $xfer = 0; 103 | $xfer += $output->writeStructBegin('Forsun_remove_result'); 104 | if ($this->success !== null) { 105 | if (!is_object($this->success)) { 106 | throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); 107 | } 108 | $xfer += $output->writeFieldBegin('success', TType::STRUCT, 0); 109 | $xfer += $this->success->write($output); 110 | $xfer += $output->writeFieldEnd(); 111 | } 112 | if ($this->err !== null) { 113 | $xfer += $output->writeFieldBegin('err', TType::STRUCT, 1); 114 | $xfer += $this->err->write($output); 115 | $xfer += $output->writeFieldEnd(); 116 | } 117 | $xfer += $output->writeFieldStop(); 118 | $xfer += $output->writeStructEnd(); 119 | return $xfer; 120 | } 121 | 122 | } 123 | 124 | -------------------------------------------------------------------------------- /src/Commands/ScheduleRegisterCommand.php: -------------------------------------------------------------------------------- 1 | make('forsun'); 22 | $name = ':schedule:run'; 23 | $forsun->plan($name)->everyMinute()->job(new ScheduleRunHandler()); 24 | $this->info("success"); 25 | } 26 | } -------------------------------------------------------------------------------- /src/Commands/ScheduleUnregisterCommand.php: -------------------------------------------------------------------------------- 1 | make('forsun'); 21 | $name = config('forsun.prefix') . ':schedule:run'; 22 | $forsun->remove($name); 23 | $this->info("success"); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Facade.php: -------------------------------------------------------------------------------- 1 | config = new Collection($config); 30 | $this->socket = null; 31 | $this->transport = null; 32 | $this->protocol = null; 33 | $this->client = null; 34 | } 35 | 36 | protected function getClient(){ 37 | if($this->client == null){ 38 | $this->makeClient(); 39 | } 40 | 41 | if($this->socket == null || !$this->socket->isOpen()){ 42 | $this->makeClient(); 43 | } 44 | 45 | if(empty($this->client)){ 46 | throw new ForsunPlanError([ 47 | 'code' => -1, 48 | 'message' => 'network error' 49 | ]); 50 | } 51 | 52 | return $this->client; 53 | } 54 | 55 | protected function makeClient() 56 | { 57 | $this->socket = new TSocket($this->config->get('host', '127.0.0.1'), $this->config->get("port", 6458)); 58 | $this->transport = new TBufferedTransport($this->socket, 1024, 1024); 59 | $this->protocol= new TBinaryProtocol($this->transport); 60 | 61 | $this->socket->setSendTimeout(5000); 62 | $this->socket->setRecvTimeout(120000); 63 | $this->transport->open(); 64 | 65 | $this->client = new ForsunClient($this->protocol); 66 | } 67 | 68 | public function ping(){ 69 | return $this->getClient()->ping(); 70 | } 71 | 72 | public function create($key, $second, $minute, $hour, $day, $month, $week, $action, array $params){ 73 | $forsun_pan = $this->getClient()->create($key, $second, $minute, $hour, $day, $month, $week, $action, $params); 74 | return new Plan($this, $forsun_pan); 75 | } 76 | 77 | public function createTimeout($key, $second, $minute, $hour, $day, $month, $week, $count, $action, array $params){ 78 | $forsun_pan = $this->getClient()->createTimeout($key, $second, $minute, $hour, $day, $month, $week, $count, $action, $params); 79 | return new Plan($this, $forsun_pan); 80 | } 81 | 82 | public function remove($key){ 83 | $forsun_pan = $this->getClient()->remove($key); 84 | return new Plan($this, $forsun_pan, true); 85 | } 86 | 87 | public function get($key){ 88 | $forsun_pan = $this->getClient()->get($key); 89 | return new Plan($this, $forsun_pan); 90 | } 91 | 92 | public function getCurrent(){ 93 | $forsun_pans = $this->getClient()->getCurrent(); 94 | $plans = []; 95 | foreach ($forsun_pans as $forsun_pan){ 96 | $plans[] = new Plan($this, $forsun_pan); 97 | } 98 | return $plans; 99 | } 100 | 101 | public function getTime($timestamp){ 102 | $forsun_pans = $this->getClient()->getTime($timestamp); 103 | $plans = []; 104 | foreach ($forsun_pans as $forsun_pan){ 105 | $plans[] = new Plan($this, $forsun_pan); 106 | } 107 | return $plans; 108 | } 109 | 110 | public function getKeys($prefix){ 111 | return $this->getClient()->getKeys($prefix); 112 | } 113 | 114 | public function plan($name = null){ 115 | return new Builder($this, $name); 116 | } 117 | } -------------------------------------------------------------------------------- /src/Jobs/CommandRunHandler.php: -------------------------------------------------------------------------------- 1 | command = $command; 23 | } 24 | 25 | public function handle(){ 26 | $laravel = Container::getInstance(); 27 | 28 | if(class_exists('Illuminate\Console\Scheduling\CacheMutex')){ 29 | $cachemutex_class = 'Illuminate\Console\Scheduling\CacheMutex'; 30 | } else { 31 | $cachemutex_class = 'Illuminate\Console\Scheduling\CacheEventMutex'; 32 | } 33 | 34 | $mutex = $laravel->bound(Mutex::class) 35 | ? $laravel->make(Mutex::class) 36 | : $laravel->make($cachemutex_class); 37 | 38 | $event = new Event($mutex, $this->command); 39 | $event->run($laravel); 40 | } 41 | } -------------------------------------------------------------------------------- /src/Jobs/EventFireHandler.php: -------------------------------------------------------------------------------- 1 | event = $event; 23 | $this->payload = $payload; 24 | $this->halt = $halt; 25 | } 26 | 27 | public function handle(){ 28 | Container::getInstance()->make('events')->dispatch($this->event, $this->payload, $this->halt); 29 | } 30 | } -------------------------------------------------------------------------------- /src/Jobs/JobDispatchHandler.php: -------------------------------------------------------------------------------- 1 | job = $job; 20 | } 21 | 22 | public function handle(){ 23 | dispatch(is_string($this->job) ? resolve($this->job) : $this->job); 24 | } 25 | } -------------------------------------------------------------------------------- /src/Jobs/ScheduleRunHandler.php: -------------------------------------------------------------------------------- 1 | make(Schedule::class); 20 | 21 | foreach ($schedule->dueEvents($laravel) as $event) { 22 | if (! $event->filtersPass($laravel)) { 23 | continue; 24 | } 25 | 26 | $event->run($laravel); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/ManagesFrequencies.php: -------------------------------------------------------------------------------- 1 | second = $second; 11 | $this->minute = $minute; 12 | $this->hour = $hour; 13 | $this->day = $day; 14 | $this->month = $month; 15 | $this->week = $week; 16 | $this->is_timeout = false; 17 | $this->timeout_count = 0; 18 | 19 | $this->timed = true; 20 | return $this->schedule(); 21 | } 22 | 23 | protected function createTimeoutPlan($count = 1, $second = 1, $minute = 0, $hour = 0, $day = 0, $month = 0, $week = 0){ 24 | $this->second = $second; 25 | $this->minute = $minute; 26 | $this->hour = $hour; 27 | $this->day = $day; 28 | $this->month = $month; 29 | $this->week = $week; 30 | $this->is_timeout = true; 31 | $this->timeout_count = $count; 32 | 33 | $this->timed = true; 34 | return $this->schedule(); 35 | } 36 | 37 | /** 38 | * Schedule the event to run hourly. 39 | * 40 | * @return $this 41 | */ 42 | public function hourly() 43 | { 44 | return $this->createPlan(0, 0); 45 | } 46 | 47 | /** 48 | * Schedule the event to run hourly at a given offset in the hour. 49 | * 50 | * @param int|string|array $offset 51 | * @return $this 52 | */ 53 | public function hourlyAt($offset) 54 | { 55 | if(is_string($offset)){ 56 | $segments = explode(':', $offset); 57 | }else if(is_numeric($offset)){ 58 | $segments = [intval($offset)]; 59 | }else{ 60 | $segments = array($offset); 61 | } 62 | return $this->createPlan(count($segments) >= 2 ? intval($segments[1]) : 0, intval($segments[0])); 63 | } 64 | 65 | /** 66 | * Schedule the event to run daily. 67 | * 68 | * @return $this 69 | */ 70 | public function daily() 71 | { 72 | return $this->createPlan(0, 0, 0); 73 | } 74 | 75 | /** 76 | * Schedule the command at a given time. 77 | * 78 | * @param string|int|Carbon $time 79 | * @return $this 80 | */ 81 | public function at($time) 82 | { 83 | if(is_string($time)){ 84 | $time = strtotime($time); 85 | } 86 | 87 | if(is_numeric($time)){ 88 | $time = Carbon::createFromTimestamp($time); 89 | } 90 | 91 | $time->setTimezone("UTC"); 92 | 93 | return $this->createPlan($time->second, $time->minute, $time->hour, $time->day, $time->month); 94 | } 95 | 96 | /** 97 | * Schedule the event to run daily at a given time (10:00, 19:30, etc). 98 | * 99 | * @param string $time 100 | * @return $this 101 | */ 102 | public function dailyAt($time) 103 | { 104 | if(is_string($time)){ 105 | $segments = explode(':', $time); 106 | }else if(is_numeric($time)){ 107 | $segments = [intval($time)]; 108 | }else{ 109 | $segments = array($time); 110 | } 111 | return $this->createPlan(count($segments) >= 3 ? intval($segments[2]) : 0, count($segments) >= 2 ? intval($segments[1]) : 0, intval($segments[0])); 112 | } 113 | 114 | /** 115 | * Schedule the event to run monthly. 116 | * 117 | * @return $this 118 | */ 119 | public function monthly() 120 | { 121 | return $this->createPlan(0, 0, 0, 1); 122 | } 123 | 124 | /** 125 | * Schedule the event to run monthly on a given day and time. 126 | * 127 | * @param int $day 128 | * @param string $time 129 | * @return $this 130 | */ 131 | public function monthlyOn($day = 1, $time = '0:0:0') 132 | { 133 | if(is_string($time)){ 134 | $segments = explode(':', $time); 135 | }else if(is_numeric($time)){ 136 | $segments = [intval($time)]; 137 | }else{ 138 | $segments = array($time); 139 | } 140 | return $this->createPlan(count($segments) >= 3 ? intval($segments[2]) : 0, count($segments) >= 2 ? intval($segments[1]) : 0, intval($segments[0]), $day); 141 | } 142 | 143 | /** 144 | * Schedule the event to run every minute. 145 | * 146 | * @return $this 147 | */ 148 | public function everyMinute($count = 0) 149 | { 150 | return $this->createTimeoutPlan($count, 0, 1); 151 | } 152 | 153 | /** 154 | * Schedule the event to run every five minutes. 155 | * 156 | * @return $this 157 | */ 158 | public function everyFiveMinutes($count = 0) 159 | { 160 | return $this->createTimeoutPlan($count, 0, 5); 161 | } 162 | 163 | /** 164 | * Schedule the event to run every ten minutes. 165 | * 166 | * @return $this 167 | */ 168 | public function everyTenMinutes($count = 0) 169 | { 170 | return $this->createTimeoutPlan($count, 0, 10); 171 | } 172 | 173 | /** 174 | * Schedule the event to run every thirty minutes. 175 | * 176 | * @return $this 177 | */ 178 | public function everyThirtyMinutes($count = 0) 179 | { 180 | return $this->createTimeoutPlan($count, 0, 30); 181 | } 182 | 183 | public function interval($seconds, $count = 0){ 184 | $minute = 0; 185 | $hour = 0; 186 | $day = 0; 187 | if($seconds > 60){ 188 | $minute = intval($seconds / 60); 189 | $seconds = $seconds % 60; 190 | } 191 | 192 | if($minute > 60){ 193 | $hour = intval($minute / 60); 194 | $minute = $minute % 60; 195 | } 196 | 197 | if($hour > 24){ 198 | $day = intval($hour / 24); 199 | $hour = $hour % 24; 200 | } 201 | 202 | return $this->createTimeoutPlan($count, $seconds, $minute, $hour, $day); 203 | } 204 | 205 | public function later($seconds){ 206 | return $this->interval($seconds, 1); 207 | } 208 | 209 | public function delay($seconds){ 210 | return $this->later($seconds); 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /src/Plan.php: -------------------------------------------------------------------------------- 1 | forsun = $forsun; 22 | $this->forsun_pan = $forsun_pan; 23 | $this->removed = $removed; 24 | } 25 | 26 | public function getName(){ 27 | return $this->forsun_pan->key; 28 | } 29 | 30 | public function getNextRunTime(){ 31 | return Carbon::createFromTimestamp($this->forsun_pan->next_time); 32 | } 33 | 34 | public function remove(){ 35 | $this->forsun->remove($this->forsun_pan->key); 36 | $this->removed = true; 37 | return true; 38 | } 39 | 40 | public function isRemoved(){ 41 | return $this->removed; 42 | } 43 | } -------------------------------------------------------------------------------- /src/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | setupConfig(); 27 | } 28 | 29 | /** 30 | * Setup the config. 31 | * 32 | * @return void 33 | */ 34 | protected function setupConfig() 35 | { 36 | $source = realpath(__DIR__.'/config.php'); 37 | 38 | if ($this->app instanceof LaravelApplication) { 39 | if ($this->app->runningInConsole()) { 40 | $this->publishes([ 41 | $source => config_path('forsun.php'), 42 | ]); 43 | } 44 | } elseif ($this->app instanceof LumenApplication) { 45 | $this->app->configure('forsun'); 46 | } 47 | 48 | $this->mergeConfigFrom($source, 'forsun'); 49 | } 50 | 51 | /** 52 | * Register the provider. 53 | * 54 | * @return void 55 | */ 56 | public function register() 57 | { 58 | $this->app->singleton(Forsun::class, function ($app) { 59 | $forsun = new Forsun(config('forsun')); 60 | return $forsun; 61 | }); 62 | 63 | $this->app->alias(Forsun::class, 'forsun'); 64 | 65 | $this->commands([ 66 | ScheduleRegisterCommand::class, 67 | ScheduleUnregisterCommand::class, 68 | ]); 69 | } 70 | 71 | /** 72 | * Get config value by key. 73 | * 74 | * @param string $key 75 | * @param mixed|null $default 76 | * 77 | * @return mixed 78 | */ 79 | private function config($key, $default = null) 80 | { 81 | return $this->app->make('config')->get("forsun.{$key}", $default); 82 | } 83 | } -------------------------------------------------------------------------------- /src/UnsupportedQueueException.php: -------------------------------------------------------------------------------- 1 | false, 11 | 12 | 'host' => '127.0.0.1', 13 | 'port' => 6458, 14 | 15 | 'prefix' => 'laravel:' 16 | ]; --------------------------------------------------------------------------------