xiaoyu 3 years ago
parent
commit
75c4069b79

+ 3 - 3
helper/refill/api/xyz/lexiangdx/RefillPhone.php

@@ -14,13 +14,13 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
         parent::__construct($cfgs);
     }
     }
 
 
-    private function req_params(int $phone, int $amount, string $order_sn)
+    private function req_params(int $phone, int $card_type, int $amount, string $order_sn)
     {
     {
         $data['ChargeAccount'] = $phone;
         $data['ChargeAccount'] = $phone;
         $data['SupBuyNum'] = 1;
         $data['SupBuyNum'] = 1;
         $data['ChargeValue'] = $amount;
         $data['ChargeValue'] = $amount;
         $data['OrderType'] = 1;
         $data['OrderType'] = 1;
-        $data['ChargeType'] = 2;
+        $data['ChargeType'] = config::operator[$card_type];
         $data['Id'] = $order_sn;
         $data['Id'] = $order_sn;
 
 
         $params['mchid'] = config::MCH_ID;
         $params['mchid'] = config::MCH_ID;
@@ -31,7 +31,7 @@ class RefillPhone extends refill\IRefillPhone
 
 
     public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
     public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
     {
     {
-        $params = $this->req_params($card_no, $amount, $params['order_sn']);
+        $params = $this->req_params($card_no, $card_type, $amount, $params['order_sn']);
 
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
 
 

+ 6 - 0
helper/refill/api/xyz/lexiangdx/config.php

@@ -1,6 +1,7 @@
 <?php
 <?php
 namespace refill\lexiangdx;
 namespace refill\lexiangdx;
 
 
+use mtopcard;
 class config
 class config
 {
 {
     const ORDER_URL = 'http://103.216.152.8:8882?c=pay&m=create';
     const ORDER_URL = 'http://103.216.152.8:8882?c=pay&m=create';
@@ -13,4 +14,9 @@ class config
     const aesIV = '1111111111111111';
     const aesIV = '1111111111111111';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_lexiangdx.php";
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_lexiangdx.php";
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+    const operator = [
+        mtopcard\ChinaMobileCard => 3,
+        mtopcard\ChinaUnicomCard => 1,
+        mtopcard\ChinaTelecomCard => 2
+    ];
 }
 }

+ 3 - 3
helper/refill/api/xyz/lexianglt/RefillPhone.php

@@ -14,13 +14,13 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
         parent::__construct($cfgs);
     }
     }
 
 
-    private function req_params(int $phone, int $amount, string $order_sn)
+    private function req_params(int $phone, int $card_type, int $amount, string $order_sn)
     {
     {
         $data['ChargeAccount'] = $phone;
         $data['ChargeAccount'] = $phone;
         $data['SupBuyNum'] = 1;
         $data['SupBuyNum'] = 1;
         $data['ChargeValue'] = $amount;
         $data['ChargeValue'] = $amount;
         $data['OrderType'] = 1;
         $data['OrderType'] = 1;
-        $data['ChargeType'] = 1;
+        $data['ChargeType'] = config::operator[$card_type];
         $data['Id'] = $order_sn;
         $data['Id'] = $order_sn;
 
 
         $params['mchid'] = config::MCH_ID;
         $params['mchid'] = config::MCH_ID;
@@ -31,7 +31,7 @@ class RefillPhone extends refill\IRefillPhone
 
 
     public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
     public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
     {
     {
-        $params = $this->req_params($card_no, $amount, $params['order_sn']);
+        $params = $this->req_params($card_no, $card_type, $amount, $params['order_sn']);
 
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
 
 

+ 6 - 0
helper/refill/api/xyz/lexianglt/config.php

@@ -1,6 +1,7 @@
 <?php
 <?php
 namespace refill\lexianglt;
 namespace refill\lexianglt;
 
 
+use mtopcard;
 class config
 class config
 {
 {
     const ORDER_URL = 'http://103.216.152.8:8882?c=pay&m=create';
     const ORDER_URL = 'http://103.216.152.8:8882?c=pay&m=create';
@@ -13,4 +14,9 @@ class config
     const aesIV = '1111111111111111';
     const aesIV = '1111111111111111';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_lexianglt.php";
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_lexianglt.php";
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+    const operator = [
+        mtopcard\ChinaMobileCard => 3,
+        mtopcard\ChinaUnicomCard => 1,
+        mtopcard\ChinaTelecomCard => 2
+    ];
 }
 }

+ 3 - 3
helper/refill/api/xyz/lexiangyd/RefillPhone.php

@@ -14,13 +14,13 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
         parent::__construct($cfgs);
     }
     }
 
 
-    private function req_params(int $phone, int $amount, string $order_sn)
+    private function req_params(int $phone, int $card_type, int $amount, string $order_sn)
     {
     {
         $data['ChargeAccount'] = $phone;
         $data['ChargeAccount'] = $phone;
         $data['SupBuyNum'] = 1;
         $data['SupBuyNum'] = 1;
         $data['ChargeValue'] = $amount;
         $data['ChargeValue'] = $amount;
         $data['OrderType'] = 1;
         $data['OrderType'] = 1;
-        $data['ChargeType'] = 3;
+        $data['ChargeType'] = config::operator[$card_type];
         $data['Id'] = $order_sn;
         $data['Id'] = $order_sn;
 
 
         $params['mchid'] = config::MCH_ID;
         $params['mchid'] = config::MCH_ID;
@@ -31,7 +31,7 @@ class RefillPhone extends refill\IRefillPhone
 
 
     public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
     public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
     {
     {
-        $params = $this->req_params($card_no, $amount, $params['order_sn']);
+        $params = $this->req_params($card_no, $card_type, $amount, $params['order_sn']);
 
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
 
 

+ 6 - 0
helper/refill/api/xyz/lexiangyd/config.php

@@ -1,6 +1,7 @@
 <?php
 <?php
 namespace refill\lexiangyd;
 namespace refill\lexiangyd;
 
 
+use mtopcard;
 class config
 class config
 {
 {
     const ORDER_URL = 'http://103.216.152.8:8882?c=pay&m=create';
     const ORDER_URL = 'http://103.216.152.8:8882?c=pay&m=create';
@@ -13,4 +14,9 @@ class config
     const aesIV = '1111111111111111';
     const aesIV = '1111111111111111';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_lexiangyd.php";
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_lexiangyd.php";
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+    const operator = [
+        mtopcard\ChinaMobileCard => 3,
+        mtopcard\ChinaUnicomCard => 1,
+        mtopcard\ChinaTelecomCard => 2
+    ];
 }
 }