Explorar o código

Merge branch 'coqueue' of 39.97.239.116:gyfl/xyzshop into coqueue

stanley-king %!s(int64=4) %!d(string=hai) anos
pai
achega
17686996a7

+ 30 - 1
data/config/xyz/refill.ini.php

@@ -245,6 +245,34 @@ $afandeng_phone = ['name' => 'afandeng', 'store_id' => 27,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$tongy_phone = ['name' => 'tongy', 'store_id' => 26,
+    'amount' => [
+        30 => [['goods_id' => 6408, 'price' => 29.76, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6408, 'price' => 29.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6408, 'price' => 29.64, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        50 => [['goods_id' => 6409, 'price' => 49.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6409, 'price' => 48.75, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6409, 'price' => 49.4, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        100 => [['goods_id' => 6410, 'price' => 99.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6410, 'price' => 97.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6410, 'price' => 98.8, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        200 => [['goods_id' => 6411, 'price' => 198.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6411, 'price' => 194.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6411, 'price' => 197.6, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        300 => [['goods_id' => 6412, 'price' => 297.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6412, 'price' => 291.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6412, 'price' => 296.4, 'quality' => 2, 'card_type' => 'chinatelecom']],
+
+        500 => [['goods_id' => 6413, 'price' => 496, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6413, 'price' => 486.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6413, 'price' => 494, 'quality' => 2, 'card_type' => 'chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -259,6 +287,7 @@ $phone_providers = [
     ['name' => 'afandeng', 'cfg' => $afandeng_phone],
     ['name' => 'afandnew', 'cfg' => $afandnew_phone],
     ['name' => 'lingzh', 'cfg' => $lingzh_phone],
-    ['name' => 'lingzhdl', 'cfg' => $lingzhdl_phone]
+    ['name' => 'lingzhdl', 'cfg' => $lingzhdl_phone],
+//    ['name' => 'tongy', 'cfg' => $tongy_phone],
 ];
 $config['phone_providers'] = $phone_providers;

+ 3 - 1
helper/refill/api/xyz/api.php

@@ -45,4 +45,6 @@ require_once(BASE_HELPER_RAPI_PATH . '/tianx/RefillCallBack.php');
 require_once(BASE_HELPER_RAPI_PATH . '/afand/RefillPhone.php');
 require_once(BASE_HELPER_RAPI_PATH . '/afand/RefillCallBack.php');
 require_once(BASE_HELPER_RAPI_PATH . '/afandeng/RefillPhone.php');
-require_once(BASE_HELPER_RAPI_PATH . '/afandeng/RefillCallBack.php');
+require_once(BASE_HELPER_RAPI_PATH . '/afandeng/RefillCallBack.php');
+//require_once(BASE_HELPER_RAPI_PATH . '/tongy/RefillPhone.php');
+//require_once(BASE_HELPER_RAPI_PATH . '/tongy/RefillCallBack.php');

+ 17 - 4
helper/refill/api/xyz/tongy/RefillPhone.php

@@ -22,7 +22,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['ShopId'] = config::SHOP_ID;
         $params['UserId'] = config::USER_ID;
         $params['Num'] = 1;
-        $params['Timestamp'] = time();
+        $params['Timestamp'] = $this->getMillisecond();;
         $params['NotifyUrl'] = config::NOTIFY_URL;
         $params['Amount'] = $amount;
         $params['ProductType'] = 1;
@@ -55,7 +55,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['OrderId'] = $refill_info['order_sn'];
         $params['ShopId'] = config::SHOP_ID;
         $params['UserId'] = config::USER_ID;
-        $params['Timestamp'] = time();
+        $params['Timestamp'] = $this->getMillisecond();
         $content = $params['ShopId'] . $params['UserId'] . $params['OrderId'] . $params['Timestamp'] . config::KEY;
         $params['sign'] = md5($content);
         $resp = http_request(config::QUERY_URL, $params , 'POST' , false);
@@ -86,9 +86,22 @@ class RefillPhone extends refill\IRefillPhone
     private function sign($params)
     {
         $key = config::KEY;
-        $content  = $params['shopId'] . $params['userId'] . $params['ProductType'] . $params['orderId'] . $params['account'] . $params['Amount'] . $params['num'];
-        $content .= $params['timestamp'] . $key;
+        $content  = $params['ShopId'] . $params['UserId'] . $params['ProductType'] . $params['OrderId'] . $params['Account'] . $params['Amount'] . $params['Num'];
+        $content .= $params['Timestamp'] . $key;
         return md5($content);
     }
 
+    /**
+     * 获取毫秒级别的时间戳
+     */
+    private static function getMillisecond()
+    {
+        //获取毫秒的时间戳
+        $time = explode ( " ", microtime () );
+        $time = $time[1] . ($time[0] * 1000);
+        $time2 = explode( ".", $time );
+        $time = $time2[0];
+        return $time;
+    }
+
 }

+ 4 - 3
helper/refill/api/xyz/tongy/config.php

@@ -6,11 +6,12 @@ namespace refill\tongy;
 
 class config
 {
-    const ORDER_URL = 'http://api.sale.tongyun188.com/v1.0/Pay.ashx';
-    const QUERY_URL = 'http://api.sale.tongyun188.com/v1.0/QueryOrder.ashx';
+    const ORDER_URL = 'http://api.sale.rongyuanruitian.com/v1.0/Pay.ashx';
+    const QUERY_URL = 'http://api.sale.rongyuanruitian.com/v1.0/QueryOrder.ashx';
 
     const SHOP_ID = 300000;
     const USER_ID = 100857;
     const KEY = 'E80A1761A46507E65202853367C2E760';
-    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_tongy.php";
+//    const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_tongy.php";
+    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
 }

+ 4 - 3
racc/callback/lingzh/yibao.php

@@ -1,4 +1,5 @@
 <?php
-
-refill\util::push_notify('yibao',$_POST);
-echo ('success');
+$content = $_SERVER['post_content'];
+$input = json_decode($content,true);
+refill\util::push_notify('yibao',$input);
+echo ('success');

+ 6 - 0
test/TestRefill.php

@@ -238,6 +238,12 @@ class TestRefill extends TestCase
         $resp = $providers->add('18500608333', 5, 20, ['order_sn' => $this->make_sn()]);
     }
 
+    public function testTongyPhone()
+    {
+        $providers = new refill\tongy\RefillPhone([]);
+        $resp = $providers->add('18500608333', 5, 30, ['order_sn' => $this->make_sn()]);
+    }
+
     public function testWeisPhone()
     {
         $providers = new refill\weisyd\RefillPhone([]);