12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace App\Console\Commands\Partner;
- use Illuminate\Console\Command;
- /**
- * Class PairCommand
- * @package App\Console\Commands\Partner
- */
- class PairCommand extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'partner:pair';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '分配对象操作';
- /**
- * Create a new command instance.
- *
- * @return void
- */
- public function __construct()
- {
- parent::__construct();
- }
- /**
- * Execute the console command.
- *
- * @return mixed
- * @throws \Exception
- */
- public function handle()
- {
- $pairObj = new \App\Http\Controllers\Crontab\Pair();
- $name = $this->choice('【分配对象】 请选择执行操作', [
- 'pair' => '对象预匹配',
- 'account' => '分销',
- 'sync' => '同步历史匹配',
- ]);
- if ($this->confirm('每次活动只能执行一次,是否确定 ?')) {
- switch ($name) {
- case 'pair':
- $stage_id = $this->ask('请选择期数:');
- $begin = time();
- $this->line('对象匹配,正在执行...');
- $pairObj->prePipei($stage_id);
- $i = (time() - $begin) / 60;
- $this->line("对象匹配,执行成功,耗时{$i}分钟");
- break;
- case 'account':
- $stage_id = $this->ask('请输入期数:(0表示上一期)');
- $mediaObj = new \App\Http\Controllers\Fpdx\Media();
- $mediaObj->autoCpAccount($stage_id);
- $this->line('执行成功!');
- break;
- default:
- $this->error('参数错误!');
- }
- }
- }
- }
|