xiaoyu 3 年之前
父節點
當前提交
1662900088

+ 48 - 24
data/config/win/refill.ini.php

@@ -617,49 +617,73 @@ $wantong_phone = ['name' => 'wantong', 'store_id' => 36, 'qualitys' => '4',
 
 $zhongst_phone = ['name' => 'zhongst', 'store_id' => 39, 'qualitys' => '2',
     'amount' => [
+        1 => [
+            ['goods_id' => 7544, 'price' => 1.04, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        2 => [
+            ['goods_id' => 7545, 'price' => 2.08, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        3 => [
+            ['goods_id' => 7546, 'price' => 3.12, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        4 => [
+            ['goods_id' => 7547, 'price' => 4.16, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        5 => [
+            ['goods_id' => 7548, 'price' => 5.2, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        6 => [
+            ['goods_id' => 7549, 'price' => 6.24, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        7 => [
+            ['goods_id' => 7550, 'price' => 7.28, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        8 => [
+            ['goods_id' => 7551, 'price' => 8.32, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        9 => [
+            ['goods_id' => 7552, 'price' => 9.36, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+
         10 => [
-            ['goods_id' => 6464, 'price' => 10.25, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6464, 'price' => 10.15, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6464, 'price' => 10.01, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6464, 'price' => 10.04, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6464, 'price' => 10.45, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         20 => [
-            ['goods_id' => 6465, 'price' => 20.08, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6465, 'price' => 20.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6465, 'price' => 20.02, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6465, 'price' => 20.08, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6465, 'price' => 20.9, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         30 => [
-            ['goods_id' => 6466, 'price' => 30.12, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6466, 'price' => 29.76, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6466, 'price' => 30.09, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6466, 'price' => 30.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6466, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6466, 'price' => 30.45, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         50 => [
-            ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6467, 'price' => 49.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6467, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6467, 'price' => 50.35, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6467, 'price' => 50.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         100 => [
-            ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6468, 'price' => 99.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6468, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6468, 'price' => 100.7, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6468, 'price' => 100.4, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6469, 'price' => 198.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6469, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6469, 'price' => 201.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6469, 'price' => 200.8, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6470, 'price' => 297.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6470, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6470, 'price' => 302.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6470, 'price' => 301.2, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6471, 'price' => 501, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6471, 'price' => 496, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6471, 'price' => 499, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6471, 'price' => 502, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];

+ 48 - 24
data/config/xyz/refill.ini.php

@@ -617,49 +617,73 @@ $wantong_phone = ['name' => 'wantong', 'store_id' => 36, 'qualitys' => '4',
 
 $zhongst_phone = ['name' => 'zhongst', 'store_id' => 39, 'qualitys' => '2',
     'amount' => [
+        1 => [
+            ['goods_id' => 7544, 'price' => 1.04, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        2 => [
+            ['goods_id' => 7545, 'price' => 2.08, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        3 => [
+            ['goods_id' => 7546, 'price' => 3.12, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        4 => [
+            ['goods_id' => 7547, 'price' => 4.16, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        5 => [
+            ['goods_id' => 7548, 'price' => 5.2, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        6 => [
+            ['goods_id' => 7549, 'price' => 6.24, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        7 => [
+            ['goods_id' => 7550, 'price' => 7.28, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        8 => [
+            ['goods_id' => 7551, 'price' => 8.32, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        9 => [
+            ['goods_id' => 7552, 'price' => 9.36, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+
         10 => [
-            ['goods_id' => 6464, 'price' => 10.25, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6464, 'price' => 10.15, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6464, 'price' => 10.01, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6464, 'price' => 10.04, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6464, 'price' => 10.45, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         20 => [
-            ['goods_id' => 6465, 'price' => 20.08, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6465, 'price' => 20.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6465, 'price' => 20.02, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6465, 'price' => 20.08, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6465, 'price' => 20.9, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         30 => [
-            ['goods_id' => 6466, 'price' => 30.12, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6466, 'price' => 29.76, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6466, 'price' => 30.09, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6466, 'price' => 30.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6466, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6466, 'price' => 30.45, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         50 => [
-            ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6467, 'price' => 49.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6467, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6467, 'price' => 50.35, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6467, 'price' => 50.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         100 => [
-            ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6468, 'price' => 99.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6468, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6468, 'price' => 100.7, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6468, 'price' => 100.4, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6469, 'price' => 198.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6469, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6469, 'price' => 201.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6469, 'price' => 200.8, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6470, 'price' => 297.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6470, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6470, 'price' => 302.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6470, 'price' => 301.2, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6471, 'price' => 501, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6471, 'price' => 496, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6471, 'price' => 499, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6471, 'price' => 502, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];

+ 48 - 24
data/config/xyzadm/refill.ini.php

@@ -617,49 +617,73 @@ $wantong_phone = ['name' => 'wantong', 'store_id' => 36, 'qualitys' => '4',
 
 $zhongst_phone = ['name' => 'zhongst', 'store_id' => 39, 'qualitys' => '2',
     'amount' => [
+        1 => [
+            ['goods_id' => 7544, 'price' => 1.04, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        2 => [
+            ['goods_id' => 7545, 'price' => 2.08, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        3 => [
+            ['goods_id' => 7546, 'price' => 3.12, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        4 => [
+            ['goods_id' => 7547, 'price' => 4.16, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        5 => [
+            ['goods_id' => 7548, 'price' => 5.2, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        6 => [
+            ['goods_id' => 7549, 'price' => 6.24, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        7 => [
+            ['goods_id' => 7550, 'price' => 7.28, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        8 => [
+            ['goods_id' => 7551, 'price' => 8.32, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        9 => [
+            ['goods_id' => 7552, 'price' => 9.36, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+
         10 => [
-            ['goods_id' => 6464, 'price' => 10.25, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6464, 'price' => 10.15, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6464, 'price' => 10.01, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6464, 'price' => 10.04, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6464, 'price' => 10.45, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         20 => [
-            ['goods_id' => 6465, 'price' => 20.08, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6465, 'price' => 20.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6465, 'price' => 20.02, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6465, 'price' => 20.08, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6465, 'price' => 20.9, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         30 => [
-            ['goods_id' => 6466, 'price' => 30.12, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6466, 'price' => 29.76, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6466, 'price' => 30.09, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6466, 'price' => 30.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6466, 'price' => 30.06, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6466, 'price' => 30.45, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         50 => [
-            ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6467, 'price' => 49.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6467, 'price' => 49.9, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6467, 'price' => 50.35, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6467, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6467, 'price' => 50.5, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
 
         100 => [
-            ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6468, 'price' => 99.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6468, 'price' => 99.8, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6468, 'price' => 100.7, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6468, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6468, 'price' => 100.4, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6469, 'price' => 198.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6469, 'price' => 199.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6469, 'price' => 201.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6469, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6469, 'price' => 200.8, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6470, 'price' => 297.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6470, 'price' => 299.4, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6470, 'price' => 302.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6470, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 6470, 'price' => 301.2, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 6471, 'price' => 501, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6471, 'price' => 496, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6471, 'price' => 499, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6471, 'price' => 502, 'quality' => 2, 'card_type' => 'chinatelecom']
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];

+ 34 - 17
helper/refill/api/xyz/zhongst/RefillCallBack.php

@@ -8,8 +8,10 @@ class RefillCallBack implements refill\IRefillCallBack
 {
     public function verify($params): bool
     {
-        $sign = $this->sign($params);
-        if ($params['szVerifyString'] == $sign) {
+        $input = $params;
+        unset($input['sign']);
+        $sign = $this->sign($input);
+        if ($params['sign'] == $sign) {
             return true;
         } else {
             return false;
@@ -18,33 +20,48 @@ class RefillCallBack implements refill\IRefillCallBack
 
     private function sign($params)
     {
-        $userid = config::USER_ID;
-        $key = config::KEY;
-        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nDemo={$params['nDemo']}&fSalePrice={$params['fSalePrice']}";
-        $content .= "&nFlag={$params['nFlag']}&szKey={$key}";
+        $params['appSecret'] = config::APP_SECRET;
+        ksort($params);
+        $content = '';
+        foreach ($params as $key => $value) {
+            if($this->check_empty($value) === false) {
+                $content .= "{$key}={$value}&";
+            }
+        }
+        $content = rtrim($content, '&');
         return md5($content);
     }
 
+    private function check_empty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
     public function notify($params)
     {
-        $status = intval($params['nFlag']);
-        $order_sn = $params['szOrderId'];
+        $status = intval($params['orderStatus']);
+        $order_sn = $params['outOrderId'];
         $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
         if (empty($order_info)) {
             return [false, false, false,false];
         }
-        $order_id = $order_info['order_id'];
 
+        $order_id = $order_info['order_id'];
         if ($status === 2) {
-            $data['official_sn'] = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            $data['official_sn'] = strtolower($params['ext1']) == 'null' ? '' : $params['ext1'];
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false,true];
-        }
-        elseif ($status === 3) {
-            return [$order_id, false, true,true];
-        }
-        else {
-            return [$order_id, false, false,false];
+            return [$order_id, true, false, true];
+        } elseif ($status === 3) {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
         }
     }
 }

+ 69 - 55
helper/refill/api/xyz/zhongst/RefillPhone.php

@@ -16,15 +16,13 @@ class RefillPhone extends refill\IRefillPhone
 
     private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
     {
-        $params['szAgentId'] = config::USER_ID;
-        $params['szOrderId'] = $order_sn;
-        $params['szPhoneNum'] = $phone;
-        $params['nMoney'] = $amount;
-        $params['nSortType'] = config::operator[$card_type];
-        $params['nProductClass'] = 1;
-        $params['nProductType'] = 1;
-        $params['szTimeStamp'] = date("Y-m-d H:i:s");
-        $params['szNotifyUrl'] = config::NOTIFY_URL;
+        $params['appId'] = config::APP_ID;
+        $params['outOrderId'] = $order_sn;
+        $params['uuid'] = $phone;
+        $params['itemId'] = config::PRODUCT[$card_type][$amount];
+        $params['itemFace'] = $amount;
+        $params['callbackUrl'] = config::NOTIFY_URL;
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
         return $params;
     }
 
@@ -32,9 +30,11 @@ class RefillPhone extends refill\IRefillPhone
     {
         $order_sn = $params['order_sn'];
         $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
-
+        if(empty($params['itemId'])) {
+            return [false, '商品编号错误', false];
+        }
         $sign = $this->sign($params);
-        $params['szVerifyString'] = $sign;
+        $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
 
@@ -45,32 +45,28 @@ class RefillPhone extends refill\IRefillPhone
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
-
-            $nRtn = $resp['nRtn'];
             if (empty($resp)) {
                 return [false, '网络错误', true];
-            } elseif ($nRtn === 0) {
-                return [true, '', false];
-            } elseif (in_array($nRtn, config::ERR_NOS, true)) {
-                return [false, $resp['szRtnCode'], false];
-            } elseif (in_array($nRtn, [2050, 999], true)) {
-                $net_errno = "HTTP-{$nRtn}";
-                return [false, $resp['szRtnCode'], true];
+            } elseif ($resp['code'] === '00') {
+                return [true, $resp['orderId'], false];
+            } elseif (in_array($resp['code'], config::ERRCODES, true)) {
+                return [false, $resp['msg'], false];
+            } elseif (in_array($resp['code'], ['-22', '-23', '-99'], true)) {
+                $net_errno = "HTTP-{$resp['code']}";
+                return [false, $resp['msg'], true];
             } else {
-                $err = 998;
-                $net_errno = "HTTP-{$err}";
-                return [false, $resp['szRtnCode'], true];
+                $net_errno = "HTTP-998";
+                return [false, $resp['msg'], true];
             }
         }
     }
 
     public function query($refill_info)
     {
-        $params['szAgentId'] = config::USER_ID;
-        $params['szOrderId'] = $refill_info['order_sn'];
-        $key = config::KEY;
-        $content = "szAgentId={$params['szAgentId']}&szOrderId={$params['szOrderId']}&szKey={$key}";
-        $params['szVerifyString'] = md5($content);
+        $params['appId'] = config::APP_ID;
+        $params['outOrderId'] = $refill_info['order_sn'];
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
+        $params['sign'] = $this->sign($params);
 
         $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
 
@@ -84,32 +80,36 @@ class RefillPhone extends refill\IRefillPhone
             if (empty($resp)) {
                 return [false, '网络错误'];
             }
-
-            $status = $resp['nRtn'];
-            if ($status === 5012) {
-                $updata['official_sn'] = $resp['szRtnMsg'];
-                Model('refill_order')->edit($refill_info['order_id'], $updata);
-                $order_state = ORDER_STATE_SUCCESS;
-            } elseif ($status === 5013) {
-                $order_state = ORDER_STATE_CANCEL;
-            } elseif (in_array($status, [5011,5019],true)) {
-                $order_state = ORDER_STATE_SEND;
-            } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
-                $order_state = ORDER_STATE_NOEXIST;
-            } else {
-                return [false, $resp['szRtnMsg']];
+            elseif ($resp['code'] === '00')
+            {
+                $status = $resp['orderStatus'];
+                if ($status === '2') {
+                    $updata['official_sn'] = $resp['ext1'];
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($status === '3') {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($status === '1') {
+                    $order_state = ORDER_STATE_SEND;
+                } elseif ($status === '4' && (time() - $refill_info['commit_time'] >= 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
+                } else {
+                    return [false, $resp['msg']];
+                }
+                return [true, $order_state];
+            }
+            else
+            {
+                return [false, $resp['msg']];
             }
-
-            return [true, $order_state];
         }
     }
 
     public function balance()
     {
-        $params['szAgentId'] = config::USER_ID;
-        $key = config::KEY;
-        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
-        $params['szVerifyString'] = md5($content);
+        $params['appId'] = config::APP_ID;
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
+        $params['sign'] = $this->sign($params);
 
         $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
 
@@ -122,20 +122,34 @@ class RefillPhone extends refill\IRefillPhone
             $resp = json_decode($resp, true);
             if (empty($resp)) {
                 return [false, '网络错误'];
-            } elseif ($resp['nRtn'] === 0) {
-                return [true, $resp['fBalance']];
+            } elseif ($resp['code'] === '00') {
+                return [true, $resp['balance']];
             } else {
-                return [false, $resp['szRtnCode']];
+                return [false, $resp['msg']];
             }
         }
     }
 
+    /**
+     * 获取毫秒级别的时间戳
+     */
+    private function get_millisecond()
+    {
+        list($usec, $sec) = explode(" ", microtime());
+        return round($usec*1000);
+    }
+
     private function sign($params)
     {
-        $userid = config::USER_ID;
-        $key = config::KEY;
-        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nMoney={$params['nMoney']}&nSortType={$params['nSortType']}";
-        $content .= "&nProductClass={$params['nProductClass']}&nProductType={$params['nProductType']}&szTimeStamp={$params['szTimeStamp']}&szKey={$key}";
+        $params['appSecret'] = config::APP_SECRET;
+        ksort($params);
+        $content = '';
+        foreach ($params as $key => $value) {
+            if($this->check_empty($value) === false) {
+                $content .= "{$key}={$value}&";
+            }
+        }
+        $content = rtrim($content, '&');
         return md5($content);
     }
 }

+ 0 - 11
helper/refill/api/xyz/zhongst/api.txt

@@ -1,11 +0,0 @@
-下单地址:http://39.102.121.210:10186/plat/api/old/submitorder
-
-查询地址:http://39.102.121.210:10186/plat/api/old/queryorder
-
-查询余额地址:http://39.102.121.210:10186/plat/api/old/queryBalance
-后台地址:http://39.102.121.210:10186/plat/index
-账号:yixintong
-密码:123456
-ID:200059
-秘钥:8ebaac1593c64ec89be660ea13040640
-接口文档:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ

+ 42 - 13
helper/refill/api/xyz/zhongst/config.php

@@ -6,21 +6,50 @@ namespace refill\zhongst;
 use mtopcard;
 class config
 {
-    const ORDER_URL = 'http://39.102.121.210:10186/plat/api/old/submitorder';
-    const QUERY_URL= 'http://39.102.121.210:10186/plat/api/old/queryorder';
-    const BALANCE_URL= 'http://39.102.121.210:10186/plat/api/old/queryBalance';
+    const ORDER_URL = 'http://112.124.58.225:8911/api/hf/order/submit';
+    const QUERY_URL = 'http://112.124.58.225:8911/api/order/query';
+    const BALANCE_URL = 'http://112.124.58.225:8911/api/account/balance';
 
-    const USER_ID= '200030';
-    const KEY = 'a6203db9639c425bba90edd7f80d2315';
+    const APP_ID = 'Jab1HfumVk';
+    const APP_SECRET = 'eIpGtPfBdSfqAYSv';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/refill_zhongst.php";
-    const operator = [
-        mtopcard\ChinaMobileCard  => 1,
-        mtopcard\ChinaUnicomCard  => 2,
-        mtopcard\ChinaTelecomCard => 3
+    const PRODUCT = [
+        mtopcard\ChinaMobileCard => [
+            30  => 100088,
+            50  => 100089,
+            100 => 100090,
+            200 => 100091,
+            300 => 100092,
+        ],
+        mtopcard\ChinaUnicomCard => [
+            1  	=> 100014,
+            2  	=> 100015,
+            3  	=> 100016,
+            4  	=> 100017,
+            5  	=> 100018,
+            6  	=> 100019,
+            7  	=> 100020,
+            8  	=> 100021,
+            9  	=> 100022,
+            10  => 100023,
+            20  => 100024,
+            30  => 100083,
+            50  => 100084,
+            100 => 100085,
+            200 => 100086,
+            300 => 100087,
+        ],
+        mtopcard\ChinaTelecomCard => [
+            10   => 100040,
+            20   => 100041,
+            30   => 100042,
+            50   => 100043,
+            100  => 100044,
+            200  => 100045,
+            300  => 100046,
+            500  => 100047,
+        ],
     ];
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
-
-    const ERR_NOS = [
-        1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
-    ];
+    const ERRCODES = ['-10', '-12', '-13', '-14', '-15', '-16', '-18', '-21'];
 }

+ 45 - 0
helper/refill/api/xyz/zhongst/开户信息.txt

@@ -0,0 +1,45 @@
+后台地址:http://112.124.58.225:8888
+帐号:guoyan
+密码:862641
+二级密码:OAwf2559
+appId:Jab1HfumVk
+appSecret:eIpGtPfBdSfqAYSv
+后台-商品列表,可查看已配置商品信息
+后台-安全中心,可配置IP白名单
+接口文档:https://www.showdoc.com.cn/1686453783298366/7925312871840290
+下单接口地址:http://112.124.58.225:8911/api/hf/order/submit
+查单接口地址:http://112.124.58.225:8911/api/order/query
+余额接口地址:http://112.124.58.225:8911/api/account/balance
+提卡接口地址:http://112.124.58.225:8911/api/card/get
+
+100088	移动30
+100089	移动50
+100090	移动100
+100091	移动200
+100092	移动300
+
+100014  联通快充1
+100015  联通快充2
+100016  联通快充3
+100017  联通快充4
+100018  联通快充5
+100019  联通快充6
+100020  联通快充7
+100021  联通快充8
+100022  联通快充9
+100023  联通快充10
+100024  联通快充20
+100083  联通沃支付30
+100084  联通沃支付50
+100085  联通沃支付100
+100086  联通沃支付200
+100087  联通沃支付300
+
+100040  电信快充10
+100041  电信快充20
+100042	电信快充30
+100043	电信快充50
+100044	电信快充100
+100045	电信快充200
+100046	电信快充300
+100047	电信快充500

+ 10 - 7
test/TestRefill.php

@@ -2150,13 +2150,16 @@ class TestRefill extends TestCase
 
     public function testZhongstPhone()
     {
-        $provider = new refill\zhongst\RefillPhone([]);
-//        $resp = $provider->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
-//        $resp = $provider->query(['order_sn' => '48941618981770389271']);
-//        $data = ' {"szOrderId":"66571619060147539784","fSalePrice":"46.5","szAgentId":"200030","nFlag":"2","szVerifyString":"c1e88701b89a4887996822d708bed5f5","szPhoneNum":"13699279618","szRtnMsg":"161122673971","nDemo":"50"}';
-//        $input = json_decode($data, true);
-//        refill\RefillFactory::instance()->notify('zhongst',$input);
-        $resp = $provider->balance();
+//        $provider = $this->getProvider('zhongst');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(18500608333, 5, 1, ['order_sn' => $this->make_sn()]);
+//        $resp = $provider->query(['order_sn' => '14941642477572151012']);
+
+        $body = '{"orderId":"220118114638207211","appId":"Jab1HfumVk","outOrderId":"14941642477572151012","sign":"4e594f9c541667ea5f07c509993932fb","orderStatus":"2","completeTime":"20220118115013","orderDesc":"\u8ba2\u5355\u6210\u529f","ext1":"110103308212201181148550490052"}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('zhongst','RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
     }
 
     public function testXunaoPhone()