stanley-king 3 лет назад
Родитель
Сommit
be5fd60045

+ 2 - 2
data/config/dev/base.ini.php

@@ -46,8 +46,8 @@ $config['gip'] 		= 0;
 $config['dbdriver'] = 'mysqli';
 $config['tablepre']	= 'lrlz_';
 
-define('SSH_TUNEL_PROD','local');
-//define('SSH_TUNEL_PROD','xyz');
+//define('SSH_TUNEL_PROD','local');
+define('SSH_TUNEL_PROD','xyz');
 //define('SSH_TUNEL_PROD','lingzh');
 
 if(SSH_TUNEL_PROD ==='local') {

+ 10 - 2
data/config/dev/refill.ini.php

@@ -490,13 +490,21 @@ $phone_providers = [
 $config['phone_providers'] = $phone_providers;
 
 //以下为三方通道
-$lingzhthird = ['name' => 'lingzhthird', 'store_id' => 52,'qualitys' => '1',
+$lingzh_third = ['name' => 'lingzhthird', 'store_id' => 52,'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 6559, 'price' => 99, 'quality' => 1, 'card_type' => 'third']],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$suning_third = ['name' => 'suning', 'store_id' => 61,'qualitys' => '1',
+    'amount' => [
+        100 => [['goods_id' => 6519, 'price' => 99, 'quality' => 1, 'card_type' => 'third']],
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+
 $third_providers = [
-    ['name' => 'lingzhthird', 'cfg' => $lingzhthird],
+    ['name' => 'lingzhthird', 'cfg' => $lingzh_third],
+    ['name' => 'suning', 'cfg' => $suning_third],
 ];
 $config['third_providers'] = $third_providers;

+ 1 - 1
helper/refill/IRefill.php

@@ -8,7 +8,7 @@ use mtopcard;
 abstract class IRefill
 {
     protected $mName;
-    protected $mStoreID;
+    public $mStoreID;
     protected $mRefillType;
     protected $mOfficialSN;
     protected $mAmountTypes = [];

+ 4 - 3
helper/refill/api/xyz/suning/RefillPhone.php

@@ -79,7 +79,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['userName'] = $card_no;
         $params['bizType'] = '02';
         $sign = $this->sign($params);
-        $params['Sign'] = $sign;
+        $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params);
         if (empty($resp)) {
@@ -115,7 +115,7 @@ class RefillPhone extends refill\IRefillPhone
         $sign = $this->sign($params);
         $params['Sign'] = $sign;
 
-        $resp = http_request(config::CARD_ORDER_URL, $params);
+        $resp = http_request(config::ORDER_URL, $params);
         if (empty($resp)) {
             return [false, '网络错误', true];
         }
@@ -155,7 +155,8 @@ class RefillPhone extends refill\IRefillPhone
             }
             $i++;
         }
-        return bin2hex(hash_hmac("sha1", $body, config::APP_KEY, true));
+        return hash_hmac("sha1", $body, config::APP_KEY);
+//        return bin2hex(hash_hmac("sha1", $body, config::APP_KEY, true));
     }
 
     private function notify_data_format($params): array

+ 9 - 10
helper/refill/api/xyz/suning/config.php

@@ -5,22 +5,21 @@ namespace refill\suning;
 class config
 {
     //正式地址及正式账号信息
-    const ORDER_URL = 'http://video.api.sctongqian.com/Order/DirectOrder';//直充订单提交地址
-    const CARD_ORDER_URL = 'http://video.api.sctongqian.com/Order/CardOrder';//卡密订单提交地址
-    const QUERY_URL= 'http://video.api.sctongqian.com/Business/QueryOrder';
+//    const ORDER_URL = 'http://video.api.sctongqian.com/Order/DirectOrder';//订单提交地址
 
 
     const PARTNER = 'YZKJ';
+    const APP_KEY = <<<keydoc
+-----BEGIN PUBLIC KEY-----
+MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANJztgvXppVfB/mJzBC9nMZWSLE3HGIy
+MqSMT/zKAAm/exJtu3xEz2fBgm6hCUPn0fQOXCOQgHUZDTGxhz7o/lsCAwEAAQ==
+-----END PUBLIC KEY-----
 
-    const APP_KEY= 211394768;
-    const App_Secret = 'vA+24E7SOUWPAIHvNMdXyw==';
+keydoc;
 
     //沙箱环境账号
-//    const ORDER_URL = 'http://182.150.21.90:8050/Order/DirectOrder';//直充订单提交地址
-//    const CARD_ORDER_URL = 'http://182.150.21.90:8050/Order/CardOrder';//卡密订单提交地址
-//    const QUERY_URL= 'http://182.150.21.90:8050/Business/QueryOrder';
-//    const APP_KEY= 211394658;
-//    const App_Secret = 'ZZV9akQWGkmR0ln6zOGmsQ==';
+    const ORDER_URL = 'http://kaapiprexg.cnsuning.com/spcopen/gateway';//订单提交地址
+
 
     const NOTIFY_URL = BASE_SITE_URL . "/racc/callback/lingzh/sctongqian.php";
     const API_IP = NET_IP;

+ 10 - 0
test/TestRefillThird.php

@@ -255,4 +255,14 @@ class TestRefillThird extends TestCase
 //        [$state, $ch_order, $neterr] = $providers->add(18500608333, 5, 100, ['order_sn' => $order_sn]);
         $providers->query(['ch_trade_no' => '','order_sn' => '4599550676464663945778']);
     }
+
+    public function testSuning()
+    {
+        $providers = $this->getProvider('suning','RefillPhone');
+        $providers->mStoreID = 61;
+        $order_sn = $this->make_sn();
+        $resp = $providers->add(13911129867, 7, 1,
+            ['order_sn' => $order_sn, 'goods_id' => 6619,
+                'quantity' => 5, 'product_code' => 'XYZ100745', 'third_card_type' => 1]);
+    }
 }