CompanyChargeDayJiesuanTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Tests\Console\Commands\Jiesuan;
  3. use App\Console\Commands\Jiesuan\CompanyChargeDayJiesuan;
  4. use Illuminate\Support\Facades\DB;
  5. use PHPUnit\Framework\TestCase;
  6. class CompanyChargeDayJiesuanTest extends \Tests\TestCase
  7. {
  8. public function testHandle()
  9. {
  10. $this->prepareData();
  11. }
  12. private function prepareData() {
  13. $startTimestamp = strtotime('yesterday') - 24 * 3600;
  14. foreach (range(1, 100) as $i) {
  15. $orders[] = [
  16. 'uid' => 100000+$i,
  17. 'promotion_id' => 1000,
  18. 'user_id' => 50 + $i,
  19. 'puser_id' => [2, 15][rand(0,1)],
  20. 'price' => rand(20, 100),
  21. 'miniprogram_id' => 1,
  22. 'pay_product_id' => 1,
  23. 'create_ip' => '192.168.0.1',
  24. 'status' => ['PAID', 'UNPAID'][rand(0,1)],
  25. 'trade_no' => uniqid('fake-1-'),
  26. 'transaction_id' => uniqid('fake-2-'),
  27. 'third_orderid' => uniqid('fake-3-'),
  28. 'order_type' => 'COIN',
  29. 'pay_merchant_source' => 'PALMPAY',
  30. 'video_id' => 0,
  31. 'video_series_sequence' => 0,
  32. 'created_at' => date('Y-m-d H:i:s', $startTimestamp + $i * 800),
  33. 'updated_at' => date('Y-m-d H:i:s', $startTimestamp + $i * 800),
  34. ];
  35. }
  36. DB::table('orders')->insert($orders);
  37. }
  38. }