12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace refill\duiba_fetch;
- require_once(BASE_HELPER_RAPI_PATH . '/duiba_fetch/config.php');
- use refill;
- use Log;
- class RefillPhone extends refill\IRefillThird
- {
- public function __construct($cfgs)
- {
- parent::__construct($cfgs);
- }
- private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
- {
- $params['tel'] = $phone;
- $params['mch_order_id'] = $order_sn;
- $params['mchid'] = config::MCHID;
- $params['price'] = $amount;
- $params['notify'] = config::NOTIFY_URL;
- $params['teltype'] = config::operator[$card_type];
- $params['timeout'] = 50;
- $params['time'] = time();
- $params['rand'] = rand(100000,999999);
- return $params;
- }
- public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
- {
- //大面值 直接返回成功
- // refill\util::send_normal($params['order_sn']);
- return [true , '',false];
- }
- public function query($refill_info)
- {
- $params['mch_order_id'] = $refill_info['order_sn'];
- $params['mchid'] = config::MCHID;
- $content = $params['mchid'] . $params['mch_order_id'] . config::KEY;
- $params['sign'] = md5($content);
- $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
- if ($resp === false) {
- return [false, '系统错误'];
- } else {
- $rand = mt_rand(0,1);
- return [$rand , ''];
- }
- }
- private function sign($params)
- {
- $key = config::KEY;
- $content = $params['mchid'] . $params['tel'] . $params['mch_order_id'] . $params['price'] . $params['teltype'] . $params['timeout'] . $params['notify'];
- $content .= $params['time'] . $params['rand'] . $key;
- return md5($content);
- }
- }
|