TestRefill.php 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864
  1. <?php
  2. use PHPUnit\Framework\TestCase;
  3. use const mtopcard\ProvinceList;
  4. define('APP_ID', 'test');
  5. define('BASE_ROOT_PATH', str_replace('/test', '', dirname(__FILE__)));
  6. require_once(BASE_ROOT_PATH . '/global.php');
  7. require_once(BASE_CORE_PATH . '/lrlz.php');
  8. require_once(BASE_ROOT_PATH . '/fooder.php');
  9. require_once(BASE_CORE_PATH . '/framework/function/http.php');
  10. require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
  11. require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
  12. const LocalTest = 1;
  13. const NetTest = 2;
  14. const CurrentTest = NetTest;
  15. class TestRefill extends TestCase
  16. {
  17. private $mReqHost;
  18. private $mKey;
  19. private $mMchid;
  20. public function __construct(?string $name = null, array $data = [], $dataName = '')
  21. {
  22. parent::__construct($name, $data, $dataName);
  23. if (CurrentTest == LocalTest) {
  24. $this->mReqHost = BASE_SITE_URL;
  25. $this->mMchid = 1;
  26. $this->mKey = '1ff02223b771c0414468c8892151c602';
  27. } else {
  28. $this->mReqHost = 'https://www.xyzshops.cn';
  29. // $this->mReqHost = 'http://121.89.196.45';
  30. $this->mMchid = 1092;
  31. $this->mKey = '210fe406954220f56085997d6a4c5b80';
  32. }
  33. }
  34. public static function setUpBeforeClass(): void
  35. {
  36. Base::run_util();
  37. refill\RefillFactory::instance();
  38. }
  39. public function testMerchantPrice()
  40. {
  41. $price = new refill\merchant_price();
  42. }
  43. public function testCallBack()
  44. {
  45. }
  46. public function testFactory()
  47. {
  48. $providers = refill\RefillFactory::instance();
  49. }
  50. private function make_sn()
  51. {
  52. return mt_rand(1000, 9999)
  53. . sprintf('%010d', time())
  54. . sprintf('%06d', (float)microtime() * 1000000);
  55. }
  56. public function testRandomMobile()
  57. {
  58. $no = "1" . mt_rand(1, 9999999999);
  59. Log::record("phone no={$no}", Log::DEBUG);
  60. }
  61. public function testBJBAddPhone()
  62. {
  63. $providers = new refill\bjb\RefillPhone([]);
  64. for ($i = 3; $i > 0; --$i) {
  65. $resp = $providers->add(13911129867, 4, 10, ['order_sn' => $this->make_sn()]);
  66. $resp = $providers->add(18500608333, 4, 10, ['order_sn' => $this->make_sn()]);
  67. $resp = $providers->add(18510683168, 4, 10, ['order_sn' => $this->make_sn()]);
  68. $resp = $providers->add(18513846008, 4, 10, ['order_sn' => $this->make_sn()]);
  69. $resp = $providers->add(18518237398, 4, 10, ['order_sn' => $this->make_sn()]);
  70. }
  71. }
  72. public function testOilticket()
  73. {
  74. $providers = new refill\bjb\RefillPhone([]);
  75. }
  76. public function testBjbRet()
  77. {
  78. $resp = '0|提交成功|14936.8600';
  79. $resp = explode('|', $resp);
  80. }
  81. public function testIpWhiteList()
  82. {
  83. $x = serialize(['47.99.57.105']);
  84. $ips = unserialize('a:1:{i:0;s:12:"47.99.57.105";}');
  85. if (!empty($ips)) {
  86. $addr = '47.99.57.105';
  87. Log::record("request ip:{$addr}", Log::DEBUG);
  88. if (!in_array($addr, $ips)) {
  89. throw new Exception("请求地址不在白名单中");
  90. }
  91. }
  92. }
  93. public function testBaizePhone()
  94. {
  95. $providers = new refill\baizeyd\RefillPhone([]);
  96. // $resp = $providers->add(17801048874, 5, 10, ['order_sn' => $this->make_sn()]);
  97. $resp = $providers->query(['order_sn' => '930668700375312006']);
  98. // $str = 'amount=10.00&orderId=720668384771999671&phone=13911129867&payTime=2021-03-06+22%3A26%3A12&sign=94dfe83221f7768650e70cce08879b60&appKey=uECmTOFAY6RPCTtI&payUrl=&statusDes=%E6%94%AF%E4%BB%98%E5%A4%B1%E8%B4%A5&status=7';
  99. // $input = $this->parse_request($str);
  100. // $input['amount'] = 10.00;
  101. // $input['orderId'] = '92391614943913061206';
  102. // $input['phone'] = 17801048874;
  103. // $input['payTime'] = '2021-03-05 19:31:55';
  104. // $input['sign'] = 'bef6ae50319fb1e8cb3f21302f0abef8';
  105. // $input['appKey'] = 'uECmTOFAY6RPCTtI';
  106. // $input['payUrl'] = '';
  107. // $input['statusDes'] = '支付失败';
  108. // $input['status'] = 7;
  109. // refill\RefillFactory::instance()->notify('baizeyd',$input);
  110. }
  111. private function parse_request($squery)
  112. {
  113. if (empty($squery)) return [];
  114. $result = [];
  115. $params = preg_split('/&/', $squery);
  116. foreach ($params as $pair) {
  117. if (empty($pair)) continue;
  118. $kv = explode('=', $pair);
  119. $count = count($kv);
  120. if ($count === 1) {
  121. $key = $kv[0];
  122. $val = "";
  123. } elseif ($count === 2) {
  124. $key = $kv[0];
  125. $val = urldecode($kv[1]);
  126. } else {
  127. continue;
  128. }
  129. if (!empty($key)) {
  130. $result[$key] = $val;
  131. }
  132. }
  133. return $result;
  134. }
  135. public function testAmPhone()
  136. {
  137. // $providers = new refill\aming\RefillPhone([]);
  138. // $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
  139. $input['result'] = 'fail';
  140. $input['msg'] = 0;
  141. $input['order'] = 'null';
  142. $input['phone_no'] = 18500608333;
  143. $input['sign'] = 'c925ad19c63c3eb36ffc52d938e24604';
  144. $input['amount'] = '10.00';
  145. $input['op_no'] = '42601615096072517841';
  146. refill\RefillFactory::instance()->notify('aming', $input);
  147. }
  148. public function testBhcPhone()
  149. {
  150. $providers = new refill\binghc\RefillPhone([]);
  151. $resp = $providers->query(['order_sn' => 250668618955902006]);
  152. // $input['result'] = 'fail';
  153. // $input['msg'] = 0;
  154. // $input['order'] = 'null';
  155. // $input['phone_no'] = 18500608333;
  156. // $input['sign'] = 'c3aa38ee07cd1b69bfd5ead56f6da8d6';
  157. // $input['amount'] = '10.00';
  158. // $input['op_no'] = '24061615096361999002';
  159. // refill\RefillFactory::instance()->notify('binghc',$input);
  160. }
  161. public function testRuishunPhone()
  162. {
  163. // $providers = new refill\ruishun\RefillPhone([]);
  164. // $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
  165. $input['result'] = 'fail';
  166. $input['msg'] = 0;
  167. $input['order'] = null;
  168. $input['phone_no'] = 18500608333;
  169. $input['sign'] = 'e234f7d1c0458ca236f53a0008436b46';
  170. $input['amount'] = "10.00";
  171. $input['op_no'] = '76361615095403188513';
  172. refill\RefillFactory::instance()->notify('ruishun', $input);
  173. }
  174. public function testWuchenPhone()
  175. {
  176. $providers = new refill\wuchen\RefillPhone([]);
  177. // $resp = $providers->add('13699279618', 5, 30, ['order_sn' => $this->make_sn()]);
  178. $resp = $providers->query(['order_sn' => '790668630498425006']);
  179. // $input['app_id'] = '70016';
  180. // $input['message'] = 'fail';
  181. // $input['order_sn'] = '43101615277293035501';
  182. // $input['platform_order_id'] = '';
  183. // $input['sign'] = '5ea59f8ac51a518f2c622824d7db2a04';
  184. // $input['state'] = "fail";
  185. // $input['sys_sn'] = '202103091608231836913889';
  186. // $input['timestamp'] = '1615277361';
  187. // refill\RefillFactory::instance()->notify('wuchen',$input);
  188. }
  189. public function testYibaoPhone()
  190. {
  191. $providers = new refill\yibao\RefillPhone([]);
  192. // $resp = $providers->add('13699279618', 5, 30, ['order_sn' => $this->make_sn()]);
  193. $resp = $providers->query(['ch_trade_no' => '31215002972142736']);
  194. // $str = '{"amount":"30","carrierOrderNo":null,"mobile":"13699279618","orderNo":"27961615532426088043","orderStatus":3,"sign":"012BA0B093A0473D7DD1634A8356DCB1","tradeNo":"31215002972142736"}';
  195. // $data = json_decode($str,true);
  196. // refill\RefillFactory::instance()->notify('yibao',$data);
  197. }
  198. public function testAmingydPhone()
  199. {
  200. $providers = new refill\amingyd\RefillPhone([]);
  201. // $resp = $providers->add('13699279618', 5, 30, ['order_sn' => $this->make_sn()]);
  202. $resp = $providers->query(['order_sn' => '15421615627436792938']);
  203. // $str = '{"orderId":"15421615627436792938","amount":3000,"appKey":"40695059","timestamp":1615627503,"status":3,"operatorId":"508353854027968617","sign":"2A0562319ED4845AB9E3812A58F0B425"}';
  204. // $data = json_decode($str,true);
  205. // refill\RefillFactory::instance()->notify('amingyd',$data);
  206. }
  207. public function testChukaPhone()
  208. {
  209. $providers = new refill\chuka\RefillPhone([]);
  210. // $resp = $providers->add('18500608333', 5, 20, ['order_sn' => $this->make_sn()]);
  211. // $resp = $providers->query(['order_sn' => '92161616314884175179']);
  212. $params['customerId'] = '101787';
  213. $params['orderno'] = 'C1616314888506705492';
  214. $params['tmporder'] = '92161616314884175179';
  215. $params['code'] = '1';
  216. $params['number'] = '18500608333';
  217. $params['money'] = '20';
  218. $params['amount'] = '0';
  219. refill\RefillFactory::instance()->notify('chuka', $params);
  220. }
  221. public function testLegouPhone()
  222. {
  223. $providers = new refill\legou\RefillPhone([]);
  224. // $resp = $providers->add('18500608333', 5, 30, ['order_sn' => '200649600557718881' , 'order_id' => 247 , 'buyer_id' => 52667]);
  225. $resp = $providers->query(['order_sn' => '200649600557718881', 'order_id' => 247]);
  226. $params['username'] = 'lzdc';
  227. $params['orderNumber'] = '690653407667699667';
  228. $params['cardNumber'] = '18500608333';
  229. $params['orderMoney'] = '30.0';
  230. $params['orderPay'] = '1.0';
  231. $params['resultCode'] = '2';
  232. $params['rechargeDesc'] = '{"rechargeStatus":600200,"rechargeDesc":"充值成功"}';
  233. $params['rechargeVoucher'] = '100407307092103291444050244599';
  234. $params['sign'] = 'c054884422a8c3749cbfda0e82b9af70';
  235. // refill\RefillFactory::instance()->notify('legou',$params);
  236. }
  237. public function testFeiniaoPhone()
  238. {
  239. $providers = new refill\feiniao\RefillPhone([]);
  240. // $order_sn = $this->make_sn();
  241. // Log::record($order_sn, Log::DEBUG);
  242. // $resp = $providers->add('13699279618', 4, 50, ['order_sn' => $order_sn]);
  243. $resp = $providers->query(['order_sn' => '28641617178590981824']);
  244. $params['result'] = 'fail';
  245. $params['msg'] = '0';
  246. $params['order'] = 'null';
  247. $params['phone_no'] = '18500608333';
  248. $params['amount'] = '100.00';
  249. $params['op_no'] = '64591617090761169983';
  250. $params['settle'] = '0';
  251. $params['sign'] = '907d2640f96e8d78d59202d090ddb470';
  252. // refill\RefillFactory::instance()->notify('feiniao',$params);
  253. }
  254. public function testTongyPhone()
  255. {
  256. $providers = new refill\tongy\RefillPhone([]);
  257. // $resp = $providers->add('18500608333', 5, 30, ['order_sn' => '690653407667699667', 'order_id' => 248, 'buyer_id' => 52667]);
  258. $params['UserId'] = '100857';
  259. $params['ShopId'] = '300000';
  260. $params['SysOrderId'] = '21070215141210085700010';
  261. $params['OrderId'] = '9241650678554051429291';
  262. $params['State'] = '5';
  263. $params['Timestamp'] = '1625210740472';
  264. $params['sign'] = 'C5C4E888A3B678470071CDA6DC31719D';
  265. $params['ParValue'] = '100.0000';
  266. $params['VoucherType'] = '';
  267. $params['VoucherContent'] = '';
  268. $params['CreateTime'] = '2021-07-02 15:14:12';
  269. $params['CompleteTime'] = '2021-07-02 15:25:40';
  270. refill\RefillFactory::instance()->notify('tongy',$params);
  271. }
  272. public function testWeiyiPhone()
  273. {
  274. $providers = new refill\weiyi\RefillPhone([]);
  275. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  276. // $resp = $providers->query(['order_sn' => '90401621489214002876']);
  277. $body = '{"userid":"1f68bb3452134a6cbaa4","ordernum":"90401621489214002876","mobile":"13699279618","timestamp":"20210520134039","state":"2","desc":"%E5%85%85%E5%80%BC%E6%88%90%E5%8A%9F","sign":"865e8d886b92e019df1d039fccf8df46"}';
  278. $params = json_decode($body , true);
  279. refill\RefillFactory::instance()->notify('weiyi',$params);
  280. }
  281. public function testWeiyimanPhone()
  282. {
  283. $providers = new refill\weiyiman\RefillPhone([]);
  284. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  285. // $resp = $providers->query(['order_sn' => '47591620898269370373']);
  286. $data = '{"userid":"46dbb0c992644da881d0","ordernum":"47591620898269370373","mobile":"18500608333","timestamp":"20210513211050","state":"2","desc":"%E5%85%85%E5%80%BC%E6%88%90%E5%8A%9F","serialno":"173313182872","sign":"e9d2ea85b43808d1587793ae329cdb0b"}';
  287. $params = json_decode($data , true);
  288. refill\RefillFactory::instance()->notify('weiyiman',$params);
  289. }
  290. public function testWeiyiWtPhone()
  291. {
  292. $providers = new refill\weiyiwt\RefillPhone([]);
  293. // $resp = $providers->add(18074608795, 6, 50, ['order_sn' => $this->make_sn()]);
  294. // $resp = $providers->query(['order_sn' => '38451621924366009924']);
  295. $body = '{"szOrderId":"38451621924366009924","fSalePrice":"47.25","szAgentId":"200016","nFlag":"2","szVerifyString":"a0b5bfc0bbf6c121a4cd74d9ecb2427d","szPhoneNum":"18074608795","szRtnMsg":"1000000083421052514441119833","nDemo":"50"}';
  296. $params = json_decode($body , true);
  297. refill\RefillFactory::instance()->notify('weiyiwt',$params);
  298. }
  299. public function testXiaochuangPhone()
  300. {
  301. $providers = new refill\xiaochuang\RefillPhone([]);
  302. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  303. // $resp = $providers->query(['order_sn' => '84891623028826872085']);
  304. $body = '{"fail_msg":"","order_sn":"84891623028826872085","order_status":"4","p_order_sn":"2021060709203558011797441162","sign":"E842203C3CA48E924D60B1B56AB93C3B"}';
  305. $params = json_decode($body , true);
  306. refill\RefillFactory::instance()->notify('xiaochuang',$params);
  307. }
  308. public function testYintengPhone()
  309. {
  310. $providers = new refill\yinteng\RefillPhone([]);
  311. // $resp = $providers->add(18074608795, 6, 50, ['order_sn' => $this->make_sn()]);
  312. // $resp = $providers->query(['order_sn' => '49631623737966351874']);
  313. $data = '{"szOrderId":"49631623737966351874","fSalePrice":"47.35","szAgentId":"200009","nFlag":"2","szVerifyString":"01c5fafb1d67175f0533b69a762286e8","szPhoneNum":"18074608795","szRtnMsg":"1000000083421061514495400262","nDemo":"50"}';
  314. $params = json_decode($data , true);
  315. refill\RefillFactory::instance()->notify('yinteng',$params);
  316. }
  317. public function testMoxjPhone()
  318. {
  319. $providers = new refill\moxj\RefillPhone([]);
  320. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  321. $resp = $providers->query(['order_sn' => '91131623906171663147']);
  322. $data = '{"result":"fail","msg":"0","order":"null","phone_no":"18500608333","amount":"50.0","op_no":"84901623900668776864","sign":"896b54914a07b814573d7f6cc403848a"}';
  323. $params = json_decode($data , true);
  324. // refill\RefillFactory::instance()->notify('moxj',$params);
  325. }
  326. public function testMoxj_fsPhone()
  327. {
  328. $providers = new refill\moxj_fs\RefillPhone([]);
  329. // $resp = $providers->add(15139608757, 4, 100, ['order_sn' => $this->make_sn()]);
  330. $resp = $providers->query(['order_sn' => '42741624242693157165']);
  331. $data = '{"amount":"100","charge_type":"2","code":"1","partner_id":"58","phone":"15139608757","sign":"30d193dba4101e50851ed0efabb75fb1","partner_order_no":"42741624242693157165","official_order_id":"20210621103211948830"}';
  332. $params = json_decode($data , true);
  333. // refill\RefillFactory::instance()->notify('moxj_fs',$params);
  334. }
  335. public function testZanzanquickPhone()
  336. {
  337. $providers = new refill\zanzanquick\RefillPhone([]);
  338. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  339. // $resp = $providers->query(['order_sn' => '90831623925322675223']);
  340. $data = '{"userid":"d845a4635f7e47668f5e","ordernum":"90831623925322675223","mobile":"18500608333","timestamp":"20210617182545","state":"2","desc":"%E5%85%85%E5%80%BC%E6%88%90%E5%8A%9F","serialno":"110103307232106171824530567108","sign":"0152c723f25be19f21d723e24b2c8987"}';
  341. $params = json_decode($data , true);
  342. refill\RefillFactory::instance()->notify('zanzanquick',$params);
  343. }
  344. public function testFengyemanPhone()
  345. {
  346. $providers = new refill\fengyeman\RefillPhone([]);
  347. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  348. // $resp = $providers->query(['order_sn' => '46221624265179185139']);
  349. $data = '{"order_id":"46221624265179185139","mchid":"HF67a65_10008","tel":"18500608333","price":"50.00","sign":"2bb4ed5edc97ba7f60cf3848aab82cf4","out_order_id":"206877995456","status":"1"}';
  350. $params = json_decode($data , true);
  351. refill\RefillFactory::instance()->notify('fengyeman',$params);
  352. }
  353. public function testMoxj_ydPhone()
  354. {
  355. $providers = new refill\moxj_yd\RefillPhone([]);
  356. $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  357. // $resp = $providers->query(['order_sn' => '52101624413125875436']);
  358. $data = '{"customer_order_no":"47651624412877257722","status":1,"merchant_id":"76505818","sign":"c185a0f2152b3ac3ee3f29009dec5a6b"}';
  359. $params = json_decode($data , true);
  360. // refill\RefillFactory::instance()->notify('moxj_yd',$params);
  361. }
  362. public function testXingzyPhone()
  363. {
  364. $providers = new refill\xingzy\RefillPhone([]);
  365. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  366. $resp = $providers->query(['order_sn' => '76791624441423287373', 'ch_trade_no' => '210623174333941000']);
  367. $data = '{"access_key":"211394702","code":3,"data":{"sellprice":26.7,"phone":"18500608333","pass":null,"official_id":null,"official_ch":null},"orderid":210623173427222000,"out_trade_no":"40441624440876653628","sign":"E1g7uHAaJI056jb1fK1DQztkpN4=","timestamp":1624441437918}';
  368. $params = json_decode($data , true);
  369. // refill\RefillFactory::instance()->notify('xingzy',$params);
  370. }
  371. public function testYuanmaiPhone()
  372. {
  373. $providers = new refill\yuanmai\RefillPhone([]);
  374. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  375. // $resp = $providers->query(['order_sn' => '24231624865882625203', 'ch_trade_no' => '210623174333941000']);
  376. $data = '{"orderid":"24231624865882625203","status":"2","ordermoney":"50","sign":"94be5b1754ffcc7f0fe1551072146941","spsno":""}';
  377. $params = json_decode($data, true);
  378. refill\RefillFactory::instance()->notify('yuanmai',$params);
  379. }
  380. public function testLangkePhone()
  381. {
  382. $providers = new refill\langke\RefillPhone([]);
  383. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  384. $resp = $providers->query(['order_sn' => '29461624952660047520', 'ch_trade_no' => '210623174333941000']);
  385. $data = '{"channelsort":"PHONE_BILL","channelno":"2021062922001123211428063487","onlystr":"29461624952660047520","channel":"TM","sign":"8aedceac4ce4d897f1f06977a9094371","amt":"50","notifyurl":"https:\/\/www.xyzshops.cn\/mobile\/signature.php","cardtype":"","cardno":"","orgid":"7532391600","account":"13699279618","status":"2"}';
  386. $params = json_decode($data, true);
  387. // refill\RefillFactory::instance()->notify('langke',$params);
  388. }
  389. public function testYunlingdsPhone()
  390. {
  391. $providers = new refill\yunlingds\RefillPhone([]);
  392. // $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
  393. // $resp = $providers->query(['order_sn' => '85351624961920020593']);
  394. $data = '{"orderid":"OWS21062918188862392","sporderid":"85351624961920020593","userid":"10002623","merchantsubmittime":"20210629181929","resultno":"1","parvalue":"30","remark1":"AW20210629181906yRAvM","payno":"AW20210629181906yRAvM","fundbalance":"-28.59","sign":"11369509ADCF2A2612B3531A15049BDD"}';
  395. $params = json_decode($data, true);
  396. refill\RefillFactory::instance()->notify('yunlingds',$params);
  397. }
  398. public function testLingzhmanPhone()
  399. {
  400. $providers = new refill\lingzhman\RefillPhone([]);
  401. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  402. $resp = $providers->query(['order_sn' => '29771625215707976538']);
  403. $data = '{"orderNo":"F2107021536431562574","status":"019","consumerNo":"60191625211393862930","voucherNo":null,"mobile":"18500608333"}';
  404. $params = json_decode($data, true);
  405. // refill\RefillFactory::instance()->notify('lingzhman',$params);
  406. }
  407. public function testQijutangPhone()
  408. {
  409. $providers = new refill\qijutang\RefillPhone([]);
  410. for ($i=1;$i<2;$i++) {
  411. $resp = $providers->add(13699279618, 4, 100, ['order_sn' => $this->make_sn()]);
  412. }
  413. // $resp = $providers->query(['order_sn' => '51501625218912512231']);
  414. $data = '{"szOrderId":"51501625218912512231","fSalePrice":"28.44","szAgentId":"200010","nFlag":"3","szVerifyString":"20cf16c6bb239e2a703d0bf3e5ef2d5a","szPhoneNum":"18500608333","szRtnMsg":"","nDemo":"30"}';
  415. $params = json_decode($data, true);
  416. // refill\RefillFactory::instance()->notify('qijutang',$params);
  417. }
  418. public function testLingzhman48Phone()
  419. {
  420. $providers = new refill\lingzhman48\RefillPhone([]);
  421. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  422. // $resp = $providers->query(['order_sn' => '49951625814151937287']);
  423. $data = '{"orderNo":"F2107091503134670764","status":"020","consumerNo":"49951625814151937287","voucherNo":null,"mobile":"18500608333"}';
  424. $params = json_decode($data, true);
  425. refill\RefillFactory::instance()->notify('lingzhman48',$params);
  426. }
  427. public function testcangbuPhone()
  428. {
  429. $providers = new refill\cangbu\RefillPhone([]);
  430. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  431. // $resp = $providers->query(['order_sn' => '35041626071052333060']);
  432. $data = '{"customerId":"112","tmporder":"35041626071052333060","orderno":"s16260710607417944801112","number":"18500608333","money":"100","amount":"94.9000","code":"1","cardno":"","voucher":"110103307042107121424210550266","sign":"de463c3d389a4afe4a2c58257972121a"}';
  433. $params = json_decode($data, true);
  434. refill\RefillFactory::instance()->notify('cangbu',$params);
  435. }
  436. public function testTongykamiPhone()
  437. {
  438. $providers = new refill\tongykami\RefillPhone([]);
  439. // $resp = $providers->add(18500608333, 5, 20, ['order_sn' => $this->make_sn()]);
  440. $resp = $providers->query(['order_sn' => '26961626077050756648']);
  441. $data = '{"UserId":"100903","ShopId":"300000","SysOrderId":"21071216040810090300001","OrderId":"26961626077050756648","State":"4","Timestamp":"1626077052399","sign":"536A0D93B0869FC4FFDF055AFB8083FE","ParValue":"20.0000","VoucherType":"5","VoucherContent":"982100214176457","CreateTime":"2021-07-12 16:04:08","CompleteTime":"2021-07-12 16:04:12"}';
  442. $params = json_decode($data, true);
  443. // refill\RefillFactory::instance()->notify('tongykami',$params);
  444. }
  445. public function testTongluPhone()
  446. {
  447. $providers = new refill\tonglu\RefillPhone([]);
  448. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  449. $resp = $providers->query(['order_sn' => '22961616468561936356']);
  450. // $body = '{"order_no":"22961616468561936356","order_status":"5","phone_no":"18500608333","amount":5000,"time_paid":1616468856287,"order_cert_no":"","paid":false,"order_id":"20210323966497008"}';
  451. // $sign = '9E41F52F612D60EBB654B3A5D1E2F1E5';
  452. // $params = json_decode($body , true);
  453. // $params['sign'] = $sign;
  454. // refill\RefillFactory::instance()->notify('tonglu',$params);
  455. }
  456. public function testAmingjd()
  457. {
  458. // $providers = new refill\amingjd\RefillPhone([]);
  459. // $resp = $providers->add(13699279618, 5, 30, ['order_sn' => $this->make_sn()]);
  460. // $resp = $providers->query(['order_sn' => '42301616475989518588']);
  461. $body = '{"order_id":"83321616478215494884","mchid":"10003","tel":"13699279618","price":"30.00","sign":"01c49620c155a80bc43cecc2b1651868","status":"0","out_order_id":"0"}';
  462. $params = json_decode($body, true);
  463. refill\RefillFactory::instance()->notify('amingjd', $params);
  464. }
  465. public function testAmingjdmanPhone()
  466. {
  467. $providers = new refill\amingjdman\RefillPhone([]);
  468. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  469. // $resp = $providers->query(['order_sn' => '82741619577673758623']);
  470. $body = '{"order_id":"82741619577673758623","mchid":"10045","tel":"13699279618","price":"30.00","sign":"2fe55fb4d4b2acc2e98137adb82fa57e","status":"0","out_order_id":"0"}';
  471. $params = json_decode($body, true);
  472. refill\RefillFactory::instance()->notify('amingjdman', $params);
  473. }
  474. public function testWeishengyWtPhone()
  475. {
  476. $providers = new refill\weishengywt\RefillPhone([]);
  477. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  478. // $resp = $providers->query(['order_sn' => '27681620538125370652']);
  479. $data = '{"szOrderId":"27681620538125370652","fSalePrice":"47.5","szAgentId":"200045","nFlag":"2","szVerifyString":"92fafec121b77518d539ed9f5005fdf9","szPhoneNum":"18500608333","szRtnMsg":"110103308032105091328520502948","nDemo":"50"}';
  480. $params = json_decode($data, true);
  481. refill\RefillFactory::instance()->notify('weishengywt', $params);
  482. }
  483. public function testWeishengyJDPhone()
  484. {
  485. $providers = new refill\weishengyjd\RefillPhone([]);
  486. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  487. // $resp = $providers->query(['order_sn' => '14261620887423822879']);
  488. $data = '{"szOrderId":"14261620887423822879","fSalePrice":"44.0","szAgentId":"200050","nFlag":"3","szVerifyString":"3cceef390602058e1d2fdde2e07636a4","szPhoneNum":"18500608333","szRtnMsg":"","nDemo":"50"}';
  489. $params = json_decode($data, true);
  490. refill\RefillFactory::instance()->notify('weishengyjd', $params);
  491. }
  492. public function testYeziPhone()
  493. {
  494. $providers = new refill\yezi\RefillPhone([]);
  495. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  496. // $resp = $providers->query(['order_sn' => '35261620988265145105']);
  497. $data = '{"mchid":"10147","order_sn":"35261620988265145105","amount":"50.00","cardno":"18500608333","trade_no":"6363570674332280422825","idcard":"","card_name":"","official_sn":"","message":"","state":"CANCEL","sign":"b79f2ddbb5b7eef98f414585a5bd2cde"}';
  498. $params = json_decode($data, true);
  499. refill\RefillFactory::instance()->notify('yezi', $params);
  500. }
  501. public function testWeishengysixPhone()
  502. {
  503. $providers = new refill\weishengysix\RefillPhone([]);
  504. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  505. // $resp = $providers->query(['order_sn' => '17171624434289348649']);
  506. $data = '{"szOrderId":"17171624434289348649","fSalePrice":"44.5","szAgentId":"200074","nFlag":"2","szVerifyString":"fa5735090199d97e6a50e7f3083be111","szPhoneNum":"18500608333","szRtnMsg":"AW2021062315464045A27","nDemo":"50"}';
  507. $params = json_decode($data, true);
  508. refill\RefillFactory::instance()->notify('weishengysix', $params);
  509. }
  510. public function testHaohaoOil()
  511. {
  512. $providers = new refill\haohao\RefillOil([]);
  513. // $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
  514. $data['amount'] = 20000;
  515. $data['mchId'] = 467253;
  516. $data['mchOrderNo'] = '5514850674656058146707';
  517. $data['mobile'] = '';
  518. $data['sign'] = 'F282D68972A437F3CEB3516BB2FDD19A';
  519. $data['operator'] = 4;
  520. $data['number'] = '1000113200020348885';
  521. $data['thirdOrderNo'] = '2317184088901537792';
  522. $data['directStatus'] = 5;
  523. // $input = json_decode($data, true);
  524. refill\RefillFactory::instance()->notify('haohao',$data);
  525. }
  526. public function testJuzhuoOil()
  527. {
  528. $providers = new refill\juzhuo\RefillOil([]);
  529. // $resp = $providers->add(1000111100021211884, 2, 200, ['order_sn' => $this->make_sn()]);
  530. // $resp = $providers->query(['order_sn' => '20121621578185774451']);
  531. // $data = '{"channelsort":"OIL_CARD","channelno":"185176855832","onlystr":"20121621578185774451","channel":"JD","sign":"34dce9329fef7997c134987247ac6ee1","amt":"200","notifyurl":"https:\/\/www.xyzshops.cn\/mobile\/signature.php","cardtype":"Sinoepc","cardno":"1000111100021211884","orgid":"6095171500","account":"","status":"2"}';
  532. // $input = json_decode($data, true);
  533. $data['channelsort'] = 'OIL_CARD';
  534. $data['channelno'] = '';
  535. $data['onlystr'] = '0772770675248490450497';
  536. $data['channel'] = 'JD';
  537. $data['sign'] = '4a9f113bfa4aa2d155de7136ca0afe2d';
  538. $data['amt'] = '100';
  539. $data['notifyurl'] = 'http://121.89.212.167/racc/callback/lingzh/juzhuo.php';
  540. $data['cardtype'] = 'Sinoepc';
  541. $data['cardno'] = '1000113200029532754';
  542. $data['orgid'] = '6095171500';
  543. $data['account'] = '';
  544. $data['status'] = '3';
  545. refill\RefillFactory::instance()->notify('juzhuo',$data);
  546. }
  547. public function testZeheng()
  548. {
  549. $providers = new refill\zeheng\RefillOil([]);
  550. // $resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 100, ['order_sn' => $this->make_sn()]);
  551. // $resp = $providers->query(['order_sn' => '45951620814813332604']);
  552. $data = '{"extOrderId":"45951620814813332604","orderId":"R2021051218240000192928","salePrice":"96.8000","sign":"0d6b9641eaf8d36ecba82cfefc6aa307","state":"4"}';
  553. $input = json_decode($data, true);
  554. refill\RefillFactory::instance()->notify('zeheng',$input);
  555. }
  556. public function testXiaoniu()
  557. {
  558. $providers = new refill\xiaoniu\RefillOil([]);
  559. // $resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 500, ['order_sn' => $this->make_sn()]);
  560. // $resp = $providers->query(['order_sn' => '39911625819031601073']);
  561. $data = '{"content":"\u3010\u4e2d\u56fd\u77f3\u5316\u3011\u60a8\u5c3e\u53f7\u4e3a211884\u7684\u52a0\u6cb9\u5361\u4e8e07\u670809\u65e5 16\u65f630\u5206\u5145\u503c\u6210\u529f,\u91d1\u989d500\u5143,\u8ba2\u5355\u53f7:2521070916304172","realAmt":"490.0000","status":"1","timestamp":"20210709163042","sign":"110aaae89243c9ed2d6aa4d753597224","orderNo":"XN20210709162351796707722","mOrderNo":"39911625819031601073"}';
  562. $input = json_decode($data, true);
  563. refill\RefillFactory::instance()->notify('xiaoniu',$input);
  564. }
  565. public function testZhenqi()
  566. {
  567. $providers = new refill\zhenqi\RefillPhone([]);
  568. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  569. $resp = $providers->query(['order_sn' => '42611626267945146350']);
  570. $data = '{"out_trade_no":"14001626266194932132","create_time":"1626266201","sp_order_no":"110103353232107142044550619272","status":"1","sign":"3C2F8ED40EEB9151D2117E2DA1FA64AA"}';
  571. $input = json_decode($data, true);
  572. // refill\RefillFactory::instance()->notify('zhenqi',$input);
  573. }
  574. public function testYunsuoyaofs()
  575. {
  576. $providers = new refill\yunsuoyaofs\RefillPhone([]);
  577. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  578. // $resp = $providers->query(['order_sn' => '85681626322286098163']);
  579. $data = '{"orderid":"AMU21071512111544162","sporderid":"85681626322286098163","userid":"10002671","merchantsubmittime":"20210715121132","resultno":"9","parvalue":"50","remark1":"","payno":"","fundbalance":"-47.7","sign":"45ECFF26E84F7DC3BFFDCFAFF3B1E561"}';
  580. $input = json_decode($data, true);
  581. refill\RefillFactory::instance()->notify('yunsuoyaofs',$input);
  582. }
  583. public function testZhenqi1m()
  584. {
  585. $providers = new refill\zhenqi1m\RefillPhone([]);
  586. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  587. // $resp = $providers->query(['order_sn' => '45611626334593130605']);
  588. $data = '{"out_trade_no":"45611626334593130605","create_time":"1626334606","sp_order_no":"202107152200117311004426885635","status":"1","sign":"CF8EB902F60B76591C898C991361BB4D"}';
  589. $input = json_decode($data, true);
  590. refill\RefillFactory::instance()->notify('zhenqi1m',$input);
  591. }
  592. public function testPrice()
  593. {
  594. $amounts = [10, 20, 30, 50, 100, 200, 300, 500];
  595. $rate = 0.994;
  596. foreach ($amounts as $amount) {
  597. $price[] = $amount * $rate;
  598. }
  599. }
  600. public function testCallbackDir()
  601. {
  602. $path = "/callback";
  603. $file = "/mobile/callback/refill_call.php";
  604. $basename = basename($file);
  605. $tmp = "{$path}/{$basename}.php";
  606. return file_exists($tmp);
  607. }
  608. public function testWeisPhone()
  609. {
  610. $providers = new refill\weisyd\RefillPhone([]);
  611. $resp = $providers->add(17801048874, 4, 10, ['order_sn' => $this->make_sn()]);
  612. }
  613. public function testXcPhone()
  614. {
  615. $providers = new refill\xc\RefillPhone([]);
  616. $resp = $providers->add(13699279618, 5, 100, ['order_sn' => $this->make_sn()]);
  617. // $resp = $providers->query(['order_sn' => '87961616926444043617']);
  618. $params['pay_orderid'] = '87961616926444043617';
  619. $params['pay_iphone'] = '18500608333';
  620. $params['pay_money'] = '100';
  621. $params['wt_orderid'] = '202103281816121070';
  622. $params['status'] = '1';
  623. $params['sign'] = 'f7be2e859a5a6dc7b1a8273361617752';
  624. // refill\RefillFactory::instance()->notify('xc',$params);
  625. }
  626. public function testAfandPhone()
  627. {
  628. $providers = new refill\afand\RefillPhone([]);
  629. // for ($i = 3; $i > 0; --$i) {
  630. $resp = $providers->query(['order_sn' => '540668612768904780']);
  631. // }
  632. }
  633. public function testAfandengPhone()
  634. {
  635. $providers = new refill\afandeng\RefillPhone([]);
  636. // for ($i = 5; $i > 0; --$i) {
  637. $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  638. // }
  639. // $resp = $providers->query(['order_sn' => '20941616115610023539']);
  640. // $params['usr'] = 'afandeng';
  641. // $params['ord'] = '20941616115610023539';
  642. // $params['state'] = '2';
  643. // $params['bz'] = '';
  644. // $params['sgn'] = 'BA2C9D379C3EB648A0B7AAB3A21A3F6A';
  645. // refill\RefillFactory::instance()->notify('afandeng',$params);
  646. }
  647. public function testWantongPhone()
  648. {
  649. $providers = new refill\wantong\RefillPhone([]);
  650. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  651. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  652. $resp = $providers->query(['order_sn' => '26061618988575301841']);
  653. $data = '{"uid":"97396885","order_no":"26061618988575301841","mobile_order_no":"","phone_number":"13699279618","face_value":"3000","status":"9","sign":"1a019202656cf4feffe715025fab01bf"}';
  654. $input = json_decode($data, true);
  655. // refill\RefillFactory::instance()->notify('wantong',$input);
  656. }
  657. public function testXunyinPhone()
  658. {
  659. $providers = new refill\xunyin\RefillPhone([]);
  660. // $resp = $providers->add(17703711950, 6, 30, ['order_sn' => $this->make_sn()]);
  661. $resp = $providers->query(['order_sn' => '76831617176125893158']);
  662. $xml = '<Order><cpid>8417</cpid><orderid>40591617173295524057</orderid><order_no>14784226</order_no><msg>充值中</msg><Code>0000</Code><Cards/></Order>';
  663. $resp = $providers->xmlToArray($xml);
  664. if ($resp['Code'] === '0000') {
  665. return [true, $resp['order_no'], false];
  666. } else {
  667. return [false, $resp['msg'], false];
  668. }
  669. // $params['ext'] = '';
  670. // $params['code'] = '8888';
  671. // $params['sign'] = '428ac223cf3a1f6f3d382aac754e8e17';
  672. // $params['statemes'] = '成功';
  673. // $params['id'] = '76831617176125893158';
  674. // $params['userid'] = '8417';
  675. // $params['operatorid'] = '1000000083421033115583773201';
  676. // $params['status'] = 'SUCCESS';
  677. // refill\RefillFactory::instance()->notify('xunyin',$params);
  678. }
  679. public function testFenshengPhone()
  680. {
  681. $file = BASE_HELPER_RAPI_PATH . "/qianqian/RefillPhone.php";
  682. if(!file_exists($file)){
  683. Log::record("provider api file={$file} not exist.",Log::DEBUG);
  684. return false;
  685. } else {
  686. require_once($file);
  687. Log::record("file={$file} load success.",Log::DEBUG);
  688. }
  689. $providers = new refill\qianqian\RefillPhone([]);
  690. $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  691. // $resp = $providers->query(['order_sn' => '27511617764278021035']);
  692. // $datas = '[{"orderNo":"F2104071058069438461","status":"001","consumerNo":"27511617764278021035","voucherNo":"510490688023364042","mobile":"13699279618"}]';
  693. // $datas = json_decode($datas,true);
  694. // foreach ($datas as $data) {
  695. // refill\RefillFactory::instance()->notify('fensheng',$data);
  696. // }
  697. }
  698. public function testQianqianPhone()
  699. {
  700. $providers = new refill\fensheng\RefillPhone([]);
  701. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  702. $resp = $providers->query(['order_sn' => '27511617764278021035']);
  703. // $datas = '[{"orderNo":"F2104071058069438461","status":"001","consumerNo":"27511617764278021035","voucherNo":"510490688023364042","mobile":"13699279618"}]';
  704. // $datas = json_decode($datas,true);
  705. // foreach ($datas as $data) {
  706. // refill\RefillFactory::instance()->notify('fensheng',$data);
  707. // }
  708. }
  709. public function testQianqianmanPhone()
  710. {
  711. $providers = new refill\qianqianman\RefillPhone([]);
  712. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  713. // $resp = $providers->query(['order_sn' => '72011621236975003462']);
  714. $data = '{"orderNo":"F2105171538062539442","status":"019","consumerNo":"72011621236975003462","voucherNo":null,"mobile":"13699279618"}';
  715. $input = json_decode($data, true);
  716. refill\RefillFactory::instance()->notify('qianqianman',$input);
  717. }
  718. public function testRiyingPhone()
  719. {
  720. $providers = new refill\riying\RefillPhone([]);
  721. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  722. $resp = $providers->query(['ch_trade_no' => '2021041311120213187423105022']);
  723. $data = '{"UserId":"10050","SysOrderId":"2021041311120213187423105022","OrderId":"15641618283518423567","State":"4","Timestamp":"1618283565746","VoucherType":"1","VoucherContent":"511009928000087852","Sign":"a6ec70a3ea42baae941528398c6d0a43"}';
  724. $input = json_decode($data, true);
  725. // refill\RefillFactory::instance()->notify('riying',$input);
  726. }
  727. public function testWeishengyPhone()
  728. {
  729. $providers = new refill\weishengy\RefillPhone([]);
  730. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  731. // $resp = $providers->query(['order_sn' => '15551618590601301527']);
  732. $data = '{"masId":"699270071532654592","oids":"158877719094,166090529155,158887187476","orderNo":"62411618635377880788","orderPrice":"150.00","phone":"18500608333","sign":"3EC10A32FC4CCC976048E1164D0FCBF6","status":"1","time":"1618643281063","type":"2"}';
  733. $input = json_decode($data, true);
  734. refill\RefillFactory::instance()->notify('weishengy',$input);
  735. }
  736. public function testWailingPhone()
  737. {
  738. $providers = new refill\wailing\RefillPhone([]);
  739. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  740. $resp = $providers->query(['order_sn' => '73241618543784045618']);
  741. $data = '{"order_id":"73241618543784045618","mchid":"10045","tel":"13699279618","price":"30.00","sign":"4991de3e40f14c198b8c194455ea021b","status":"0","out_order_id":"0"}';
  742. $input = json_decode($data, true);
  743. // refill\RefillFactory::instance()->notify('wailing',$input);
  744. }
  745. public function testShengyingPhone()
  746. {
  747. $providers = new refill\shengying\RefillPhone([]);
  748. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  749. $resp = $providers->query(['order_sn' => '37571618805115582483']);
  750. $data = '{"TaskID":"129636","Mobile":"13699279618","Status":"4","ReportTime":"2021-04-19T12:06:16.050","ReportCode":"1:511531522026586295","OutTradeNo":"37571618805115582483","ReceiptNum":"511531522026586295","Sign":"a7f46a988bc8483091d94130804e5078"}';
  751. $input = json_decode($data, true);
  752. // refill\RefillFactory::instance()->notify('shengying',$input);
  753. }
  754. public function testYunlingPhone()
  755. {
  756. $providers = new refill\yunling\RefillPhone([]);
  757. // $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
  758. // $resp = $providers->query(['order_sn' => '73791623147517199719']);
  759. $data = '{"orderid":"EAF21060818183032772","sporderid":"73791623147517199719","userid":"10002504","merchantsubmittime":"20210608181912","resultno":"1","parvalue":"30","remark1":"1000000083421060818483137636","payno":"1000000083421060818483137636","fundbalance":"-28.59","sign":"8D77517AC3905ED88BF79EE789A5FA86"}';
  760. $input = json_decode($data, true);
  761. refill\RefillFactory::instance()->notify('yunling',$input);
  762. }
  763. public function testZhongstPhone()
  764. {
  765. $providers = new refill\zhongst\RefillPhone([]);
  766. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  767. // $resp = $providers->query(['order_sn' => '48941618981770389271']);
  768. $data = ' {"szOrderId":"66571619060147539784","fSalePrice":"46.5","szAgentId":"200030","nFlag":"2","szVerifyString":"c1e88701b89a4887996822d708bed5f5","szPhoneNum":"13699279618","szRtnMsg":"161122673971","nDemo":"50"}';
  769. $input = json_decode($data, true);
  770. refill\RefillFactory::instance()->notify('zhongst',$input);
  771. }
  772. public function testXunaoPhone()
  773. {
  774. $providers = new refill\xunao\RefillPhone([]);
  775. // $resp = $providers->add(18074608795, 6, 10, ['order_sn' => $this->make_sn()]);
  776. // $resp = $providers->query(['order_sn' => '40021619431386253803', 'card_no' => 18074608795, 'card_type' => 6]);
  777. $data = '{"amount":"10.00","orderNo":"40021619431386253803","supplierId":"10","orderId":"S20210426180311761051424910","notifyTime":"1619431456411","sign":"c4eef22091831104be7ae95a0292c703","discountAmount":"0.50","phoneNo":"18074608795","queryUrl":"https:\/\/www.189.cn\/client\/wap\/wapproject\/wapclient\/feecharge\/feecharge_result.html?sessionid=f633d8a270aa4e5892d0f7ca6f09e95e","payType":"alipay","ticketNo":"1000000083421042618356072935","company":"dx","status":"2"}';
  778. $input = json_decode($data, true);
  779. refill\RefillFactory::instance()->notify('xunao',$input);
  780. }
  781. public function testYonghePhone()
  782. {
  783. $providers = new refill\yonghe\RefillPhone([]);
  784. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  785. // $resp = $providers->query(['order_sn' => '20461619597297972685']);
  786. $data = '{"szOrderId":"20461619597297972685","fSalePrice":"29.955","szAgentId":"200115","nFlag":"2","szVerifyString":"b5c292a13c5e67a9b850eb37239682ae","szPhoneNum":"13699279618","szRtnMsg":"2021042822001139701437383521","nDemo":"30"}';
  787. $input = json_decode($data, true);
  788. refill\RefillFactory::instance()->notify('yonghe',$input);
  789. }
  790. public function testJumiPhone()
  791. {
  792. $providers = new refill\jumi\RefillPhone([]);
  793. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  794. // $resp = $providers->query(['order_sn' => '12161619768293529384']);
  795. $data = '{"order_no":"12161619768293529384","channel_order_no":"C2104300338227862125","status":1,"money":"50.00","cost_money":"48.60","mch_no":210303112631,"account":"13699279618","official_sn":"","sign":"efa99b969f318ef934d8120ccfc77c3e"}';
  796. $input = json_decode($data, true);
  797. refill\RefillFactory::instance()->notify('jumi',$input);
  798. }
  799. public function testJumiOil()
  800. {
  801. $providers = new refill\jumi\RefillOil([]);
  802. // $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
  803. // $resp = $providers->query(['order_sn' => '29021620617872685187']);
  804. $data = '{"order_no":"29021620617872685187","channel_order_no":"C2105101138061082025","status":1,"money":"100.00","cost_money":"98.00","mch_no":210303112631,"account":"1000111100021211884","official_sn":"","sign":"0914807052a04282aeb855f459fcc7b7"}';
  805. $input = json_decode($data, true);
  806. refill\RefillFactory::instance()->notify('jumi',$input);
  807. }
  808. public function testFengyePhone()
  809. {
  810. $providers = new refill\fengye\RefillPhone([]);
  811. // $resp = $providers->add(18074608795, 6, 50, ['order_sn' => $this->make_sn()]);
  812. // $resp = $providers->query(['order_sn' => '53511620355988978053', 'card_no' => 18074608795, 'card_type' => 6]);
  813. $data = '{"amount":"50.00","orderNo":"53511620355988978053","supplierId":"13","orderId":"S20210507105309202749918513","notifyTime":"1620356062365","sign":"371260b007f2e64d86873ce3ede67fa3","discountAmount":"2.50","phoneNo":"18074608795","queryUrl":"https:\/\/www.189.cn\/client\/wap\/wapproject\/wapclient\/feecharge\/feecharge_result.html?sessionid=e896e66c2e134ba3b469b26df34d12d1","payType":"wechat","ticketNo":"1000000083421050710397228882","company":"dx","status":"2"}';
  814. $input = json_decode($data, true);
  815. refill\RefillFactory::instance()->notify('fengye',$input);
  816. }
  817. public function testYunsuoyaoPhone()
  818. {
  819. $providers = new refill\yunsuoyao\RefillPhone([]);
  820. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  821. $resp = $providers->query(['order_sn' => '20431621331092296201']);
  822. $data = '{"orderid":"RLU21051817441937847","sporderid":"20431621331092296201","userid":"10002501","merchantsubmittime":"20210518174858","resultno":"9","parvalue":"30","remark1":"","payno":"","fundbalance":"-28.74","sign":"426EAC103B79505BAE7AB3F16886F1A8"}';
  823. $input = json_decode($data, true);
  824. // refill\RefillFactory::instance()->notify('yunsuoyao',$input);
  825. }
  826. public function testAfdPhone()
  827. {
  828. $providers = new refill\afd\RefillPhone([]);
  829. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  830. // $resp = $providers->query(['order_sn' => '71001621233525947994']);
  831. $data = '{"code":"000","merchantorderId":"71001621233525947994","platformorderid":"aab01693204b95c4df1268313","orderid":"经度110103308082105171438580570638","rechargeno":"18500608333","amount":"50.00","payamount":"47.40000","rechargestate":"99","createtime":"2021-05-17 14:38:29","sign":"62d9af5833e1bf489998a0425107573f"}';
  832. $input = json_decode($data, true);
  833. refill\RefillFactory::instance()->notify('afd',$input);
  834. }
  835. public function testLuqianPhone()
  836. {
  837. $providers = new refill\luqian\RefillPhone([]);
  838. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  839. $resp = $providers->query(['order_sn' => '2829660672500596314764']);
  840. $data = '{"amount":"100","charge_type":"0","code":"1","partner_id":"38","phone":"18500608333","sign":"c2c86cccc73fa991a63c369e683c91f2","partner_order_no":"34101618897099329575","official_order_id":"110103308072104201338340278420"}';
  841. $input = json_decode($data, true);
  842. // refill\RefillFactory::instance()->notify('luqian',$input);
  843. }
  844. public function testAfandfsPhone()
  845. {
  846. $providers = new refill\afandfs\RefillPhone([]);
  847. // $resp = $providers->add(15139608757, 4, 30, ['order_sn' => $this->make_sn()]);
  848. $resp = $providers->query(['order_sn' => '65101618975926761630']);
  849. $data = '{"amount":"30","charge_type":"2","code":"1","partner_id":"52","phone":"15139608757","sign":"a7f54c1ac3e1af72f9fc849086cc4bec","partner_order_no":"65101618975926761630","official_order_id":"20210421113256628350"}';
  850. $input = json_decode($data, true);
  851. // refill\RefillFactory::instance()->notify('afandfs',$input);
  852. }
  853. public function testYunlingfsPhone()
  854. {
  855. $providers = new refill\yunlingfs\RefillPhone([]);
  856. // $resp = $providers->add(15139608757, 4, 50, ['order_sn' => $this->make_sn()]);
  857. $resp = $providers->query(['order_sn' => '79251623739433607563']);
  858. $data = '{"orderid":"BGC21061514434393910","sporderid":"79251623739433607563","userid":"10002543","merchantsubmittime":"20210615144434","resultno":"1","parvalue":"50","remark1":"20210615144420321813","payno":"20210615144420321813","fundbalance":"-47.65","sign":"6B9B7C15A3F9CBC773562327B6744B1E"}';
  859. $input = json_decode($data, true);
  860. // refill\RefillFactory::instance()->notify('yunlingfs',$input);
  861. }
  862. public function testTianchengPhone()
  863. {
  864. $providers = new refill\tiancheng\RefillPhone([]);
  865. $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
  866. // $resp = $providers->query(['order_sn' => '15301619399212504464']);
  867. $data = ' {"result":"fail","msg":"0","order":"null","phone_no":"13699279618","amount":"10","op_no":"84801619340283980506","settle":"0","sign":"D64039ED791920B08BDA9DD95700C0E6"}';
  868. $input = json_decode($data, true);
  869. // refill\RefillFactory::instance()->notify('tiancheng',$input);
  870. }
  871. public function testLingzhPhone()
  872. {
  873. $providers = new refill\lingzh\RefillPhone([]);
  874. // $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
  875. // $resp = $providers->query(['order_sn' => '59911615124025101286']);
  876. $resp = $providers->balance();
  877. // $input['usr'] = 1;
  878. // $input['ord'] = '52741615119546453690';
  879. // $input['bz'] = '';
  880. // $input['state'] = 2;
  881. // $input['sgn'] = 'FFCBB75C307154DD306F4EC75BB69A6D';
  882. // refill\RefillFactory::instance()->notify('lingzh',$input);
  883. }
  884. public function testAfandnewPhone()
  885. {
  886. $providers = new refill\afandnew\RefillPhone([]);
  887. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  888. // $resp = $providers->query(['order_sn' => '45371617101073876975', 'ch_trade_no' => '33018443659736309']);
  889. $params = '{"amount":"100","carrierOrderNo":null,"mobile":"18500608333","orderNo":"45371617101073876975","orderStatus":3,"sign":"8DE392AD6B4730AD9EE0FC2B95BBDF17","tradeNo":"33018443659736309"}';
  890. $input = json_decode($params, true);
  891. refill\RefillFactory::instance()->notify('afandnew', $input);
  892. }
  893. public function testYifaPhone()
  894. {
  895. $providers = new refill\yifa\RefillPhone([]);
  896. $resp = $providers->add(15120035568, 5, 50, ['order_sn' => $this->make_sn()]);
  897. }
  898. public function testTianjtOil()
  899. {
  900. $cardno = 1000111100021211884;
  901. $providers = new refill\tianjt\RefillOil([]);
  902. $resp = $providers->add($cardno, 2, 500, ['order_sn' => $this->make_sn()]);
  903. }
  904. public function testWeitPhone()
  905. {
  906. $providers = new refill\weit\RefillPhone([]);
  907. for ($i = 0; $i <= 10; $i++) {
  908. $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
  909. }
  910. }
  911. public function testWeitCB()
  912. {
  913. $params['sign'] = 'af820c33472f4b571fa0c48483dfb975';
  914. $params['status'] = 0;
  915. $params['price'] = 30;
  916. $params['op_order_id'] = '';
  917. $params['mch_order_id'] = '900664281823957221';
  918. $params['pt_order_id'] = '2021011802434412825405218901';
  919. $params['pay_type'] = '';
  920. $params['tel'] = 18500608333;
  921. $params['mchid'] = 10014;
  922. $resp = http_request($this->mReqHost . "/mobile/refill_weit.php", $params, 'POST');
  923. }
  924. public function testYifaCB()
  925. {
  926. $body = '{"app_id":"e4a61b2acf1119c72c1ed9b61781494e","nonce_str":"OQMEBRQWJGPKOWYUXDVPTNMLEQJHXFWG","timestamp":1610275083,"order_sn":"161027325773032634","coder_order_sn":"60641610273255214687","isp_order_sn":null,"phone":"15120035568","amount":"94.000","discount":"0.9400","create_time":"2021-01-10 18:07:42","recharge_time":"","status":"fail","channel_id":3,"sign":"47278AD74EFA7F5FC8DE3A6D362C409B"}';
  927. $input = json_decode($body, true);
  928. refill\RefillFactory::instance()->notify('yifa', $input);
  929. }
  930. public function testBjbQuery()
  931. {
  932. $providers = new refill\bjb\RefillPhone([]);
  933. $refill_info = ['order_sn' => 110667993758599771, 'ch_trade_no' => 499, 'card_no' => 1000111200005252927];
  934. $resp = $providers->query($refill_info);
  935. }
  936. public function testXcQuery()
  937. {
  938. $providers = new refill\xc\RefillPhone([]);
  939. $refill_info = ['order_sn' => 950663423236726632, 'ch_trade_no' => 499, 'card_no' => 1000111200005252927];
  940. $resp = $providers->query($refill_info);
  941. }
  942. public function testTianjtQuery()
  943. {
  944. $providers = new refill\tianjt\RefillOil([]);
  945. $refill_info = ['order_sn' => 680665862267622221, 'ch_trade_no' => 499, 'card_no' => 1000111200005252927];
  946. $resp = $providers->query($refill_info);
  947. }
  948. public function testSaihuOil()
  949. {
  950. $providers = new refill\saihu\RefillOil([]);
  951. $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
  952. }
  953. public function testBdtOil()
  954. {
  955. $providers = new refill\bdt\RefillOil([]);
  956. $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => '200229600556618886']);
  957. }
  958. public function testGFTDOil()
  959. {
  960. $providers = new refill\gftd\RefillOil([]);
  961. $resp = $providers->add(1000111100020445281, mtopcard\SinopecCard, 100, ['order_sn' => $this->make_sn()]);
  962. }
  963. public function testYichangtOil()
  964. {
  965. $providers = new refill\yichangt\RefillOil([]);
  966. $resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 200, ['order_sn' => $this->make_sn()]);
  967. // $resp = $providers->query(['order_sn' => '87591620379260314044']);
  968. $data = '{"appid":"app570259129507","order_id":"M202105077888184428723706","merchant_order_id":"82231620378877155624","status":"3","cash":"100","time":"1620378961450","nonce":"2fad56d59a9f46d896c15b0cff74bc","signature":"57a6d24ec376b58bb433cfcf8528d53cb276eac8"}';
  969. $input = json_decode($data, true);
  970. // refill\RefillFactory::instance()->notify('yichangt',$input);
  971. }
  972. public function testGFTDCB()
  973. {
  974. $data = '{"channelOrderNumber":"79091610959059372019","orderNumber":"GYFL1610959060397001","message":"充值成功","storage":"881036222bd8f067ff47d248c75f4c8d","voucher":"","status":101}';
  975. $url = "http://192.168.1.220/mobile/refill_gftd.php?" . $data;
  976. $resp = http_post_data($url, $data, ['Content-Type: application/json;charset=UTF-8;', 'Accept:application/json;charset=UTF-8;']);
  977. }
  978. public function testJiecPhone()
  979. {
  980. $providers = new refill\jiec\RefillPhone([]);
  981. $resp = $providers->add('18500608333', 5, 30, ['order_sn' => $this->make_sn()]);
  982. }
  983. public function testBxtwtCB()
  984. {
  985. $data = '{"order_number":18219726,"shipping_status":4,"shipping_status_desc":"发货失败","shipping_status_message":"","sign":"863b4d972f2a4d39a9af7396879116c4","voucher":"","vouchertype":"","voucherurl":"","tradeNo":"100662475851197741"}';
  986. }
  987. public function testTianjtJDVerify()
  988. {
  989. $data = 'onlystr=920661883198026632&sign=533151e3f0dff5f507786aabc37b18f7&amt=100&notifyurl=https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_tianjt.php&jdno&cardtype=Sinoepc&batchid=26106&cardno=1000111100020654226&orgid=1590993600&status=3';
  990. $url = "http://192.168.1.220/mobile/refill_tianjt.php?" . $data;
  991. $resp = http_request($url);
  992. }
  993. public function testSuhcPDD()
  994. {
  995. $data = 'onlystr=820663525320005221&pddno&sign=4b1e8645f7541ced34855779448d9d52&amt=100&notifyurl=https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_suhcpdd.php&cardtype=Sinoepc&batchid=3&cardno=1000111100020445281&orgid=1590993600&status=2';
  996. $url = "https://www.xyzshops.cn/mobile/refill_suhcpdd.php?" . $data;
  997. $resp = http_request($url);
  998. }
  999. public function testSuhcTMVerify()
  1000. {
  1001. $data = 'onlystr=180662473867058221&sign=5ff5f95d54a89e78dbb49923f6b20c08&amt=100&notifyurl=https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_suhctm.php&cardtype=Sinoepc&batchid=3&cardno=1000111100020445281&orgid=1590993600&status=3';
  1002. $url = "https://www.xyzshops.cn/mobile/refill_suhctm.php?" . $data;
  1003. $resp = http_request($url);
  1004. }
  1005. public function testBeixtVerify()
  1006. {
  1007. $data = '{"order_number":18219726,"shipping_status":4,"shipping_status_desc":"发货失败","shipping_status_message":"","sign":"863b4d972f2a4d39a9af7396879116c4","voucher":"","vouchertype":"","voucherurl":"","tradeNo":"100662475851197741"}';
  1008. $url = "https://www.xyzshops.cn/mobile/refill_bxtwt.php";
  1009. $headers = ['Content-Type: application/json'];
  1010. $resp = http_post_data($url, $data, $headers);
  1011. }
  1012. public function testInput()
  1013. {
  1014. $input = fopen("php://input", "rw");
  1015. file_put_contents($input, 'xxxx');
  1016. $content = file_get_contents('php://input');
  1017. }
  1018. public function testUrl()
  1019. {
  1020. $data = 'onlystr=190661874318128632&sign=9eb60765c356341fd41c9bec6526f46a&amt=1000&notifyurl=https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_suhc.php&jdno&cardtype=Sinoepc&batchid=25940&cardno=1000111100012304048&orgid=1590993600&status=2';
  1021. $params = preg_split('/&/', $data);
  1022. foreach ($params as $pair) {
  1023. $kv = explode('=', $pair);
  1024. $count = count($kv);
  1025. if ($count === 1) {
  1026. $key = $kv[0];
  1027. $val = "";
  1028. } elseif ($count === 2) {
  1029. $key = $kv[0];
  1030. $val = $kv[1];
  1031. } else {
  1032. continue;
  1033. }
  1034. Log::record("{$key}:{$val}", Log::DEBUG);
  1035. }
  1036. }
  1037. public function testAddoil()
  1038. {
  1039. $url = $this->mReqHost . "/mobile/index.php";
  1040. $notifyurl = 'http://121.89.196.45/mobile/signature.php';
  1041. $params = ['mchid' => $this->mMchid,
  1042. 'cardno' => '1000111100020445281',
  1043. 'amount' => "100",
  1044. "act" => "refill",
  1045. "op" => "add",
  1046. 'order_sn' => $this->make_sn(),
  1047. 'notifyurl' => $notifyurl];
  1048. $resp = $this->send_md5($url, $params);
  1049. Log::record($resp, Log::DEBUG);
  1050. }
  1051. public function testBalance()
  1052. {
  1053. $url = $this->mReqHost . "/mobile/index.php";
  1054. $params = ['mchid' => 1092,
  1055. "act" => "refill",
  1056. "op" => "balance"];
  1057. $resp = $this->send_md5($url, $params);
  1058. Log::record($resp, Log::DEBUG);
  1059. }
  1060. public function testAddPhoe()
  1061. {
  1062. $url = $this->mReqHost . "/mobile/index.php";
  1063. $params = ['mchid' => $this->mMchid,
  1064. 'cardno' => '',
  1065. 'amount' => 100,
  1066. "act" => "refill",
  1067. "op" => "add",
  1068. 'order_sn' => '',
  1069. 'notifyurl' => "https://www.baoyung.com/api/unionservice/yezicharge"];
  1070. Log::record(json_encode($params), Log::DEBUG);
  1071. // $resp = $this->send_md5($url, $params);
  1072. }
  1073. public function testProxyHelper()
  1074. {
  1075. $phone = '13911129867';
  1076. $amount = 100;
  1077. $url = $this->mReqHost . "/mobile/index.php";
  1078. $params = ['mchid' => $this->mMchid,
  1079. 'cardno' => $phone,
  1080. 'amount' => $amount,
  1081. "act" => "refill",
  1082. "op" => "add",
  1083. 'order_sn' => $this->make_sn(),
  1084. 'notifyurl' => "https://xxx"];
  1085. $proxy = new refill_proxy("xxx");
  1086. $resp = $proxy->send($url, $params);
  1087. }
  1088. public function testGoods()
  1089. {
  1090. $req_url = $this->mReqHost . '/mobile/index.php';
  1091. $params = ['mchid' => $this->mMchid,
  1092. "act" => "refill",
  1093. "op" => "goods"];
  1094. $resp = $this->send_md5($req_url, $params);
  1095. }
  1096. public function testQueryFactory()
  1097. {
  1098. refill\RefillFactory::instance()->query(295);
  1099. }
  1100. public function testQuery()
  1101. {
  1102. //$req_url = 'https://www.xyzshops.cn/mobile/index.php';
  1103. // $notifyurl = 'https://www.xyzshops.cn/mobile/signature.php';
  1104. $req_url = BASE_SITE_URL . '/mobile/index.php';
  1105. $notifyurl = 'https://www.xyzshops.cn/mobile/signature.php';
  1106. $params = ['mchid' => 1,
  1107. "act" => "refill",
  1108. "op" => "query",
  1109. 'order_sn' => "13281476"];
  1110. $resp = $this->send_md5($req_url, $params);
  1111. }
  1112. public function testRemoveSession()
  1113. {
  1114. $resp = http_request(BASE_SITE_URL . "/mobile/signature.php", [], 'POST');
  1115. }
  1116. public function testTianjtCB()
  1117. {
  1118. // $notifyurl = BASE_SITE_URL . "/mobile/refill_tianjt.php";
  1119. $notifyurl = "https://www.xyzshops.cn/mobile/refill_tianjt.php";
  1120. // $notifyurl = "https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_tianjt.php";
  1121. $params = ['onlystr' => '690665858589475818',
  1122. 'amt' => 1000,
  1123. 'jdno' => '',
  1124. 'notifyurl' => $notifyurl,
  1125. 'cardtype' => 'Sinoepc',
  1126. 'batchid' => 30589,
  1127. 'cardno' => '1000113300007993287',
  1128. 'orgid' => '1590993600',
  1129. 'status' => 3];
  1130. $sign = $this->md5_sign($params);
  1131. $params['sign'] = $sign;
  1132. $resp = http_request($notifyurl, $params, 'POST');
  1133. Log::record($resp, Log::DEBUG);
  1134. }
  1135. public function testBJBCB()
  1136. {
  1137. $params = [
  1138. 'usr' => '13699279618',
  1139. 'ord' => '710662733975412771',
  1140. 'state' => '2',
  1141. 'bz' => '',
  1142. 'sgn' => 'AC9AFD254DE682D8440A97CA68B992DA'
  1143. ];
  1144. $resp = http_request("https://www.xyzshops.cn/mobile/refill_bjb.php", $params, 'POST');
  1145. }
  1146. public function testJiecCB()
  1147. {
  1148. $params['result'] = 'fail';
  1149. $params['msg'] = '0';
  1150. $params['order'] = 'null';
  1151. $params['phone_no'] = '18500608333';
  1152. $params['amount'] = '30.00';
  1153. $params['op_no'] = '800663597981819221';
  1154. $params['sign'] = '2510046895e8e12322c8a32547905ee9';
  1155. $resp = http_request($this->mReqHost . "/mobile/refill_jiec.php", $params, 'POST');
  1156. }
  1157. public function testZFKJ()
  1158. {
  1159. //带签名参数:mchid=1090&act=refill&op=add&cardno=100112121212212133
  1160. //&amount=10&order_sn=PH2012261356569433&
  1161. //notifyurl=https%3A%2F%2Fqzcz.edusahoo.com.cn%2Findex%2Findex%2Fcallback
  1162. //&sign=4a3ac5f9706e64aa70c6cab0fc5839d3
  1163. $params = ['mchid' => 1090,
  1164. 'cardno' => '100112121212212133',
  1165. 'amount' => '10',
  1166. "act" => "refill",
  1167. "op" => "add",
  1168. 'order_sn' => 'PH2012261356569433',
  1169. 'notifyurl' => 'https://qzcz.edusahoo.com.cn/index/index/callback'];
  1170. $resp = $this->send_md5(BASE_SITE_URL . '/mobile/index.php', $params);
  1171. }
  1172. protected function check_empty($value)
  1173. {
  1174. if (!isset($value))
  1175. return true;
  1176. if ($value === null)
  1177. return true;
  1178. if (trim($value) === "")
  1179. return true;
  1180. return false;
  1181. }
  1182. public function testcreateSign()
  1183. {
  1184. $params['act'] = 'refill';
  1185. $params['amount'] = '30';
  1186. $params['cardno'] = '18500972879';
  1187. $params['mchid'] = '10175';
  1188. $params['notifyurl'] = 'https://su.emgot.com/union/coco/rechargeNotify';
  1189. $params['op'] = 'add';
  1190. $params['order_sn'] = '20210706125001412243513';
  1191. $params['quality'] = 7;
  1192. $sign = $this->md5_sign($params);
  1193. }
  1194. public function testCheckphone()
  1195. {
  1196. $check = function ($phone) {
  1197. $url = 'https://mobileempty.shumaidata.com/mobileempty';
  1198. $params['mobile'] = $phone;
  1199. $headers = array();
  1200. array_push($headers, "Authorization:APPCODE " . '8f92d951293f4d2ea48ff86d5a70c537');
  1201. $resp = http_request($url, $params, 'GET', false, $headers);
  1202. $resp = json_decode($resp, true);
  1203. if ($resp['success'] == true && $resp['code'] == 200) {
  1204. Log::record("data phone:{$phone} , status : {$resp['data']['status']}", Log::DEBUG);
  1205. if (in_array($resp['data']['status'], [0, 3, 4, 5])) {
  1206. return false;
  1207. }
  1208. } else {
  1209. Log::record("data phone:{$phone} , 不支持的号段", Log::DEBUG);
  1210. }
  1211. };
  1212. $check(17801048874);
  1213. }
  1214. public function testCtSign()
  1215. {
  1216. $params['act'] = 'refill';
  1217. $params['amount'] = 1;
  1218. $params['cardno'] = 18888888888;
  1219. $params['mchid'] = 1101;
  1220. $params['op'] = 'add';
  1221. $params['notifyurl'] = '';
  1222. $params['order_sn'] = '1231212';
  1223. $sign = $this->md5_sign($params);
  1224. }
  1225. private function md5_sign($params)
  1226. {
  1227. ksort($params);
  1228. $body = "";
  1229. $i = 0;
  1230. foreach ($params as $k => $v) {
  1231. if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
  1232. if ($i == 0) {
  1233. $body .= "{$k}" . "=" . urlencode($v);
  1234. } else {
  1235. $body .= "&" . "{$k}" . "=" . urlencode($v);
  1236. }
  1237. $i++;
  1238. }
  1239. }
  1240. $body .= "&key=BcuXVAbW3KstGRWh6EdMMoFIfq9XKUW0";
  1241. return md5($body);
  1242. }
  1243. public function testCallMech()
  1244. {
  1245. $logic = Logic('queue');
  1246. $logic->NotifyMerchantComplete(['order_id' => 18171, 'manual' => true]);
  1247. }
  1248. //docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefill::testCallMech)( .*)?$/" --test-suffix TestRefill.php /var/www/html/test
  1249. private function send($url, $params)
  1250. {
  1251. $mchid = $params['mchid'];
  1252. $pri_key = BASE_DATA_PATH . "/api/merchant/key/{$mchid}_pri.pem";
  1253. $key = file_get_contents($pri_key);
  1254. $pri = openssl_get_privatekey($key);
  1255. $body = $this->body($params);
  1256. openssl_sign($body, $signed, $pri);
  1257. $sign = base64_encode($signed);
  1258. $params['sign'] = $sign;
  1259. $resp = http_request($url, $params, 'POST');
  1260. Log::record("resp:{$resp}", Log::DEBUG);
  1261. }
  1262. private function send_md5($url, $params)
  1263. {
  1264. $body = $this->body($params);
  1265. $body .= "&key={$this->mKey}";
  1266. $params['sign'] = md5($body);
  1267. $resp = http_request($url, $params, 'POST');
  1268. Log::record("resp:{$resp}", Log::DEBUG);
  1269. return $resp;
  1270. }
  1271. public function testCardType()
  1272. {
  1273. $cardno = '1000111100021211884';
  1274. $ret = preg_match('/^1[0-9]{18}$/', $cardno, $matches);
  1275. }
  1276. public function testMtrand()
  1277. {
  1278. }
  1279. public function testHttpRefill()
  1280. {
  1281. $mchid = '000001';
  1282. $pri_key = BASE_DATA_PATH . "/api/merchant/key/{$mchid}_pri.pem";
  1283. $key = file_get_contents($pri_key);
  1284. $pri = openssl_get_privatekey($key);
  1285. $params = ['MCHID' => $mchid, 'cardno' => '1000111100021211884', 'amt' => "100", "act" => "refill", "op" => "addoil"];
  1286. $body = $this->body($params);
  1287. openssl_sign($body, $signed, $pri);
  1288. $sign = base64_encode($signed);
  1289. $params['sign'] = $sign;
  1290. $resp = http_request(BASE_SITE_URL . "/mobile/index.php", $params, 'POST');
  1291. }
  1292. private function body($params)
  1293. {
  1294. ksort($params);
  1295. $body = "";
  1296. $i = 0;
  1297. foreach ($params as $k => $v) {
  1298. if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
  1299. if ($i == 0) {
  1300. $body .= "{$k}" . "=" . urlencode($v);
  1301. } else {
  1302. $body .= "&" . "{$k}" . "=" . urlencode($v);
  1303. }
  1304. $i++;
  1305. }
  1306. }
  1307. return $body;
  1308. }
  1309. private function checkEmpty($value)
  1310. {
  1311. if (!isset($value))
  1312. return true;
  1313. if ($value === null)
  1314. return true;
  1315. if (trim($value) === "")
  1316. return true;
  1317. return false;
  1318. }
  1319. public function testKsort()
  1320. {
  1321. $age = ["Peter" => "35", "Ben" => "37", "Joe" => "43"];
  1322. ksort($age);
  1323. foreach ($age as $x => $x_value) {
  1324. echo "Key=" . $x . ", Value=" . $x_value;
  1325. echo "<br>";
  1326. }
  1327. }
  1328. public function testip()
  1329. {
  1330. $model_merchant = Model('merchant');
  1331. $merchant_info = $model_merchant->getMerchantInfo(['mchid' => 1]);
  1332. $ipwhitelist = unserialize($merchant_info['ip_white_list']);
  1333. $res = json_encode($ipwhitelist);
  1334. }
  1335. //测试向内部店提交订单,可先屏蔽其它充值通道
  1336. public function testAddoilToInnerStore()
  1337. {
  1338. $url = $this->mReqHost . "/mobile/index.php";
  1339. $notifyurl = BASE_SITE_URL . '/mobile/signature.php';
  1340. $params = ['mchid' => 1,
  1341. 'cardno' => '1000111100020445281',
  1342. 'amount' => "1000",
  1343. "act" => "refill",
  1344. "op" => "add",
  1345. 'order_sn' => $this->make_sn(),
  1346. 'notifyurl' => $notifyurl];
  1347. $resp = $this->send_md5($url, $params);
  1348. Log::record($resp, Log::DEBUG);
  1349. }
  1350. public function testRefillInnerCB()
  1351. {
  1352. $params = ['state_type' => 'order_cancel', 'order_id' => 311, 'channel_name' => 'lx'];
  1353. $resp = http_request(BASE_SITE_URL . '/mobile/refill_inner.php', $params, 'POST');
  1354. }
  1355. public function testArgs()
  1356. {
  1357. Log::record($_SERVER['argv'], Log::DEBUG);
  1358. }
  1359. public function testCall()
  1360. {
  1361. $order_id = 14974;
  1362. QueueClient::async_push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => true], 10);
  1363. }
  1364. public function testSyncconfig()
  1365. {
  1366. $name_val_cfg = function ($items) {
  1367. $result = [];
  1368. foreach ($items as $item) {
  1369. $name = $item->name();
  1370. $result[$name] = $item;
  1371. }
  1372. return $result;
  1373. };
  1374. $name_val_row = function ($items) {
  1375. $result = [];
  1376. foreach ($items as $item) {
  1377. $name = $item['name'];
  1378. $result[$name] = $item;
  1379. }
  1380. return $result;
  1381. };
  1382. $match = function ($all, $cur) {
  1383. $insert = [];
  1384. foreach ($all as $key => $value) {
  1385. if (!array_key_exists($key, $cur)) {
  1386. $insert[] = $key;
  1387. }
  1388. }
  1389. return $insert;
  1390. };
  1391. $inserter = function ($mod, $type, $names) {
  1392. foreach ($names as $name) {
  1393. $data = ['name' => $name, 'type' => $type];
  1394. $mod->insert($data);
  1395. }
  1396. };
  1397. $providers = refill\RefillFactory::instance()->providers();
  1398. $oils = $name_val_cfg($providers['oil']);
  1399. $phones = $name_val_cfg($providers['phone']);
  1400. $mod_prov = Model('refill_provider');
  1401. $oil_items = $mod_prov->getProviderList(['type' => 1]);
  1402. $oil_items = $name_val_row($oil_items);
  1403. $oil_inserts = $match($oils, $oil_items);
  1404. $phone_items = $mod_prov->getProviderList(['type' => 2]);
  1405. $phone_items = $name_val_row($phone_items);
  1406. $phone_inserts = $match($phones, $phone_items);
  1407. $inserter($mod_prov, 1, $oil_inserts);
  1408. $inserter($mod_prov, 2, $phone_inserts);
  1409. }
  1410. public function testStat()
  1411. {
  1412. $model_refill_order = Model('refill_order');
  1413. $stat = Model('')->table('refill_order,vr_order')->join('inner')
  1414. ->on('refill_order.order_id=vr_order.order_id')
  1415. ->field('sum(refill_amount) as refill_amounts , sum(channel_amount) as channel_amounts , sum(mch_amount) as mch_amounts')
  1416. ->where([])->select();
  1417. }
  1418. public function testRefillGoods()
  1419. {
  1420. $goods = refill\RefillFactory::instance()->goods();
  1421. }
  1422. private function make_mobile()
  1423. {
  1424. $no = "1" . mt_rand(3000000000, 3999999999);
  1425. return $no;
  1426. }
  1427. private function refill_info($card_no, $card_type)
  1428. {
  1429. $data = rcache($card_no, 'cardrefill-');
  1430. if (empty($data)) {
  1431. $mod_topcard = Model('topcard');
  1432. $ret = $mod_topcard->get_card($card_no);
  1433. if (empty($ret)) {
  1434. $bind_phone = $this->make_mobile();
  1435. $mod_topcard->add($card_no, $card_type, time(), $bind_phone);
  1436. $data['bind_phone'] = $bind_phone;
  1437. $data['refill_time'] = time();
  1438. $data['times'] = 0;
  1439. wcache($card_no, $data, 'cardrefill-');
  1440. } else {
  1441. $val = $ret[0];
  1442. $data['bind_phone'] = $val['bind_phone'];
  1443. $data['refill_time'] = time();
  1444. $data['times'] = 0;
  1445. }
  1446. }
  1447. return $data;
  1448. }
  1449. public function testGetMobile()
  1450. {
  1451. $card_no = '1000119000001679247';
  1452. $card_type = 1;
  1453. $info = $this->refill_info($card_no, $card_type);
  1454. }
  1455. private function check_mchorder($mchid, $mch_order)
  1456. {
  1457. if (empty($mch_order)) {
  1458. return true;
  1459. } else {
  1460. $refill_order = Model('refill_order');
  1461. $ret = $refill_order->getOrderInfo(['mchid' => $mchid, 'mch_order' => $mch_order]);
  1462. return empty($ret);
  1463. }
  1464. }
  1465. public function testCheckMchorder()
  1466. {
  1467. $ret = $this->check_mchorder(1, '13281475');
  1468. }
  1469. public function testMakemobile()
  1470. {
  1471. $mobile = refill\util::make_mobile();
  1472. $ret = refill\util::set_black('1000111100020445281');
  1473. }
  1474. public function testLoadBlack()
  1475. {
  1476. $path = BASE_DATA_PATH . "/log";
  1477. $names = ['20210119-mobile.log',
  1478. '20210120-mobile.log', '20210121-mobile.log', '20210122-mobile.log', '20210123-mobile.log',
  1479. '20210124-mobile.log', '20210125-mobile.log'];
  1480. foreach ($names as $name) {
  1481. $file_name = $path . "/" . $name;
  1482. refill\util::black_from_log($file_name);
  1483. }
  1484. }
  1485. public function testStats()
  1486. {
  1487. $date = date('Y-m-d', time());
  1488. $today = strtotime("{$date}");
  1489. $times_begin = function ($start) {
  1490. $times = [];
  1491. $begin = $start;
  1492. for ($i = 0; $i < 7; $i++) {
  1493. $times[] = $begin;
  1494. $begin -= 86400;
  1495. }
  1496. return $times;
  1497. };
  1498. $reader = function ($mchid, $time) {
  1499. $cond['mchid'] = $mchid;
  1500. $cond['inner_status'] = 0;
  1501. $cond['refill_order.order_time'] = ['between', [$time, $time + 86400 - 1]];
  1502. $items = Model('')->table('refill_order,vr_order')->join('inner')
  1503. ->on('refill_order.order_id=vr_order.order_id')
  1504. ->field('count(*) as order_count, vr_order.order_state, sum(mch_amount) as mch_amounts')
  1505. ->group('vr_order.order_state')
  1506. ->where($cond)->select();
  1507. return $items;
  1508. };
  1509. $begins = $times_begin($today);
  1510. $mchid = 10096;
  1511. // $states = rcache($this->mchid() , 'refillstat-');
  1512. $states = unserialize($states ?? "");
  1513. if (empty($states)) $states = [];
  1514. $result = [];
  1515. $cache = [];
  1516. foreach ($begins as $begin) {
  1517. if (array_key_exists($begin, $states)) {
  1518. $item = $states[$begin];
  1519. } else {
  1520. $item = $reader($mchid, $begin);
  1521. }
  1522. $result[$begin] = $item;
  1523. //判断item 中充值中的状态是否为0,为0的情况下放进cache
  1524. $cache = $item;
  1525. }
  1526. wcache($this->mchid(), $cache, 'refillstat-');
  1527. return $result;
  1528. }
  1529. public function testNotifyx()
  1530. {
  1531. $mch_cache = rcache("merchant-notify", 'refill-');
  1532. $caches = empty($mch_cache['data']) ? [] : unserialize($mch_cache['data']);
  1533. $new_caches = [];
  1534. $merchants = Model('merchant')->getMerchantList([], '', '', 'merchant.*,member.available_predeposit', "0,1000");
  1535. foreach ($merchants as $merchant) {
  1536. $mchid = $merchant['mchid'];
  1537. $phone = $merchant['contact_phone'] ?? "";
  1538. $available_pd = intval($merchant['available_predeposit']);
  1539. $alarm_pd = intval($merchant['alarm_amount']) < 10000 ? 10000 : intval($merchant['alarm_amount']);
  1540. if (array_key_exists($mchid, $caches)) {
  1541. $mch_cache = $caches[$mchid];
  1542. } else {
  1543. $mch_cache = ['last_time' => 0, 'send_count' => 0];
  1544. }
  1545. if (!empty($phone) && ($available_pd < $alarm_pd)) {
  1546. $counts = $mch_cache['send_count'];
  1547. if (($mch_cache['last_time'] + 300 < time()) && $counts < 5) {
  1548. $mch_cache = ['last_time' => time(), 'send_count' => $counts + 1];
  1549. QueueClient::push('sendSMS', ['mobile' => $merchant['contact_phone'],
  1550. 'type' => 'balance_warning', 'datas' => [date("m月d日H时"), $merchant['available_predeposit']]]);
  1551. }
  1552. } else {
  1553. $mch_cache = ['last_time' => 0, 'send_count' => 0];
  1554. }
  1555. $new_caches[$mchid] = $mch_cache;
  1556. }
  1557. wcache("merchant-notify", ['data' => serialize($new_caches)], 'refill-');
  1558. }
  1559. public function testReadChannel()
  1560. {
  1561. refill\RefillFactory::instance()->read_channel();
  1562. }
  1563. public function testAllow()
  1564. {
  1565. $allow = refill\RefillFactory::instance()->allow(10096, 1, 100);
  1566. }
  1567. public function testCheckData()
  1568. {
  1569. $str = '|2|110667993758599771-充值失败|';
  1570. // $str = '0|提交成功|-36557.7400';
  1571. // if(preg_match( '/^-*[0-9]{1,3}\|[\x{4e00}-\x{9fa5}]+\|-*[0-9]+\.*[0-9]+$/u',$str,$matches)) {
  1572. // return true;
  1573. // }
  1574. // if(preg_match('/^[0-3]\|[0-9]+-*[\x{4e00}-\x{9fa5}]+\|[0-9]*$/u',$str,$matches)){
  1575. // return true;
  1576. // }
  1577. // return false;
  1578. $resp = ltrim($str, '|');
  1579. $resp = explode('|', $resp);
  1580. if (count($resp) != 3) {
  1581. return [false, '返回值错误'];
  1582. }
  1583. }
  1584. public function testErrre()
  1585. {
  1586. $line = '[13 2021-01-24 16:07:03] DEBUG: type = application/json;charset=utf-8, content={"channelOrderNumber":"610664819621371793","orderNumber":"GYFL1611475621525437","message":"充值失败","signature":"6c28c15b9ce2b2243742ecebbd929ac5","status":109}';
  1587. $ret = preg_match('/[\w\W]+"channelOrderNumber":"(?P<order_sn>[^"]+)"[\w\W]+"message":"(?P<message>[\x{4e00}-\x{9fa5}]+)"[\w\W]+"status":109/u', $line, $matches);
  1588. }
  1589. public function testExpolode()
  1590. {
  1591. $x = "HTTP-504";
  1592. [$type,$code] = explode('-',$x);
  1593. }
  1594. public function testMchctl()
  1595. {
  1596. $ctl = new refill\mchctl();
  1597. }
  1598. public function testAsyncadd()
  1599. {
  1600. $x = \refill\util::async_add(['xxxx' => 1],4);
  1601. }
  1602. }
  1603. //docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefill::testLoadBlack)( .*)?$/" --test-suffix TestRefill.php /var/www/html/test
  1604. //docker-compose -f ./docker-compose-dev.yml run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefill::testCall)( .*)?$/" --test-suffix TestRefill.php /var/www/html/test