mReqHost = BASE_SITE_URL;
$this->mMchid = 1;
$this->mKey = '1ff02223b771c0414468c8892151c602';
} else {
$this->mReqHost = 'https://www.xyzshops.cn';
// $this->mReqHost = 'http://121.89.196.45';
$this->mMchid = 1092;
$this->mKey = '210fe406954220f56085997d6a4c5b80';
}
}
public static function setUpBeforeClass(): void
{
Base::run_util();
refill\RefillFactory::instance();
}
public function testMerchantPrice()
{
$price = new refill\merchant_price();
}
public function testCallBack()
{
}
public function testFactory()
{
$providers = refill\RefillFactory::instance();
}
private function make_sn()
{
return mt_rand(1000, 9999)
. sprintf('%010d', time())
. sprintf('%06d', (float)microtime() * 1000000);
}
public function testRandomMobile()
{
$no = "1" . mt_rand(1, 9999999999);
Log::record("phone no={$no}", Log::DEBUG);
}
public function testBJBAddPhone()
{
$providers = new refill\bjb\RefillPhone([]);
for ($i = 3; $i > 0; --$i) {
$resp = $providers->add(13911129867, 4, 10, ['order_sn' => $this->make_sn()]);
$resp = $providers->add(18500608333, 4, 10, ['order_sn' => $this->make_sn()]);
$resp = $providers->add(18510683168, 4, 10, ['order_sn' => $this->make_sn()]);
$resp = $providers->add(18513846008, 4, 10, ['order_sn' => $this->make_sn()]);
$resp = $providers->add(18518237398, 4, 10, ['order_sn' => $this->make_sn()]);
}
}
public function testOilticket()
{
$providers = new refill\bjb\RefillPhone([]);
}
public function testBjbRet()
{
$resp = '0|提交成功|14936.8600';
$resp = explode('|', $resp);
}
public function testIpWhiteList()
{
$x = serialize(['47.99.57.105']);
$ips = unserialize('a:1:{i:0;s:12:"47.99.57.105";}');
if (!empty($ips)) {
$addr = '47.99.57.105';
Log::record("request ip:{$addr}", Log::DEBUG);
if (!in_array($addr, $ips)) {
throw new Exception("请求地址不在白名单中");
}
}
}
public function testBaizePhone()
{
$providers = new refill\baizeyd\RefillPhone([]);
// $resp = $providers->add(17801048874, 5, 10, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '930668700375312006']);
// $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';
// $input = $this->parse_request($str);
// $input['amount'] = 10.00;
// $input['orderId'] = '92391614943913061206';
// $input['phone'] = 17801048874;
// $input['payTime'] = '2021-03-05 19:31:55';
// $input['sign'] = 'bef6ae50319fb1e8cb3f21302f0abef8';
// $input['appKey'] = 'uECmTOFAY6RPCTtI';
// $input['payUrl'] = '';
// $input['statusDes'] = '支付失败';
// $input['status'] = 7;
// refill\RefillFactory::instance()->notify('baizeyd',$input);
}
private function parse_request($squery)
{
if (empty($squery)) return [];
$result = [];
$params = preg_split('/&/', $squery);
foreach ($params as $pair) {
if (empty($pair)) continue;
$kv = explode('=', $pair);
$count = count($kv);
if ($count === 1) {
$key = $kv[0];
$val = "";
} elseif ($count === 2) {
$key = $kv[0];
$val = urldecode($kv[1]);
} else {
continue;
}
if (!empty($key)) {
$result[$key] = $val;
}
}
return $result;
}
public function testAmPhone()
{
// $providers = new refill\aming\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
$input['result'] = 'fail';
$input['msg'] = 0;
$input['order'] = 'null';
$input['phone_no'] = 18500608333;
$input['sign'] = 'c925ad19c63c3eb36ffc52d938e24604';
$input['amount'] = '10.00';
$input['op_no'] = '42601615096072517841';
refill\RefillFactory::instance()->notify('aming', $input);
}
public function testBhcPhone()
{
$providers = new refill\binghc\RefillPhone([]);
$resp = $providers->query(['order_sn' => 250668618955902006]);
// $input['result'] = 'fail';
// $input['msg'] = 0;
// $input['order'] = 'null';
// $input['phone_no'] = 18500608333;
// $input['sign'] = 'c3aa38ee07cd1b69bfd5ead56f6da8d6';
// $input['amount'] = '10.00';
// $input['op_no'] = '24061615096361999002';
// refill\RefillFactory::instance()->notify('binghc',$input);
}
public function testRuishunPhone()
{
// $providers = new refill\ruishun\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
$input['result'] = 'fail';
$input['msg'] = 0;
$input['order'] = null;
$input['phone_no'] = 18500608333;
$input['sign'] = 'e234f7d1c0458ca236f53a0008436b46';
$input['amount'] = "10.00";
$input['op_no'] = '76361615095403188513';
refill\RefillFactory::instance()->notify('ruishun', $input);
}
public function testWuchenPhone()
{
$providers = new refill\wuchen\RefillPhone([]);
// $resp = $providers->add('13699279618', 5, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '790668630498425006']);
// $input['app_id'] = '70016';
// $input['message'] = 'fail';
// $input['order_sn'] = '43101615277293035501';
// $input['platform_order_id'] = '';
// $input['sign'] = '5ea59f8ac51a518f2c622824d7db2a04';
// $input['state'] = "fail";
// $input['sys_sn'] = '202103091608231836913889';
// $input['timestamp'] = '1615277361';
// refill\RefillFactory::instance()->notify('wuchen',$input);
}
public function testYibaoPhone()
{
$providers = new refill\yibao\RefillPhone([]);
// $resp = $providers->add('13699279618', 5, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['ch_trade_no' => '31215002972142736']);
// $str = '{"amount":"30","carrierOrderNo":null,"mobile":"13699279618","orderNo":"27961615532426088043","orderStatus":3,"sign":"012BA0B093A0473D7DD1634A8356DCB1","tradeNo":"31215002972142736"}';
// $data = json_decode($str,true);
// refill\RefillFactory::instance()->notify('yibao',$data);
}
public function testAmingydPhone()
{
$providers = new refill\amingyd\RefillPhone([]);
// $resp = $providers->add('13699279618', 5, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '15421615627436792938']);
// $str = '{"orderId":"15421615627436792938","amount":3000,"appKey":"40695059","timestamp":1615627503,"status":3,"operatorId":"508353854027968617","sign":"2A0562319ED4845AB9E3812A58F0B425"}';
// $data = json_decode($str,true);
// refill\RefillFactory::instance()->notify('amingyd',$data);
}
public function testChukaPhone()
{
$providers = new refill\chuka\RefillPhone([]);
// $resp = $providers->add('18500608333', 5, 20, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '92161616314884175179']);
$params['customerId'] = '101787';
$params['orderno'] = 'C1616314888506705492';
$params['tmporder'] = '92161616314884175179';
$params['code'] = '1';
$params['number'] = '18500608333';
$params['money'] = '20';
$params['amount'] = '0';
refill\RefillFactory::instance()->notify('chuka', $params);
}
public function testLegouPhone()
{
$providers = new refill\legou\RefillPhone([]);
// $resp = $providers->add('18500608333', 5, 30, ['order_sn' => '200649600557718881' , 'order_id' => 247 , 'buyer_id' => 52667]);
$resp = $providers->query(['order_sn' => '200649600557718881', 'order_id' => 247]);
$params['username'] = 'lzdc';
$params['orderNumber'] = '690653407667699667';
$params['cardNumber'] = '18500608333';
$params['orderMoney'] = '30.0';
$params['orderPay'] = '1.0';
$params['resultCode'] = '2';
$params['rechargeDesc'] = '{"rechargeStatus":600200,"rechargeDesc":"充值成功"}';
$params['rechargeVoucher'] = '100407307092103291444050244599';
$params['sign'] = 'c054884422a8c3749cbfda0e82b9af70';
// refill\RefillFactory::instance()->notify('legou',$params);
}
public function testFeiniaoPhone()
{
$providers = new refill\feiniao\RefillPhone([]);
// $order_sn = $this->make_sn();
// Log::record($order_sn, Log::DEBUG);
// $resp = $providers->add('13699279618', 4, 50, ['order_sn' => $order_sn]);
$resp = $providers->query(['order_sn' => '28641617178590981824']);
$params['result'] = 'fail';
$params['msg'] = '0';
$params['order'] = 'null';
$params['phone_no'] = '18500608333';
$params['amount'] = '100.00';
$params['op_no'] = '64591617090761169983';
$params['settle'] = '0';
$params['sign'] = '907d2640f96e8d78d59202d090ddb470';
// refill\RefillFactory::instance()->notify('feiniao',$params);
}
public function testTongyPhone()
{
$providers = new refill\tongy\RefillPhone([]);
// $resp = $providers->add('18500608333', 5, 30, ['order_sn' => '690653407667699667', 'order_id' => 248, 'buyer_id' => 52667]);
$params['UserId'] = '100857';
$params['ShopId'] = '300000';
$params['SysOrderId'] = '21070215141210085700010';
$params['OrderId'] = '9241650678554051429291';
$params['State'] = '5';
$params['Timestamp'] = '1625210740472';
$params['sign'] = 'C5C4E888A3B678470071CDA6DC31719D';
$params['ParValue'] = '100.0000';
$params['VoucherType'] = '';
$params['VoucherContent'] = '';
$params['CreateTime'] = '2021-07-02 15:14:12';
$params['CompleteTime'] = '2021-07-02 15:25:40';
refill\RefillFactory::instance()->notify('tongy',$params);
}
public function testWeiyiPhone()
{
$providers = new refill\weiyi\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '90401621489214002876']);
$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"}';
$params = json_decode($body , true);
refill\RefillFactory::instance()->notify('weiyi',$params);
}
public function testWeiyimanPhone()
{
$providers = new refill\weiyiman\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '47591620898269370373']);
$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"}';
$params = json_decode($data , true);
refill\RefillFactory::instance()->notify('weiyiman',$params);
}
public function testWeiyiWtPhone()
{
$providers = new refill\weiyiwt\RefillPhone([]);
// $resp = $providers->add(18074608795, 6, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '38451621924366009924']);
$body = '{"szOrderId":"38451621924366009924","fSalePrice":"47.25","szAgentId":"200016","nFlag":"2","szVerifyString":"a0b5bfc0bbf6c121a4cd74d9ecb2427d","szPhoneNum":"18074608795","szRtnMsg":"1000000083421052514441119833","nDemo":"50"}';
$params = json_decode($body , true);
refill\RefillFactory::instance()->notify('weiyiwt',$params);
}
public function testXiaochuangPhone()
{
$providers = new refill\xiaochuang\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '84891623028826872085']);
$body = '{"fail_msg":"","order_sn":"84891623028826872085","order_status":"4","p_order_sn":"2021060709203558011797441162","sign":"E842203C3CA48E924D60B1B56AB93C3B"}';
$params = json_decode($body , true);
refill\RefillFactory::instance()->notify('xiaochuang',$params);
}
public function testYintengPhone()
{
$providers = new refill\yinteng\RefillPhone([]);
// $resp = $providers->add(18074608795, 6, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '49631623737966351874']);
$data = '{"szOrderId":"49631623737966351874","fSalePrice":"47.35","szAgentId":"200009","nFlag":"2","szVerifyString":"01c5fafb1d67175f0533b69a762286e8","szPhoneNum":"18074608795","szRtnMsg":"1000000083421061514495400262","nDemo":"50"}';
$params = json_decode($data , true);
refill\RefillFactory::instance()->notify('yinteng',$params);
}
public function testMoxjPhone()
{
$providers = new refill\moxj\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '91131623906171663147']);
$data = '{"result":"fail","msg":"0","order":"null","phone_no":"18500608333","amount":"50.0","op_no":"84901623900668776864","sign":"896b54914a07b814573d7f6cc403848a"}';
$params = json_decode($data , true);
// refill\RefillFactory::instance()->notify('moxj',$params);
}
public function testMoxj_fsPhone()
{
$providers = new refill\moxj_fs\RefillPhone([]);
// $resp = $providers->add(15139608757, 4, 100, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '42741624242693157165']);
$data = '{"amount":"100","charge_type":"2","code":"1","partner_id":"58","phone":"15139608757","sign":"30d193dba4101e50851ed0efabb75fb1","partner_order_no":"42741624242693157165","official_order_id":"20210621103211948830"}';
$params = json_decode($data , true);
// refill\RefillFactory::instance()->notify('moxj_fs',$params);
}
public function testZanzanquickPhone()
{
$providers = new refill\zanzanquick\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '90831623925322675223']);
$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"}';
$params = json_decode($data , true);
refill\RefillFactory::instance()->notify('zanzanquick',$params);
}
public function testFengyemanPhone()
{
$providers = new refill\fengyeman\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '46221624265179185139']);
$data = '{"order_id":"46221624265179185139","mchid":"HF67a65_10008","tel":"18500608333","price":"50.00","sign":"2bb4ed5edc97ba7f60cf3848aab82cf4","out_order_id":"206877995456","status":"1"}';
$params = json_decode($data , true);
refill\RefillFactory::instance()->notify('fengyeman',$params);
}
public function testMoxj_ydPhone()
{
$providers = new refill\moxj_yd\RefillPhone([]);
$resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '52101624413125875436']);
$data = '{"customer_order_no":"47651624412877257722","status":1,"merchant_id":"76505818","sign":"c185a0f2152b3ac3ee3f29009dec5a6b"}';
$params = json_decode($data , true);
// refill\RefillFactory::instance()->notify('moxj_yd',$params);
}
public function testXingzyPhone()
{
$providers = new refill\xingzy\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '76791624441423287373', 'ch_trade_no' => '210623174333941000']);
$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}';
$params = json_decode($data , true);
// refill\RefillFactory::instance()->notify('xingzy',$params);
}
public function testYuanmaiPhone()
{
$providers = new refill\yuanmai\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '24231624865882625203', 'ch_trade_no' => '210623174333941000']);
$data = '{"orderid":"24231624865882625203","status":"2","ordermoney":"50","sign":"94be5b1754ffcc7f0fe1551072146941","spsno":""}';
$params = json_decode($data, true);
refill\RefillFactory::instance()->notify('yuanmai',$params);
}
public function testLangkePhone()
{
$providers = new refill\langke\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '29461624952660047520', 'ch_trade_no' => '210623174333941000']);
$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"}';
$params = json_decode($data, true);
// refill\RefillFactory::instance()->notify('langke',$params);
}
public function testYunlingdsPhone()
{
$providers = new refill\yunlingds\RefillPhone([]);
// $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '85351624961920020593']);
$data = '{"orderid":"OWS21062918188862392","sporderid":"85351624961920020593","userid":"10002623","merchantsubmittime":"20210629181929","resultno":"1","parvalue":"30","remark1":"AW20210629181906yRAvM","payno":"AW20210629181906yRAvM","fundbalance":"-28.59","sign":"11369509ADCF2A2612B3531A15049BDD"}';
$params = json_decode($data, true);
refill\RefillFactory::instance()->notify('yunlingds',$params);
}
public function testLingzhmanPhone()
{
$providers = new refill\lingzhman\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '29771625215707976538']);
$data = '{"orderNo":"F2107021536431562574","status":"019","consumerNo":"60191625211393862930","voucherNo":null,"mobile":"18500608333"}';
$params = json_decode($data, true);
// refill\RefillFactory::instance()->notify('lingzhman',$params);
}
public function testQijutangPhone()
{
$providers = new refill\qijutang\RefillPhone([]);
for ($i=1;$i<2;$i++) {
$resp = $providers->add(13699279618, 4, 100, ['order_sn' => $this->make_sn()]);
}
// $resp = $providers->query(['order_sn' => '51501625218912512231']);
$data = '{"szOrderId":"51501625218912512231","fSalePrice":"28.44","szAgentId":"200010","nFlag":"3","szVerifyString":"20cf16c6bb239e2a703d0bf3e5ef2d5a","szPhoneNum":"18500608333","szRtnMsg":"","nDemo":"30"}';
$params = json_decode($data, true);
// refill\RefillFactory::instance()->notify('qijutang',$params);
}
public function testLingzhman48Phone()
{
$providers = new refill\lingzhman48\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '49951625814151937287']);
$data = '{"orderNo":"F2107091503134670764","status":"020","consumerNo":"49951625814151937287","voucherNo":null,"mobile":"18500608333"}';
$params = json_decode($data, true);
refill\RefillFactory::instance()->notify('lingzhman48',$params);
}
public function testcangbuPhone()
{
$providers = new refill\cangbu\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '35041626071052333060']);
$data = '{"customerId":"112","tmporder":"35041626071052333060","orderno":"s16260710607417944801112","number":"18500608333","money":"100","amount":"94.9000","code":"1","cardno":"","voucher":"110103307042107121424210550266","sign":"de463c3d389a4afe4a2c58257972121a"}';
$params = json_decode($data, true);
refill\RefillFactory::instance()->notify('cangbu',$params);
}
public function testTongykamiPhone()
{
$providers = new refill\tongykami\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 20, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '26961626077050756648']);
$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"}';
$params = json_decode($data, true);
// refill\RefillFactory::instance()->notify('tongykami',$params);
}
public function testTongluPhone()
{
$providers = new refill\tonglu\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '22961616468561936356']);
// $body = '{"order_no":"22961616468561936356","order_status":"5","phone_no":"18500608333","amount":5000,"time_paid":1616468856287,"order_cert_no":"","paid":false,"order_id":"20210323966497008"}';
// $sign = '9E41F52F612D60EBB654B3A5D1E2F1E5';
// $params = json_decode($body , true);
// $params['sign'] = $sign;
// refill\RefillFactory::instance()->notify('tonglu',$params);
}
public function testAmingjd()
{
// $providers = new refill\amingjd\RefillPhone([]);
// $resp = $providers->add(13699279618, 5, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '42301616475989518588']);
$body = '{"order_id":"83321616478215494884","mchid":"10003","tel":"13699279618","price":"30.00","sign":"01c49620c155a80bc43cecc2b1651868","status":"0","out_order_id":"0"}';
$params = json_decode($body, true);
refill\RefillFactory::instance()->notify('amingjd', $params);
}
public function testAmingjdmanPhone()
{
$providers = new refill\amingjdman\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '82741619577673758623']);
$body = '{"order_id":"82741619577673758623","mchid":"10045","tel":"13699279618","price":"30.00","sign":"2fe55fb4d4b2acc2e98137adb82fa57e","status":"0","out_order_id":"0"}';
$params = json_decode($body, true);
refill\RefillFactory::instance()->notify('amingjdman', $params);
}
public function testWeishengyWtPhone()
{
$providers = new refill\weishengywt\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '27681620538125370652']);
$data = '{"szOrderId":"27681620538125370652","fSalePrice":"47.5","szAgentId":"200045","nFlag":"2","szVerifyString":"92fafec121b77518d539ed9f5005fdf9","szPhoneNum":"18500608333","szRtnMsg":"110103308032105091328520502948","nDemo":"50"}';
$params = json_decode($data, true);
refill\RefillFactory::instance()->notify('weishengywt', $params);
}
public function testWeishengyJDPhone()
{
$providers = new refill\weishengyjd\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '14261620887423822879']);
$data = '{"szOrderId":"14261620887423822879","fSalePrice":"44.0","szAgentId":"200050","nFlag":"3","szVerifyString":"3cceef390602058e1d2fdde2e07636a4","szPhoneNum":"18500608333","szRtnMsg":"","nDemo":"50"}';
$params = json_decode($data, true);
refill\RefillFactory::instance()->notify('weishengyjd', $params);
}
public function testYeziPhone()
{
$providers = new refill\yezi\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '35261620988265145105']);
$data = '{"mchid":"10147","order_sn":"35261620988265145105","amount":"50.00","cardno":"18500608333","trade_no":"6363570674332280422825","idcard":"","card_name":"","official_sn":"","message":"","state":"CANCEL","sign":"b79f2ddbb5b7eef98f414585a5bd2cde"}';
$params = json_decode($data, true);
refill\RefillFactory::instance()->notify('yezi', $params);
}
public function testWeishengysixPhone()
{
$providers = new refill\weishengysix\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '17171624434289348649']);
$data = '{"szOrderId":"17171624434289348649","fSalePrice":"44.5","szAgentId":"200074","nFlag":"2","szVerifyString":"fa5735090199d97e6a50e7f3083be111","szPhoneNum":"18500608333","szRtnMsg":"AW2021062315464045A27","nDemo":"50"}';
$params = json_decode($data, true);
refill\RefillFactory::instance()->notify('weishengysix', $params);
}
public function testHaohaoOil()
{
$providers = new refill\haohao\RefillOil([]);
// $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
$data['amount'] = 20000;
$data['mchId'] = 467253;
$data['mchOrderNo'] = '5514850674656058146707';
$data['mobile'] = '';
$data['sign'] = 'F282D68972A437F3CEB3516BB2FDD19A';
$data['operator'] = 4;
$data['number'] = '1000113200020348885';
$data['thirdOrderNo'] = '2317184088901537792';
$data['directStatus'] = 5;
// $input = json_decode($data, true);
refill\RefillFactory::instance()->notify('haohao',$data);
}
public function testJuzhuoOil()
{
$providers = new refill\juzhuo\RefillOil([]);
// $resp = $providers->add(1000111100021211884, 2, 200, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '20121621578185774451']);
// $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"}';
// $input = json_decode($data, true);
$data['channelsort'] = 'OIL_CARD';
$data['channelno'] = '';
$data['onlystr'] = '0772770675248490450497';
$data['channel'] = 'JD';
$data['sign'] = '4a9f113bfa4aa2d155de7136ca0afe2d';
$data['amt'] = '100';
$data['notifyurl'] = 'http://121.89.212.167/racc/callback/lingzh/juzhuo.php';
$data['cardtype'] = 'Sinoepc';
$data['cardno'] = '1000113200029532754';
$data['orgid'] = '6095171500';
$data['account'] = '';
$data['status'] = '3';
refill\RefillFactory::instance()->notify('juzhuo',$data);
}
public function testZeheng()
{
$providers = new refill\zeheng\RefillOil([]);
// $resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 100, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '45951620814813332604']);
$data = '{"extOrderId":"45951620814813332604","orderId":"R2021051218240000192928","salePrice":"96.8000","sign":"0d6b9641eaf8d36ecba82cfefc6aa307","state":"4"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('zeheng',$input);
}
public function testXiaoniu()
{
$providers = new refill\xiaoniu\RefillOil([]);
// $resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 500, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '39911625819031601073']);
$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"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('xiaoniu',$input);
}
public function testZhenqi()
{
$providers = new refill\zhenqi\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '42611626267945146350']);
$data = '{"out_trade_no":"14001626266194932132","create_time":"1626266201","sp_order_no":"110103353232107142044550619272","status":"1","sign":"3C2F8ED40EEB9151D2117E2DA1FA64AA"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('zhenqi',$input);
}
public function testYunsuoyaofs()
{
$providers = new refill\yunsuoyaofs\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '85681626322286098163']);
$data = '{"orderid":"AMU21071512111544162","sporderid":"85681626322286098163","userid":"10002671","merchantsubmittime":"20210715121132","resultno":"9","parvalue":"50","remark1":"","payno":"","fundbalance":"-47.7","sign":"45ECFF26E84F7DC3BFFDCFAFF3B1E561"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('yunsuoyaofs',$input);
}
public function testZhenqi1m()
{
$providers = new refill\zhenqi1m\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '45611626334593130605']);
$data = '{"out_trade_no":"45611626334593130605","create_time":"1626334606","sp_order_no":"202107152200117311004426885635","status":"1","sign":"CF8EB902F60B76591C898C991361BB4D"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('zhenqi1m',$input);
}
public function testHongxudayz()
{
$providers = new refill\hongxudayz\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '78221626445316011524']);
$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":""}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('hongxudayz',$input);
}
public function testHongxudagy()
{
$providers = new refill\hongxudagy\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '86521626446475240639']);
$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":""}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('hongxudagy',$input);
}
public function testPrice()
{
$amounts = [10, 20, 30, 50, 100, 200, 300, 500];
$rate = 0.994;
foreach ($amounts as $amount) {
$price[] = $amount * $rate;
}
}
public function testCallbackDir()
{
$path = "/callback";
$file = "/mobile/callback/refill_call.php";
$basename = basename($file);
$tmp = "{$path}/{$basename}.php";
return file_exists($tmp);
}
public function testWeisPhone()
{
$providers = new refill\weisyd\RefillPhone([]);
$resp = $providers->add(17801048874, 4, 10, ['order_sn' => $this->make_sn()]);
}
public function testXcPhone()
{
$providers = new refill\xc\RefillPhone([]);
$resp = $providers->add(13699279618, 5, 100, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '87961616926444043617']);
$params['pay_orderid'] = '87961616926444043617';
$params['pay_iphone'] = '18500608333';
$params['pay_money'] = '100';
$params['wt_orderid'] = '202103281816121070';
$params['status'] = '1';
$params['sign'] = 'f7be2e859a5a6dc7b1a8273361617752';
// refill\RefillFactory::instance()->notify('xc',$params);
}
public function testAfandPhone()
{
$providers = new refill\afand\RefillPhone([]);
// for ($i = 3; $i > 0; --$i) {
$resp = $providers->query(['order_sn' => '540668612768904780']);
// }
}
public function testAfandengPhone()
{
$providers = new refill\afandeng\RefillPhone([]);
// for ($i = 5; $i > 0; --$i) {
$resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
// }
// $resp = $providers->query(['order_sn' => '20941616115610023539']);
// $params['usr'] = 'afandeng';
// $params['ord'] = '20941616115610023539';
// $params['state'] = '2';
// $params['bz'] = '';
// $params['sgn'] = 'BA2C9D379C3EB648A0B7AAB3A21A3F6A';
// refill\RefillFactory::instance()->notify('afandeng',$params);
}
public function testWantongPhone()
{
$providers = new refill\wantong\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '26061618988575301841']);
$data = '{"uid":"97396885","order_no":"26061618988575301841","mobile_order_no":"","phone_number":"13699279618","face_value":"3000","status":"9","sign":"1a019202656cf4feffe715025fab01bf"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('wantong',$input);
}
public function testXunyinPhone()
{
$providers = new refill\xunyin\RefillPhone([]);
// $resp = $providers->add(17703711950, 6, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '76831617176125893158']);
$xml = '84174059161717329552405714784226充值中0000
';
$resp = $providers->xmlToArray($xml);
if ($resp['Code'] === '0000') {
return [true, $resp['order_no'], false];
} else {
return [false, $resp['msg'], false];
}
// $params['ext'] = '';
// $params['code'] = '8888';
// $params['sign'] = '428ac223cf3a1f6f3d382aac754e8e17';
// $params['statemes'] = '成功';
// $params['id'] = '76831617176125893158';
// $params['userid'] = '8417';
// $params['operatorid'] = '1000000083421033115583773201';
// $params['status'] = 'SUCCESS';
// refill\RefillFactory::instance()->notify('xunyin',$params);
}
public function testFenshengPhone()
{
$file = BASE_HELPER_RAPI_PATH . "/qianqian/RefillPhone.php";
if(!file_exists($file)){
Log::record("provider api file={$file} not exist.",Log::DEBUG);
return false;
} else {
require_once($file);
Log::record("file={$file} load success.",Log::DEBUG);
}
$providers = new refill\qianqian\RefillPhone([]);
$resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '27511617764278021035']);
// $datas = '[{"orderNo":"F2104071058069438461","status":"001","consumerNo":"27511617764278021035","voucherNo":"510490688023364042","mobile":"13699279618"}]';
// $datas = json_decode($datas,true);
// foreach ($datas as $data) {
// refill\RefillFactory::instance()->notify('fensheng',$data);
// }
}
public function testQianqianPhone()
{
$providers = new refill\fensheng\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '27511617764278021035']);
// $datas = '[{"orderNo":"F2104071058069438461","status":"001","consumerNo":"27511617764278021035","voucherNo":"510490688023364042","mobile":"13699279618"}]';
// $datas = json_decode($datas,true);
// foreach ($datas as $data) {
// refill\RefillFactory::instance()->notify('fensheng',$data);
// }
}
public function testQianqianmanPhone()
{
$providers = new refill\qianqianman\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '72011621236975003462']);
$data = '{"orderNo":"F2105171538062539442","status":"019","consumerNo":"72011621236975003462","voucherNo":null,"mobile":"13699279618"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('qianqianman',$input);
}
public function testRiyingPhone()
{
$providers = new refill\riying\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['ch_trade_no' => '2021041311120213187423105022']);
$data = '{"UserId":"10050","SysOrderId":"2021041311120213187423105022","OrderId":"15641618283518423567","State":"4","Timestamp":"1618283565746","VoucherType":"1","VoucherContent":"511009928000087852","Sign":"a6ec70a3ea42baae941528398c6d0a43"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('riying',$input);
}
public function testWeishengyPhone()
{
$providers = new refill\weishengy\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '15551618590601301527']);
$data = '{"masId":"699270071532654592","oids":"158877719094,166090529155,158887187476","orderNo":"62411618635377880788","orderPrice":"150.00","phone":"18500608333","sign":"3EC10A32FC4CCC976048E1164D0FCBF6","status":"1","time":"1618643281063","type":"2"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('weishengy',$input);
}
public function testWailingPhone()
{
$providers = new refill\wailing\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '73241618543784045618']);
$data = '{"order_id":"73241618543784045618","mchid":"10045","tel":"13699279618","price":"30.00","sign":"4991de3e40f14c198b8c194455ea021b","status":"0","out_order_id":"0"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('wailing',$input);
}
public function testShengyingPhone()
{
$providers = new refill\shengying\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '37571618805115582483']);
$data = '{"TaskID":"129636","Mobile":"13699279618","Status":"4","ReportTime":"2021-04-19T12:06:16.050","ReportCode":"1:511531522026586295","OutTradeNo":"37571618805115582483","ReceiptNum":"511531522026586295","Sign":"a7f46a988bc8483091d94130804e5078"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('shengying',$input);
}
public function testYunlingPhone()
{
$providers = new refill\yunling\RefillPhone([]);
// $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '73791623147517199719']);
$data = '{"orderid":"EAF21060818183032772","sporderid":"73791623147517199719","userid":"10002504","merchantsubmittime":"20210608181912","resultno":"1","parvalue":"30","remark1":"1000000083421060818483137636","payno":"1000000083421060818483137636","fundbalance":"-28.59","sign":"8D77517AC3905ED88BF79EE789A5FA86"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('yunling',$input);
}
public function testZhongstPhone()
{
$providers = new refill\zhongst\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '48941618981770389271']);
$data = ' {"szOrderId":"66571619060147539784","fSalePrice":"46.5","szAgentId":"200030","nFlag":"2","szVerifyString":"c1e88701b89a4887996822d708bed5f5","szPhoneNum":"13699279618","szRtnMsg":"161122673971","nDemo":"50"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('zhongst',$input);
}
public function testXunaoPhone()
{
$providers = new refill\xunao\RefillPhone([]);
// $resp = $providers->add(18074608795, 6, 10, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '40021619431386253803', 'card_no' => 18074608795, 'card_type' => 6]);
$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"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('xunao',$input);
}
public function testYonghePhone()
{
$providers = new refill\yonghe\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '20461619597297972685']);
$data = '{"szOrderId":"20461619597297972685","fSalePrice":"29.955","szAgentId":"200115","nFlag":"2","szVerifyString":"b5c292a13c5e67a9b850eb37239682ae","szPhoneNum":"13699279618","szRtnMsg":"2021042822001139701437383521","nDemo":"30"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('yonghe',$input);
}
public function testJumiPhone()
{
$providers = new refill\jumi\RefillPhone([]);
// $resp = $providers->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '12161619768293529384']);
$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"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('jumi',$input);
}
public function testJumiOil()
{
$providers = new refill\jumi\RefillOil([]);
// $resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '29021620617872685187']);
$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"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('jumi',$input);
}
public function testFengyePhone()
{
$providers = new refill\fengye\RefillPhone([]);
// $resp = $providers->add(18074608795, 6, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '53511620355988978053', 'card_no' => 18074608795, 'card_type' => 6]);
$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"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('fengye',$input);
}
public function testYunsuoyaoPhone()
{
$providers = new refill\yunsuoyao\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '20431621331092296201']);
$data = '{"orderid":"RLU21051817441937847","sporderid":"20431621331092296201","userid":"10002501","merchantsubmittime":"20210518174858","resultno":"9","parvalue":"30","remark1":"","payno":"","fundbalance":"-28.74","sign":"426EAC103B79505BAE7AB3F16886F1A8"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('yunsuoyao',$input);
}
public function testAfdPhone()
{
$providers = new refill\afd\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '71001621233525947994']);
$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"}';
$input = json_decode($data, true);
refill\RefillFactory::instance()->notify('afd',$input);
}
public function testLuqianPhone()
{
$providers = new refill\luqian\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '2829660672500596314764']);
$data = '{"amount":"100","charge_type":"0","code":"1","partner_id":"38","phone":"18500608333","sign":"c2c86cccc73fa991a63c369e683c91f2","partner_order_no":"34101618897099329575","official_order_id":"110103308072104201338340278420"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('luqian',$input);
}
public function testAfandfsPhone()
{
$providers = new refill\afandfs\RefillPhone([]);
// $resp = $providers->add(15139608757, 4, 30, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '65101618975926761630']);
$data = '{"amount":"30","charge_type":"2","code":"1","partner_id":"52","phone":"15139608757","sign":"a7f54c1ac3e1af72f9fc849086cc4bec","partner_order_no":"65101618975926761630","official_order_id":"20210421113256628350"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('afandfs',$input);
}
public function testYunlingfsPhone()
{
$providers = new refill\yunlingfs\RefillPhone([]);
// $resp = $providers->add(15139608757, 4, 50, ['order_sn' => $this->make_sn()]);
$resp = $providers->query(['order_sn' => '79251623739433607563']);
$data = '{"orderid":"BGC21061514434393910","sporderid":"79251623739433607563","userid":"10002543","merchantsubmittime":"20210615144434","resultno":"1","parvalue":"50","remark1":"20210615144420321813","payno":"20210615144420321813","fundbalance":"-47.65","sign":"6B9B7C15A3F9CBC773562327B6744B1E"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('yunlingfs',$input);
}
public function testTianchengPhone()
{
$providers = new refill\tiancheng\RefillPhone([]);
$resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '15301619399212504464']);
$data = ' {"result":"fail","msg":"0","order":"null","phone_no":"13699279618","amount":"10","op_no":"84801619340283980506","settle":"0","sign":"D64039ED791920B08BDA9DD95700C0E6"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('tiancheng',$input);
}
public function testLingzhPhone()
{
$providers = new refill\lingzh\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '59911615124025101286']);
$resp = $providers->balance();
// $input['usr'] = 1;
// $input['ord'] = '52741615119546453690';
// $input['bz'] = '';
// $input['state'] = 2;
// $input['sgn'] = 'FFCBB75C307154DD306F4EC75BB69A6D';
// refill\RefillFactory::instance()->notify('lingzh',$input);
}
public function testAfandnewPhone()
{
$providers = new refill\afandnew\RefillPhone([]);
// $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '45371617101073876975', 'ch_trade_no' => '33018443659736309']);
$params = '{"amount":"100","carrierOrderNo":null,"mobile":"18500608333","orderNo":"45371617101073876975","orderStatus":3,"sign":"8DE392AD6B4730AD9EE0FC2B95BBDF17","tradeNo":"33018443659736309"}';
$input = json_decode($params, true);
refill\RefillFactory::instance()->notify('afandnew', $input);
}
public function testYifaPhone()
{
$providers = new refill\yifa\RefillPhone([]);
$resp = $providers->add(15120035568, 5, 50, ['order_sn' => $this->make_sn()]);
}
public function testTianjtOil()
{
$cardno = 1000111100021211884;
$providers = new refill\tianjt\RefillOil([]);
$resp = $providers->add($cardno, 2, 500, ['order_sn' => $this->make_sn()]);
}
public function testWeitPhone()
{
$providers = new refill\weit\RefillPhone([]);
for ($i = 0; $i <= 10; $i++) {
$resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
}
}
public function testWeitCB()
{
$params['sign'] = 'af820c33472f4b571fa0c48483dfb975';
$params['status'] = 0;
$params['price'] = 30;
$params['op_order_id'] = '';
$params['mch_order_id'] = '900664281823957221';
$params['pt_order_id'] = '2021011802434412825405218901';
$params['pay_type'] = '';
$params['tel'] = 18500608333;
$params['mchid'] = 10014;
$resp = http_request($this->mReqHost . "/mobile/refill_weit.php", $params, 'POST');
}
public function testYifaCB()
{
$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"}';
$input = json_decode($body, true);
refill\RefillFactory::instance()->notify('yifa', $input);
}
public function testBjbQuery()
{
$providers = new refill\bjb\RefillPhone([]);
$refill_info = ['order_sn' => 110667993758599771, 'ch_trade_no' => 499, 'card_no' => 1000111200005252927];
$resp = $providers->query($refill_info);
}
public function testXcQuery()
{
$providers = new refill\xc\RefillPhone([]);
$refill_info = ['order_sn' => 950663423236726632, 'ch_trade_no' => 499, 'card_no' => 1000111200005252927];
$resp = $providers->query($refill_info);
}
public function testTianjtQuery()
{
$providers = new refill\tianjt\RefillOil([]);
$refill_info = ['order_sn' => 680665862267622221, 'ch_trade_no' => 499, 'card_no' => 1000111200005252927];
$resp = $providers->query($refill_info);
}
public function testSaihuOil()
{
$providers = new refill\saihu\RefillOil([]);
$resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => $this->make_sn()]);
}
public function testBdtOil()
{
$providers = new refill\bdt\RefillOil([]);
$resp = $providers->add(1000111100021211884, 2, 100, ['order_sn' => '200229600556618886']);
}
public function testGFTDOil()
{
$providers = new refill\gftd\RefillOil([]);
$resp = $providers->add(1000111100020445281, mtopcard\SinopecCard, 100, ['order_sn' => $this->make_sn()]);
}
public function testYichangtOil()
{
$providers = new refill\yichangt\RefillOil([]);
$resp = $providers->add(1000111100021211884, mtopcard\SinopecCard, 200, ['order_sn' => $this->make_sn()]);
// $resp = $providers->query(['order_sn' => '87591620379260314044']);
$data = '{"appid":"app570259129507","order_id":"M202105077888184428723706","merchant_order_id":"82231620378877155624","status":"3","cash":"100","time":"1620378961450","nonce":"2fad56d59a9f46d896c15b0cff74bc","signature":"57a6d24ec376b58bb433cfcf8528d53cb276eac8"}';
$input = json_decode($data, true);
// refill\RefillFactory::instance()->notify('yichangt',$input);
}
public function testGFTDCB()
{
$data = '{"channelOrderNumber":"79091610959059372019","orderNumber":"GYFL1610959060397001","message":"充值成功","storage":"881036222bd8f067ff47d248c75f4c8d","voucher":"","status":101}';
$url = "http://192.168.1.220/mobile/refill_gftd.php?" . $data;
$resp = http_post_data($url, $data, ['Content-Type: application/json;charset=UTF-8;', 'Accept:application/json;charset=UTF-8;']);
}
public function testJiecPhone()
{
$providers = new refill\jiec\RefillPhone([]);
$resp = $providers->add('18500608333', 5, 30, ['order_sn' => $this->make_sn()]);
}
public function testBxtwtCB()
{
$data = '{"order_number":18219726,"shipping_status":4,"shipping_status_desc":"发货失败","shipping_status_message":"","sign":"863b4d972f2a4d39a9af7396879116c4","voucher":"","vouchertype":"","voucherurl":"","tradeNo":"100662475851197741"}';
}
public function testTianjtJDVerify()
{
$data = 'onlystr=920661883198026632&sign=533151e3f0dff5f507786aabc37b18f7&amt=100¬ifyurl=https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_tianjt.php&jdno&cardtype=Sinoepc&batchid=26106&cardno=1000111100020654226&orgid=1590993600&status=3';
$url = "http://192.168.1.220/mobile/refill_tianjt.php?" . $data;
$resp = http_request($url);
}
public function testSuhcPDD()
{
$data = 'onlystr=820663525320005221&pddno&sign=4b1e8645f7541ced34855779448d9d52&amt=100¬ifyurl=https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_suhcpdd.php&cardtype=Sinoepc&batchid=3&cardno=1000111100020445281&orgid=1590993600&status=2';
$url = "https://www.xyzshops.cn/mobile/refill_suhcpdd.php?" . $data;
$resp = http_request($url);
}
public function testSuhcTMVerify()
{
$data = 'onlystr=180662473867058221&sign=5ff5f95d54a89e78dbb49923f6b20c08&amt=100¬ifyurl=https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_suhctm.php&cardtype=Sinoepc&batchid=3&cardno=1000111100020445281&orgid=1590993600&status=3';
$url = "https://www.xyzshops.cn/mobile/refill_suhctm.php?" . $data;
$resp = http_request($url);
}
public function testBeixtVerify()
{
$data = '{"order_number":18219726,"shipping_status":4,"shipping_status_desc":"发货失败","shipping_status_message":"","sign":"863b4d972f2a4d39a9af7396879116c4","voucher":"","vouchertype":"","voucherurl":"","tradeNo":"100662475851197741"}';
$url = "https://www.xyzshops.cn/mobile/refill_bxtwt.php";
$headers = ['Content-Type: application/json'];
$resp = http_post_data($url, $data, $headers);
}
public function testInput()
{
$input = fopen("php://input", "rw");
file_put_contents($input, 'xxxx');
$content = file_get_contents('php://input');
}
public function testUrl()
{
$data = 'onlystr=190661874318128632&sign=9eb60765c356341fd41c9bec6526f46a&amt=1000¬ifyurl=https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_suhc.php&jdno&cardtype=Sinoepc&batchid=25940&cardno=1000111100012304048&orgid=1590993600&status=2';
$params = preg_split('/&/', $data);
foreach ($params as $pair) {
$kv = explode('=', $pair);
$count = count($kv);
if ($count === 1) {
$key = $kv[0];
$val = "";
} elseif ($count === 2) {
$key = $kv[0];
$val = $kv[1];
} else {
continue;
}
Log::record("{$key}:{$val}", Log::DEBUG);
}
}
public function testAddoil()
{
$url = $this->mReqHost . "/mobile/index.php";
$notifyurl = 'http://121.89.196.45/mobile/signature.php';
$params = ['mchid' => $this->mMchid,
'cardno' => '1000111100020445281',
'amount' => "100",
"act" => "refill",
"op" => "add",
'order_sn' => $this->make_sn(),
'notifyurl' => $notifyurl];
$resp = $this->send_md5($url, $params);
Log::record($resp, Log::DEBUG);
}
public function testBalance()
{
$url = $this->mReqHost . "/mobile/index.php";
$params = ['mchid' => 1092,
"act" => "refill",
"op" => "balance"];
$resp = $this->send_md5($url, $params);
Log::record($resp, Log::DEBUG);
}
public function testAddPhoe()
{
$url = $this->mReqHost . "/mobile/index.php";
$params = ['mchid' => $this->mMchid,
'cardno' => '',
'amount' => 100,
"act" => "refill",
"op" => "add",
'order_sn' => '',
'notifyurl' => "https://www.baoyung.com/api/unionservice/yezicharge"];
Log::record(json_encode($params), Log::DEBUG);
// $resp = $this->send_md5($url, $params);
}
public function testProxyHelper()
{
$phone = '13911129867';
$amount = 100;
$url = $this->mReqHost . "/mobile/index.php";
$params = ['mchid' => $this->mMchid,
'cardno' => $phone,
'amount' => $amount,
"act" => "refill",
"op" => "add",
'order_sn' => $this->make_sn(),
'notifyurl' => "https://xxx"];
$proxy = new refill_proxy("xxx");
$resp = $proxy->send($url, $params);
}
public function testGoods()
{
$req_url = $this->mReqHost . '/mobile/index.php';
$params = ['mchid' => $this->mMchid,
"act" => "refill",
"op" => "goods"];
$resp = $this->send_md5($req_url, $params);
}
public function testQueryFactory()
{
refill\RefillFactory::instance()->query(295);
}
public function testQuery()
{
//$req_url = 'https://www.xyzshops.cn/mobile/index.php';
// $notifyurl = 'https://www.xyzshops.cn/mobile/signature.php';
$req_url = BASE_SITE_URL . '/mobile/index.php';
$notifyurl = 'https://www.xyzshops.cn/mobile/signature.php';
$params = ['mchid' => 1,
"act" => "refill",
"op" => "query",
'order_sn' => "13281476"];
$resp = $this->send_md5($req_url, $params);
}
public function testRemoveSession()
{
$resp = http_request(BASE_SITE_URL . "/mobile/signature.php", [], 'POST');
}
public function testTianjtCB()
{
// $notifyurl = BASE_SITE_URL . "/mobile/refill_tianjt.php";
$notifyurl = "https://www.xyzshops.cn/mobile/refill_tianjt.php";
// $notifyurl = "https%3A%2F%2Fwww.xyzshops.cn%2Fmobile%2Frefill_tianjt.php";
$params = ['onlystr' => '690665858589475818',
'amt' => 1000,
'jdno' => '',
'notifyurl' => $notifyurl,
'cardtype' => 'Sinoepc',
'batchid' => 30589,
'cardno' => '1000113300007993287',
'orgid' => '1590993600',
'status' => 3];
$sign = $this->md5_sign($params);
$params['sign'] = $sign;
$resp = http_request($notifyurl, $params, 'POST');
Log::record($resp, Log::DEBUG);
}
public function testBJBCB()
{
$params = [
'usr' => '13699279618',
'ord' => '710662733975412771',
'state' => '2',
'bz' => '',
'sgn' => 'AC9AFD254DE682D8440A97CA68B992DA'
];
$resp = http_request("https://www.xyzshops.cn/mobile/refill_bjb.php", $params, 'POST');
}
public function testJiecCB()
{
$params['result'] = 'fail';
$params['msg'] = '0';
$params['order'] = 'null';
$params['phone_no'] = '18500608333';
$params['amount'] = '30.00';
$params['op_no'] = '800663597981819221';
$params['sign'] = '2510046895e8e12322c8a32547905ee9';
$resp = http_request($this->mReqHost . "/mobile/refill_jiec.php", $params, 'POST');
}
public function testZFKJ()
{
//带签名参数:mchid=1090&act=refill&op=add&cardno=100112121212212133
//&amount=10&order_sn=PH2012261356569433&
//notifyurl=https%3A%2F%2Fqzcz.edusahoo.com.cn%2Findex%2Findex%2Fcallback
//&sign=4a3ac5f9706e64aa70c6cab0fc5839d3
$params = ['mchid' => 1090,
'cardno' => '100112121212212133',
'amount' => '10',
"act" => "refill",
"op" => "add",
'order_sn' => 'PH2012261356569433',
'notifyurl' => 'https://qzcz.edusahoo.com.cn/index/index/callback'];
$resp = $this->send_md5(BASE_SITE_URL . '/mobile/index.php', $params);
}
protected function check_empty($value)
{
if (!isset($value))
return true;
if ($value === null)
return true;
if (trim($value) === "")
return true;
return false;
}
public function testcreateSign()
{
$params['act'] = 'refill';
$params['amount'] = '30';
$params['cardno'] = '18500972879';
$params['mchid'] = '10175';
$params['notifyurl'] = 'https://su.emgot.com/union/coco/rechargeNotify';
$params['op'] = 'add';
$params['order_sn'] = '20210706125001412243513';
$params['quality'] = 7;
$sign = $this->md5_sign($params);
}
public function testCheckphone()
{
$check = function ($phone) {
$url = 'https://mobileempty.shumaidata.com/mobileempty';
$params['mobile'] = $phone;
$headers = array();
array_push($headers, "Authorization:APPCODE " . '8f92d951293f4d2ea48ff86d5a70c537');
$resp = http_request($url, $params, 'GET', false, $headers);
$resp = json_decode($resp, true);
if ($resp['success'] == true && $resp['code'] == 200) {
Log::record("data phone:{$phone} , status : {$resp['data']['status']}", Log::DEBUG);
if (in_array($resp['data']['status'], [0, 3, 4, 5])) {
return false;
}
} else {
Log::record("data phone:{$phone} , 不支持的号段", Log::DEBUG);
}
};
$check(17801048874);
}
public function testCtSign()
{
$params['act'] = 'refill';
$params['amount'] = 1;
$params['cardno'] = 18888888888;
$params['mchid'] = 1101;
$params['op'] = 'add';
$params['notifyurl'] = '';
$params['order_sn'] = '1231212';
$sign = $this->md5_sign($params);
}
private function md5_sign($params)
{
ksort($params);
$body = "";
$i = 0;
foreach ($params as $k => $v) {
if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
if ($i == 0) {
$body .= "{$k}" . "=" . urlencode($v);
} else {
$body .= "&" . "{$k}" . "=" . urlencode($v);
}
$i++;
}
}
$body .= "&key=BcuXVAbW3KstGRWh6EdMMoFIfq9XKUW0";
return md5($body);
}
public function testCallMech()
{
$logic = Logic('queue');
$logic->NotifyMerchantComplete(['order_id' => 18171, 'manual' => true]);
}
//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefill::testCallMech)( .*)?$/" --test-suffix TestRefill.php /var/www/html/test
private function send($url, $params)
{
$mchid = $params['mchid'];
$pri_key = BASE_DATA_PATH . "/api/merchant/key/{$mchid}_pri.pem";
$key = file_get_contents($pri_key);
$pri = openssl_get_privatekey($key);
$body = $this->body($params);
openssl_sign($body, $signed, $pri);
$sign = base64_encode($signed);
$params['sign'] = $sign;
$resp = http_request($url, $params, 'POST');
Log::record("resp:{$resp}", Log::DEBUG);
}
private function send_md5($url, $params)
{
$body = $this->body($params);
$body .= "&key={$this->mKey}";
$params['sign'] = md5($body);
$resp = http_request($url, $params, 'POST');
Log::record("resp:{$resp}", Log::DEBUG);
return $resp;
}
public function testCardType()
{
$cardno = '1000111100021211884';
$ret = preg_match('/^1[0-9]{18}$/', $cardno, $matches);
}
public function testMtrand()
{
}
public function testHttpRefill()
{
$mchid = '000001';
$pri_key = BASE_DATA_PATH . "/api/merchant/key/{$mchid}_pri.pem";
$key = file_get_contents($pri_key);
$pri = openssl_get_privatekey($key);
$params = ['MCHID' => $mchid, 'cardno' => '1000111100021211884', 'amt' => "100", "act" => "refill", "op" => "addoil"];
$body = $this->body($params);
openssl_sign($body, $signed, $pri);
$sign = base64_encode($signed);
$params['sign'] = $sign;
$resp = http_request(BASE_SITE_URL . "/mobile/index.php", $params, 'POST');
}
private function body($params)
{
ksort($params);
$body = "";
$i = 0;
foreach ($params as $k => $v) {
if (false === $this->checkEmpty($v) && "@" != substr($v, 0, 1)) {
if ($i == 0) {
$body .= "{$k}" . "=" . urlencode($v);
} else {
$body .= "&" . "{$k}" . "=" . urlencode($v);
}
$i++;
}
}
return $body;
}
private function checkEmpty($value)
{
if (!isset($value))
return true;
if ($value === null)
return true;
if (trim($value) === "")
return true;
return false;
}
public function testKsort()
{
$age = ["Peter" => "35", "Ben" => "37", "Joe" => "43"];
ksort($age);
foreach ($age as $x => $x_value) {
echo "Key=" . $x . ", Value=" . $x_value;
echo "
";
}
}
public function testip()
{
$model_merchant = Model('merchant');
$merchant_info = $model_merchant->getMerchantInfo(['mchid' => 1]);
$ipwhitelist = unserialize($merchant_info['ip_white_list']);
$res = json_encode($ipwhitelist);
}
//测试向内部店提交订单,可先屏蔽其它充值通道
public function testAddoilToInnerStore()
{
$url = $this->mReqHost . "/mobile/index.php";
$notifyurl = BASE_SITE_URL . '/mobile/signature.php';
$params = ['mchid' => 1,
'cardno' => '1000111100020445281',
'amount' => "1000",
"act" => "refill",
"op" => "add",
'order_sn' => $this->make_sn(),
'notifyurl' => $notifyurl];
$resp = $this->send_md5($url, $params);
Log::record($resp, Log::DEBUG);
}
public function testRefillInnerCB()
{
$params = ['state_type' => 'order_cancel', 'order_id' => 311, 'channel_name' => 'lx'];
$resp = http_request(BASE_SITE_URL . '/mobile/refill_inner.php', $params, 'POST');
}
public function testArgs()
{
Log::record($_SERVER['argv'], Log::DEBUG);
}
public function testCall()
{
$order_id = 14974;
QueueClient::async_push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => true], 10);
}
public function testSyncconfig()
{
$name_val_cfg = function ($items) {
$result = [];
foreach ($items as $item) {
$name = $item->name();
$result[$name] = $item;
}
return $result;
};
$name_val_row = function ($items) {
$result = [];
foreach ($items as $item) {
$name = $item['name'];
$result[$name] = $item;
}
return $result;
};
$match = function ($all, $cur) {
$insert = [];
foreach ($all as $key => $value) {
if (!array_key_exists($key, $cur)) {
$insert[] = $key;
}
}
return $insert;
};
$inserter = function ($mod, $type, $names) {
foreach ($names as $name) {
$data = ['name' => $name, 'type' => $type];
$mod->insert($data);
}
};
$providers = refill\RefillFactory::instance()->providers();
$oils = $name_val_cfg($providers['oil']);
$phones = $name_val_cfg($providers['phone']);
$mod_prov = Model('refill_provider');
$oil_items = $mod_prov->getProviderList(['type' => 1]);
$oil_items = $name_val_row($oil_items);
$oil_inserts = $match($oils, $oil_items);
$phone_items = $mod_prov->getProviderList(['type' => 2]);
$phone_items = $name_val_row($phone_items);
$phone_inserts = $match($phones, $phone_items);
$inserter($mod_prov, 1, $oil_inserts);
$inserter($mod_prov, 2, $phone_inserts);
}
public function testStat()
{
$model_refill_order = Model('refill_order');
$stat = Model('')->table('refill_order,vr_order')->join('inner')
->on('refill_order.order_id=vr_order.order_id')
->field('sum(refill_amount) as refill_amounts , sum(channel_amount) as channel_amounts , sum(mch_amount) as mch_amounts')
->where([])->select();
}
public function testRefillGoods()
{
$goods = refill\RefillFactory::instance()->goods();
}
private function make_mobile()
{
$no = "1" . mt_rand(3000000000, 3999999999);
return $no;
}
private function refill_info($card_no, $card_type)
{
$data = rcache($card_no, 'cardrefill-');
if (empty($data)) {
$mod_topcard = Model('topcard');
$ret = $mod_topcard->get_card($card_no);
if (empty($ret)) {
$bind_phone = $this->make_mobile();
$mod_topcard->add($card_no, $card_type, time(), $bind_phone);
$data['bind_phone'] = $bind_phone;
$data['refill_time'] = time();
$data['times'] = 0;
wcache($card_no, $data, 'cardrefill-');
} else {
$val = $ret[0];
$data['bind_phone'] = $val['bind_phone'];
$data['refill_time'] = time();
$data['times'] = 0;
}
}
return $data;
}
public function testGetMobile()
{
$card_no = '1000119000001679247';
$card_type = 1;
$info = $this->refill_info($card_no, $card_type);
}
private function check_mchorder($mchid, $mch_order)
{
if (empty($mch_order)) {
return true;
} else {
$refill_order = Model('refill_order');
$ret = $refill_order->getOrderInfo(['mchid' => $mchid, 'mch_order' => $mch_order]);
return empty($ret);
}
}
public function testCheckMchorder()
{
$ret = $this->check_mchorder(1, '13281475');
}
public function testMakemobile()
{
$mobile = refill\util::make_mobile();
$ret = refill\util::set_black('1000111100020445281');
}
public function testLoadBlack()
{
$path = BASE_DATA_PATH . "/log";
$names = ['20210119-mobile.log',
'20210120-mobile.log', '20210121-mobile.log', '20210122-mobile.log', '20210123-mobile.log',
'20210124-mobile.log', '20210125-mobile.log'];
foreach ($names as $name) {
$file_name = $path . "/" . $name;
refill\util::black_from_log($file_name);
}
}
public function testStats()
{
$date = date('Y-m-d', time());
$today = strtotime("{$date}");
$times_begin = function ($start) {
$times = [];
$begin = $start;
for ($i = 0; $i < 7; $i++) {
$times[] = $begin;
$begin -= 86400;
}
return $times;
};
$reader = function ($mchid, $time) {
$cond['mchid'] = $mchid;
$cond['inner_status'] = 0;
$cond['refill_order.order_time'] = ['between', [$time, $time + 86400 - 1]];
$items = Model('')->table('refill_order,vr_order')->join('inner')
->on('refill_order.order_id=vr_order.order_id')
->field('count(*) as order_count, vr_order.order_state, sum(mch_amount) as mch_amounts')
->group('vr_order.order_state')
->where($cond)->select();
return $items;
};
$begins = $times_begin($today);
$mchid = 10096;
// $states = rcache($this->mchid() , 'refillstat-');
$states = unserialize($states ?? "");
if (empty($states)) $states = [];
$result = [];
$cache = [];
foreach ($begins as $begin) {
if (array_key_exists($begin, $states)) {
$item = $states[$begin];
} else {
$item = $reader($mchid, $begin);
}
$result[$begin] = $item;
//判断item 中充值中的状态是否为0,为0的情况下放进cache
$cache = $item;
}
wcache($this->mchid(), $cache, 'refillstat-');
return $result;
}
public function testNotifyx()
{
$mch_cache = rcache("merchant-notify", 'refill-');
$caches = empty($mch_cache['data']) ? [] : unserialize($mch_cache['data']);
$new_caches = [];
$merchants = Model('merchant')->getMerchantList([], '', '', 'merchant.*,member.available_predeposit', "0,1000");
foreach ($merchants as $merchant) {
$mchid = $merchant['mchid'];
$phone = $merchant['contact_phone'] ?? "";
$available_pd = intval($merchant['available_predeposit']);
$alarm_pd = intval($merchant['alarm_amount']) < 10000 ? 10000 : intval($merchant['alarm_amount']);
if (array_key_exists($mchid, $caches)) {
$mch_cache = $caches[$mchid];
} else {
$mch_cache = ['last_time' => 0, 'send_count' => 0];
}
if (!empty($phone) && ($available_pd < $alarm_pd)) {
$counts = $mch_cache['send_count'];
if (($mch_cache['last_time'] + 300 < time()) && $counts < 5) {
$mch_cache = ['last_time' => time(), 'send_count' => $counts + 1];
QueueClient::push('sendSMS', ['mobile' => $merchant['contact_phone'],
'type' => 'balance_warning', 'datas' => [date("m月d日H时"), $merchant['available_predeposit']]]);
}
} else {
$mch_cache = ['last_time' => 0, 'send_count' => 0];
}
$new_caches[$mchid] = $mch_cache;
}
wcache("merchant-notify", ['data' => serialize($new_caches)], 'refill-');
}
public function testReadChannel()
{
refill\RefillFactory::instance()->read_channel();
}
public function testAllow()
{
$allow = refill\RefillFactory::instance()->allow(10096, 1, 100);
}
public function testCheckData()
{
$str = '|2|110667993758599771-充值失败|';
// $str = '0|提交成功|-36557.7400';
// if(preg_match( '/^-*[0-9]{1,3}\|[\x{4e00}-\x{9fa5}]+\|-*[0-9]+\.*[0-9]+$/u',$str,$matches)) {
// return true;
// }
// if(preg_match('/^[0-3]\|[0-9]+-*[\x{4e00}-\x{9fa5}]+\|[0-9]*$/u',$str,$matches)){
// return true;
// }
// return false;
$resp = ltrim($str, '|');
$resp = explode('|', $resp);
if (count($resp) != 3) {
return [false, '返回值错误'];
}
}
public function testErrre()
{
$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}';
$ret = preg_match('/[\w\W]+"channelOrderNumber":"(?P[^"]+)"[\w\W]+"message":"(?P[\x{4e00}-\x{9fa5}]+)"[\w\W]+"status":109/u', $line, $matches);
}
public function testExpolode()
{
$x = "HTTP-504";
[$type,$code] = explode('-',$x);
}
public function testMchctl()
{
$ctl = new refill\mchctl();
}
public function testAsyncadd()
{
$x = \refill\util::async_add(['xxxx' => 1],4);
}
}
//docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefill::testLoadBlack)( .*)?$/" --test-suffix TestRefill.php /var/www/html/test
//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