| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?php
- namespace app\api\command;
- use think\console\Command;
- use think\console\Input;
- use think\console\Output;
- use app\common\logic\TeamRewards;
- use app\common\model\TimedTaskLogModel;
- use think\Model;
- class SendTeamRewards extends Command
- {
- protected function configure()
- {
- $this->setName('SendTeamRewards')->setDescription('Here is the remark ');
- }
- protected function execute(Input $input, Output $output)
- {
- /* 永不超时 */
- // ini_set('max_execution_time', 0);
- // 记录开始运行的时间
- $GLOBALS['_beginTime'] = microtime(TRUE);
- $output->writeln('定时任务开始执行:' . date('Y-m-d H:i:s', time()));
- /*** 发放团队算力奖励 ***/
- $output->writeln("开始发放团队算力奖励:");
- $log_id = (new TeamRewards())->powerRewards();
- $time_total = round(microtime(true) - $GLOBALS['_beginTime'], 4);//计算耗时
- $output->writeln('团队算力奖励发放结束:' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
- //更新发放日志
- if($log_id > 0){
- (new TimedTaskLogModel())->update([
- 'id' => $log_id,
- 'status' => 1,
- 'end_time' => date('Y-m-d H:i:s'),
- 'elapsed_time' => $time_total
- ]);
- }
- /*** 发放分红收益 ***/
- $begin_usdt = microtime(TRUE);
- $output->writeln("开始发放加权分红:");
- $log_id_1 = (new TeamRewards())->usdtRewards();
- $time_total = round(microtime(true) - $begin_usdt, 4);//计算耗时
- $output->writeln('加权分红发放结束:' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
- //更新发放日志
- if($log_id_1 > 0){
- (new TimedTaskLogModel())
- ->where('id', $log_id_1)
- ->update([
- 'id' => $log_id_1,
- 'status' => 1,
- 'end_time' => date('Y-m-d H:i:s'),
- 'elapsed_time' => $time_total
- ]);
- }
- /*** 发放社区长、系统领导人加权分红 ***/
- $begin_usdt = microtime(TRUE);
- $output->writeln("开始发放社区长、系统领导人加权分红:");
- $log_id_1 = (new TeamRewards())->marketRewards();
- $time_total = round(microtime(true) - $begin_usdt, 4);//计算耗时
- $output->writeln('社区长、系统领导人加权分红发放结束:' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
- //更新发放日志
- if($log_id_1 > 0){
- (new TimedTaskLogModel())
- ->where('id', $log_id_1)
- ->update([
- 'id' => $log_id_1,
- 'status' => 1,
- 'end_time' => date('Y-m-d H:i:s'),
- 'elapsed_time' => $time_total
- ]);
- }
- /*** 团队业绩分红 ***/
- $begin_usdt = microtime(TRUE);
- $output->writeln("团队业绩分红:");
- $log_id_1 = (new TeamRewards())->teamRewards();
- $time_total = round(microtime(true) - $begin_usdt, 4);//计算耗时
- $output->writeln('团队业绩分红发放结束:' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
- //更新发放日志
- if($log_id_1 > 0){
- (new TimedTaskLogModel())
- ->where('id', $log_id_1)
- ->update([
- 'id' => $log_id_1,
- 'status' => 1,
- 'end_time' => date('Y-m-d H:i:s'),
- 'elapsed_time' => $time_total
- ]);
- }
- /*** 今日产出 ***/
- // $begin_usdt = microtime(TRUE);
- // $output->writeln("今日产出:");
- //
- // $log_id_1 = (new TeamRewards())->AllocateEtc();
- //
- // $time_total = round(microtime(true) - $begin_usdt, 4);//计算耗时
- // $output->writeln('今日产出放结束:' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
- // //更新发放日志
- // if($log_id_1 > 0){
- // (new TimedTaskLogModel())
- // ->where('id', $log_id_1)
- // ->update([
- // 'id' => $log_id_1,
- // 'status' => 1,
- // 'end_time' => date('Y-m-d H:i:s'),
- // 'elapsed_time' => $time_total
- // ]);
- // }
- $time_total = round(microtime(true) - $GLOBALS['_beginTime'], 4);//计算耗时
- $output->writeln('定时任务执行结束,总耗时' . date('Y-m-d H:i:s', time()) . '; 耗时:' . $time_total . '秒');
- }
- }
|