XcxStastical.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Modules\User\Models\Xcxuser;
  5. use App\Modules\User\Models\XcxUserStat;
  6. use App\Modules\Subscribe\Models\Order;
  7. use DB;
  8. class XcxStastical extends Command
  9. {
  10. /**
  11. * The name and signature of the console command.
  12. *
  13. * @var string
  14. */
  15. protected $signature = 'xcx:stats';
  16. /**
  17. * The console command description.
  18. *
  19. * @var string
  20. */
  21. protected $description = 'Command description';
  22. /**
  23. * Create a new command instance.
  24. *
  25. * @return void
  26. */
  27. public function __construct()
  28. {
  29. parent::__construct();
  30. }
  31. /**
  32. * Execute the console command.
  33. *
  34. * @return mixed
  35. */
  36. public function handle()
  37. {
  38. }
  39. private function start(){
  40. $channel = DB::select('select distinct distribution_channel_id from xcx_users');
  41. foreach ($channel as $v){
  42. /*$channel_id = $v->distribution_channel_id;
  43. $recharge = Order::where('status','PAID')
  44. ->where('pay_merchant_source','XIAOCHENGXU')
  45. ->where('created_at','>=',date('Y-m-d',time()-86400))
  46. ->where('created_at','<=',date('Y-m-d',time()))
  47. ->where('distribution_channel_id',$channel_id)
  48. ->sum('price');
  49. $total_recharge = Order::where('status','PAID')
  50. ->where('pay_merchant_source','XIAOCHENGXU')
  51. ->where('created_at','<',date('Y-m-d'))
  52. ->where('distribution_channel_id',$channel_id)
  53. ->sum('price');
  54. $new_user_num = Xcxuser::where('created_at','>=',date('Y-m-d',time()-86400))
  55. ->where('created_at','<=',date('Y-m-d'))
  56. ->where('distribution_channel_id',$channel_id)
  57. ->count();
  58. $total_user_num = Xcxuser::where('created_at','<',date('Y-m-d'))
  59. ->where('distribution_channel_id',$channel_id)
  60. ->count();*/
  61. }
  62. }
  63. }