Prechádzať zdrojové kódy

feimingyu update api

xiaoyu 2 rokov pred
rodič
commit
556fb48b0f

+ 12 - 21
helper/refill/api/xyz/feimingyu/RefillCallBack.php

@@ -4,15 +4,13 @@ namespace refill\feimingyu;
 require_once(BASE_HELPER_RAPI_PATH . '/feimingyu/config.php');
 
 use refill;
-
 class RefillCallBack implements refill\IRefillCallBack
 {
     public function verify($params): bool
     {
         $input = $params;
         unset($input['sign']);
-        unset($input['voucher']);
-        $sign = $this->sign($input);
+        $sign = config::sign($input);
         if ($params['sign'] == $sign) {
             return true;
         } else {
@@ -20,32 +18,25 @@ class RefillCallBack implements refill\IRefillCallBack
         }
     }
 
-    private function sign($params)
-    {
-        ksort($params);
-        $str = implode('', $params);
-        $str .= config::KEY;
-        return strtoupper(md5($str));
-    }
-
     public function notify($params)
     {
-        $status = $params['state'];
-        $order_sn = $params['user_order'];
+        $status = $params['orderStatus'];
+        $order_sn = $params['applyNo'];
         $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') {
-            $data['official_sn'] = strtolower($params['voucher']) == 'null' ? '' : $params['voucher'];
+        if ($status === 'SUCCESS') {
+            $official_sn = strtolower($params['ext1']) == 'null' ? '' : $params['ext1'];
+            $data['official_sn'] = $official_sn;
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false, true];
-        } elseif ($status === 'failed') {
-            return [$order_id, false, true, true];
+            return [$order_id, true, false, true, $official_sn];
+        } elseif ($status === 'FAILED') {
+            return [$order_id, false, true, true, ''];
         } else {
-            return [$order_id, false, false, false];
+            return [$order_id, false, false, false, ''];
         }
     }
-}
+}

+ 51 - 54
helper/refill/api/xyz/feimingyu/RefillPhone.php

@@ -1,5 +1,4 @@
 <?php
-declare(strict_types=0);
 
 namespace refill\feimingyu;
 
@@ -17,14 +16,13 @@ class RefillPhone extends refill\IRefillPhone
 
     private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
     {
-        $params['userid'] = config::USER_ID;
-        $params['create_time'] = date("YmdHis");
-        $params['buy_type'] = 1;
-        $params['account'] = $phone;
-        $params['product_id'] = config::Products[$card_type][$amount];
-        $params['amount'] = $amount;
-        $params['user_order'] = $order_sn;
-
+        $params['appId'] = config::APP_ID;
+        $params['timestamp'] = date("YmdHis").$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;
         return $params;
     }
 
@@ -32,11 +30,13 @@ class RefillPhone extends refill\IRefillPhone
     {
         $order_sn = $params['order_sn'];
         $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
-        $sign = $this->sign($params);
+        if(empty($params['agentProductId'])) {
+            return [false, '商品编号错误', false];
+        }
+        $sign = config::sign($params);
         $params['sign'] = $sign;
-        $params['cat_id'] = config::operator[$card_type];
 
-        $resp = http_request(config::ORDER_URL, $params, 'GET', false, [], $net_errno);
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
 
         if (empty($resp)) {
             return [false, '网络错误', true];
@@ -47,32 +47,25 @@ class RefillPhone extends refill\IRefillPhone
             $resp = json_decode($resp, true);
             if (empty($resp)) {
                 return [false, '网络错误', true];
-            }
-            $status = $resp['status'];
-
-            if ($status === '0') {
-                return [true, $resp['order_id'], false];
-            } elseif (in_array($status, config::ERR_NOS, true)) {
-                return [false, $resp['msg'], false];
-            } elseif (in_array($status, ['110', '113', '-999'], true)) {
-                $net_errno = "HTTP-{$status}";
+            } elseif ($resp['code'] === '00000') {
+                return [true, $resp['data']['orderNo'], false];
+            } elseif ($resp['code'] === 'A0503') {
+                $net_errno = "HTTP-{$resp['code']}";
                 return [false, $resp['msg'], true];
             } else {
-                //未知状态码
-                $net_errno = "HTTP-998";
-                return [false, $resp['msg'], true];
+                return [false, $resp['msg'], false];
             }
         }
     }
 
     public function query($refill_info)
     {
-        $params['userid'] = config::USER_ID;
-        $params['create_time'] = date("YmdHis");
-        $params['user_order'] = $refill_info['order_sn'];
-        $params['sign'] = $this->sign($params);
+        $params['appId'] = config::APP_ID;
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
+        $params['applyNo'] = $refill_info['order_sn'];
+        $params['sign'] = config::sign($params);
 
-        $resp = http_request(config::QUERY_URL, $params);
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
             return [false, '网络错误'];
@@ -81,38 +74,41 @@ class RefillPhone extends refill\IRefillPhone
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if (empty($resp))
-            {
-                return [false, '网络错误'];
+            if (empty($resp)) {
+                return [false, '网络错误', ''];
             }
-            elseif ($resp['status'] === '0')
+            elseif ($resp['code'] === '00000')
             {
-                $status = $resp['state'];
-                if ($status === 'success') {
-                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $resp['voucher']]);
+                $offical_sn = '';
+                $status = $resp['data']['orderStatus'];
+                if ($status === 'SUCCESS') {
+                    $offical_sn = $resp['data']['ext1'];
+                    $updata['official_sn'] = $offical_sn;
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
                     $order_state = ORDER_STATE_SUCCESS;
-                } elseif ($status === 'failed') {
+                } elseif ($status === 'FAILED') {
                     $order_state = ORDER_STATE_CANCEL;
-                } elseif ($status === 'untreated') {
+                } elseif ($status === 'PROCESSING' || $status === 'INIT') {
                     $order_state = ORDER_STATE_SEND;
                 } else {
-                    return [false, $status];
+                    return [false, $resp['msg'], $offical_sn];
                 }
-                return [true, $order_state];
+                return [true, $order_state, $offical_sn];
             }
-            else {
-                return [false, $resp['msg']];
+            else
+            {
+                return [false, $resp['msg'], ''];
             }
         }
     }
 
     public function balance()
     {
-        $params['userid'] = config::USER_ID;
-        $params['create_time'] = date("YmdHis");
-        $params['sign'] = $this->sign($params);
+        $params['appId'] = config::APP_ID;
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
+        $params['sign'] = config::sign($params);
 
-        $resp = http_request(config::BALANCE_URL, $params);
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
             return [false, '网络错误'];
@@ -123,19 +119,20 @@ class RefillPhone extends refill\IRefillPhone
             $resp = json_decode($resp, true);
             if (empty($resp)) {
                 return [false, '网络错误'];
-            } elseif ($resp['status'] === '0') {
-                return [true, $resp['balance']];
+            } elseif ($resp['code'] === '00000') {
+                return [true, $resp['data']['balance']];
             } else {
                 return [false, $resp['msg']];
             }
         }
     }
 
-    private function sign($params)
+    /**
+     * 获取毫秒级别的时间戳
+     */
+    private function get_millisecond()
     {
-        ksort($params);
-        $str = implode('', $params);
-        $str .= config::KEY;
-        return strtoupper(md5($str));
+        list($usec, $sec) = explode(" ", microtime());
+        return round($usec*1000);
     }
-}
+}

+ 50 - 41
helper/refill/api/xyz/feimingyu/config.php

@@ -6,50 +6,59 @@ namespace refill\feimingyu;
 use mtopcard;
 class config
 {
-    //回调地址需配置
-    const ORDER_URL = 'http://47.98.163.205:80/recharge/buy.do';
-    const QUERY_URL= 'http://47.98.163.205:80/recharge/query.do';
-    const BALANCE_URL = 'http://47.98.163.205:80/user/balance.do';
+    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';
 
-    const USER_ID= '69876';
-    const KEY = 'AC7F7353AAA6';
+    const APP_ID = 'VIP006';
+    const APP_SECRET = 'Ik5APKkMhUJ9NQ6ntJ2R7g==';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_feimingyu.php";
+    const PRODUCT = [
+        mtopcard\ChinaMobileCard => [
+            30  => 334,
+            50  => 335,
+            100 => 336,
+            200 => 337,
+        ],
 
-    const operator = [
-        mtopcard\ChinaMobileCard  => 1,
-        mtopcard\ChinaUnicomCard  => 2,
-        mtopcard\ChinaTelecomCard => 3
+        mtopcard\ChinaUnicomCard => [
+            30  => 331,
+            50  => 330,
+            100 => 332,
+            200 => 333,
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30  => 338,
+            50  => 339,
+            100 => 340,
+            200 => 341,
+        ]
     ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
 
-    const Products = [
-        mtopcard\ChinaMobileCard =>
-            [
-                30  => 20003,
-                50  => 20004,
-                100 => 20005,
-                200 => 20006,
-                300 => 20007,
-                500 => 20008
-            ],
-        mtopcard\ChinaUnicomCard =>
-            [
-                30  => 20011,
-                50  => 20012,
-                100 => 20013,
-                200 => 20014,
-                300 => 20015,
-                500 => 20016
-            ],
-        mtopcard\ChinaTelecomCard =>
-            [
-                30  => 20019,
-                50  => 20020,
-                100 => 20021,
-                200 => 20022,
-                300 => 20023,
-                500 => 20024
-            ]
-    ];
+    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;
 
-    const ERR_NOS = ['101', '102', '103', '104', '105', '106', '107', '108', '109', '100', '112', '115', '116', '117', '118', '119', '120'];
-}
+        return false;
+    }
+}

BIN
helper/refill/api/xyz/feimingyu/互联网增值业务接口文档.pdf


BIN
helper/refill/api/xyz/feimingyu/产品编码.xlsx


+ 0 - 8
helper/refill/api/xyz/feimingyu/北京椰子对接信息.txt

@@ -1,8 +0,0 @@
-客户端入口:http://47.98.163.205:80/
-下单接口:http://47.98.163.205:80/recharge/buy.do
-订单查询:http://47.98.163.205:80/recharge/query.do
-余额查询:http://47.98.163.205:80/user/balance.do
-帐号:北京椰子
-密码:123456
-用户编号:69876
-秘钥:AC7F7353AAA6

+ 0 - 8
helper/refill/api/xyz/feimingyu/对接信息.txt

@@ -1,8 +0,0 @@
-客户端入口:http://47.98.163.205:80/
-下单接口:http://47.98.163.205:80/recharge/buy.do
-订单查询:http://47.98.163.205:80/recharge/query.do
-余额查询:http://47.98.163.205:80/user/balance.do
-帐号:北京椰子
-密码:123456
-用户编号:69876
-秘钥:AC7F7353AAA6

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

@@ -0,0 +1,33 @@
+后台地址: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

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

@@ -4,15 +4,13 @@ namespace refill\feimingyu;
 require_once(BASE_HELPER_RAPI_PATH . '/feimingyu/config.php');
 
 use refill;
-
 class RefillCallBack implements refill\IRefillCallBack
 {
     public function verify($params): bool
     {
         $input = $params;
         unset($input['sign']);
-        unset($input['voucher']);
-        $sign = $this->sign($input);
+        $sign = config::sign($input);
         if ($params['sign'] == $sign) {
             return true;
         } else {
@@ -20,32 +18,25 @@ class RefillCallBack implements refill\IRefillCallBack
         }
     }
 
-    private function sign($params)
-    {
-        ksort($params);
-        $str = implode('', $params);
-        $str .= config::KEY;
-        return strtoupper(md5($str));
-    }
-
     public function notify($params)
     {
-        $status = $params['state'];
-        $order_sn = $params['user_order'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        $status = $params['orderStatus'];
+        $order_sn = $params['applyNo'];
+        $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') {
-            $data['official_sn'] = strtolower($params['voucher']) == 'null' ? '' : $params['voucher'];
+        if ($status === 'SUCCESS') {
+            $official_sn = strtolower($params['ext1']) == 'null' ? '' : $params['ext1'];
+            $data['official_sn'] = $official_sn;
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false, true];
-        } elseif ($status === 'failed') {
-            return [$order_id, false, true, true];
+            return [$order_id, true, false, true, $official_sn];
+        } elseif ($status === 'FAILED') {
+            return [$order_id, false, true, true, ''];
         } else {
-            return [$order_id, false, false, false];
+            return [$order_id, false, false, false, ''];
         }
     }
-}
+}

+ 51 - 54
helper/refill/api/yl/feimingyu/RefillPhone.php

@@ -1,5 +1,4 @@
 <?php
-declare(strict_types=0);
 
 namespace refill\feimingyu;
 
@@ -17,14 +16,13 @@ class RefillPhone extends refill\IRefillPhone
 
     private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
     {
-        $params['userid'] = config::USER_ID;
-        $params['create_time'] = date("YmdHis");
-        $params['buy_type'] = 1;
-        $params['account'] = $phone;
-        $params['product_id'] = config::Products[$card_type][$amount];
-        $params['amount'] = $amount;
-        $params['user_order'] = $order_sn;
-
+        $params['appId'] = config::APP_ID;
+        $params['timestamp'] = date("YmdHis").$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;
         return $params;
     }
 
@@ -32,11 +30,13 @@ class RefillPhone extends refill\IRefillPhone
     {
         $order_sn = $params['order_sn'];
         $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
-        $sign = $this->sign($params);
+        if(empty($params['agentProductId'])) {
+            return [false, '商品编号错误', false];
+        }
+        $sign = config::sign($params);
         $params['sign'] = $sign;
-        $params['cat_id'] = config::operator[$card_type];
 
-        $resp = http_request(config::ORDER_URL, $params, 'GET', false, [], $net_errno);
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
 
         if (empty($resp)) {
             return [false, '网络错误', true];
@@ -47,32 +47,25 @@ class RefillPhone extends refill\IRefillPhone
             $resp = json_decode($resp, true);
             if (empty($resp)) {
                 return [false, '网络错误', true];
-            }
-            $status = $resp['status'];
-
-            if ($status === '0') {
-                return [true, $resp['order_id'], false];
-            } elseif (in_array($status, config::ERR_NOS, true)) {
-                return [false, $resp['msg'], false];
-            } elseif (in_array($status, ['110', '113', '-999'], true)) {
-                $net_errno = "HTTP-{$status}";
+            } elseif ($resp['code'] === '00000') {
+                return [true, $resp['data']['orderNo'], false];
+            } elseif ($resp['code'] === 'A0503') {
+                $net_errno = "HTTP-{$resp['code']}";
                 return [false, $resp['msg'], true];
             } else {
-                //未知状态码
-                $net_errno = "HTTP-998";
-                return [false, $resp['msg'], true];
+                return [false, $resp['msg'], false];
             }
         }
     }
 
     public function query($refill_info)
     {
-        $params['userid'] = config::USER_ID;
-        $params['create_time'] = date("YmdHis");
-        $params['user_order'] = $refill_info['order_sn'];
-        $params['sign'] = $this->sign($params);
+        $params['appId'] = config::APP_ID;
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
+        $params['applyNo'] = $refill_info['order_sn'];
+        $params['sign'] = config::sign($params);
 
-        $resp = http_request(config::QUERY_URL, $params);
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
             return [false, '网络错误'];
@@ -81,38 +74,41 @@ class RefillPhone extends refill\IRefillPhone
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-            if (empty($resp))
-            {
-                return [false, '网络错误'];
+            if (empty($resp)) {
+                return [false, '网络错误', ''];
             }
-            elseif ($resp['status'] === '0')
+            elseif ($resp['code'] === '00000')
             {
-                $status = $resp['state'];
-                if ($status === 'success') {
-                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $resp['voucher']]);
+                $offical_sn = '';
+                $status = $resp['data']['orderStatus'];
+                if ($status === 'SUCCESS') {
+                    $offical_sn = $resp['data']['ext1'];
+                    $updata['official_sn'] = $offical_sn;
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
                     $order_state = ORDER_STATE_SUCCESS;
-                } elseif ($status === 'failed') {
+                } elseif ($status === 'FAILED') {
                     $order_state = ORDER_STATE_CANCEL;
-                } elseif ($status === 'untreated') {
+                } elseif ($status === 'PROCESSING' || $status === 'INIT') {
                     $order_state = ORDER_STATE_SEND;
                 } else {
-                    return [false, $status];
+                    return [false, $resp['msg'], $offical_sn];
                 }
-                return [true, $order_state];
+                return [true, $order_state, $offical_sn];
             }
-            else {
-                return [false, $resp['msg']];
+            else
+            {
+                return [false, $resp['msg'], ''];
             }
         }
     }
 
     public function balance()
     {
-        $params['userid'] = config::USER_ID;
-        $params['create_time'] = date("YmdHis");
-        $params['sign'] = $this->sign($params);
+        $params['appId'] = config::APP_ID;
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
+        $params['sign'] = config::sign($params);
 
-        $resp = http_request(config::BALANCE_URL, $params);
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
             return [false, '网络错误'];
@@ -123,19 +119,20 @@ class RefillPhone extends refill\IRefillPhone
             $resp = json_decode($resp, true);
             if (empty($resp)) {
                 return [false, '网络错误'];
-            } elseif ($resp['status'] === '0') {
-                return [true, $resp['balance']];
+            } elseif ($resp['code'] === '00000') {
+                return [true, $resp['data']['balance']];
             } else {
                 return [false, $resp['msg']];
             }
         }
     }
 
-    private function sign($params)
+    /**
+     * 获取毫秒级别的时间戳
+     */
+    private function get_millisecond()
     {
-        ksort($params);
-        $str = implode('', $params);
-        $str .= config::KEY;
-        return strtoupper(md5($str));
+        list($usec, $sec) = explode(" ", microtime());
+        return round($usec*1000);
     }
-}
+}

+ 50 - 41
helper/refill/api/yl/feimingyu/config.php

@@ -6,50 +6,59 @@ namespace refill\feimingyu;
 use mtopcard;
 class config
 {
-    //回调地址需配置
-    const ORDER_URL = 'http://47.98.163.205:80/recharge/buy.do';
-    const QUERY_URL= 'http://47.98.163.205:80/recharge/query.do';
-    const BALANCE_URL = 'http://47.98.163.205:80/user/balance.do';
+    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';
 
-    const USER_ID= '69876';
-    const KEY = 'AC7F7353AAA6';
+    const APP_ID = 'VIP007';
+    const APP_SECRET = 'UuF9LDamNNYV70iZ8hjHdQ==';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_feimingyu.php";
+    const PRODUCT = [
+        mtopcard\ChinaMobileCard => [
+            30  => 334,
+            50  => 335,
+            100 => 336,
+            200 => 337,
+        ],
 
-    const operator = [
-        mtopcard\ChinaMobileCard  => 1,
-        mtopcard\ChinaUnicomCard  => 2,
-        mtopcard\ChinaTelecomCard => 3
+        mtopcard\ChinaUnicomCard => [
+            30  => 331,
+            50  => 330,
+            100 => 332,
+            200 => 333,
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30  => 338,
+            50  => 339,
+            100 => 340,
+            200 => 341,
+        ]
     ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
 
-    const Products = [
-        mtopcard\ChinaMobileCard =>
-            [
-                30  => 20003,
-                50  => 20004,
-                100 => 20005,
-                200 => 20006,
-                300 => 20007,
-                500 => 20008
-            ],
-        mtopcard\ChinaUnicomCard =>
-            [
-                30  => 20011,
-                50  => 20012,
-                100 => 20013,
-                200 => 20014,
-                300 => 20015,
-                500 => 20016
-            ],
-        mtopcard\ChinaTelecomCard =>
-            [
-                30  => 20019,
-                50  => 20020,
-                100 => 20021,
-                200 => 20022,
-                300 => 20023,
-                500 => 20024
-            ]
-    ];
+    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;
 
-    const ERR_NOS = ['101', '102', '103', '104', '105', '106', '107', '108', '109', '100', '112', '115', '116', '117', '118', '119', '120'];
-}
+        return false;
+    }
+}

BIN
helper/refill/api/yl/feimingyu/互联网增值业务接口文档.pdf


BIN
helper/refill/api/yl/feimingyu/产品编码.xlsx


+ 0 - 8
helper/refill/api/yl/feimingyu/北京椰子对接信息.txt

@@ -1,8 +0,0 @@
-客户端入口:http://47.98.163.205:80/
-下单接口:http://47.98.163.205:80/recharge/buy.do
-订单查询:http://47.98.163.205:80/recharge/query.do
-余额查询:http://47.98.163.205:80/user/balance.do
-帐号:北京椰子
-密码:123456
-用户编号:69876
-秘钥:AC7F7353AAA6

+ 0 - 8
helper/refill/api/yl/feimingyu/对接信息.txt

@@ -1,8 +0,0 @@
-客户端入口:http://47.98.163.205:80/
-下单接口:http://47.98.163.205:80/recharge/buy.do
-订单查询:http://47.98.163.205:80/recharge/query.do
-余额查询:http://47.98.163.205:80/user/balance.do
-帐号:北京椰子
-密码:123456
-用户编号:69876
-秘钥:AC7F7353AAA6

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

@@ -0,0 +1,33 @@
+后台地址: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
+
+
+334	全国移动快充30
+335	全国移动快充50
+336	全国移动快充100
+337	全国移动快充200
+
+331	全国联通快充30
+330	全国联通快充50
+332	全国联通快充100
+333	全国联通快充200
+
+338	全国电信快充30
+339	全国电信快充50
+340	全国电信快充100
+341	全国电信快充200

+ 1 - 1
mobile/callback/refill_feimingyu.php

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

+ 6 - 6
test/TestRefill.php

@@ -1302,12 +1302,12 @@ class TestRefill extends TestCase
     {
 //        $provider = $this->getProvider('feimingyu');
 //        $resp = $provider->balance();
-//        $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
-//        $resp = $provider->query(['order_sn' => '99741635757876781160']);
+//        $resp = $provider->add(15811535608, 4, 30, ['order_sn' => $this->make_sn(), 'regin_no' => 18]);
+//        $resp = $provider->query(['order_sn' => '33891681804839775889']);
 
-        $body = '{"userid":"69876","order_id":"21110117111869876daed6b187","account":"18500608333","amount":"30","price":"28.41","state":"failed","user_order":"99741635757876781160","sign":"C82F4821547BBFC462E9758EE28287E1","voucher":""}';
+        $body = '{"finishTime":"20230418160354079","orderNo":"XY3569958846292104149","appId":"VIP006","applyNo":"33891681804839775889","orderStatusDesc":"\u5931\u8d25","sign":"9196fe618512ad84fe1fdbbeb687253a","orderStatus":"FAILED","ext2":"NORMAL_FAILED","timestamp":"20230418160657014"}';
         $params = json_decode($body, true);
-        $provider = $this->getProvider('feimingyu', 'RefillCallBack');
+        $provider = $this->getProvider('feimingyu', 'RefillCallback');
         $ret = $provider->verify($params);
         $resp = $provider->notify($params);
     }
@@ -3268,8 +3268,8 @@ class TestRefill extends TestCase
     {
         $provider = $this->getProvider('huiyuan');
 //        $resp = $provider->balance();
-//        $resp = $provider->add(18010110637, 6, 10, ['order_sn' => $this->make_sn(), 'regin_no' => 18]);
-        $resp = $provider->query(['order_sn' => '30711681711707563864']);
+//        $resp = $provider->add(15811535608, 4, 10, ['order_sn' => $this->make_sn(), 'regin_no' => 18]);
+        $resp = $provider->query(['order_sn' => '12721681790791705529']);
     }
 
     public function testDezhi_yi()