xiaoyu пре 1 година
родитељ
комит
4e2cc205b9

+ 19 - 13
helper/refill/api/xyz/feimingyu/RefillCallBack.php

@@ -8,9 +8,7 @@ class RefillCallBack implements refill\IRefillCallBack
 {
     public function verify($params): bool
     {
-        $input = $params;
-        unset($input['sign']);
-        $sign = config::sign($input);
+        $sign = $this->sign($params);
         if ($params['sign'] == $sign) {
             return true;
         } else {
@@ -18,25 +16,33 @@ class RefillCallBack implements refill\IRefillCallBack
         }
     }
 
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
     public function notify($params)
     {
-        $status = $params['orderStatus'];
-        $order_sn = $params['applyNo'];
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false, false, ''];
+            return [false, false, false,false];
         }
 
         $order_id = $order_info['order_id'];
-        if ($status === 'SUCCESS') {
-            $official_sn = strtolower($params['ext1']) == 'null' ? '' : $params['ext1'];
-            $data['official_sn'] = $official_sn;
+        if ($status === 1) {
+            $data['official_sn'] = strtolower($params['remark1']) == 'null' ? '' : $params['remark1'];
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false, true, $official_sn];
-        } elseif ($status === 'FAILED') {
-            return [$order_id, false, true, true, ''];
+            return [$order_id, true, false, true];
+        } elseif ($status === 9) {
+            return [$order_id, false, true, true];
         } else {
-            return [$order_id, false, false, false, ''];
+            return [$order_id, false, false, false];
         }
     }
 }

+ 71 - 58
helper/refill/api/xyz/feimingyu/RefillPhone.php

@@ -14,15 +14,18 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
     }
 
-    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    private function req_params(int $phone, int $amount, $card_type, string $order_sn)
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['applyNo'] = $order_sn;
-        $params['rechargeNo'] = $phone;
-        $params['agentProductId'] = config::PRODUCT[$card_type][$amount];
-        $params['denomination'] = $amount;
-        $params['callbackUrl'] = config::NOTIFY_URL;
+        $params['userid'] = config::USER_ID;
+        $params['productid'] = config::ProductIdS[$card_type][$amount];
+        $params['price'] = $amount;
+        $params['num'] = 1;
+        $params['mobile'] = $phone;
+        $params['spordertime'] = date("YmdHis");
+        $params['sporderid'] = $order_sn;
+        $params['back_url'] = config::NOTIFY_URL;
+        $params['paytype'] = config::operator[$card_type];
+
         return $params;
     }
 
@@ -30,14 +33,9 @@ class RefillPhone extends refill\IRefillPhone
     {
         $order_sn = $params['order_sn'];
         $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
-        if(empty($params['agentProductId'])) {
-            return [false, '商品编号错误', false];
-        }
-        $sign = config::sign($params);
-        $params['sign'] = $sign;
 
-        $json_str = json_encode($params);
-        Log::record("feimingyu body : {$json_str}", Log::DEBUG);
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
 
@@ -47,69 +45,77 @@ class RefillPhone extends refill\IRefillPhone
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
+            $resp = $this->xmlToArray($resp);
             if (empty($resp)) {
                 return [false, '网络错误', true];
-            } elseif ($resp['code'] === '00000') {
-                return [true, $resp['data']['orderNo'], false];
-            } elseif ($resp['code'] === 'A0503') {
-                $net_errno = "HTTP-{$resp['code']}";
-                return [false, $resp['msg'], true];
+            }
+
+            $resultno = $resp['resultno'];
+            if (in_array($resultno, ['0', '2'], true)) {
+                return [true, $resp['orderid'], false];
+            } elseif (in_array($resultno, config::ERR_NOS, true)) {
+                return [false, $resultno, false];
+            } elseif ($resultno === '9999' || $resultno === '5006') {
+                $net_errno = "HTTP-{$resultno}";
+                return [false, $resultno, true];
             } else {
-                return [false, $resp['msg'], false];
+                //未知结果码
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resultno, true];
             }
         }
     }
 
     public function query($refill_info)
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['applyNo'] = $refill_info['order_sn'];
-        $params['sign'] = config::sign($params);
+        $params['userid'] = config::USER_ID;
+        $params['sporderid'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&sporderid={$params['sporderid']}&key={$key}";
+        $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
-            return [false, '网络错误', ''];
+            return [false, '网络错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
-            if (empty($resp)) {
-                return [false, '网络错误', ''];
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp))
+            {
+                return [false, '网络错误'];
             }
-            elseif ($resp['code'] === '00000')
+            else
             {
-                $offical_sn = '';
-                $status = $resp['data']['orderStatus'];
-                if ($status === 'SUCCESS') {
-                    $offical_sn = $resp['data']['ext1'];
-                    $updata['official_sn'] = $offical_sn;
+                $resultno = $resp['resultno'];
+                if ($resultno === '1') {
+                    $updata['official_sn'] = $resp['remark1'];
                     Model('refill_order')->edit($refill_info['order_id'], $updata);
                     $order_state = ORDER_STATE_SUCCESS;
-                } elseif ($status === 'FAILED') {
+                } elseif ($resultno === '9') {
                     $order_state = ORDER_STATE_CANCEL;
-                } elseif ($status === 'PROCESSING' || $status === 'INIT') {
+                } elseif (in_array($resultno, ['0','2'], true)) {
                     $order_state = ORDER_STATE_SEND;
+                } elseif ($resultno === '5007' && (time() - $refill_info['commit_time'] > 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
                 } else {
-                    return [false, $resp['msg'], $offical_sn];
+                    return [false, $resultno];
                 }
-                return [true, $order_state, $offical_sn];
-            }
-            else
-            {
-                return [false, $resp['msg'], ''];
+
+                return [true, $order_state];
             }
         }
     }
 
     public function balance()
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['sign'] = config::sign($params);
+        $params['userid'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&key={$key}";
+        $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
 
@@ -119,24 +125,31 @@ class RefillPhone extends refill\IRefillPhone
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
+            $resp = $this->xmlToArray($resp);
             if (empty($resp)) {
                 return [false, '网络错误'];
-            } elseif ($resp['code'] === '00000') {
-                return [true, $resp['data']['balance']];
+            } elseif ($resp['resultno'] === '1') {
+                return [true, $resp['balance']];
             } else {
-                return [false, $resp['msg']];
+                return [false, $resp['resultno']];
             }
         }
     }
 
-    /**
-     * 获取毫秒级别的时间戳
-     */
-    private function get_millisecond()
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
+        $content .= "&sporderid={$params['sporderid']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
+    public function xmlToArray($xml)
     {
-        list($msec, $sec) = explode(' ', microtime());
-        $msectime =  (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
-        return date('YmdHis').substr($msectime, -3);
+        $replace_str = str_replace(' ','','encoding="gb2312"');
+        $xml = mb_convert_encoding($xml,"UTF-8","gb2312");
+        $xml = str_replace($replace_str, "encoding='utf-8'", $xml);
+        return refill\util::xmlToArray($xml);
     }
 }

+ 37 - 52
helper/refill/api/xyz/feimingyu/config.php

@@ -6,59 +6,44 @@ namespace refill\feimingyu;
 use mtopcard;
 class config
 {
-    const ORDER_URL = 'http://119.91.194.222:9999/api/v1/order/submit';
-    const QUERY_URL = 'http://119.91.194.222:9999/api/v1/order/query';
-    const BALANCE_URL = 'http://119.91.194.222:9999/api/v1/agent/balance';
+    //https://www.showdoc.com.cn/AQL666666/
+    const ORDER_URL = 'http://60.204.138.14:9086/onlinepay.do';
+    const QUERY_URL= 'http://60.204.138.14:9086/searchpay.do';
+    const BALANCE_URL = 'http://60.204.138.14:9086/searchbalance.do';
 
-    const APP_ID = 'VIP006';
-    const APP_SECRET = 'Ik5APKkMhUJ9NQ6ntJ2R7g==';
+    const USER_ID= '10002543';
+    const KEY = 'NFBQYxrAKPGcDP32GWZhYeKTsPzDFjAi';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_feimingyu.php";
-    const PRODUCT = [
-        mtopcard\ChinaMobileCard => [
-            30  => 334,
-            50  => 335,
-            100 => 336,
-            200 => 337,
-        ],
-
-        mtopcard\ChinaUnicomCard => [
-            30  => 331,
-            50  => 330,
-            100 => 332,
-            200 => 333,
-        ],
-        mtopcard\ChinaTelecomCard => [
-            30  => 338,
-            50  => 339,
-            100 => 340,
-            200 => 341,
-        ]
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ERR_NOS = [
+        '5001','5002','5003','5004','5005','5008','5009','5010','5011','5012'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard =>
+            [
+                30  => '101687',
+                50  => '101688',
+                100 => '101689',
+                200 => '101690',
+            ],
+        mtopcard\ChinaUnicomCard =>
+            [
+                30  => '101705',
+                50  => '101706',
+                100 => '101707',
+                200 => '101708',
+            ],
+        mtopcard\ChinaTelecomCard =>
+            [
+                30  => '101723',
+                50  => '101724',
+                100 => '101725',
+                200 => '101726',
+            ]
     ];
-    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
-
-    public static function sign($params)
-    {
-        $params['appSecret'] = config::APP_SECRET;
-        ksort($params);
-        $content = '';
-        foreach ($params as $key => $value) {
-            if(self::check_empty($value) === false) {
-                $content .= "{$key}={$value}&";
-            }
-        }
-        $content = rtrim($content, '&');
-        return md5($content);
-    }
-
-    public static function check_empty($value)
-    {
-        if (!isset($value))
-            return true;
-        if ($value === null)
-            return true;
-        if (trim($value) === "")
-            return true;
-
-        return false;
-    }
 }

+ 29 - 0
helper/refill/api/xyz/feimingyu/对接文档-yezi.txt

@@ -0,0 +1,29 @@
+登录名:椰子全国
+密码:12345
+用户编码:10002543
+密钥:NFBQYxrAKPGcDP32GWZhYeKTsPzDFjAi
+客户注册和登录地址:
+http://60.204.138.14:7080/
+api接口文档地址:
+https://www.showdoc.com.cn/AQL666666/
+话费下单地址:
+http://60.204.138.14:9086/onlinepay.do
+订单主动查询地址:
+http://60.204.138.14:9086/searchpay.do
+余额查询:
+http://60.204.138.14:9086/searchbalance.do
+
+101687 全国移动话费30元直充
+101688 全国移动话费50元直充
+101689 全国移动话费100元直充
+101690 全国移动话费200元直充   折扣96.3
+
+101705 全国联通话费30元直充
+101706 全国联通话费50元直充
+101707 全国联通话费100元直充
+101708 全国联通话费200元直充  折扣93.5
+
+101723 全国电信话费30元直充
+101724 全国电信话费50元直充
+101725 全国电信话费100元直充
+101726 全国电信话费200元直充    折扣96

+ 0 - 33
helper/refill/api/xyz/feimingyu/开户信息.txt

@@ -1,33 +0,0 @@
-后台地址:http://119.91.194.222/login
-账号:VIP006
-默认密码:123456
-
-APPID:VIP006
-APPSECRET:Ik5APKkMhUJ9NQ6ntJ2R7g==
-
-后台-产品列表,可查看已配置商品信息
-后台-个人中心,可配置IP白名单
-回调地址请在提单接口动态传入
-产品已配置,产品ID请登录后台进行查看
-
-对接文档: https://galaxy168.yuque.com/yxumsu/dbqgf8?#%20%E3%80%8A%E6%98%9F%E4%BA%91%E5%B9%B3%E5%8F%B0%E3%80%8B
-
-话费直充接口:http://119.91.194.222:9999/api/v1/order/submit
-订单查询接口:http://119.91.194.222:9999/api/v1/order/query
-余额查询接口:http://119.91.194.222:9999/api/v1/agent/balance
-
-
-334	全国移动快充30
-335	全国移动快充50
-336	全国移动快充100
-337	全国移动快充200
-
-331	全国联通快充30
-330	全国联通快充50
-332	全国联通快充100
-333	全国联通快充200
-
-338	全国电信快充30
-339	全国电信快充50
-340	全国电信快充100
-341	全国电信快充200

+ 19 - 13
helper/refill/api/yl/feimingyu/RefillCallBack.php

@@ -8,9 +8,7 @@ class RefillCallBack implements refill\IRefillCallBack
 {
     public function verify($params): bool
     {
-        $input = $params;
-        unset($input['sign']);
-        $sign = config::sign($input);
+        $sign = $this->sign($params);
         if ($params['sign'] == $sign) {
             return true;
         } else {
@@ -18,25 +16,33 @@ class RefillCallBack implements refill\IRefillCallBack
         }
     }
 
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
     public function notify($params)
     {
-        $status = $params['orderStatus'];
-        $order_sn = $params['applyNo'];
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false, false, ''];
+            return [false, false, false,false];
         }
 
         $order_id = $order_info['order_id'];
-        if ($status === 'SUCCESS') {
-            $official_sn = strtolower($params['ext1']) == 'null' ? '' : $params['ext1'];
-            $data['official_sn'] = $official_sn;
+        if ($status === 1) {
+            $data['official_sn'] = strtolower($params['remark1']) == 'null' ? '' : $params['remark1'];
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false, true, $official_sn];
-        } elseif ($status === 'FAILED') {
-            return [$order_id, false, true, true, ''];
+            return [$order_id, true, false, true];
+        } elseif ($status === 9) {
+            return [$order_id, false, true, true];
         } else {
-            return [$order_id, false, false, false, ''];
+            return [$order_id, false, false, false];
         }
     }
 }

+ 71 - 55
helper/refill/api/yl/feimingyu/RefillPhone.php

@@ -14,15 +14,18 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
     }
 
-    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    private function req_params(int $phone, int $amount, $card_type, string $order_sn)
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['applyNo'] = $order_sn;
-        $params['rechargeNo'] = $phone;
-        $params['agentProductId'] = config::PRODUCT[$card_type][$amount];
-        $params['denomination'] = $amount;
-        $params['callbackUrl'] = config::NOTIFY_URL;
+        $params['userid'] = config::USER_ID;
+        $params['productid'] = config::ProductIdS[$card_type][$amount];
+        $params['price'] = $amount;
+        $params['num'] = 1;
+        $params['mobile'] = $phone;
+        $params['spordertime'] = date("YmdHis");
+        $params['sporderid'] = $order_sn;
+        $params['back_url'] = config::NOTIFY_URL;
+        $params['paytype'] = config::operator[$card_type];
+
         return $params;
     }
 
@@ -30,10 +33,8 @@ class RefillPhone extends refill\IRefillPhone
     {
         $order_sn = $params['order_sn'];
         $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
-        if(empty($params['agentProductId'])) {
-            return [false, '商品编号错误', false];
-        }
-        $sign = config::sign($params);
+
+        $sign = $this->sign($params);
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
@@ -44,69 +45,77 @@ class RefillPhone extends refill\IRefillPhone
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
+            $resp = $this->xmlToArray($resp);
             if (empty($resp)) {
                 return [false, '网络错误', true];
-            } elseif ($resp['code'] === '00000') {
-                return [true, $resp['data']['orderNo'], false];
-            } elseif ($resp['code'] === 'A0503') {
-                $net_errno = "HTTP-{$resp['code']}";
-                return [false, $resp['msg'], true];
+            }
+
+            $resultno = $resp['resultno'];
+            if (in_array($resultno, ['0', '2'], true)) {
+                return [true, $resp['orderid'], false];
+            } elseif (in_array($resultno, config::ERR_NOS, true)) {
+                return [false, $resultno, false];
+            } elseif ($resultno === '9999' || $resultno === '5006') {
+                $net_errno = "HTTP-{$resultno}";
+                return [false, $resultno, true];
             } else {
-                return [false, $resp['msg'], false];
+                //未知结果码
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resultno, true];
             }
         }
     }
 
     public function query($refill_info)
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['applyNo'] = $refill_info['order_sn'];
-        $params['sign'] = config::sign($params);
+        $params['userid'] = config::USER_ID;
+        $params['sporderid'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&sporderid={$params['sporderid']}&key={$key}";
+        $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
-            return [false, '网络错误', ''];
+            return [false, '网络错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
-            if (empty($resp)) {
-                return [false, '网络错误', ''];
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp))
+            {
+                return [false, '网络错误'];
             }
-            elseif ($resp['code'] === '00000')
+            else
             {
-                $offical_sn = '';
-                $status = $resp['data']['orderStatus'];
-                if ($status === 'SUCCESS') {
-                    $offical_sn = $resp['data']['ext1'];
-                    $updata['official_sn'] = $offical_sn;
+                $resultno = $resp['resultno'];
+                if ($resultno === '1') {
+                    $updata['official_sn'] = $resp['remark1'];
                     Model('refill_order')->edit($refill_info['order_id'], $updata);
                     $order_state = ORDER_STATE_SUCCESS;
-                } elseif ($status === 'FAILED') {
+                } elseif ($resultno === '9') {
                     $order_state = ORDER_STATE_CANCEL;
-                } elseif ($status === 'PROCESSING' || $status === 'INIT') {
+                } elseif (in_array($resultno, ['0','2'], true)) {
                     $order_state = ORDER_STATE_SEND;
+                } elseif ($resultno === '5007' && (time() - $refill_info['commit_time'] > 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
                 } else {
-                    return [false, $resp['msg'], $offical_sn];
+                    return [false, $resultno];
                 }
-                return [true, $order_state, $offical_sn];
-            }
-            else
-            {
-                return [false, $resp['msg'], ''];
+
+                return [true, $order_state];
             }
         }
     }
 
     public function balance()
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['sign'] = config::sign($params);
+        $params['userid'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&key={$key}";
+        $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
 
@@ -116,24 +125,31 @@ class RefillPhone extends refill\IRefillPhone
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
+            $resp = $this->xmlToArray($resp);
             if (empty($resp)) {
                 return [false, '网络错误'];
-            } elseif ($resp['code'] === '00000') {
-                return [true, $resp['data']['balance']];
+            } elseif ($resp['resultno'] === '1') {
+                return [true, $resp['balance']];
             } else {
-                return [false, $resp['msg']];
+                return [false, $resp['resultno']];
             }
         }
     }
 
-    /**
-     * 获取毫秒级别的时间戳
-     */
-    private function get_millisecond()
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
+        $content .= "&sporderid={$params['sporderid']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
+    public function xmlToArray($xml)
     {
-        list($msec, $sec) = explode(' ', microtime());
-        $msectime =  (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
-        return date('YmdHis').substr($msectime, -3);
+        $replace_str = str_replace(' ','','encoding="gb2312"');
+        $xml = mb_convert_encoding($xml,"UTF-8","gb2312");
+        $xml = str_replace($replace_str, "encoding='utf-8'", $xml);
+        return refill\util::xmlToArray($xml);
     }
 }

+ 37 - 52
helper/refill/api/yl/feimingyu/config.php

@@ -6,59 +6,44 @@ namespace refill\feimingyu;
 use mtopcard;
 class config
 {
-    const ORDER_URL = 'http://119.91.194.222:9999/api/v1/order/submit';
-    const QUERY_URL = 'http://119.91.194.222:9999/api/v1/order/query';
-    const BALANCE_URL = 'http://119.91.194.222:9999/api/v1/agent/balance';
+    //https://www.showdoc.com.cn/AQL666666/
+    const ORDER_URL = 'http://60.204.138.14:9086/onlinepay.do';
+    const QUERY_URL= 'http://60.204.138.14:9086/searchpay.do';
+    const BALANCE_URL = 'http://60.204.138.14:9086/searchbalance.do';
 
-    const APP_ID = 'VIP007';
-    const APP_SECRET = 'UuF9LDamNNYV70iZ8hjHdQ==';
+    const USER_ID= '10002544';
+    const KEY = 'eixtp3Gm7HfzDJXW2ziNTy5GW5AehWz3';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_feimingyu.php";
-    const PRODUCT = [
-        mtopcard\ChinaMobileCard => [
-            30  => 347,
-            50  => 348,
-            100 => 349,
-            200 => 350,
-        ],
-
-        mtopcard\ChinaUnicomCard => [
-            30  => 344,
-            50  => 343,
-            100 => 345,
-            200 => 346,
-        ],
-        mtopcard\ChinaTelecomCard => [
-            30  => 351,
-            50  => 352,
-            100 => 353,
-            200 => 354,
-        ]
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ERR_NOS = [
+        '5001','5002','5003','5004','5005','5008','5009','5010','5011','5012'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard =>
+            [
+                30  => '101687',
+                50  => '101688',
+                100 => '101689',
+                200 => '101690',
+            ],
+        mtopcard\ChinaUnicomCard =>
+            [
+                30  => '101705',
+                50  => '101706',
+                100 => '101707',
+                200 => '101708',
+            ],
+        mtopcard\ChinaTelecomCard =>
+            [
+                30  => '101723',
+                50  => '101724',
+                100 => '101725',
+                200 => '101726',
+            ]
     ];
-    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
-
-    public static function sign($params)
-    {
-        $params['appSecret'] = config::APP_SECRET;
-        ksort($params);
-        $content = '';
-        foreach ($params as $key => $value) {
-            if(self::check_empty($value) === false) {
-                $content .= "{$key}={$value}&";
-            }
-        }
-        $content = rtrim($content, '&');
-        return md5($content);
-    }
-
-    public static function check_empty($value)
-    {
-        if (!isset($value))
-            return true;
-        if ($value === null)
-            return true;
-        if (trim($value) === "")
-            return true;
-
-        return false;
-    }
 }

+ 29 - 0
helper/refill/api/yl/feimingyu/对接文档-yelin.txt

@@ -0,0 +1,29 @@
+登录名:椰林全国
+密码:12345
+用户编码:10002544
+密钥:eixtp3Gm7HfzDJXW2ziNTy5GW5AehWz3
+客户注册和登录地址:
+http://60.204.138.14:7080/
+api接口文档地址:
+https://www.showdoc.com.cn/AQL666666/
+话费下单地址:
+http://60.204.138.14:9086/onlinepay.do
+订单主动查询地址:
+http://60.204.138.14:9086/searchpay.do
+余额查询:
+http://60.204.138.14:9086/searchbalance.do
+
+101687 全国移动话费30元直充
+101688 全国移动话费50元直充
+101689 全国移动话费100元直充
+101690 全国移动话费200元直充   折扣96.3
+
+101705 全国联通话费30元直充
+101706 全国联通话费50元直充
+101707 全国联通话费100元直充
+101708 全国联通话费200元直充  折扣93.5
+
+101723 全国电信话费30元直充
+101724 全国电信话费50元直充
+101725 全国电信话费100元直充
+101726 全国电信话费200元直充    折扣96

+ 0 - 33
helper/refill/api/yl/feimingyu/开户信息.txt

@@ -1,33 +0,0 @@
-后台地址:http://119.91.194.222/login
-账号:VIP007
-默认密码:123456
-
-APPID:VIP007
-APPSECRET:UuF9LDamNNYV70iZ8hjHdQ==
-
-后台-产品列表,可查看已配置商品信息
-后台-个人中心,可配置IP白名单
-回调地址请在提单接口动态传入
-产品已配置,产品ID请登录后台进行查看
-
-对接文档: https://galaxy168.yuque.com/yxumsu/dbqgf8?#%20%E3%80%8A%E6%98%9F%E4%BA%91%E5%B9%B3%E5%8F%B0%E3%80%8B
-
-话费直充接口:http://119.91.194.222:9999/api/v1/order/submit
-订单查询接口:http://119.91.194.222:9999/api/v1/order/query
-余额查询接口:http://119.91.194.222:9999/api/v1/agent/balance
-
-
-347	全国移动快充30
-348	全国移动快充50
-349	全国移动快充100
-350	全国移动快充200
-
-344	全国联通快充30
-343	全国联通快充50
-345	全国联通快充100
-346	全国联通快充200
-
-351	全国电信快充30
-352	全国电信快充50
-353	全国电信快充100
-354	全国电信快充200

+ 1 - 1
mobile/callback/refill_feimingyu.php

@@ -1,4 +1,4 @@
 <?php
 
 refill\util::push_notify('feimingyu',$_POST);
-echo json_encode(['code' => '00000']);
+echo ('OK');