TestRefill.php 80 KB

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