OrderTest.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Bear
  5. * Date: 2018/11/22
  6. * Time: 下午5:08
  7. */
  8. use app\common\service\OrderService;
  9. use app\admin\model\PalmpaySplitAccountLog;
  10. use app\main\service\AdminService;
  11. class OrderTest extends TestInit
  12. {
  13. public function testMonthService()
  14. {
  15. $start_time = strtotime('2020-02-15');
  16. $end_time = time();
  17. $data = \app\main\service\OrderService::instance()->getOrderKlData($start_time, $end_time)->data;
  18. \app\main\service\OrderService::instance()->updateKlTable($data);
  19. }
  20. public function testDayService()
  21. {
  22. $admin_id = 9;
  23. $date_range = '20181022,20181121';
  24. $result = OrderService::instance()->getDayServiceReport($admin_id, $date_range, 0, 10);
  25. var_dump($result);
  26. }
  27. public function testDay()
  28. {
  29. $admin_id = 9;
  30. $date_range = '20181022,20181121';
  31. $result = OrderService::instance()->getDayReport($admin_id, $date_range, 0, 10);
  32. var_dump($result);
  33. }
  34. public function testMonth()
  35. {
  36. $admin_id = 9;
  37. $date_range = '201810,201811';
  38. $result = OrderService::instance()->getMonthReport($admin_id, $date_range, 0, 10);
  39. var_dump($result);
  40. }
  41. public function testDayFormat()
  42. {
  43. $time = '201812';
  44. $time = $time . str_pad(date('d') - 1, 2, '0', STR_PAD_LEFT);
  45. $this->assertTrue($time == '20181203');
  46. }
  47. public function testGetSql()
  48. {
  49. $sql = "ALTER TABLE `cps_user_{db_index}`.`user` ADD COLUMN `is_first_unfollow` enum('0','1','2') NOT NULL DEFAULT '2' COMMENT '是否首次取消关注:0=否,1=是,2=未取关' AFTER `updatetime`;";
  50. for ($i = 0; $i < 512; $i++) {
  51. echo str_replace('{db_index}', $i, $sql)."\n";
  52. }
  53. }
  54. public function testDzAccount()
  55. {
  56. $data = OrderService::instance()->getDzAccount('zsjwsfz.wnread.cn');
  57. var_dump($data);
  58. }
  59. public function testChannelAccount()
  60. {
  61. $data = OrderService::instance()->getChannelAccount(1, 3);
  62. var_dump($data);
  63. }
  64. public function testOrderId()
  65. {
  66. var_dump(OrderService::instance()->getUniqueOrder());
  67. }
  68. public function testOrderCmd()
  69. {
  70. $_SERVER['HTTP_X_REAL_HOST'] = 'zsjwsfz.wnread.cn';
  71. $data = OrderService::instance()->getPalmPayCmd(0.03, 3);
  72. var_dump($data);
  73. }
  74. public function testCreate(){
  75. PalmpaySplitAccountLog::create(['order_id'=>1,'dz_palmpay_sub_account_id'=>1,'dz_amount'=>1,'channel_palmpay_sub_account_id'=>1,'channel_amount'=>1])->insert();
  76. }
  77. public function testReferralDayData() {
  78. \app\main\service\ReferralService::instance()->updateDayData(961, ['orders_num' => 1, 'recharge_money' => 0.01], 1563551999);
  79. }
  80. public function testRechargeRecord()
  81. {
  82. $data = \app\main\service\OrderService::instance()->getRechargeRecord(60007, 1, 10);
  83. var_dump($data);
  84. }
  85. public function testUserCount()
  86. {
  87. $channelList = AdminService::instance()->getAdminConfigModel()
  88. ->join('admin a','a.id=admin_config.admin_id')
  89. ->whereIn('a.id', [1734])
  90. ->select();
  91. var_dump($channelList);
  92. }
  93. }