Bladeren bron

guochuang_nation

xiaoyu 3 jaren geleden
bovenliggende
commit
0ea463deac

+ 83 - 0
data/config/win/refill.ini.php

@@ -2291,6 +2291,88 @@ $yunchonggong_yd_phone = ['name' => 'yunchonggong_yd', 'store_id' => 120, 'quali
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$guochuang_nation_phone = ['name' => 'guochuang_nation', 'store_id' => 121, 'qualitys' => '2',
+    'amount' => [
+        1  => [
+            ['goods_id' => 7051, 'price' => 1.02, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        2  => [
+            ['goods_id' => 7052, 'price' => 2.04, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        3  => [
+            ['goods_id' => 7053, 'price' => 3.06, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        4  => [
+            ['goods_id' => 7054, 'price' => 4.08, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        5  => [
+            ['goods_id' => 7055, 'price' => 5.15, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7055, 'price' => 5.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7055, 'price' => 5.15, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        6  => [
+            ['goods_id' => 7056, 'price' => 6.12, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7056, 'price' => 6.12, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7056, 'price' => 6.18, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        7  => [
+            ['goods_id' => 7057, 'price' => 7.14, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7057, 'price' => 7.14, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7057, 'price' => 7.21, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        8  => [
+            ['goods_id' => 7058, 'price' => 8.16, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7058, 'price' => 8.16, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7058, 'price' => 8.24, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        9  => [
+            ['goods_id' => 7059, 'price' => 9.09, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7059, 'price' => 9.18, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7059, 'price' => 9.27, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        10 => [
+            ['goods_id' => 7060, 'price' => 10.16, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7060, 'price' => 10.26, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7060, 'price' => 10.13, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 7061, 'price' => 20.17, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7061, 'price' => 20.52, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7061, 'price' => 20.26, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 7062, 'price' => 30.21, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7062, 'price' => 30.15, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7062, 'price' => 30.39, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 7063, 'price' => 50.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7063, 'price' => 50.25, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7063, 'price' => 50.15, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 7064, 'price' => 100.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7064, 'price' => 100.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7064, 'price' => 100.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 7065, 'price' => 200.8, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7065, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7065, 'price' => 200.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 7066, 'price' => 301.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7066, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7066, 'price' => 300.9, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 7067, 'price' => 502, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7067, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7067, 'price' => 501.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -2381,6 +2463,7 @@ $phone_providers = [
     ['name' => 'yikatong', 'cfg' => $yikatong_phone],
     ['name' => 'sialan_tax', 'cfg' => $sialan_tax_phone],
     ['name' => 'yunchonggong_yd', 'cfg' => $yunchonggong_yd_phone],
+    ['name' => 'guochuang_nation', 'cfg' => $guochuang_nation_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 84 - 0
data/config/xyz/refill.ini.php

@@ -4,6 +4,7 @@ global $config;
 
 $config['refill_oil_specs'] = [50, 100, 200, 500, 1000, 2000];
 $config['refill_phone_specs'] = [10, 20, 30, 50, 100, 200, 300, 500];
+//$config['refill_phone_small_specs'] = [1, 2, 3, 4, 5, 6, 7, 8, 9];
 $config['refill_phone_small_specs'] = [];
 //充值额度基本表
 $config['refill_specs'] = [
@@ -2290,6 +2291,88 @@ $yunchonggong_yd_phone = ['name' => 'yunchonggong_yd', 'store_id' => 120, 'quali
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$guochuang_nation_phone = ['name' => 'guochuang_nation', 'store_id' => 121, 'qualitys' => '2',
+    'amount' => [
+        1  => [
+            ['goods_id' => 7051, 'price' => 1.02, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        2  => [
+            ['goods_id' => 7052, 'price' => 2.04, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        3  => [
+            ['goods_id' => 7053, 'price' => 3.06, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        4  => [
+            ['goods_id' => 7054, 'price' => 4.08, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        5  => [
+            ['goods_id' => 7055, 'price' => 5.15, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7055, 'price' => 5.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7055, 'price' => 5.15, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        6  => [
+            ['goods_id' => 7056, 'price' => 6.12, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7056, 'price' => 6.12, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7056, 'price' => 6.18, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        7  => [
+            ['goods_id' => 7057, 'price' => 7.14, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7057, 'price' => 7.14, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7057, 'price' => 7.21, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        8  => [
+            ['goods_id' => 7058, 'price' => 8.16, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7058, 'price' => 8.16, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7058, 'price' => 8.24, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        9  => [
+            ['goods_id' => 7059, 'price' => 9.09, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7059, 'price' => 9.18, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7059, 'price' => 9.27, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        10 => [
+            ['goods_id' => 7060, 'price' => 10.16, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7060, 'price' => 10.26, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7060, 'price' => 10.13, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 7061, 'price' => 20.17, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7061, 'price' => 20.52, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7061, 'price' => 20.26, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 7062, 'price' => 30.21, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7062, 'price' => 30.15, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7062, 'price' => 30.39, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 7063, 'price' => 50.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7063, 'price' => 50.25, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7063, 'price' => 50.15, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 7064, 'price' => 100.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7064, 'price' => 100.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7064, 'price' => 100.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 7065, 'price' => 200.8, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7065, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7065, 'price' => 200.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 7066, 'price' => 301.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7066, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7066, 'price' => 300.9, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 7067, 'price' => 502, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7067, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7067, 'price' => 501.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -2380,6 +2463,7 @@ $phone_providers = [
     ['name' => 'yikatong', 'cfg' => $yikatong_phone],
     ['name' => 'sialan_tax', 'cfg' => $sialan_tax_phone],
     ['name' => 'yunchonggong_yd', 'cfg' => $yunchonggong_yd_phone],
+    ['name' => 'guochuang_nation', 'cfg' => $guochuang_nation_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 84 - 0
data/config/xyzadm/refill.ini.php

@@ -4,6 +4,7 @@ global $config;
 
 $config['refill_oil_specs'] = [50, 100, 200, 500, 1000, 2000];
 $config['refill_phone_specs'] = [10, 20, 30, 50, 100, 200, 300, 500];
+//$config['refill_phone_small_specs'] = [1, 2, 3, 4, 5, 6, 7, 8, 9];
 $config['refill_phone_small_specs'] = [];
 //充值额度基本表
 $config['refill_specs'] = [
@@ -2290,6 +2291,88 @@ $yunchonggong_yd_phone = ['name' => 'yunchonggong_yd', 'store_id' => 120, 'quali
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$guochuang_nation_phone = ['name' => 'guochuang_nation', 'store_id' => 121, 'qualitys' => '2',
+    'amount' => [
+        1  => [
+            ['goods_id' => 7051, 'price' => 1.02, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        2  => [
+            ['goods_id' => 7052, 'price' => 2.04, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        3  => [
+            ['goods_id' => 7053, 'price' => 3.06, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        4  => [
+            ['goods_id' => 7054, 'price' => 4.08, 'quality' => 2, 'card_type' => 'chinaunicom']
+        ],
+        5  => [
+            ['goods_id' => 7055, 'price' => 5.15, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7055, 'price' => 5.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7055, 'price' => 5.15, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        6  => [
+            ['goods_id' => 7056, 'price' => 6.12, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7056, 'price' => 6.12, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7056, 'price' => 6.18, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        7  => [
+            ['goods_id' => 7057, 'price' => 7.14, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7057, 'price' => 7.14, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7057, 'price' => 7.21, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        8  => [
+            ['goods_id' => 7058, 'price' => 8.16, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7058, 'price' => 8.16, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7058, 'price' => 8.24, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        9  => [
+            ['goods_id' => 7059, 'price' => 9.09, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7059, 'price' => 9.18, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7059, 'price' => 9.27, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        10 => [
+            ['goods_id' => 7060, 'price' => 10.16, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7060, 'price' => 10.26, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7060, 'price' => 10.13, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 7061, 'price' => 20.17, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7061, 'price' => 20.52, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7061, 'price' => 20.26, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 7062, 'price' => 30.21, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7062, 'price' => 30.15, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7062, 'price' => 30.39, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 7063, 'price' => 50.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7063, 'price' => 50.25, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7063, 'price' => 50.15, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 7064, 'price' => 100.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7064, 'price' => 100.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7064, 'price' => 100.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 7065, 'price' => 200.8, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7065, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7065, 'price' => 200.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 7066, 'price' => 301.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7066, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7066, 'price' => 300.9, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 7067, 'price' => 502, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7067, 'price' => 501, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7067, 'price' => 501.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -2380,6 +2463,7 @@ $phone_providers = [
     ['name' => 'yikatong', 'cfg' => $yikatong_phone],
     ['name' => 'sialan_tax', 'cfg' => $sialan_tax_phone],
     ['name' => 'yunchonggong_yd', 'cfg' => $yunchonggong_yd_phone],
+    ['name' => 'guochuang_nation', 'cfg' => $guochuang_nation_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

BIN
helper/refill/api/xyz/guochuang_nation/10-500面值.png


+ 50 - 0
helper/refill/api/xyz/guochuang_nation/RefillCallBack.php

@@ -0,0 +1,50 @@
+<?php
+
+
+namespace refill\guochuang_nation;
+
+require_once(BASE_HELPER_RAPI_PATH . '/guochuang_nation/config.php');
+
+use refill;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $key = config::ApiKey;
+        $content = "{$params['body']}&ts={$params['ts']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
+    public function notify($params)
+    {
+        $params = json_decode($params['body'], true);
+        $status = $params['status'];
+        $order_sn = $params['outerId'];
+        $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'];
+        if ($status === 'SUCCESS') {
+            $data['official_sn'] = strtolower($params['evidence']) == 'null' ? '' : $params['evidence'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true];
+        } elseif ($status === 'FAIL') {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

+ 183 - 0
helper/refill/api/xyz/guochuang_nation/RefillPhone.php

@@ -0,0 +1,183 @@
+<?php
+
+namespace refill\guochuang_nation;
+
+require_once(BASE_HELPER_RAPI_PATH . '/guochuang_nation/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    {
+        $params['phone'] = $phone;
+        $params['phoneType'] = config::operator[$card_type];
+        $params['money'] = $amount;
+        $params['outerId'] = $order_sn;
+        $params['callBackUrl'] = config::NOTIFY_URL;
+        $params['speed'] = 0;
+
+        return $params;
+    }
+
+    //统一请求
+    private function url_request($params,$service)
+    {
+        $get_params['service'] = $service;
+        $get_params['userId'] = config::UserId;
+        $get_params['ts'] = $this->getMillisecond();
+
+        $sign = $this->sign($params,$get_params);
+        $get_params['sign'] = $sign;
+
+        $url = config::API_URL;
+        $url = $url . (strpos($url, '?') ? '&' : '?') . (is_array($get_params) ? http_build_query($get_params) : $get_params);
+        return http_request($url, $params, 'POST', false, [], $net_errno);
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $order_sn = $params['order_sn'];
+        $regin_no = $params['regin_no'] ?? -1;
+
+        if($regin_no <= 0) {
+            return [false, '省份获取错误', false];
+        }
+
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+        $params['provId'] = config::ProvinceMap[$regin_no];
+        if(empty($params['provId'])) {
+            return [false, '省份获取错误', false];
+        }
+
+        $resp = $this->url_request($params,'order.phone.charge');
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+
+            $resp = json_decode($resp ,true);
+            $code = $resp['code'];
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($code == 'SUCCESS') {
+                return [true, $resp['id'], false];
+            } elseif (in_array($code, config::ORDER_ERR_CODE)) {
+                return [false, $code, false];
+            } elseif (in_array($code, ['SYSTEM_ERROR', 'ORDER_ID_EXIST'])) {
+                $net_errno = "HTTP-{$code}";
+                return [false, $code, false];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $code, false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        //上游单号,可以为空,但需参与签名
+        $params['id'] = '';
+        $params['outerId'] = $refill_info['order_sn'];
+
+        $resp = $this->url_request($params,'order.status.query');
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            $code = $resp['code'];
+            if (empty($resp))
+            {
+                return [false, '系统错误'];
+            }
+            elseif ($code == 'SUCCESS')
+            {
+                $status = $resp['status'];
+
+                if ($status === 'SUCCESS') {
+                    $order_state = ORDER_STATE_SUCCESS;
+                    $save['official_sn'] = strtolower($resp['evidence']) == 'null' ? '' : $resp['evidence'];
+                    Model('refill_order')->edit($refill_info['order_id'], $save);
+                } elseif ($status === 'FAIL') {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($status === 'PROCESSING') {
+                    $order_state = ORDER_STATE_SEND;
+                } elseif ($status === 'ORDER_NOT_EXIST' && (time() - $refill_info['commit_time'] >= 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
+                } else {
+                    return [false, $code];
+                }
+
+                return [true, $order_state];
+            }
+            else
+            {
+                return [false, "code={$code}"];
+            }
+        }
+    }
+
+    public function balance()
+    {
+        $resp = $this->url_request([],'user.balance.query');
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp))
+            {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 'SUCCESS')
+            {
+                return [true, $resp['balance']];
+            }
+            else
+            {
+                return [false, $resp['code']];
+            }
+        }
+    }
+
+    private function sign($params,$get_params)
+    {
+        $userId = config::UserId;
+        $api_key = config::ApiKey;
+        $content = "service={$get_params['service']}&userId={$userId}&ts={$get_params['ts']}&";
+        if(!empty($params)) {
+            foreach ($params as $key => $value){
+                $content .= "{$key}={$value}&";
+            }
+            $content = rtrim($content, '&');
+        }
+        $content .= "&key={$api_key}";
+        return strtoupper(md5($content));
+    }
+
+    /**
+     * 获取毫秒级别的时间戳
+     */
+    private function getMillisecond()
+    {
+        $cur = microtime (true);
+        $cur = intval($cur * 1000);
+        return $cur;
+    }
+}

+ 62 - 0
helper/refill/api/xyz/guochuang_nation/config.php

@@ -0,0 +1,62 @@
+<?php
+
+
+namespace refill\guochuang_nation;
+
+use mtopcard;
+
+class config
+{
+    const API_URL = 'http://39.98.30.44:34341/hbgc/zz003';
+
+    const UserId = 'gyfs8888';
+    const ApiKey = 'ZFNpTFRrSm5qQ1Jo';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_guochuang_nation.php";
+    const operator = [
+        mtopcard\ChinaMobileCard => 11,
+        mtopcard\ChinaUnicomCard => 21,
+        mtopcard\ChinaTelecomCard => 31
+    ];
+    //key值为regin_no,value为上游省份id
+
+    //系统省份变化 -> 国创省份编号 转换表
+    const ProvinceMap = [
+        1	=> 1,  //'北京',
+        2	=> 2,  //'天津',
+        3	=> 10, //'河北',
+        4	=> 12, //'山西',
+        5	=> 5,  //'内蒙古',
+        6	=> 8,  //'辽宁',
+        7	=> 7,  //'吉林',
+        8	=> 6,  //'黑龙江',
+        9	=> 3,  //'上海',
+        10	=> 20, //'江苏',
+        11	=> 21, //'浙江',
+        12	=> 18, //'安徽',
+        13	=> 22, //'福建',
+        14	=> 19, //'江西',
+        15	=> 11, //'山东',
+        16	=> 9,  //'河南',
+        17	=> 14, //'湖北',
+        18	=> 13, //'湖南',
+        19	=> 15, //'广东',
+        20	=> 16, //'广西',
+        21	=> 17, //'海南',
+        22	=> 4,  //'重庆',
+        23	=> 28, //'四川',
+        24	=> 27, //'贵州',
+        25	=> 26, //'云南',
+        26	=> 31, //'西藏',
+        27	=> 23, //'陕西',
+        28	=> 24, //'甘肃',
+        29	=> 29, //'青海',
+        30	=> 25, //'宁夏',
+        31	=> 30  //'新疆'
+    ];
+
+    const ORDER_ERR_CODE = [
+        'PARAM_EMPTY', 'PARAM_ERROR', 'PARAM_TS_TIMEOUT', 'USER_NOT_EXISTS', 'USER_AUTH_NOT_ENOUGH',
+        'IP_DENY', 'SIGN_ERROR', 'SYSTEM_ERROR_DB', 'BALANCE_NOT_ENOUGH',
+        'ORDER_PRICE_ERROR', 'ORDER_NOT_SUPPORT_ACCOUNT', 'ORDER_NOT_SUPPORT_CHANNEL', 'DENY_ACCOUNT'
+    ];
+}

BIN
helper/refill/api/xyz/guochuang_nation/小面值.png


BIN
helper/refill/api/xyz/guochuang_nation/接口使用说明V2.0.20200427.pdf


BIN
helper/refill/api/xyz/guochuang_nation/接口签名补充说明.docx


+ 7 - 0
mobile/callback/refill_guochuang_nation.php

@@ -0,0 +1,7 @@
+<?php
+
+$content = $_SERVER['post_content'];
+$_POST['body'] = $content;
+refill\util::push_notify('guochuang_nation',$_POST);
+
+echo json_encode(['code' => 'SUCCESS']);

+ 16 - 2
test/TestRefill.php

@@ -687,8 +687,8 @@ class TestRefill extends TestCase
 
     public function testGuochuang()
     {
-        $providers = new refill\guochuang\RefillPhone([]);
-//        $resp = $providers->add(18074608795, 6, 10, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
+        $providers = $this->getProvider('guochuang');
+        $resp = $providers->add(13699279618, 4, 5, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
 //        $resp = $providers->query(['order_sn' => '82951628231038096078']);
 //        $resp = $providers->balance();
 //        $body = '{"account":"18074608795","evidence":"1000000083421080614310024563","evidenceType":"","id":"D2021080614235942044","inTime":"2021/08/06 14:26:22","money":"10","outerId":"82951628231038096078","status":"SUCCESS"}';
@@ -913,6 +913,20 @@ class TestRefill extends TestCase
 //        $resp = $providers->notify($params);
     }
 
+    public function testGuochuang_nation()
+    {
+//        $providers = $this->getProvider('guochuang_nation');
+//        $resp = $providers->add(18500608333, 5, 1, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
+
+        $body = '{"account":"18500608333","evidence":"N/A","evidenceType":"","id":"D2021090718185107657","inTime":"2021/09/07 18:19:05","money":"1","outerId":"65261631009929751933","status":"SUCCESS"}';
+        $params['ts'] = 1631009945;
+        $params['sign'] = 'C53F921EB5573EF4D0C757C5B5D4185D';
+        $params['body'] = $body;
+        $providers = $this->getProvider('guochuang_nation','RefillCallBack');
+        $ret = $providers->verify($params);
+        $resp = $providers->notify($params);
+    }
+
     public function testAmingjd()
     {
 //        $providers = new refill\amingjd\RefillPhone([]);