|
@@ -6,7 +6,6 @@ require_once(BASE_HELPER_RAPI_PATH . '/afand/config.php');
|
|
|
|
|
|
use refill;
|
|
|
use Log;
|
|
|
-use mtopcard;
|
|
|
|
|
|
class RefillPhone extends refill\IRefillPhone
|
|
|
{
|
|
@@ -15,14 +14,14 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
parent::__construct($cfgs);
|
|
|
}
|
|
|
|
|
|
- private function req_params(int $phone, int $amount, string $order_sn)
|
|
|
+ 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'] = $this->phone_type($phone);
|
|
|
+ $params['teltype'] = config::operator[$card_type];
|
|
|
$params['timeout'] = 50;
|
|
|
$params['time'] = time();
|
|
|
$params['rand'] = rand(100000,999999);
|
|
@@ -33,7 +32,7 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
//[$state, $errmsg,$neterr]
|
|
|
public function add($card_no, $card_type, $amount, $params)
|
|
|
{
|
|
|
- $params = $this->req_params($card_no, $amount, $params['order_sn']);
|
|
|
+ $params = $this->req_params($card_no, $amount, $card_type, $params['order_sn']);
|
|
|
$sign = $this->sign($params);
|
|
|
$params['sign'] = $sign;
|
|
|
|
|
@@ -106,17 +105,4 @@ class RefillPhone extends refill\IRefillPhone
|
|
|
$content .= $params['time'] . $params['rand'] . $key;
|
|
|
return md5($content);
|
|
|
}
|
|
|
-
|
|
|
- private function phone_type($phone)
|
|
|
- {
|
|
|
- $card_type = mtopcard\card_type($phone,$regin_no);
|
|
|
-
|
|
|
- if ($card_type == mtopcard\ChinaMobileCard) {
|
|
|
- return 2;
|
|
|
- } elseif ($card_type == mtopcard\ChinaUnicomCard) {
|
|
|
- return 1;
|
|
|
- } elseif ($card_type == mtopcard\ChinaTelecomCard) {
|
|
|
- return 3;
|
|
|
- }
|
|
|
- }
|
|
|
}
|