TestRefill.php 88 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016
  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 testFeinimoshu_hf()
  238. {
  239. $providers = new refill\feinimoshu_hf\RefillPhone([]);
  240. // $resp = $providers->query(['order_sn' => '3708210680873565742704']);
  241. $resp = $providers->balance();
  242. }
  243. public function testFeiniaoPhone()
  244. {
  245. $providers = new refill\feiniao\RefillPhone([]);
  246. // $order_sn = $this->make_sn();
  247. // Log::record($order_sn, Log::DEBUG);
  248. // $resp = $providers->add('13699279618', 4, 50, ['order_sn' => $order_sn]);
  249. $resp = $providers->query(['order_sn' => '28641617178590981824']);
  250. $params['result'] = 'fail';
  251. $params['msg'] = '0';
  252. $params['order'] = 'null';
  253. $params['phone_no'] = '18500608333';
  254. $params['amount'] = '100.00';
  255. $params['op_no'] = '64591617090761169983';
  256. $params['settle'] = '0';
  257. $params['sign'] = '907d2640f96e8d78d59202d090ddb470';
  258. // refill\RefillFactory::instance()->notify('feiniao',$params);
  259. }
  260. public function testTongyPhone()
  261. {
  262. $providers = new refill\tongy\RefillPhone([]);
  263. // $resp = $providers->add('18500608333', 5, 30, ['order_sn' => '690653407667699667', 'order_id' => 248, 'buyer_id' => 52667]);
  264. $params['UserId'] = '100857';
  265. $params['ShopId'] = '300000';
  266. $params['SysOrderId'] = '21070215141210085700010';
  267. $params['OrderId'] = '9241650678554051429291';
  268. $params['State'] = '5';
  269. $params['Timestamp'] = '1625210740472';
  270. $params['sign'] = 'C5C4E888A3B678470071CDA6DC31719D';
  271. $params['ParValue'] = '100.0000';
  272. $params['VoucherType'] = '';
  273. $params['VoucherContent'] = '';
  274. $params['CreateTime'] = '2021-07-02 15:14:12';
  275. $params['CompleteTime'] = '2021-07-02 15:25:40';
  276. refill\RefillFactory::instance()->notify('tongy',$params);
  277. }
  278. public function testWeiyiPhone()
  279. {
  280. $providers = new refill\weiyi\RefillPhone([]);
  281. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  282. // $resp = $providers->query(['order_sn' => '90401621489214002876']);
  283. $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"}';
  284. $params = json_decode($body , true);
  285. refill\RefillFactory::instance()->notify('weiyi',$params);
  286. }
  287. public function testWeiyimanPhone()
  288. {
  289. $providers = new refill\weiyiman\RefillPhone([]);
  290. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  291. // $resp = $providers->query(['order_sn' => '47591620898269370373']);
  292. $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"}';
  293. $params = json_decode($data , true);
  294. refill\RefillFactory::instance()->notify('weiyiman',$params);
  295. }
  296. public function testWeiyiWtPhone()
  297. {
  298. $providers = new refill\weiyiwt\RefillPhone([]);
  299. // $resp = $providers->add(18074608795, 6, 50, ['order_sn' => $this->make_sn()]);
  300. // $resp = $providers->query(['order_sn' => '38451621924366009924']);
  301. $body = '{"szOrderId":"38451621924366009924","fSalePrice":"47.25","szAgentId":"200016","nFlag":"2","szVerifyString":"a0b5bfc0bbf6c121a4cd74d9ecb2427d","szPhoneNum":"18074608795","szRtnMsg":"1000000083421052514441119833","nDemo":"50"}';
  302. $params = json_decode($body , true);
  303. refill\RefillFactory::instance()->notify('weiyiwt',$params);
  304. }
  305. public function testXiaochuangPhone()
  306. {
  307. $providers = new refill\xiaochuang\RefillPhone([]);
  308. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  309. // $resp = $providers->query(['order_sn' => '84891623028826872085']);
  310. $body = '{"fail_msg":"","order_sn":"84891623028826872085","order_status":"4","p_order_sn":"2021060709203558011797441162","sign":"E842203C3CA48E924D60B1B56AB93C3B"}';
  311. $params = json_decode($body , true);
  312. refill\RefillFactory::instance()->notify('xiaochuang',$params);
  313. }
  314. public function testYintengPhone()
  315. {
  316. $providers = new refill\yinteng\RefillPhone([]);
  317. // $resp = $providers->add(18074608795, 6, 50, ['order_sn' => $this->make_sn()]);
  318. // $resp = $providers->query(['order_sn' => '49631623737966351874']);
  319. $data = '{"szOrderId":"49631623737966351874","fSalePrice":"47.35","szAgentId":"200009","nFlag":"2","szVerifyString":"01c5fafb1d67175f0533b69a762286e8","szPhoneNum":"18074608795","szRtnMsg":"1000000083421061514495400262","nDemo":"50"}';
  320. $params = json_decode($data , true);
  321. refill\RefillFactory::instance()->notify('yinteng',$params);
  322. }
  323. public function testMoxjPhone()
  324. {
  325. $providers = new refill\moxj\RefillPhone([]);
  326. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  327. $resp = $providers->query(['order_sn' => '91131623906171663147']);
  328. $data = '{"result":"fail","msg":"0","order":"null","phone_no":"18500608333","amount":"50.0","op_no":"84901623900668776864","sign":"896b54914a07b814573d7f6cc403848a"}';
  329. $params = json_decode($data , true);
  330. // refill\RefillFactory::instance()->notify('moxj',$params);
  331. }
  332. public function testMoxj_fsPhone()
  333. {
  334. $providers = new refill\moxj_fs\RefillPhone([]);
  335. // $resp = $providers->add(15139608757, 4, 100, ['order_sn' => $this->make_sn()]);
  336. // $resp = $providers->query(['order_sn' => '42741624242693157165']);
  337. // $data = '{"amount":"100","charge_type":"2","code":"1","partner_id":"58","phone":"15139608757","sign":"30d193dba4101e50851ed0efabb75fb1","partner_order_no":"42741624242693157165","official_order_id":"20210621103211948830"}';
  338. // $params = json_decode($data , true);
  339. // refill\RefillFactory::instance()->notify('moxj_fs',$params);
  340. $resp = $providers->balance();
  341. }
  342. public function testZanzanquickPhone()
  343. {
  344. $providers = new refill\zanzanquick\RefillPhone([]);
  345. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  346. // $resp = $providers->query(['order_sn' => '90831623925322675223']);
  347. $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"}';
  348. $params = json_decode($data , true);
  349. refill\RefillFactory::instance()->notify('zanzanquick',$params);
  350. }
  351. public function testFengyemanPhone()
  352. {
  353. $providers = new refill\fengyeman\RefillPhone([]);
  354. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  355. // $resp = $providers->query(['order_sn' => '46221624265179185139']);
  356. $data = '{"order_id":"46221624265179185139","mchid":"HF67a65_10008","tel":"18500608333","price":"50.00","sign":"2bb4ed5edc97ba7f60cf3848aab82cf4","out_order_id":"206877995456","status":"1"}';
  357. $params = json_decode($data , true);
  358. refill\RefillFactory::instance()->notify('fengyeman',$params);
  359. }
  360. public function testMoxj_ydPhone()
  361. {
  362. $providers = new refill\moxj_yd\RefillPhone([]);
  363. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  364. // $resp = $providers->query(['order_sn' => '52101624413125875436']);
  365. // $data = '{"customer_order_no":"47651624412877257722","status":1,"merchant_id":"76505818","sign":"c185a0f2152b3ac3ee3f29009dec5a6b"}';
  366. // $params = json_decode($data , true);
  367. // refill\RefillFactory::instance()->notify('moxj_yd',$params);
  368. $resp = $providers->balance();
  369. }
  370. public function testXingzyPhone()
  371. {
  372. $providers = new refill\xingzy\RefillPhone([]);
  373. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  374. $resp = $providers->query(['order_sn' => '76791624441423287373', 'ch_trade_no' => '210623174333941000']);
  375. $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}';
  376. $params = json_decode($data , true);
  377. // refill\RefillFactory::instance()->notify('xingzy',$params);
  378. }
  379. public function testYuanmaiPhone()
  380. {
  381. $providers = new refill\yuanmai\RefillPhone([]);
  382. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  383. // $resp = $providers->query(['order_sn' => '24231624865882625203', 'ch_trade_no' => '210623174333941000']);
  384. $data = '{"orderid":"24231624865882625203","status":"2","ordermoney":"50","sign":"94be5b1754ffcc7f0fe1551072146941","spsno":""}';
  385. $params = json_decode($data, true);
  386. refill\RefillFactory::instance()->notify('yuanmai',$params);
  387. }
  388. public function testLangkePhone()
  389. {
  390. $providers = new refill\langke\RefillPhone([]);
  391. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  392. $resp = $providers->query(['order_sn' => '29461624952660047520', 'ch_trade_no' => '210623174333941000']);
  393. $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"}';
  394. $params = json_decode($data, true);
  395. // refill\RefillFactory::instance()->notify('langke',$params);
  396. }
  397. public function testYunlingdsPhone()
  398. {
  399. $providers = new refill\yunlingds\RefillPhone([]);
  400. // $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
  401. // $resp = $providers->query(['order_sn' => '85351624961920020593']);
  402. $data = '{"orderid":"OWS21062918188862392","sporderid":"85351624961920020593","userid":"10002623","merchantsubmittime":"20210629181929","resultno":"1","parvalue":"30","remark1":"AW20210629181906yRAvM","payno":"AW20210629181906yRAvM","fundbalance":"-28.59","sign":"11369509ADCF2A2612B3531A15049BDD"}';
  403. $params = json_decode($data, true);
  404. refill\RefillFactory::instance()->notify('yunlingds',$params);
  405. }
  406. public function testLingzhmanPhone()
  407. {
  408. $providers = new refill\lingzhman\RefillPhone([]);
  409. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  410. // $resp = $providers->query(['order_sn' => '29771625215707976538']);
  411. // $data = '{"orderNo":"F2107021536431562574","status":"019","consumerNo":"60191625211393862930","voucherNo":null,"mobile":"18500608333"}';
  412. // $params = json_decode($data, true);
  413. // refill\RefillFactory::instance()->notify('lingzhman',$params);
  414. $resp = $providers->balance();
  415. }
  416. public function testQijutangPhone()
  417. {
  418. $providers = new refill\qijutang\RefillPhone([]);
  419. for ($i=1;$i<2;$i++) {
  420. $resp = $providers->add(13699279618, 4, 100, ['order_sn' => $this->make_sn()]);
  421. }
  422. // $resp = $providers->query(['order_sn' => '51501625218912512231']);
  423. $data = '{"szOrderId":"51501625218912512231","fSalePrice":"28.44","szAgentId":"200010","nFlag":"3","szVerifyString":"20cf16c6bb239e2a703d0bf3e5ef2d5a","szPhoneNum":"18500608333","szRtnMsg":"","nDemo":"30"}';
  424. $params = json_decode($data, true);
  425. // refill\RefillFactory::instance()->notify('qijutang',$params);
  426. }
  427. public function testLingzhman48Phone()
  428. {
  429. $providers = new refill\lingzhman48\RefillPhone([]);
  430. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  431. // $resp = $providers->query(['order_sn' => '49951625814151937287']);
  432. $data = '{"orderNo":"F2107091503134670764","status":"020","consumerNo":"49951625814151937287","voucherNo":null,"mobile":"18500608333"}';
  433. $params = json_decode($data, true);
  434. refill\RefillFactory::instance()->notify('lingzhman48',$params);
  435. }
  436. public function testcangbuPhone()
  437. {
  438. $providers = new refill\cangbu\RefillPhone([]);
  439. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  440. // $resp = $providers->query(['order_sn' => '35041626071052333060']);
  441. // $data = '{"customerId":"112","tmporder":"35041626071052333060","orderno":"s16260710607417944801112","number":"18500608333","money":"100","amount":"94.9000","code":"1","cardno":"","voucher":"110103307042107121424210550266","sign":"de463c3d389a4afe4a2c58257972121a"}';
  442. // $params = json_decode($data, true);
  443. // refill\RefillFactory::instance()->notify('cangbu',$params);
  444. $resp = $providers->query_balance();
  445. }
  446. public function testCangbukami()
  447. {
  448. $providers = new refill\cangbukami\RefillPhone([]);
  449. // $resp = $providers->add(18500608333, 5, 20, ['order_sn' => $this->make_sn()]);
  450. $resp = $providers->query(['order_sn' => '23231627380108954478']);
  451. }
  452. public function testTongykamiPhone()
  453. {
  454. $providers = new refill\tongykami\RefillPhone([]);
  455. // $resp = $providers->add(18500608333, 5, 20, ['order_sn' => $this->make_sn()]);
  456. $resp = $providers->query(['order_sn' => '26961626077050756648']);
  457. $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"}';
  458. $params = json_decode($data, true);
  459. // refill\RefillFactory::instance()->notify('tongykami',$params);
  460. }
  461. public function testTongluPhone()
  462. {
  463. $providers = new refill\tonglu\RefillPhone([]);
  464. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  465. $resp = $providers->query(['order_sn' => '22961616468561936356']);
  466. // $body = '{"order_no":"22961616468561936356","order_status":"5","phone_no":"18500608333","amount":5000,"time_paid":1616468856287,"order_cert_no":"","paid":false,"order_id":"20210323966497008"}';
  467. // $sign = '9E41F52F612D60EBB654B3A5D1E2F1E5';
  468. // $params = json_decode($body , true);
  469. // $params['sign'] = $sign;
  470. // refill\RefillFactory::instance()->notify('tonglu',$params);
  471. }
  472. public function testSialan()
  473. {
  474. $providers = new refill\sialan\RefillPhone([]);
  475. // $resp = $providers->add(13699279618, 4, 10, ['order_sn' => $this->make_sn()]);
  476. // $resp = $providers->query(['order_sn' => '79651627436983840352', 'card_no' => 13699279618]);
  477. $body = '{"cpid":"39780","order_no":"21072809494539780728903528","mobile":"13699279618","amount":"10","status":"success","sz_order_no":"2021072822001158391454773955","ret_para":"79651627436983840352","sign":"aa7e8a2e589660e98319c5546cb432fa"}';
  478. $params = json_decode($body, true);
  479. refill\RefillFactory::instance()->notify('sialan', $params);
  480. }
  481. public function testMoxj_new()
  482. {
  483. $providers = new refill\moxj_new\RefillPhone([]);
  484. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  485. // $resp = $providers->query(['order_sn' => '33301627887529587739', 'card_no' => 13699279618]);
  486. // $body = '{"code":"2101","official_order_no":"0","partner_no":"300459017","partner_order_no":"33301627887529587739","phone":"18500608333","amount":"30","isp":"cucc","charge_time":"0","sign":"A512D612C823DFBCA9B4BC42134CC164"}';
  487. // $params = json_decode($body, true);
  488. // refill\RefillFactory::instance()->notify('moxj_new', $params);
  489. $resp = $providers->balance();
  490. }
  491. public function testKangkai()
  492. {
  493. $providers = new refill\kangkai\RefillPhone([]);
  494. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  495. // $resp = $providers->query(['order_sn' => '25431627898461762024']);
  496. // $body = '{"TaskID":"267459","Mobile":"18500608333","Status":"5","ReportTime":"2021-08-02T18:02:01.777","ReportCode":"7:","OutTradeNo":"25431627898461762024","Price":"44.2500","ReceiptNum":"","Sign":"f0934a621fd0b076373f77a9bf8d7051"}';
  497. // $params = json_decode($body, true);
  498. // refill\RefillFactory::instance()->notify('kangkai', $params);
  499. $resp = $providers->balance();
  500. }
  501. public function testLechong()
  502. {
  503. $providers = new refill\lechong\RefillPhone([]);
  504. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  505. // $resp = $providers->query(['order_sn' => '55641627902450221838']);
  506. // $body = '{"sellerid":"55641627902450221838","agentcode":"202108021753","account":"MTg1MDA2MDgzMzM=","value":"50","payvalue":"47.8500","voucher":"","createtime":"20210802190739","endtime":"20210802191008","state":"4","remark":"","time":"20210802191008","sign":"0e2d69318d03871d887debd498cc50f2"}';
  507. // $params = json_decode($body, true);
  508. // refill\RefillFactory::instance()->notify('lechong', $params);
  509. $resp = $providers->balance();
  510. }
  511. public function testXinhengyang()
  512. {
  513. $providers = new refill\xinhengyang\RefillPhone([]);
  514. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  515. // $resp = $providers->query(['order_sn' => '50441628062235230398']);
  516. // $resp = $providers->balance();
  517. $body = '{"szOrderId":"50441628062235230398","fSalePrice":"28.68","szAgentId":"200026","nFlag":"3","szVerifyString":"0166cec8496c59b377744ef5dd9e02dc","szPhoneNum":"18500608333","szRtnMsg":"","nDemo":"30"}';
  518. $params = json_decode($body, true);
  519. refill\RefillFactory::instance()->notify('xinhengyang', $params);
  520. }
  521. public function testAmingjd()
  522. {
  523. // $providers = new refill\amingjd\RefillPhone([]);
  524. // $resp = $providers->add(13699279618, 5, 30, ['order_sn' => $this->make_sn()]);
  525. // $resp = $providers->query(['order_sn' => '42301616475989518588']);
  526. $body = '{"order_id":"83321616478215494884","mchid":"10003","tel":"13699279618","price":"30.00","sign":"01c49620c155a80bc43cecc2b1651868","status":"0","out_order_id":"0"}';
  527. $params = json_decode($body, true);
  528. refill\RefillFactory::instance()->notify('amingjd', $params);
  529. }
  530. public function testAmingjdmanPhone()
  531. {
  532. $providers = new refill\amingjdman\RefillPhone([]);
  533. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  534. // $resp = $providers->query(['order_sn' => '82741619577673758623']);
  535. $body = '{"order_id":"82741619577673758623","mchid":"10045","tel":"13699279618","price":"30.00","sign":"2fe55fb4d4b2acc2e98137adb82fa57e","status":"0","out_order_id":"0"}';
  536. $params = json_decode($body, true);
  537. refill\RefillFactory::instance()->notify('amingjdman', $params);
  538. }
  539. public function testWeishengyWtPhone()
  540. {
  541. $providers = new refill\weishengywt\RefillPhone([]);
  542. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  543. // $resp = $providers->query(['order_sn' => '27681620538125370652']);
  544. $data = '{"szOrderId":"27681620538125370652","fSalePrice":"47.5","szAgentId":"200045","nFlag":"2","szVerifyString":"92fafec121b77518d539ed9f5005fdf9","szPhoneNum":"18500608333","szRtnMsg":"110103308032105091328520502948","nDemo":"50"}';
  545. $params = json_decode($data, true);
  546. refill\RefillFactory::instance()->notify('weishengywt', $params);
  547. }
  548. public function testWeishengyJDPhone()
  549. {
  550. $providers = new refill\weishengyjd\RefillPhone([]);
  551. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  552. // $resp = $providers->query(['order_sn' => '14261620887423822879']);
  553. $data = '{"szOrderId":"14261620887423822879","fSalePrice":"44.0","szAgentId":"200050","nFlag":"3","szVerifyString":"3cceef390602058e1d2fdde2e07636a4","szPhoneNum":"18500608333","szRtnMsg":"","nDemo":"50"}';
  554. $params = json_decode($data, true);
  555. refill\RefillFactory::instance()->notify('weishengyjd', $params);
  556. }
  557. public function testYeziPhone()
  558. {
  559. $providers = new refill\yezi\RefillPhone([]);
  560. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  561. // $resp = $providers->query(['order_sn' => '35261620988265145105']);
  562. $data = '{"mchid":"10147","order_sn":"35261620988265145105","amount":"50.00","cardno":"18500608333","trade_no":"6363570674332280422825","idcard":"","card_name":"","official_sn":"","message":"","state":"CANCEL","sign":"b79f2ddbb5b7eef98f414585a5bd2cde"}';
  563. $params = json_decode($data, true);
  564. refill\RefillFactory::instance()->notify('yezi', $params);
  565. }
  566. public function testWeishengysixPhone()
  567. {
  568. $providers = new refill\weishengysix\RefillPhone([]);
  569. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  570. // $resp = $providers->query(['order_sn' => '17171624434289348649']);
  571. $data = '{"szOrderId":"17171624434289348649","fSalePrice":"44.5","szAgentId":"200074","nFlag":"2","szVerifyString":"fa5735090199d97e6a50e7f3083be111","szPhoneNum":"18500608333","szRtnMsg":"AW2021062315464045A27","nDemo":"50"}';
  572. $params = json_decode($data, true);
  573. refill\RefillFactory::instance()->notify('weishengysix', $params);
  574. }
  575. public function testHaohaoOil()
  576. {
  577. $providers = new refill\haohao\RefillOil([]);
  578. // $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
  579. $data['amount'] = 20000;
  580. $data['mchId'] = 467253;
  581. $data['mchOrderNo'] = '5514850674656058146707';
  582. $data['mobile'] = '';
  583. $data['sign'] = 'F282D68972A437F3CEB3516BB2FDD19A';
  584. $data['operator'] = 4;
  585. $data['number'] = '1000113200020348885';
  586. $data['thirdOrderNo'] = '2317184088901537792';
  587. $data['directStatus'] = 5;
  588. // $input = json_decode($data, true);
  589. refill\RefillFactory::instance()->notify('haohao',$data);
  590. }
  591. public function testJuzhuoOil()
  592. {
  593. $providers = new refill\juzhuo\RefillOil([]);
  594. // $resp = $providers->add(1000111100021211884, 2, 200, ['order_sn' => $this->make_sn()]);
  595. // $resp = $providers->query(['order_sn' => '20121621578185774451']);
  596. // $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"}';
  597. // $input = json_decode($data, true);
  598. $data['channelsort'] = 'OIL_CARD';
  599. $data['channelno'] = '';
  600. $data['onlystr'] = '0772770675248490450497';
  601. $data['channel'] = 'JD';
  602. $data['sign'] = '4a9f113bfa4aa2d155de7136ca0afe2d';
  603. $data['amt'] = '100';
  604. $data['notifyurl'] = 'http://121.89.212.167/racc/callback/lingzh/juzhuo.php';
  605. $data['cardtype'] = 'Sinoepc';
  606. $data['cardno'] = '1000113200029532754';
  607. $data['orgid'] = '6095171500';
  608. $data['account'] = '';
  609. $data['status'] = '3';
  610. refill\RefillFactory::instance()->notify('juzhuo',$data);
  611. }
  612. public function testZeheng()
  613. {
  614. $providers = new refill\zeheng\RefillOil([]);
  615. // $resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 100, ['order_sn' => $this->make_sn()]);
  616. // $resp = $providers->query(['order_sn' => '45951620814813332604']);
  617. $data = '{"extOrderId":"45951620814813332604","orderId":"R2021051218240000192928","salePrice":"96.8000","sign":"0d6b9641eaf8d36ecba82cfefc6aa307","state":"4"}';
  618. $input = json_decode($data, true);
  619. refill\RefillFactory::instance()->notify('zeheng',$input);
  620. }
  621. public function testXiaoniu()
  622. {
  623. $providers = new refill\xiaoniu\RefillOil([]);
  624. // $resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 500, ['order_sn' => $this->make_sn()]);
  625. // $resp = $providers->query(['order_sn' => '39911625819031601073']);
  626. $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"}';
  627. $input = json_decode($data, true);
  628. refill\RefillFactory::instance()->notify('xiaoniu',$input);
  629. }
  630. public function testYingdian()
  631. {
  632. $providers = new refill\yingdian\RefillOil([]);
  633. // $resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 200, ['order_sn' => $this->make_sn()]);
  634. // $resp = $providers->query(['order_sn' => '94691626688509004979']);
  635. $resp = $providers->query(['order_sn' => '45671626687631917892']);
  636. $data = '{"orderNo":"94691626688509004979","vouchers":"[\"2421071918070053\"]","orderId":"63400811-e877-11eb-a89f-00163e147a9b","spOrderNo":"052423YK241720210719175503603473","status":"SUCCESS"}';
  637. $input = json_decode($data, true);
  638. // refill\RefillFactory::instance()->notify('yingdian',$input);
  639. }
  640. public function testZhenqi()
  641. {
  642. $providers = new refill\zhenqi\RefillPhone([]);
  643. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  644. $resp = $providers->query(['order_sn' => '42611626267945146350']);
  645. $data = '{"out_trade_no":"14001626266194932132","create_time":"1626266201","sp_order_no":"110103353232107142044550619272","status":"1","sign":"3C2F8ED40EEB9151D2117E2DA1FA64AA"}';
  646. $input = json_decode($data, true);
  647. // refill\RefillFactory::instance()->notify('zhenqi',$input);
  648. }
  649. public function testYunsuoyaofs()
  650. {
  651. $providers = new refill\yunsuoyaofs\RefillPhone([]);
  652. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  653. // $resp = $providers->query(['order_sn' => '85681626322286098163']);
  654. $data = '{"orderid":"AMU21071512111544162","sporderid":"85681626322286098163","userid":"10002671","merchantsubmittime":"20210715121132","resultno":"9","parvalue":"50","remark1":"","payno":"","fundbalance":"-47.7","sign":"45ECFF26E84F7DC3BFFDCFAFF3B1E561"}';
  655. $input = json_decode($data, true);
  656. refill\RefillFactory::instance()->notify('yunsuoyaofs',$input);
  657. }
  658. public function testZhenqi1m()
  659. {
  660. $providers = new refill\zhenqi1m\RefillPhone([]);
  661. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  662. // $resp = $providers->query(['order_sn' => '45611626334593130605']);
  663. $data = '{"out_trade_no":"45611626334593130605","create_time":"1626334606","sp_order_no":"202107152200117311004426885635","status":"1","sign":"CF8EB902F60B76591C898C991361BB4D"}';
  664. $input = json_decode($data, true);
  665. refill\RefillFactory::instance()->notify('zhenqi1m',$input);
  666. }
  667. public function testHongxudayz()
  668. {
  669. $providers = new refill\hongxudayz\RefillPhone([]);
  670. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  671. // $resp = $providers->query(['order_sn' => '78221626445316011524']);
  672. $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":""}';
  673. $input = json_decode($data, true);
  674. refill\RefillFactory::instance()->notify('hongxudayz',$input);
  675. }
  676. public function testHongxudagy()
  677. {
  678. $providers = new refill\hongxudagy\RefillPhone([]);
  679. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  680. // $resp = $providers->query(['order_sn' => '86521626446475240639']);
  681. $data = '{"sale_value":"29.76","supply_id":"18790079","order_status":"0","mer_oid":"86521626446475240639","phone_no":"18500608333","mer_id":"bjgyfl","sale_discount":"0.992","sign":"9BDA608364D4E08C653E8C6798151AC2","cp_id":"","product_no":"HFLTBJ_****00003000","product_face":"30","cp_ctype":""}';
  682. $input = json_decode($data, true);
  683. refill\RefillFactory::instance()->notify('hongxudagy',$input);
  684. }
  685. public function testHongxudayz996()
  686. {
  687. $providers = new refill\hongxudayz996\RefillPhone([]);
  688. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  689. // $resp = $providers->query(['order_sn' => '73691626753698522472']);
  690. $data = '{"sale_value":"29.88","supply_id":"18888477","order_status":"3","mer_oid":"73691626753698522472","phone_no":"18500608333","mer_id":"bjyz2","sale_discount":"0.996","sign":"8E98EA2B6B81D832EBA8F89611A3F9B9","cp_id":"","product_no":"HFLTBJ_****00003000","product_face":"30","cp_ctype":""}';
  691. $input = json_decode($data, true);
  692. refill\RefillFactory::instance()->notify('hongxudayz996',$input);
  693. }
  694. public function testHongxudagy996()
  695. {
  696. $providers = new refill\hongxudagy996\RefillPhone([]);
  697. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  698. // $resp = $providers->query(['order_sn' => '87681626758209689412']);
  699. $data = '{"sale_value":"29.88","supply_id":"18889758","order_status":"3","mer_oid":"87681626758209689412","phone_no":"18500608333","mer_id":"bjgy2","sale_discount":"0.996","sign":"0CBA5B8F34D40914CB86CC74BE8EF15B","cp_id":"","product_no":"HFLTBJ_****00003000","product_face":"30","cp_ctype":""}';
  700. $input = json_decode($data, true);
  701. refill\RefillFactory::instance()->notify('hongxudagy996',$input);
  702. }
  703. public function testYunchonggong()
  704. {
  705. $providers = new refill\yunchonggong\RefillPhone([]);
  706. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  707. // $resp = $providers->query(['order_sn' => '96481626678323726593']);
  708. $data = '{"szOrderId":"96481626678323726593","fSalePrice":"28.5","szAgentId":"200009","nFlag":"2","szVerifyString":"3f9cdc789c61646cf13079ee0464c6a0","szPhoneNum":"18500608333","szRtnMsg":"110103353092107191505440605544","nDemo":"30"}';
  709. $input = json_decode($data, true);
  710. refill\RefillFactory::instance()->notify('yunchonggong',$input);
  711. }
  712. public function testBingdht()
  713. {
  714. $providers = new refill\bingdht\RefillPhone([]);
  715. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  716. // $resp = $providers->query(['order_sn' => '62491626761331174794']);
  717. $data = '{"szOrderId":"62491626761331174794","fSalePrice":"45.25","szAgentId":"200044","nFlag":"3","szVerifyString":"46745191d31b16ee7978a7f5554357d6","szPhoneNum":"18500608333","szRtnMsg":"","nDemo":"50"}';
  718. $input = json_decode($data, true);
  719. refill\RefillFactory::instance()->notify('bingdht',$input);
  720. }
  721. public function testYuecheng()
  722. {
  723. $providers = new refill\yuecheng\RefillPhone([]);
  724. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  725. // $resp = $providers->query(['order_sn' => '45101626776884387650']);
  726. $data = '{"ste":"0","cpid":"982100572516571","sign":"E0347851C8395B4FC08DA51FC650ABDA","dm":"49.6500","pid":"HFLTBJ_****00005000","oid":"45101626776884387650","sid":"200014603779","ct":"","tf":"50.0000","nb":"1","cardinfo":"","salevalue":"49.6500","pn":"18500608333","cid":"gyhf"}';
  727. $input = json_decode($data, true);
  728. refill\RefillFactory::instance()->notify('yuecheng',$input);
  729. }
  730. public function testPrice()
  731. {
  732. $amounts = [10, 20, 30, 50, 100, 200, 300, 500];
  733. $rate = 0.994;
  734. foreach ($amounts as $amount) {
  735. $price[] = $amount * $rate;
  736. }
  737. }
  738. public function testCallbackDir()
  739. {
  740. $path = "/callback";
  741. $file = "/mobile/callback/refill_call.php";
  742. $basename = basename($file);
  743. $tmp = "{$path}/{$basename}.php";
  744. return file_exists($tmp);
  745. }
  746. public function testWeisPhone()
  747. {
  748. $providers = new refill\weisyd\RefillPhone([]);
  749. $resp = $providers->add(17801048874, 4, 10, ['order_sn' => $this->make_sn()]);
  750. }
  751. public function testXcPhone()
  752. {
  753. $providers = new refill\xc\RefillPhone([]);
  754. $resp = $providers->add(13699279618, 5, 100, ['order_sn' => $this->make_sn()]);
  755. // $resp = $providers->query(['order_sn' => '87961616926444043617']);
  756. $params['pay_orderid'] = '87961616926444043617';
  757. $params['pay_iphone'] = '18500608333';
  758. $params['pay_money'] = '100';
  759. $params['wt_orderid'] = '202103281816121070';
  760. $params['status'] = '1';
  761. $params['sign'] = 'f7be2e859a5a6dc7b1a8273361617752';
  762. // refill\RefillFactory::instance()->notify('xc',$params);
  763. }
  764. public function testAfandPhone()
  765. {
  766. $providers = new refill\afand\RefillPhone([]);
  767. // for ($i = 3; $i > 0; --$i) {
  768. $resp = $providers->query(['order_sn' => '540668612768904780']);
  769. // }
  770. }
  771. public function testAfandengPhone()
  772. {
  773. $providers = new refill\afandeng\RefillPhone([]);
  774. // for ($i = 5; $i > 0; --$i) {
  775. $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  776. // }
  777. // $resp = $providers->query(['order_sn' => '20941616115610023539']);
  778. // $params['usr'] = 'afandeng';
  779. // $params['ord'] = '20941616115610023539';
  780. // $params['state'] = '2';
  781. // $params['bz'] = '';
  782. // $params['sgn'] = 'BA2C9D379C3EB648A0B7AAB3A21A3F6A';
  783. // refill\RefillFactory::instance()->notify('afandeng',$params);
  784. }
  785. public function testWantongPhone()
  786. {
  787. $providers = new refill\wantong\RefillPhone([]);
  788. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  789. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  790. $resp = $providers->query(['order_sn' => '26061618988575301841']);
  791. $data = '{"uid":"97396885","order_no":"26061618988575301841","mobile_order_no":"","phone_number":"13699279618","face_value":"3000","status":"9","sign":"1a019202656cf4feffe715025fab01bf"}';
  792. $input = json_decode($data, true);
  793. // refill\RefillFactory::instance()->notify('wantong',$input);
  794. }
  795. public function testXunyinPhone()
  796. {
  797. $providers = new refill\xunyin\RefillPhone([]);
  798. // $resp = $providers->add(17703711950, 6, 30, ['order_sn' => $this->make_sn()]);
  799. $resp = $providers->query(['order_sn' => '76831617176125893158']);
  800. $xml = '<Order><cpid>8417</cpid><orderid>40591617173295524057</orderid><order_no>14784226</order_no><msg>充值中</msg><Code>0000</Code><Cards/></Order>';
  801. $resp = $providers->xmlToArray($xml);
  802. if ($resp['Code'] === '0000') {
  803. return [true, $resp['order_no'], false];
  804. } else {
  805. return [false, $resp['msg'], false];
  806. }
  807. // $params['ext'] = '';
  808. // $params['code'] = '8888';
  809. // $params['sign'] = '428ac223cf3a1f6f3d382aac754e8e17';
  810. // $params['statemes'] = '成功';
  811. // $params['id'] = '76831617176125893158';
  812. // $params['userid'] = '8417';
  813. // $params['operatorid'] = '1000000083421033115583773201';
  814. // $params['status'] = 'SUCCESS';
  815. // refill\RefillFactory::instance()->notify('xunyin',$params);
  816. }
  817. public function testFenshengPhone()
  818. {
  819. $file = BASE_HELPER_RAPI_PATH . "/qianqian/RefillPhone.php";
  820. if(!file_exists($file)){
  821. Log::record("provider api file={$file} not exist.",Log::DEBUG);
  822. return false;
  823. } else {
  824. require_once($file);
  825. Log::record("file={$file} load success.",Log::DEBUG);
  826. }
  827. $providers = new refill\qianqian\RefillPhone([]);
  828. $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  829. // $resp = $providers->query(['order_sn' => '27511617764278021035']);
  830. // $datas = '[{"orderNo":"F2104071058069438461","status":"001","consumerNo":"27511617764278021035","voucherNo":"510490688023364042","mobile":"13699279618"}]';
  831. // $datas = json_decode($datas,true);
  832. // foreach ($datas as $data) {
  833. // refill\RefillFactory::instance()->notify('fensheng',$data);
  834. // }
  835. }
  836. public function testQianqianPhone()
  837. {
  838. $providers = new refill\fensheng\RefillPhone([]);
  839. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  840. $resp = $providers->query(['order_sn' => '27511617764278021035']);
  841. // $datas = '[{"orderNo":"F2104071058069438461","status":"001","consumerNo":"27511617764278021035","voucherNo":"510490688023364042","mobile":"13699279618"}]';
  842. // $datas = json_decode($datas,true);
  843. // foreach ($datas as $data) {
  844. // refill\RefillFactory::instance()->notify('fensheng',$data);
  845. // }
  846. }
  847. public function testQianqianmanPhone()
  848. {
  849. $providers = new refill\qianqianman\RefillPhone([]);
  850. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  851. // $resp = $providers->query(['order_sn' => '72011621236975003462']);
  852. $data = '{"orderNo":"F2105171538062539442","status":"019","consumerNo":"72011621236975003462","voucherNo":null,"mobile":"13699279618"}';
  853. $input = json_decode($data, true);
  854. refill\RefillFactory::instance()->notify('qianqianman',$input);
  855. }
  856. public function testRiyingPhone()
  857. {
  858. $providers = new refill\riying\RefillPhone([]);
  859. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  860. $resp = $providers->query(['ch_trade_no' => '2021041311120213187423105022']);
  861. $data = '{"UserId":"10050","SysOrderId":"2021041311120213187423105022","OrderId":"15641618283518423567","State":"4","Timestamp":"1618283565746","VoucherType":"1","VoucherContent":"511009928000087852","Sign":"a6ec70a3ea42baae941528398c6d0a43"}';
  862. $input = json_decode($data, true);
  863. // refill\RefillFactory::instance()->notify('riying',$input);
  864. }
  865. public function testWeishengyPhone()
  866. {
  867. $providers = new refill\weishengy\RefillPhone([]);
  868. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  869. // $resp = $providers->query(['order_sn' => '15551618590601301527']);
  870. $data = '{"masId":"699270071532654592","oids":"158877719094,166090529155,158887187476","orderNo":"62411618635377880788","orderPrice":"150.00","phone":"18500608333","sign":"3EC10A32FC4CCC976048E1164D0FCBF6","status":"1","time":"1618643281063","type":"2"}';
  871. $input = json_decode($data, true);
  872. refill\RefillFactory::instance()->notify('weishengy',$input);
  873. }
  874. public function testWailingPhone()
  875. {
  876. $providers = new refill\wailing\RefillPhone([]);
  877. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  878. $resp = $providers->query(['order_sn' => '73241618543784045618']);
  879. $data = '{"order_id":"73241618543784045618","mchid":"10045","tel":"13699279618","price":"30.00","sign":"4991de3e40f14c198b8c194455ea021b","status":"0","out_order_id":"0"}';
  880. $input = json_decode($data, true);
  881. // refill\RefillFactory::instance()->notify('wailing',$input);
  882. }
  883. public function testShengyingPhone()
  884. {
  885. $providers = new refill\shengying\RefillPhone([]);
  886. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  887. $resp = $providers->query(['order_sn' => '37571618805115582483']);
  888. $data = '{"TaskID":"129636","Mobile":"13699279618","Status":"4","ReportTime":"2021-04-19T12:06:16.050","ReportCode":"1:511531522026586295","OutTradeNo":"37571618805115582483","ReceiptNum":"511531522026586295","Sign":"a7f46a988bc8483091d94130804e5078"}';
  889. $input = json_decode($data, true);
  890. // refill\RefillFactory::instance()->notify('shengying',$input);
  891. }
  892. public function testYunlingPhone()
  893. {
  894. $providers = new refill\yunling\RefillPhone([]);
  895. // $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
  896. // $resp = $providers->query(['order_sn' => '73791623147517199719']);
  897. $data = '{"orderid":"EAF21060818183032772","sporderid":"73791623147517199719","userid":"10002504","merchantsubmittime":"20210608181912","resultno":"1","parvalue":"30","remark1":"1000000083421060818483137636","payno":"1000000083421060818483137636","fundbalance":"-28.59","sign":"8D77517AC3905ED88BF79EE789A5FA86"}';
  898. $input = json_decode($data, true);
  899. refill\RefillFactory::instance()->notify('yunling',$input);
  900. }
  901. public function testZhongstPhone()
  902. {
  903. $providers = new refill\zhongst\RefillPhone([]);
  904. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  905. // $resp = $providers->query(['order_sn' => '48941618981770389271']);
  906. $data = ' {"szOrderId":"66571619060147539784","fSalePrice":"46.5","szAgentId":"200030","nFlag":"2","szVerifyString":"c1e88701b89a4887996822d708bed5f5","szPhoneNum":"13699279618","szRtnMsg":"161122673971","nDemo":"50"}';
  907. $input = json_decode($data, true);
  908. refill\RefillFactory::instance()->notify('zhongst',$input);
  909. }
  910. public function testXunaoPhone()
  911. {
  912. $providers = new refill\xunao\RefillPhone([]);
  913. // $resp = $providers->add(18074608795, 6, 10, ['order_sn' => $this->make_sn()]);
  914. // $resp = $providers->query(['order_sn' => '40021619431386253803', 'card_no' => 18074608795, 'card_type' => 6]);
  915. $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"}';
  916. $input = json_decode($data, true);
  917. refill\RefillFactory::instance()->notify('xunao',$input);
  918. }
  919. public function testYonghePhone()
  920. {
  921. $providers = new refill\yonghe\RefillPhone([]);
  922. // $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
  923. // $resp = $providers->query(['order_sn' => '20461619597297972685']);
  924. $data = '{"szOrderId":"20461619597297972685","fSalePrice":"29.955","szAgentId":"200115","nFlag":"2","szVerifyString":"b5c292a13c5e67a9b850eb37239682ae","szPhoneNum":"13699279618","szRtnMsg":"2021042822001139701437383521","nDemo":"30"}';
  925. $input = json_decode($data, true);
  926. refill\RefillFactory::instance()->notify('yonghe',$input);
  927. }
  928. public function testJumiPhone()
  929. {
  930. $providers = new refill\jumi\RefillPhone([]);
  931. // $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
  932. // $resp = $providers->query(['order_sn' => '12161619768293529384']);
  933. $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"}';
  934. $input = json_decode($data, true);
  935. refill\RefillFactory::instance()->notify('jumi',$input);
  936. }
  937. public function testJumiOil()
  938. {
  939. $providers = new refill\jumi\RefillOil([]);
  940. // $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
  941. // $resp = $providers->query(['order_sn' => '29021620617872685187']);
  942. $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"}';
  943. $input = json_decode($data, true);
  944. refill\RefillFactory::instance()->notify('jumi',$input);
  945. }
  946. public function testFengyePhone()
  947. {
  948. $providers = new refill\fengye\RefillPhone([]);
  949. // $resp = $providers->add(18074608795, 6, 50, ['order_sn' => $this->make_sn()]);
  950. // $resp = $providers->query(['order_sn' => '53511620355988978053', 'card_no' => 18074608795, 'card_type' => 6]);
  951. $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"}';
  952. $input = json_decode($data, true);
  953. refill\RefillFactory::instance()->notify('fengye',$input);
  954. }
  955. public function testYunsuoyaoPhone()
  956. {
  957. $providers = new refill\yunsuoyao\RefillPhone([]);
  958. // $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
  959. $resp = $providers->query(['order_sn' => '20431621331092296201']);
  960. $data = '{"orderid":"RLU21051817441937847","sporderid":"20431621331092296201","userid":"10002501","merchantsubmittime":"20210518174858","resultno":"9","parvalue":"30","remark1":"","payno":"","fundbalance":"-28.74","sign":"426EAC103B79505BAE7AB3F16886F1A8"}';
  961. $input = json_decode($data, true);
  962. // refill\RefillFactory::instance()->notify('yunsuoyao',$input);
  963. }
  964. public function testAfdPhone()
  965. {
  966. $providers = new refill\afd\RefillPhone([]);
  967. // $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
  968. // $resp = $providers->query(['order_sn' => '71001621233525947994']);
  969. $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"}';
  970. $input = json_decode($data, true);
  971. refill\RefillFactory::instance()->notify('afd',$input);
  972. }
  973. public function testLuqianPhone()
  974. {
  975. $providers = new refill\luqian\RefillPhone([]);
  976. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  977. $resp = $providers->query(['order_sn' => '2829660672500596314764']);
  978. $data = '{"amount":"100","charge_type":"0","code":"1","partner_id":"38","phone":"18500608333","sign":"c2c86cccc73fa991a63c369e683c91f2","partner_order_no":"34101618897099329575","official_order_id":"110103308072104201338340278420"}';
  979. $input = json_decode($data, true);
  980. // refill\RefillFactory::instance()->notify('luqian',$input);
  981. }
  982. public function testAfandfsPhone()
  983. {
  984. $providers = new refill\afandfs\RefillPhone([]);
  985. // $resp = $providers->add(15139608757, 4, 30, ['order_sn' => $this->make_sn()]);
  986. $resp = $providers->query(['order_sn' => '65101618975926761630']);
  987. $data = '{"amount":"30","charge_type":"2","code":"1","partner_id":"52","phone":"15139608757","sign":"a7f54c1ac3e1af72f9fc849086cc4bec","partner_order_no":"65101618975926761630","official_order_id":"20210421113256628350"}';
  988. $input = json_decode($data, true);
  989. // refill\RefillFactory::instance()->notify('afandfs',$input);
  990. }
  991. public function testYunlingfsPhone()
  992. {
  993. $providers = new refill\yunlingfs\RefillPhone([]);
  994. // $resp = $providers->add(15139608757, 4, 50, ['order_sn' => $this->make_sn()]);
  995. $resp = $providers->query(['order_sn' => '79251623739433607563']);
  996. $data = '{"orderid":"BGC21061514434393910","sporderid":"79251623739433607563","userid":"10002543","merchantsubmittime":"20210615144434","resultno":"1","parvalue":"50","remark1":"20210615144420321813","payno":"20210615144420321813","fundbalance":"-47.65","sign":"6B9B7C15A3F9CBC773562327B6744B1E"}';
  997. $input = json_decode($data, true);
  998. // refill\RefillFactory::instance()->notify('yunlingfs',$input);
  999. }
  1000. public function testTianchengPhone()
  1001. {
  1002. $providers = new refill\tiancheng\RefillPhone([]);
  1003. $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
  1004. // $resp = $providers->query(['order_sn' => '15301619399212504464']);
  1005. $data = ' {"result":"fail","msg":"0","order":"null","phone_no":"13699279618","amount":"10","op_no":"84801619340283980506","settle":"0","sign":"D64039ED791920B08BDA9DD95700C0E6"}';
  1006. $input = json_decode($data, true);
  1007. // refill\RefillFactory::instance()->notify('tiancheng',$input);
  1008. }
  1009. public function testLingzhPhone()
  1010. {
  1011. $providers = new refill\lingzh\RefillPhone([]);
  1012. // $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
  1013. // $resp = $providers->query(['order_sn' => '59911615124025101286']);
  1014. $resp = $providers->balance();
  1015. // $input['usr'] = 1;
  1016. // $input['ord'] = '52741615119546453690';
  1017. // $input['bz'] = '';
  1018. // $input['state'] = 2;
  1019. // $input['sgn'] = 'FFCBB75C307154DD306F4EC75BB69A6D';
  1020. // refill\RefillFactory::instance()->notify('lingzh',$input);
  1021. }
  1022. public function testAfandnewPhone()
  1023. {
  1024. $providers = new refill\afandnew\RefillPhone([]);
  1025. // $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
  1026. // $resp = $providers->query(['order_sn' => '45371617101073876975', 'ch_trade_no' => '33018443659736309']);
  1027. $params = '{"amount":"100","carrierOrderNo":null,"mobile":"18500608333","orderNo":"45371617101073876975","orderStatus":3,"sign":"8DE392AD6B4730AD9EE0FC2B95BBDF17","tradeNo":"33018443659736309"}';
  1028. $input = json_decode($params, true);
  1029. refill\RefillFactory::instance()->notify('afandnew', $input);
  1030. }
  1031. public function testYifaPhone()
  1032. {
  1033. $providers = new refill\yifa\RefillPhone([]);
  1034. $resp = $providers->add(15120035568, 5, 50, ['order_sn' => $this->make_sn()]);
  1035. }
  1036. public function testTianjtOil()
  1037. {
  1038. $cardno = 1000111100021211884;
  1039. $providers = new refill\tianjt\RefillOil([]);
  1040. $resp = $providers->add($cardno, 2, 500, ['order_sn' => $this->make_sn()]);
  1041. }
  1042. public function testWeitPhone()
  1043. {
  1044. $providers = new refill\weit\RefillPhone([]);
  1045. for ($i = 0; $i <= 10; $i++) {
  1046. $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
  1047. }
  1048. }
  1049. public function testWeitCB()
  1050. {
  1051. $params['sign'] = 'af820c33472f4b571fa0c48483dfb975';
  1052. $params['status'] = 0;
  1053. $params['price'] = 30;
  1054. $params['op_order_id'] = '';
  1055. $params['mch_order_id'] = '900664281823957221';
  1056. $params['pt_order_id'] = '2021011802434412825405218901';
  1057. $params['pay_type'] = '';
  1058. $params['tel'] = 18500608333;
  1059. $params['mchid'] = 10014;
  1060. $resp = http_request($this->mReqHost . "/mobile/refill_weit.php", $params, 'POST');
  1061. }
  1062. public function testYifaCB()
  1063. {
  1064. $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"}';
  1065. $input = json_decode($body, true);
  1066. refill\RefillFactory::instance()->notify('yifa', $input);
  1067. }
  1068. public function testBjbQuery()
  1069. {
  1070. $providers = new refill\bjb\RefillPhone([]);
  1071. $refill_info = ['order_sn' => 110667993758599771, 'ch_trade_no' => 499, 'card_no' => 1000111200005252927];
  1072. $resp = $providers->query($refill_info);
  1073. }
  1074. public function testXcQuery()
  1075. {
  1076. $providers = new refill\xc\RefillPhone([]);
  1077. $refill_info = ['order_sn' => 950663423236726632, 'ch_trade_no' => 499, 'card_no' => 1000111200005252927];
  1078. $resp = $providers->query($refill_info);
  1079. }
  1080. public function testTianjtQuery()
  1081. {
  1082. $providers = new refill\tianjt\RefillOil([]);
  1083. $refill_info = ['order_sn' => 680665862267622221, 'ch_trade_no' => 499, 'card_no' => 1000111200005252927];
  1084. $resp = $providers->query($refill_info);
  1085. }
  1086. public function testSaihuOil()
  1087. {
  1088. $providers = new refill\saihu\RefillOil([]);
  1089. $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
  1090. }
  1091. public function testBdtOil()
  1092. {
  1093. $providers = new refill\bdt\RefillOil([]);
  1094. $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => '200229600556618886']);
  1095. }
  1096. public function testGFTDOil()
  1097. {
  1098. $providers = new refill\gftd\RefillOil([]);
  1099. $resp = $providers->add(1000111100020445281, mtopcard\SinopecCard, 100, ['order_sn' => $this->make_sn()]);
  1100. }
  1101. public function testYichangtOil()
  1102. {
  1103. $providers = new refill\yichangt\RefillOil([]);
  1104. $resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 200, ['order_sn' => $this->make_sn()]);
  1105. // $resp = $providers->query(['order_sn' => '87591620379260314044']);
  1106. $data = '{"appid":"app570259129507","order_id":"M202105077888184428723706","merchant_order_id":"82231620378877155624","status":"3","cash":"100","time":"1620378961450","nonce":"2fad56d59a9f46d896c15b0cff74bc","signature":"57a6d24ec376b58bb433cfcf8528d53cb276eac8"}';
  1107. $input = json_decode($data, true);
  1108. // refill\RefillFactory::instance()->notify('yichangt',$input);
  1109. }
  1110. public function testGFTDCB()
  1111. {
  1112. $data = '{"channelOrderNumber":"79091610959059372019","orderNumber":"GYFL1610959060397001","message":"充值成功","storage":"881036222bd8f067ff47d248c75f4c8d","voucher":"","status":101}';
  1113. $url = "http://192.168.1.220/mobile/refill_gftd.php?" . $data;
  1114. $resp = http_post_data($url, $data, ['Content-Type: application/json;charset=UTF-8;', 'Accept:application/json;charset=UTF-8;']);
  1115. }
  1116. public function testJiecPhone()
  1117. {
  1118. $providers = new refill\jiec\RefillPhone([]);
  1119. $resp = $providers->add('18500608333', 5, 30, ['order_sn' => $this->make_sn()]);
  1120. }
  1121. public function testBxtwtCB()
  1122. {
  1123. $data = '{"order_number":18219726,"shipping_status":4,"shipping_status_desc":"发货失败","shipping_status_message":"","sign":"863b4d972f2a4d39a9af7396879116c4","voucher":"","vouchertype":"","voucherurl":"","tradeNo":"100662475851197741"}';
  1124. }
  1125. public function testTianjtJDVerify()
  1126. {
  1127. $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';
  1128. $url = "http://192.168.1.220/mobile/refill_tianjt.php?" . $data;
  1129. $resp = http_request($url);
  1130. }
  1131. public function testSuhcPDD()
  1132. {
  1133. $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';
  1134. $url = "https://www.xyzshops.cn/mobile/refill_suhcpdd.php?" . $data;
  1135. $resp = http_request($url);
  1136. }
  1137. public function testSuhcTMVerify()
  1138. {
  1139. $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';
  1140. $url = "https://www.xyzshops.cn/mobile/refill_suhctm.php?" . $data;
  1141. $resp = http_request($url);
  1142. }
  1143. public function testBeixtVerify()
  1144. {
  1145. $data = '{"order_number":18219726,"shipping_status":4,"shipping_status_desc":"发货失败","shipping_status_message":"","sign":"863b4d972f2a4d39a9af7396879116c4","voucher":"","vouchertype":"","voucherurl":"","tradeNo":"100662475851197741"}';
  1146. $url = "https://www.xyzshops.cn/mobile/refill_bxtwt.php";
  1147. $headers = ['Content-Type: application/json'];
  1148. $resp = http_post_data($url, $data, $headers);
  1149. }
  1150. public function testInput()
  1151. {
  1152. $input = fopen("php://input", "rw");
  1153. file_put_contents($input, 'xxxx');
  1154. $content = file_get_contents('php://input');
  1155. }
  1156. public function testUrl()
  1157. {
  1158. $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';
  1159. $params = preg_split('/&/', $data);
  1160. foreach ($params as $pair) {
  1161. $kv = explode('=', $pair);
  1162. $count = count($kv);
  1163. if ($count === 1) {
  1164. $key = $kv[0];
  1165. $val = "";
  1166. } elseif ($count === 2) {
  1167. $key = $kv[0];
  1168. $val = $kv[1];
  1169. } else {
  1170. continue;
  1171. }
  1172. Log::record("{$key}:{$val}", Log::DEBUG);
  1173. }
  1174. }
  1175. public function testAddoil()
  1176. {
  1177. $url = $this->mReqHost . "/mobile/index.php";
  1178. $notifyurl = 'http://121.89.196.45/mobile/signature.php';
  1179. $params = ['mchid' => $this->mMchid,
  1180. 'cardno' => '1000111100020445281',
  1181. 'amount' => "100",
  1182. "act" => "refill",
  1183. "op" => "add",
  1184. 'order_sn' => $this->make_sn(),
  1185. 'notifyurl' => $notifyurl];
  1186. $resp = $this->send_md5($url, $params);
  1187. Log::record($resp, Log::DEBUG);
  1188. }
  1189. public function testBalance()
  1190. {
  1191. $url = $this->mReqHost . "/mobile/index.php";
  1192. $params = ['mchid' => 1092,
  1193. "act" => "refill",
  1194. "op" => "balance"];
  1195. $resp = $this->send_md5($url, $params);
  1196. Log::record($resp, Log::DEBUG);
  1197. }
  1198. public function testAddPhoe()
  1199. {
  1200. $url = $this->mReqHost . "/mobile/index.php";
  1201. $params = ['mchid' => $this->mMchid,
  1202. 'cardno' => '',
  1203. 'amount' => 100,
  1204. "act" => "refill",
  1205. "op" => "add",
  1206. 'order_sn' => '',
  1207. 'notifyurl' => "https://www.baoyung.com/api/unionservice/yezicharge"];
  1208. Log::record(json_encode($params), Log::DEBUG);
  1209. // $resp = $this->send_md5($url, $params);
  1210. }
  1211. public function testProxyHelper()
  1212. {
  1213. $phone = '13911129867';
  1214. $amount = 100;
  1215. $url = $this->mReqHost . "/mobile/index.php";
  1216. $params = ['mchid' => $this->mMchid,
  1217. 'cardno' => $phone,
  1218. 'amount' => $amount,
  1219. "act" => "refill",
  1220. "op" => "add",
  1221. 'order_sn' => $this->make_sn(),
  1222. 'notifyurl' => "https://xxx"];
  1223. $proxy = new refill_proxy("xxx");
  1224. $resp = $proxy->send($url, $params);
  1225. }
  1226. public function testGoods()
  1227. {
  1228. $req_url = $this->mReqHost . '/mobile/index.php';
  1229. $params = ['mchid' => $this->mMchid,
  1230. "act" => "refill",
  1231. "op" => "goods"];
  1232. $resp = $this->send_md5($req_url, $params);
  1233. }
  1234. public function testQueryFactory()
  1235. {
  1236. refill\RefillFactory::instance()->query(295);
  1237. }
  1238. public function testQuery()
  1239. {
  1240. //$req_url = 'https://www.xyzshops.cn/mobile/index.php';
  1241. // $notifyurl = 'https://www.xyzshops.cn/mobile/signature.php';
  1242. $req_url = BASE_SITE_URL . '/mobile/index.php';
  1243. $notifyurl = 'https://www.xyzshops.cn/mobile/signature.php';
  1244. $params = ['mchid' => 1,
  1245. "act" => "refill",
  1246. "op" => "query",
  1247. 'order_sn' => "13281476"];
  1248. $resp = $this->send_md5($req_url, $params);
  1249. }
  1250. public function testRemoveSession()
  1251. {
  1252. $resp = http_request(BASE_SITE_URL . "/mobile/signature.php", [], 'POST');
  1253. }
  1254. public function testTianjtCB()
  1255. {
  1256. // $notifyurl = BASE_SITE_URL . "/mobile/refill_tianjt.php";
  1257. $notifyurl = "https://www.xyzshops.cn/mobile/refill_tianjt.php";
  1258. // $notifyurl = "https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_tianjt.php";
  1259. $params = ['onlystr' => '690665858589475818',
  1260. 'amt' => 1000,
  1261. 'jdno' => '',
  1262. 'notifyurl' => $notifyurl,
  1263. 'cardtype' => 'Sinoepc',
  1264. 'batchid' => 30589,
  1265. 'cardno' => '1000113300007993287',
  1266. 'orgid' => '1590993600',
  1267. 'status' => 3];
  1268. $sign = $this->md5_sign($params);
  1269. $params['sign'] = $sign;
  1270. $resp = http_request($notifyurl, $params, 'POST');
  1271. Log::record($resp, Log::DEBUG);
  1272. }
  1273. public function testBJBCB()
  1274. {
  1275. $params = [
  1276. 'usr' => '13699279618',
  1277. 'ord' => '710662733975412771',
  1278. 'state' => '2',
  1279. 'bz' => '',
  1280. 'sgn' => 'AC9AFD254DE682D8440A97CA68B992DA'
  1281. ];
  1282. $resp = http_request("https://www.xyzshops.cn/mobile/refill_bjb.php", $params, 'POST');
  1283. }
  1284. public function testJiecCB()
  1285. {
  1286. $params['result'] = 'fail';
  1287. $params['msg'] = '0';
  1288. $params['order'] = 'null';
  1289. $params['phone_no'] = '18500608333';
  1290. $params['amount'] = '30.00';
  1291. $params['op_no'] = '800663597981819221';
  1292. $params['sign'] = '2510046895e8e12322c8a32547905ee9';
  1293. $resp = http_request($this->mReqHost . "/mobile/refill_jiec.php", $params, 'POST');
  1294. }
  1295. public function testZFKJ()
  1296. {
  1297. //带签名参数:mchid=1090&act=refill&op=add&cardno=100112121212212133
  1298. //&amount=10&order_sn=PH2012261356569433&
  1299. //notifyurl=https%3A%2F%2Fqzcz.edusahoo.com.cn%2Findex%2Findex%2Fcallback
  1300. //&sign=4a3ac5f9706e64aa70c6cab0fc5839d3
  1301. $params = ['mchid' => 1090,
  1302. 'cardno' => '100112121212212133',
  1303. 'amount' => '10',
  1304. "act" => "refill",
  1305. "op" => "add",
  1306. 'order_sn' => 'PH2012261356569433',
  1307. 'notifyurl' => 'https://qzcz.edusahoo.com.cn/index/index/callback'];
  1308. $resp = $this->send_md5(BASE_SITE_URL . '/mobile/index.php', $params);
  1309. }
  1310. protected function check_empty($value)
  1311. {
  1312. if (!isset($value))
  1313. return true;
  1314. if ($value === null)
  1315. return true;
  1316. if (trim($value) === "")
  1317. return true;
  1318. return false;
  1319. }
  1320. public function testcreateSign()
  1321. {
  1322. $params['act'] = 'refill';
  1323. $params['amount'] = '30';
  1324. $params['cardno'] = '18111516552';
  1325. $params['mchid'] = '10179';
  1326. $params['notifyurl'] = 'http://czapi2.1jinb.net/YeZiHCCallBackOrderServlet';
  1327. $params['op'] = 'add';
  1328. $params['order_sn'] = 'JFNOR10835056877';
  1329. $sign = $this->md5_sign($params);
  1330. }
  1331. public function testCheckphone()
  1332. {
  1333. $check = function ($phone) {
  1334. $url = 'https://mobileempty.shumaidata.com/mobileempty';
  1335. $params['mobile'] = $phone;
  1336. $headers = array();
  1337. array_push($headers, "Authorization:APPCODE " . '8f92d951293f4d2ea48ff86d5a70c537');
  1338. $resp = http_request($url, $params, 'GET', false, $headers);
  1339. $resp = json_decode($resp, true);
  1340. if ($resp['success'] == true && $resp['code'] == 200) {
  1341. Log::record("data phone:{$phone} , status : {$resp['data']['status']}", Log::DEBUG);
  1342. if (in_array($resp['data']['status'], [0, 3, 4, 5])) {
  1343. return false;
  1344. }
  1345. } else {
  1346. Log::record("data phone:{$phone} , 不支持的号段", Log::DEBUG);
  1347. }
  1348. };
  1349. $check(17801048874);
  1350. }
  1351. public function testCtSign()
  1352. {
  1353. $params['act'] = 'refill';
  1354. $params['amount'] = 1;
  1355. $params['cardno'] = 18888888888;
  1356. $params['mchid'] = 1101;
  1357. $params['op'] = 'add';
  1358. $params['notifyurl'] = '';
  1359. $params['order_sn'] = '1231212';
  1360. $sign = $this->md5_sign($params);
  1361. }
  1362. private function md5_sign($params)
  1363. {
  1364. ksort($params);
  1365. $body = "";
  1366. $i = 0;
  1367. foreach ($params as $k => $v) {
  1368. if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
  1369. if ($i == 0) {
  1370. $body .= "{$k}" . "=" . urlencode($v);
  1371. } else {
  1372. $body .= "&" . "{$k}" . "=" . urlencode($v);
  1373. }
  1374. $i++;
  1375. }
  1376. }
  1377. $body .= "&key=E63AFB19FA130AC0E35C5BD1C42470A5";
  1378. return md5($body);
  1379. }
  1380. public function testCallMech()
  1381. {
  1382. $logic = Logic('queue');
  1383. $logic->NotifyMerchantComplete(['order_id' => 18171, 'manual' => true]);
  1384. }
  1385. //docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefill::testCallMech)( .*)?$/" --test-suffix TestRefill.php /var/www/html/test
  1386. private function send($url, $params)
  1387. {
  1388. $mchid = $params['mchid'];
  1389. $pri_key = BASE_DATA_PATH . "/api/merchant/key/{$mchid}_pri.pem";
  1390. $key = file_get_contents($pri_key);
  1391. $pri = openssl_get_privatekey($key);
  1392. $body = $this->body($params);
  1393. openssl_sign($body, $signed, $pri);
  1394. $sign = base64_encode($signed);
  1395. $params['sign'] = $sign;
  1396. $resp = http_request($url, $params, 'POST');
  1397. Log::record("resp:{$resp}", Log::DEBUG);
  1398. }
  1399. private function send_md5($url, $params)
  1400. {
  1401. $body = $this->body($params);
  1402. $body .= "&key={$this->mKey}";
  1403. $params['sign'] = md5($body);
  1404. $resp = http_request($url, $params, 'POST');
  1405. Log::record("resp:{$resp}", Log::DEBUG);
  1406. return $resp;
  1407. }
  1408. public function testCardType()
  1409. {
  1410. $cardno = '1000111100021211884';
  1411. $ret = preg_match('/^1[0-9]{18}$/', $cardno, $matches);
  1412. }
  1413. public function testMtrand()
  1414. {
  1415. }
  1416. public function testHttpRefill()
  1417. {
  1418. $mchid = '000001';
  1419. $pri_key = BASE_DATA_PATH . "/api/merchant/key/{$mchid}_pri.pem";
  1420. $key = file_get_contents($pri_key);
  1421. $pri = openssl_get_privatekey($key);
  1422. $params = ['MCHID' => $mchid, 'cardno' => '1000111100021211884', 'amt' => "100", "act" => "refill", "op" => "addoil"];
  1423. $body = $this->body($params);
  1424. openssl_sign($body, $signed, $pri);
  1425. $sign = base64_encode($signed);
  1426. $params['sign'] = $sign;
  1427. $resp = http_request(BASE_SITE_URL . "/mobile/index.php", $params, 'POST');
  1428. }
  1429. private function body($params)
  1430. {
  1431. ksort($params);
  1432. $body = "";
  1433. $i = 0;
  1434. foreach ($params as $k => $v) {
  1435. if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
  1436. if ($i == 0) {
  1437. $body .= "{$k}" . "=" . urlencode($v);
  1438. } else {
  1439. $body .= "&" . "{$k}" . "=" . urlencode($v);
  1440. }
  1441. $i++;
  1442. }
  1443. }
  1444. return $body;
  1445. }
  1446. private function checkEmpty($value)
  1447. {
  1448. if (!isset($value))
  1449. return true;
  1450. if ($value === null)
  1451. return true;
  1452. if (trim($value) === "")
  1453. return true;
  1454. return false;
  1455. }
  1456. public function testKsort()
  1457. {
  1458. $age = ["Peter" => "35", "Ben" => "37", "Joe" => "43"];
  1459. ksort($age);
  1460. foreach ($age as $x => $x_value) {
  1461. echo "Key=" . $x . ", Value=" . $x_value;
  1462. echo "<br>";
  1463. }
  1464. }
  1465. public function testip()
  1466. {
  1467. $model_merchant = Model('merchant');
  1468. $merchant_info = $model_merchant->getMerchantInfo(['mchid' => 1]);
  1469. $ipwhitelist = unserialize($merchant_info['ip_white_list']);
  1470. $res = json_encode($ipwhitelist);
  1471. }
  1472. //测试向内部店提交订单,可先屏蔽其它充值通道
  1473. public function testAddoilToInnerStore()
  1474. {
  1475. $url = $this->mReqHost . "/mobile/index.php";
  1476. $notifyurl = BASE_SITE_URL . '/mobile/signature.php';
  1477. $params = ['mchid' => 1,
  1478. 'cardno' => '1000111100020445281',
  1479. 'amount' => "1000",
  1480. "act" => "refill",
  1481. "op" => "add",
  1482. 'order_sn' => $this->make_sn(),
  1483. 'notifyurl' => $notifyurl];
  1484. $resp = $this->send_md5($url, $params);
  1485. Log::record($resp, Log::DEBUG);
  1486. }
  1487. public function testRefillInnerCB()
  1488. {
  1489. $params = ['state_type' => 'order_cancel', 'order_id' => 311, 'channel_name' => 'lx'];
  1490. $resp = http_request(BASE_SITE_URL . '/mobile/refill_inner.php', $params, 'POST');
  1491. }
  1492. public function testArgs()
  1493. {
  1494. Log::record($_SERVER['argv'], Log::DEBUG);
  1495. }
  1496. public function testCall()
  1497. {
  1498. $order_id = 14974;
  1499. QueueClient::async_push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => true], 10);
  1500. }
  1501. public function testSyncconfig()
  1502. {
  1503. $name_val_cfg = function ($items) {
  1504. $result = [];
  1505. foreach ($items as $item) {
  1506. $name = $item->name();
  1507. $result[$name] = $item;
  1508. }
  1509. return $result;
  1510. };
  1511. $name_val_row = function ($items) {
  1512. $result = [];
  1513. foreach ($items as $item) {
  1514. $name = $item['name'];
  1515. $result[$name] = $item;
  1516. }
  1517. return $result;
  1518. };
  1519. $match = function ($all, $cur) {
  1520. $insert = [];
  1521. foreach ($all as $key => $value) {
  1522. if (!array_key_exists($key, $cur)) {
  1523. $insert[] = $key;
  1524. }
  1525. }
  1526. return $insert;
  1527. };
  1528. $inserter = function ($mod, $type, $names) {
  1529. foreach ($names as $name) {
  1530. $data = ['name' => $name, 'type' => $type];
  1531. $mod->insert($data);
  1532. }
  1533. };
  1534. $providers = refill\RefillFactory::instance()->providers();
  1535. $oils = $name_val_cfg($providers['oil']);
  1536. $phones = $name_val_cfg($providers['phone']);
  1537. $mod_prov = Model('refill_provider');
  1538. $oil_items = $mod_prov->getProviderList(['type' => 1]);
  1539. $oil_items = $name_val_row($oil_items);
  1540. $oil_inserts = $match($oils, $oil_items);
  1541. $phone_items = $mod_prov->getProviderList(['type' => 2]);
  1542. $phone_items = $name_val_row($phone_items);
  1543. $phone_inserts = $match($phones, $phone_items);
  1544. $inserter($mod_prov, 1, $oil_inserts);
  1545. $inserter($mod_prov, 2, $phone_inserts);
  1546. }
  1547. public function testStat()
  1548. {
  1549. $model_refill_order = Model('refill_order');
  1550. $stat = Model('')->table('refill_order,vr_order')->join('inner')
  1551. ->on('refill_order.order_id=vr_order.order_id')
  1552. ->field('sum(refill_amount) as refill_amounts , sum(channel_amount) as channel_amounts , sum(mch_amount) as mch_amounts')
  1553. ->where([])->select();
  1554. }
  1555. public function testRefillGoods()
  1556. {
  1557. $goods = refill\RefillFactory::instance()->goods();
  1558. }
  1559. private function make_mobile()
  1560. {
  1561. $no = "1" . mt_rand(3000000000, 3999999999);
  1562. return $no;
  1563. }
  1564. private function refill_info($card_no, $card_type)
  1565. {
  1566. $data = rcache($card_no, 'cardrefill-');
  1567. if (empty($data)) {
  1568. $mod_topcard = Model('topcard');
  1569. $ret = $mod_topcard->get_card($card_no);
  1570. if (empty($ret)) {
  1571. $bind_phone = $this->make_mobile();
  1572. $mod_topcard->add($card_no, $card_type, time(), $bind_phone);
  1573. $data['bind_phone'] = $bind_phone;
  1574. $data['refill_time'] = time();
  1575. $data['times'] = 0;
  1576. wcache($card_no, $data, 'cardrefill-');
  1577. } else {
  1578. $val = $ret[0];
  1579. $data['bind_phone'] = $val['bind_phone'];
  1580. $data['refill_time'] = time();
  1581. $data['times'] = 0;
  1582. }
  1583. }
  1584. return $data;
  1585. }
  1586. public function testGetMobile()
  1587. {
  1588. $card_no = '1000119000001679247';
  1589. $card_type = 1;
  1590. $info = $this->refill_info($card_no, $card_type);
  1591. }
  1592. private function check_mchorder($mchid, $mch_order)
  1593. {
  1594. if (empty($mch_order)) {
  1595. return true;
  1596. } else {
  1597. $refill_order = Model('refill_order');
  1598. $ret = $refill_order->getOrderInfo(['mchid' => $mchid, 'mch_order' => $mch_order]);
  1599. return empty($ret);
  1600. }
  1601. }
  1602. public function testCheckMchorder()
  1603. {
  1604. $ret = $this->check_mchorder(1, '13281475');
  1605. }
  1606. public function testMakemobile()
  1607. {
  1608. $mobile = refill\util::make_mobile();
  1609. $ret = refill\util::set_black('1000111100020445281');
  1610. }
  1611. public function testLoadBlack()
  1612. {
  1613. $path = BASE_DATA_PATH . "/log";
  1614. $names = ['20210119-mobile.log',
  1615. '20210120-mobile.log', '20210121-mobile.log', '20210122-mobile.log', '20210123-mobile.log',
  1616. '20210124-mobile.log', '20210125-mobile.log'];
  1617. foreach ($names as $name) {
  1618. $file_name = $path . "/" . $name;
  1619. refill\util::black_from_log($file_name);
  1620. }
  1621. }
  1622. public function testStats()
  1623. {
  1624. $date = date('Y-m-d', time());
  1625. $today = strtotime("{$date}");
  1626. $times_begin = function ($start) {
  1627. $times = [];
  1628. $begin = $start;
  1629. for ($i = 0; $i < 7; $i++) {
  1630. $times[] = $begin;
  1631. $begin -= 86400;
  1632. }
  1633. return $times;
  1634. };
  1635. $reader = function ($mchid, $time) {
  1636. $cond['mchid'] = $mchid;
  1637. $cond['inner_status'] = 0;
  1638. $cond['refill_order.order_time'] = ['between', [$time, $time + 86400 - 1]];
  1639. $items = Model('')->table('refill_order,vr_order')->join('inner')
  1640. ->on('refill_order.order_id=vr_order.order_id')
  1641. ->field('count(*) as order_count, vr_order.order_state, sum(mch_amount) as mch_amounts')
  1642. ->group('vr_order.order_state')
  1643. ->where($cond)->select();
  1644. return $items;
  1645. };
  1646. $begins = $times_begin($today);
  1647. $mchid = 10096;
  1648. // $states = rcache($this->mchid() , 'refillstat-');
  1649. $states = unserialize($states ?? "");
  1650. if (empty($states)) $states = [];
  1651. $result = [];
  1652. $cache = [];
  1653. foreach ($begins as $begin) {
  1654. if (array_key_exists($begin, $states)) {
  1655. $item = $states[$begin];
  1656. } else {
  1657. $item = $reader($mchid, $begin);
  1658. }
  1659. $result[$begin] = $item;
  1660. //判断item 中充值中的状态是否为0,为0的情况下放进cache
  1661. $cache = $item;
  1662. }
  1663. wcache($this->mchid(), $cache, 'refillstat-');
  1664. return $result;
  1665. }
  1666. public function testNotifyx()
  1667. {
  1668. $mch_cache = rcache("merchant-notify", 'refill-');
  1669. $caches = empty($mch_cache['data']) ? [] : unserialize($mch_cache['data']);
  1670. $new_caches = [];
  1671. $merchants = Model('merchant')->getMerchantList([], '', '', 'merchant.*,member.available_predeposit', "0,1000");
  1672. foreach ($merchants as $merchant) {
  1673. $mchid = $merchant['mchid'];
  1674. $phone = $merchant['contact_phone'] ?? "";
  1675. $available_pd = intval($merchant['available_predeposit']);
  1676. $alarm_pd = intval($merchant['alarm_amount']) < 10000 ? 10000 : intval($merchant['alarm_amount']);
  1677. if (array_key_exists($mchid, $caches)) {
  1678. $mch_cache = $caches[$mchid];
  1679. } else {
  1680. $mch_cache = ['last_time' => 0, 'send_count' => 0];
  1681. }
  1682. if (!empty($phone) && ($available_pd < $alarm_pd)) {
  1683. $counts = $mch_cache['send_count'];
  1684. if (($mch_cache['last_time'] + 300 < time()) && $counts < 5) {
  1685. $mch_cache = ['last_time' => time(), 'send_count' => $counts + 1];
  1686. QueueClient::push('sendSMS', ['mobile' => $merchant['contact_phone'],
  1687. 'type' => 'balance_warning', 'datas' => [date("m月d日H时"), $merchant['available_predeposit']]]);
  1688. }
  1689. } else {
  1690. $mch_cache = ['last_time' => 0, 'send_count' => 0];
  1691. }
  1692. $new_caches[$mchid] = $mch_cache;
  1693. }
  1694. wcache("merchant-notify", ['data' => serialize($new_caches)], 'refill-');
  1695. }
  1696. public function testReadChannel()
  1697. {
  1698. refill\RefillFactory::instance()->read_channel();
  1699. }
  1700. public function testAllow()
  1701. {
  1702. $allow = refill\RefillFactory::instance()->allow(10096, 1, 100);
  1703. }
  1704. public function testCheckData()
  1705. {
  1706. $str = '|2|110667993758599771-充值失败|';
  1707. // $str = '0|提交成功|-36557.7400';
  1708. // if(preg_match( '/^-*[0-9]{1,3}\|[\x{4e00}-\x{9fa5}]+\|-*[0-9]+\.*[0-9]+$/u',$str,$matches)) {
  1709. // return true;
  1710. // }
  1711. // if(preg_match('/^[0-3]\|[0-9]+-*[\x{4e00}-\x{9fa5}]+\|[0-9]*$/u',$str,$matches)){
  1712. // return true;
  1713. // }
  1714. // return false;
  1715. $resp = ltrim($str, '|');
  1716. $resp = explode('|', $resp);
  1717. if (count($resp) != 3) {
  1718. return [false, '返回值错误'];
  1719. }
  1720. }
  1721. public function testErrre()
  1722. {
  1723. $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}';
  1724. $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);
  1725. }
  1726. public function testExpolode()
  1727. {
  1728. $x = "HTTP-504";
  1729. [$type,$code] = explode('-',$x);
  1730. }
  1731. public function testMchctl()
  1732. {
  1733. $ctl = new refill\mchctl();
  1734. }
  1735. public function testAsyncadd()
  1736. {
  1737. $x = \refill\util::async_add(['xxxx' => 1],4);
  1738. }
  1739. }
  1740. //docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefill::testLoadBlack)( .*)?$/" --test-suffix TestRefill.php /var/www/html/test
  1741. //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