PaymentStatisticTask.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: tandunzhao
  5. * Date: 2017/12/5
  6. * Time: 下午4:24
  7. */
  8. namespace App\Console\Commands;
  9. use App\Modules\Channel\Services\ChannelService;
  10. use App\Modules\Finance\Services\FinanceService;
  11. use Log;
  12. use Illuminate\Console\Command;
  13. class PaymentStatisticTask extends Command
  14. {
  15. /**
  16. * 执行命令 php artisan payment_statistic_task
  17. *
  18. * The name and signature of the console command.
  19. *
  20. * @var string
  21. */
  22. protected $signature = 'payment_statistic_task';
  23. /**
  24. * The console command description.
  25. *
  26. * @var string
  27. */
  28. protected $description = '每日打款报表生成';
  29. /**
  30. * Execute the console command.
  31. *
  32. * @return mixed
  33. */
  34. public function handle()
  35. {
  36. print_r("======每日打款报表生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
  37. Log::info("======每日打款报表生成 【任务执行开始】=====".date("y-m-d H:i:s"."\n"));
  38. $channels = $this->getAllChannel();
  39. foreach ($channels as $channel) {
  40. //print_r($channel->id."=".$channel->name."\n");
  41. $channelId = $channel->id;
  42. FinanceService::makeYesterdayWithdrawCashStatistics($channelId);
  43. // print_r($channelId."=".$channelName."=".$rechargeAmount."\n");
  44. }
  45. Log::info("======每日打款报表生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
  46. print_r("======每日打款报表生成 【任务执行结束】=====".date("y-m-d H:i:s"."\n"));
  47. }
  48. /**
  49. * 获取所有渠道
  50. * @return mixed
  51. */
  52. public function getAllChannel() {
  53. $channels = ChannelService::getAllChannels();
  54. return $channels;
  55. }
  56. }