TestPay.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: stanley-king
  5. * Date: 16/6/15
  6. * Time: 下午3:12
  7. */
  8. declare(strict_types=0);
  9. define('APP_ID', 'test');
  10. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  11. require_once(BASE_ROOT_PATH . '/global.php');
  12. require_once(BASE_CORE_PATH . '/lrlz.php');
  13. require_once(BASE_ROOT_PATH . '/fooder.php');
  14. require_once (BASE_ROOT_PATH . '/helper/util_helper.php');
  15. require_once (BASE_ROOT_PATH . '/helper/pay/IPay.php');
  16. require_once (BASE_ROOT_PATH . '/helper/pay/aopay.php');
  17. require_once (BASE_ROOT_PATH . '/core/framework/function/http.php');
  18. use PHPUnit\Framework\TestCase;
  19. class TestAddData extends TestCase
  20. {
  21. public static function setUpBeforeClass() : void
  22. {
  23. Base::run_util();
  24. }
  25. public function testAdd()
  26. {
  27. $y = unserialize('a:8:{s:11:"home1_title";s:9:"那句好";s:5:"image";s:0:"";s:9:"show_type";s:4:"vote";s:9:"show_data";s:0:"";s:4:"type";s:4:"vote";s:4:"data";s:75:"[{"id":0,"text":"u7b2cu4e00u53e5"},{"id":1,"text":"u7b2cu4e8cu53e5"}]";s:5:"title";s:9:"那句好";s:8:"reserved";s:11:"vote_type=0";}');
  28. $mobiles = array();
  29. $mobiles['139111269867'] = '江海苗C';
  30. $mobiles['139111269868'] = '江海苗C';
  31. $mobiles['139111269869'] = '江海苗C';
  32. }
  33. public function testSerialize()
  34. {
  35. $data = array (
  36. 'home1_title' => '今年春节放几天假',
  37. 'image' => '',
  38. 'show_type' => 'vote',
  39. 'show_data' => '',
  40. 'type' => 'vote',
  41. 'data' => '[{"id":0,"text":"\\u4e00\\u5929"},{"id":1,"text":"\\u4e24\\u5929"},{"id":2,"text":"\\u4e09\\u5929"}]',
  42. 'title' => '今年春节放几天假',
  43. 'reserved' => 'vote_type=0',
  44. );
  45. $x = serialize($data);
  46. $y = unserialize($x);
  47. }
  48. public function testAopay()
  49. {
  50. $payer = new Pay\aopay();
  51. $ret = $payer->gen_pay('100510761183646482',0.01,'8000000000002204',"实物订单");
  52. }
  53. public function testHfivePay()
  54. {
  55. $body = '<xml><appid><![CDATA[wxfdaeb25e38c4c47e]]></appid>
  56. <attach><![CDATA[590604488911416534]]></attach>
  57. <bank_type><![CDATA[CFT]]></bank_type>
  58. <cash_fee><![CDATA[15400]]></cash_fee>
  59. <fee_type><![CDATA[CNY]]></fee_type>
  60. <is_subscribe><![CDATA[N]]></is_subscribe>
  61. <mch_id><![CDATA[1380733702]]></mch_id>
  62. <nonce_str><![CDATA[0al5w566fsnpvn56zoo5lbf59kymmhbs]]></nonce_str>
  63. <openid><![CDATA[oQH7D5My2UkjSWv-7YYwM-faZ_3c]]></openid>
  64. <out_trade_no><![CDATA[590604488911416534686]]></out_trade_no>
  65. <result_code><![CDATA[SUCCESS]]></result_code>
  66. <return_code><![CDATA[SUCCESS]]></return_code>
  67. <sign><![CDATA[7C677137D72376B9B1815D1F084FC068]]></sign>
  68. <time_end><![CDATA[20190226093533]]></time_end>
  69. <total_fee>15400</total_fee>
  70. <trade_type><![CDATA[MWEB]]></trade_type>
  71. <transaction_id><![CDATA[4200000279201902260421273158]]></transaction_id>
  72. </xml>^M';
  73. $resp = http_post_data('https://www.xyzshops.cn/mobile/web_wxnotify.php',$body);
  74. }
  75. public function testPostData()
  76. {
  77. $msg = "1柜门1箱门,取件码59368";
  78. $postData['orderCode'] = '4312431431431265900431';
  79. $postData['boxMsg'] = $msg;
  80. $count = 1000;
  81. do{
  82. $resp = http_post_data('https://yxmall-adminportal.eavic.com/oms-web/box/deliver',json_encode($postData));
  83. Log::record($resp,Log::DEBUG);
  84. }
  85. while($count--);
  86. }
  87. }