Parcourir la source

Merge branch 'raccount' into rcore

stanley-king il y a 1 an
Parent
commit
9bf66bdc1b
34 fichiers modifiés avec 1790 ajouts et 34 suppressions
  1. 146 8
      data/config/xyz/refill.ini.php
  2. 84 0
      data/config/yl/refill.ini.php
  3. 1 1
      helper/refill/RefillBase.php
  4. 13 25
      helper/refill/api/xyz/huifen_fast/RefillPhone.php
  5. 12 0
      helper/refill/api/xyz/kachong_new/API.MD
  6. 49 0
      helper/refill/api/xyz/kachong_new/RefillCallBack.php
  7. 137 0
      helper/refill/api/xyz/kachong_new/RefillPhone.php
  8. 24 0
      helper/refill/api/xyz/kachong_new/config.php
  9. 43 0
      helper/refill/api/xyz/menshang_sec/API.MD
  10. BIN
      helper/refill/api/xyz/menshang_sec/API.doc
  11. 53 0
      helper/refill/api/xyz/menshang_sec/RefillCallBack.php
  12. 155 0
      helper/refill/api/xyz/menshang_sec/RefillPhone.php
  13. 46 0
      helper/refill/api/xyz/menshang_sec/config.php
  14. 24 0
      helper/refill/api/xyz/xingchuang_trd/API.MD
  15. 52 0
      helper/refill/api/xyz/xingchuang_trd/RefillCallBack.php
  16. 154 0
      helper/refill/api/xyz/xingchuang_trd/RefillPhone.php
  17. 37 0
      helper/refill/api/xyz/xingchuang_trd/config.php
  18. 43 0
      helper/refill/api/yl/menshang/API.MD
  19. BIN
      helper/refill/api/yl/menshang/API.doc
  20. 52 0
      helper/refill/api/yl/menshang/RefillCallBack.php
  21. 155 0
      helper/refill/api/yl/menshang/RefillPhone.php
  22. 46 0
      helper/refill/api/yl/menshang/config.php
  23. BIN
      helper/refill/api/yl/menshang_fs/20240126_all.jpg
  24. 89 0
      helper/refill/api/yl/menshang_fs/API.MD
  25. BIN
      helper/refill/api/yl/menshang_fs/API.doc
  26. 52 0
      helper/refill/api/yl/menshang_fs/RefillCallBack.php
  27. 174 0
      helper/refill/api/yl/menshang_fs/RefillPhone.php
  28. 93 0
      helper/refill/api/yl/menshang_fs/config.php
  29. 4 0
      mobile/callback/refill_kachong_new.php
  30. 4 0
      mobile/callback/refill_menshang.php
  31. 4 0
      mobile/callback/refill_menshang_fs.php
  32. 4 0
      mobile/callback/refill_menshang_sec.php
  33. 4 0
      mobile/callback/refill_xingchuang_trd.php
  34. 36 0
      test/TestRefill.php

+ 146 - 8
data/config/xyz/refill.ini.php

@@ -10380,28 +10380,28 @@ $huifen_fast_phone = ['name' => 'huifen_fast', 'store_id' => 391, 'qualitys' =>
 //            ['goods_id' => 9067, 'price' => 30.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 9067, 'price' => 30.93, 'quality' => 2, 'card_type' => 'chinatelecom'],
 //        ],
-//        50 => [
-//            ['goods_id' => 9068, 'price' => 51.85, 'quality' => 2, 'card_type' => 'chinamobile'],
+        50 => [
+            ['goods_id' => 9068, 'price' => 50.4, 'quality' => 2, 'card_type' => 'chinamobile'],
 //            ['goods_id' => 9068, 'price' => 51.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 9068, 'price' => 51.55, 'quality' => 2, 'card_type' => 'chinatelecom'],
-//        ],
+        ],
         100 => [
-            ['goods_id' => 9069, 'price' => 100, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9069, 'price' => 100.5, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 9069, 'price' => 100, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 9069, 'price' => 100, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         200 => [
-            ['goods_id' => 9070, 'price' => 200, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9070, 'price' => 201, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 9070, 'price' => 200, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 9070, 'price' => 200, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         300 => [
-            ['goods_id' => 9071, 'price' => 300, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9071, 'price' => 301.5, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 9071, 'price' => 300, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 9071, 'price' => 300, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         500 => [
-            ['goods_id' => 9072, 'price' => 500, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9072, 'price' => 502.5, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 9072, 'price' => 500, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 9072, 'price' => 500, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ]
@@ -10453,6 +10453,141 @@ $xingchuang_sec_phone = ['name' => 'xingchuang_sec', 'store_id' => 392, 'quality
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$kachong_new_phone = ['name' => 'kachong_new', 'store_id' => 393, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 9081, 'price' => 9.91, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9081, 'price' => 9.91, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9081, 'price' => 9.89, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        20 => [
+//            ['goods_id' => 9082, 'price' => 19.82, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9082, 'price' => 19.88, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9082, 'price' => 19.78, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 9083, 'price' => 29.985, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9083, 'price' => 29.82, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9083, 'price' => 29.997, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 9084, 'price' => 49.975, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9084, 'price' => 49, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9084, 'price' => 49.995, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 9085, 'price' => 99.95, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9085, 'price' => 94.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9085, 'price' => 99.99, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+//        200 => [
+//            ['goods_id' => 9086, 'price' => 198.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9086, 'price' => 198.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9086, 'price' => 197.8, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        300 => [
+//            ['goods_id' => 9087, 'price' => 297.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9087, 'price' => 297.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9087, 'price' => 296.7, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 9088, 'price' => 495.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9088, 'price' => 495.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9088, 'price' => 494.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$xingchuang_trd_phone = ['name' => 'xingchuang_trd', 'store_id' => 394, 'qualitys' => '1',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 9089, 'price' => 10, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9089, 'price' => 10, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9089, 'price' => 10, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+//        20 => [
+//            ['goods_id' => 9090, 'price' => 20, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9090, 'price' => 20, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9090, 'price' => 20, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+//        30 => [
+//            ['goods_id' => 9091, 'price' => 30, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9091, 'price' => 30, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9091, 'price' => 30, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+//        50 => [
+//            ['goods_id' => 9092, 'price' => 50, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9092, 'price' => 50, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9092, 'price' => 50, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+        100 => [
+            ['goods_id' => 9093, 'price' => 97.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9093, 'price' => 100, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9093, 'price' => 100, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        200 => [
+            ['goods_id' => 9094, 'price' => 194.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9094, 'price' => 200, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9094, 'price' => 200, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+//        300 => [
+//            ['goods_id' => 9095, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9095, 'price' => 300, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9095, 'price' => 300, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+//        500 => [
+//            ['goods_id' => 9096, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9096, 'price' => 500, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9096, 'price' => 500, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$menshang_sec_phone = ['name' => 'menshang_sec', 'store_id' => 395, 'qualitys' => '1',
+    'amount' => [
+        10 => [
+            ['goods_id' => 9097, 'price' => 9.65, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9097, 'price' => 10, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9097, 'price' => 10, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 9098, 'price' => 19.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9098, 'price' => 20, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9098, 'price' => 20, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+//            ['goods_id' => 9099, 'price' => 30, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9099, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9099, 'price' => 29.01, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 9100, 'price' => 48.35, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9100, 'price' => 47, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9100, 'price' => 48.35, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 9101, 'price' => 96.7, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9101, 'price' => 94, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9101, 'price' => 96.7, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 9102, 'price' => 193.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9102, 'price' => 188, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9102, 'price' => 193.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+//        300 => [
+//            ['goods_id' => 9103, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9103, 'price' => 300, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9103, 'price' => 300, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 9104, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9104, 'price' => 500, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9104, 'price' => 500, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_p hone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -10764,8 +10899,11 @@ $phone_providers = [
     ['name' => 'yeyekami_fast', 'cfg' => $yeyekami_fast_phone],
     ['name' => 'tengyoujun_ylyw', 'cfg' => $tengyoujun_ylyw_phone],
     ['name' => 'tengyoujun_yj', 'cfg' => $tengyoujun_yj_phone],
-//    ['name' => 'huifen_fast', 'cfg' => $huifen_fast_phone],
+    ['name' => 'huifen_fast', 'cfg' => $huifen_fast_phone],
         ['name' => 'xingchuang_sec', 'cfg' => $xingchuang_sec_phone],
+    ['name' => 'kachong_new', 'cfg' => $kachong_new_phone],
+    ['name' => 'xingchuang_trd', 'cfg' => $xingchuang_trd_phone],
+    ['name' => 'menshang_sec', 'cfg' => $menshang_sec_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

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

@@ -8068,6 +8068,88 @@ $xingchuang_fs_phone = ['name' => 'xingchuang_fs', 'store_id' => 310, 'qualitys'
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$menshang_phone = ['name' => 'menshang', 'store_id' => 311, 'qualitys' => '1',
+    'amount' => [
+        10 => [
+            ['goods_id' => 8499, 'price' => 9.67, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8499, 'price' => 10, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8499, 'price' => 10, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 8500, 'price' => 19.34, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8500, 'price' => 20, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8500, 'price' => 20, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+//            ['goods_id' => 8501, 'price' => 30, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8501, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8501, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 8502, 'price' => 48.35, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8502, 'price' => 47, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8502, 'price' => 48.35, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8503, 'price' => 96.7, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8503, 'price' => 94, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8503, 'price' => 96.7, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8504, 'price' => 193.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8504, 'price' => 188, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8504, 'price' => 193.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+//        300 => [
+//            ['goods_id' => 8505, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8505, 'price' => 300, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8505, 'price' => 300, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8506, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8506, 'price' => 500, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8506, 'price' => 500, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$menshang_fs_phone = ['name' => 'menshang_fs', 'store_id' => 312, 'qualitys' => '1',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 8507, 'price' => 10, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8507, 'price' => 10, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 8508, 'price' => 20, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8508, 'price' => 20, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+        30 => [
+            ['goods_id' => 8509, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8509, 'price' => 28.14, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 8510, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8510, 'price' => 46.9, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8511, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8511, 'price' => 93.8, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8512, 'price' => 189, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8512, 'price' => 187.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+//        300 => [
+//            ['goods_id' => 8513, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8513, 'price' => 300, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8514, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8514, 'price' => 500, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -8325,6 +8407,8 @@ $phone_providers = [
     ['name' => 'yzpuchong2', 'cfg' => $yzpuchong2_phone],
     ['name' => 'xingchuang_nation', 'cfg' => $xingchuang_nation_phone],
     ['name' => 'xingchuang_fs', 'cfg' => $xingchuang_fs_phone],
+    ['name' => 'menshang', 'cfg' => $menshang_phone],
+    ['name' => 'menshang_fs', 'cfg' => $menshang_fs_phone],
 ];
 
 $config['phone_providers'] = $phone_providers;

+ 1 - 1
helper/refill/RefillBase.php

@@ -455,7 +455,7 @@ class RefillBase
 
         if (empty($providers)) {
             Log::record("canot find any providers", Log::DEBUG);
-            return [errcode::CANNOT_MATCH_PROVIDER, "匹配不到任何通道", $last_orderid, false, 0];
+            return [errcode::MERCHANT_REFILL_CHLIMIT, "匹配不到任何通道", $last_orderid, false, 0];
         }
 
         try

+ 13 - 25
helper/refill/api/xyz/huifen_fast/RefillPhone.php

@@ -20,33 +20,25 @@ class RefillPhone extends refill\IRefillPhone
      */
     private function req_params(int $card_no, int $card_type, string $order_sn, int $amount): array
     {
-        $checker = function ($card_type, $amount)
-        {
-            if (!isset(config::operator[$card_type])) {
-                return '运营商错误';
-            }
-            return '';
-        };
-        $params_err = $checker($card_type, $amount);
-        if (!empty($params_err)) {
-            throw new Exception($params_err);
+        $operatorName = config::operator[$card_type] ?? false;
+        if($operatorName === false) {
+            return [];
         }
 
         $params['partnerNo'] = config::PARTNER_NO;
         $params['productNo'] = $amount;
         $params['orderNo'] = $order_sn;
         $params['productQty'] = 1;
-        $params['operatorName'] = config::operator[$card_type];
+        $params['operatorName'] = $operatorName;
         $params['accountNo'] = $card_no;
         return $params;
     }
 
     public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
     {
-        try {
-            $params = $this->req_params($card_no, $card_type, $params['order_sn'], $amount);
-        } catch (Exception $e) {
-            return [false, $e->getMessage(), false];
+        $params = $this->req_params($card_no, $card_type, $params['order_sn'], $amount);
+        if(empty($params)) {
+            return [false, '参数错误', false];
         }
 
         $sign = config::sign($params);
@@ -69,14 +61,14 @@ class RefillPhone extends refill\IRefillPhone
             $code = intval($resp['code']);
             if ($code === 200) {
                 return [true, '', false];
-            } elseif (in_array($code, config::ERR_NOS, true)) {
+            } elseif (in_array($code, config::ERR_NOS, true)) { //const ERR_NOS = [500, 50001, 50003, 50005];
                 return [false, $resp['message'], false];
             } elseif (in_array($code, config::EXP_NOS, true)) {
-                $net_errno = "HTTP-{$code}";
+                $net_errno = "HTTP-$code";
                 return [false, $resp['message'], true];
             } else {
                 $err = 998;
-                $net_errno = "HTTP-{$err}";
+                $net_errno = "HTTP-$err";
                 return [false, $resp['message'], true];
             }
         }
@@ -99,8 +91,7 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp, Log::DEBUG);
 
             $resp = json_decode($resp, true);
-            if (empty($resp))
-            {
+            if (empty($resp)) {
                 return [false, '网络错误', ''];
             }
 
@@ -108,8 +99,8 @@ class RefillPhone extends refill\IRefillPhone
             if ($code === 200)
             {
                 $offical_sn = '';
-
                 $status = intval($resp['data']['orderStatus']);
+
                 if ($status === 20) {
                     $offical_sn = $resp['data']['operatorSerialNo'];
                     Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $offical_sn]);
@@ -124,10 +115,6 @@ class RefillPhone extends refill\IRefillPhone
 
                 return [true, $order_state, $offical_sn];
             }
-            elseif (in_array($code, config::ERR_NOS))
-            {
-                return [true, ORDER_STATE_CANCEL, ''];
-            }
             else
             {
                 return [false, $resp['message'], ''];
@@ -141,6 +128,7 @@ class RefillPhone extends refill\IRefillPhone
 
         $sign = config::sign($params);
         $params['sign'] = $sign;
+
         $params = json_encode($params);
         $resp = http_post_data(config::BALANCE_URL, $params, config::ExtHeaders);
         if (empty($resp)) {

+ 12 - 0
helper/refill/api/xyz/kachong_new/API.MD

@@ -0,0 +1,12 @@
+## 70卡充(新)
+
+- 下单地址:http://42.193.245.133:5001/plat/api/old/submitorder
+- 查单地址:http://42.193.245.133:5001/plat/api/old/queryorder
+- 余额地址:http://42.193.245.133:5001/plat/api/old/queryBalance
+- 接口文档:https://docs.qq.com/doc/DZW5jTWdHZFVIYnZp?_t=1639711707120 话费
+- ID:200517
+- 密钥:618702d302bab75af6b429b5563047ec
+
+## 店铺账号:
+- kachong_new
+- kachong_new67890

+ 49 - 0
helper/refill/api/xyz/kachong_new/RefillCallBack.php

@@ -0,0 +1,49 @@
+<?php
+namespace refill\kachong_new;
+
+require_once(BASE_HELPER_RAPI_PATH . '/kachong_new/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['szVerifyString'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    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}";
+        return md5($content);
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['nFlag']);
+        $order_sn = $params['szOrderId'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 2) {
+            Model('refill_order')->edit($order_id, ['official_sn' => $params['szRtnMsg']]);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 137 - 0
helper/refill/api/xyz/kachong_new/RefillPhone.php

@@ -0,0 +1,137 @@
+<?php
+
+namespace refill\kachong_new;
+
+require_once(BASE_HELPER_RAPI_PATH . '/kachong_new/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['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;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            $nRtn = intval($resp['nRtn']);
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($nRtn === 0) {
+                return [true, '', false];
+            } elseif (in_array($nRtn, config::ERR_NOS)) {
+                return [false, $resp['szRtnCode'], false];
+            } elseif (in_array($nRtn, [2050, 999])) {
+                $net_errno = "HTTP-{$nRtn}";
+                return [false, $resp['szRtnCode'], true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], 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);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+            $status = intval($resp['nRtn']);
+            if ($status === 5012) {
+                Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $resp['szRtnMsg']]);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif (in_array($status, [5011,5019])) {
+                $order_state = ORDER_STATE_SEND;
+            } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
+                $order_state = ORDER_STATE_NOEXIST;
+            } else {
+                return [false, $status];
+            }
+            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);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['nRtn'] == 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    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}";
+        return md5($content);
+    }
+}

+ 24 - 0
helper/refill/api/xyz/kachong_new/config.php

@@ -0,0 +1,24 @@
+<?php
+namespace refill\kachong_new;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://42.193.245.133:5001/plat/api/old/submitorder';
+    const QUERY_URL= 'http://42.193.245.133:5001/plat/api/old/queryorder';
+    const BALANCE_URL= 'http://42.193.245.133:5001/plat/api/old/queryBalance';
+
+    const USER_ID= '200517';
+    const KEY = '618702d302bab75af6b429b5563047ec';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_kachong_new.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+
+    const ERR_NOS = [
+        1000,1001,1003,1004,1023,1024,1025,1026,2001,2002,2003,2020,2021,2025,2026,1006,2030,3003
+    ];
+}

+ 43 - 0
helper/refill/api/xyz/menshang_sec/API.MD

@@ -0,0 +1,43 @@
+
+## 门上全国2号
+
+### 账号信息
+- 后台登录地址:http://123.249.40.234:10060
+- 登录名:福清0095
+- 初始密码:123456
+
+### 接口信息
+- 用户id:10002649
+- 密钥:2b3tMhAz7khJw8tfFyAJyFJ6e2Ec7rNw
+
+## 接口地址
+话费充值接口:http://123.249.40.234:9086/onlinepay.do
+订单查询接口:http://123.249.40.234:9086/searchpay.do
+账户余额查询接口:http://123.249.40.234:9086/searchbalance.do
+
+## 店铺账号
+- 账号:menshang_sec
+- 密码:menshang_sec67890
+
+## 编码
+- 商品编号 商品名称
+- 30000000739 全国电信200元直充
+- 30000000738 全国电信100元直充
+- 30000000737 全国电信50元直充
+- 30000000736 全国电信30元直充
+
+
+- 商品编号 商品名称
+- 30000000992 全国联通200元直充
+- 30000000733 全国联通100元直充
+- 30000000732 全国联通50元直充
+- 30000000731 全国联通30元直充
+
+
+- 商品编号 商品名称
+- 30000000911 全国移动200元直充
+- 30000000910 全国移动100元直充
+- 30000000909 全国移动50元直充
+- 商品编号 商品名称
+- 30000000907 全国移动20元直充
+- 30000000906 全国移动10元直充

BIN
helper/refill/api/xyz/menshang_sec/API.doc


+ 53 - 0
helper/refill/api/xyz/menshang_sec/RefillCallBack.php

@@ -0,0 +1,53 @@
+<?php
+namespace refill\menshang_sec;
+
+require_once(BASE_HELPER_RAPI_PATH . '/menshang_sec/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): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid=$userid&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key=$key";
+
+        return strtoupper(md5($content));
+    }
+
+    public function notify($params): array
+    {
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
+        $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 === 1) {
+            $official_sn = $params['remark1'] ?? '';
+            $ch_trade_no = $params['orderid'] ?? '';
+            Model('refill_order')->edit($order_id, ['official_sn' => $official_sn, 'ch_trade_no' => $ch_trade_no]);
+            return [$order_id, true, false, true, $official_sn];
+        } elseif ($status === 9) {
+            $ch_trade_no = $params['orderid'] ?? '';
+            Model('refill_order')->edit($order_id, ['ch_trade_no' => $ch_trade_no]);
+            return [$order_id, false, true, true, ''];
+        } else {
+            return [$order_id, false, false, false, ''];
+        }
+    }
+}

+ 155 - 0
helper/refill/api/xyz/menshang_sec/RefillPhone.php

@@ -0,0 +1,155 @@
+<?php
+
+namespace refill\menshang_sec;
+
+require_once(BASE_HELPER_RAPI_PATH . '/menshang_sec/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, $card_type, string $order_sn): array
+    {
+        $params['userid'] = config::USER_ID;
+        $params['productid'] = config::ProductIdS[$card_type][$amount];
+        $params['price'] = $amount;
+        $params['num'] = 1;
+        $params['mobile'] = $phone;
+        $params['spordertime'] = date("YmdHis");
+        $params['sporderid'] = $order_sn;
+        $params['back_url'] = config::NOTIFY_URL;
+        $params['paytype'] = config::operator[$card_type];
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            }
+
+            $resultno = $resp['resultno'];
+            if (in_array($resultno, ['0', '2'], true)) {
+                return [true, $resp['orderid'], false];
+            } elseif (in_array($resultno, config::ERR_NOS, true)) {
+                return [false, $resultno, false];
+            } elseif ($resultno === '9999' || $resultno === '5006') {
+                $net_errno = "HTTP-{$resultno}";
+                return [false, $net_errno, true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $net_errno, true];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $params['userid'] = config::USER_ID;
+        $params['sporderid'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&sporderid={$params['sporderid']}&key={$key}";
+        $params['sign'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误', ''];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp))
+            {
+                return [false, '网络错误', ''];
+            }
+            else
+            {
+                $official_sn = $resp['remark1'] ?? '';
+                $ch_trade_no = $resp['orderid'] ?? '';
+
+                $resultno = $resp['resultno'];
+                if ($resultno === '1') {
+                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $official_sn,'ch_trade_no' => $ch_trade_no]);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($resultno === '9') {
+                    Model('refill_order')->edit($refill_info['order_id'], ['ch_trade_no' => $ch_trade_no]);
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($resultno === '5007' && (time() - $refill_info['commit_time'] > 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
+                } else {
+                    $order_state = ORDER_STATE_SEND;
+                }
+
+                return [true, $order_state, $official_sn];
+            }
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['userid'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&key={$key}";
+        $params['sign'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['resultno'] === '1') {
+                return [true, $resp['balance']];
+            } else {
+                return [false, $resp['resultno']];
+            }
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
+        $content .= "&sporderid={$params['sporderid']}&key={$key}";
+        return md5($content);
+    }
+
+    public function xmlToArray($xml)
+    {
+        $replace_str = str_replace(' ','','encoding="gb2312"');
+        $xml = mb_convert_encoding($xml,"UTF-8","gb2312");
+        $xml = str_replace($replace_str, "encoding='utf-8'", $xml);
+        return refill\util::xmlToArray($xml);
+    }
+}

+ 46 - 0
helper/refill/api/xyz/menshang_sec/config.php

@@ -0,0 +1,46 @@
+<?php
+
+
+namespace refill\menshang_sec;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://123.249.40.234:9086/onlinepay.do';
+    const QUERY_URL= 'http://123.249.40.234:9086/searchpay.do';
+    const BALANCE_URL= 'http://123.249.40.234:9086/searchbalance.do';
+    const USER_ID= '10002649';
+    const KEY = '2b3tMhAz7khJw8tfFyAJyFJ6e2Ec7rNw';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_menshang_sec.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ERR_NOS = [
+        '5001', '5002', '5003', '5004', '5005', '5008', '5009', '5010', '5011', '5012', '7001'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard => [
+            10 => '30000000906',
+            20 => '30000000907',
+            50 => '30000000909',
+            100 => '30000000910',
+            200 => '30000000911'
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30 => '30000000731',
+            50 => '30000000732',
+            100 => '30000000733',
+            200 => '30000000992'
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30 => '30000000736',
+            50 => '30000000737',
+            100 => '30000000738',
+            200 => '30000000739'
+        ],
+    ];
+}

+ 24 - 0
helper/refill/api/xyz/xingchuang_trd/API.MD

@@ -0,0 +1,24 @@
+## 兴创全国3号
+
+### 正式环境:
+- 话费下单地址:http://121.43.238.2:16188/plat/api/hf/submitorder
+- 查询地址:http://121.43.238.2:16188/plat/api/queryorder
+- 查询余额地址:http://121.43.238.2:16188/plat/api/querybalance
+
+- 客户端地址:http://121.43.238.2:16188/plat/login
+- 账号:兴创全国3
+- 密码:123456
+- 客户ID:100006
+- 密钥:aabb82748e484189bbe1d57a1d86eafb
+
+### 对接文档地址:
+> https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+### 店铺账号
+- xingchuang_trd
+- xingchuang_trd67890
+
+### 产品编码
+
+福庆顺全国3	全国移动100元	1000100
+福庆顺全国3	全国移动200元	1000200

+ 52 - 0
helper/refill/api/xyz/xingchuang_trd/RefillCallBack.php

@@ -0,0 +1,52 @@
+<?php
+namespace refill\xingchuang_trd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/xingchuang_trd/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['szVerifyString'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params): string
+    {
+        $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}";
+        return md5($content);
+    }
+
+    public function notify($params): array
+    {
+        $status = intval($params['nFlag']);
+        $order_sn = $params['szOrderId'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false, false, ''];
+        }
+        $order_id = $order_info['order_id'];
+
+        if ($status === 2) {
+            $official_sn = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+
+            $data['official_sn'] = $official_sn;
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true, $official_sn];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true, true, ''];
+        }
+        else {
+            return [$order_id, false, false, false, ''];
+        }
+    }
+}

+ 154 - 0
helper/refill/api/xyz/xingchuang_trd/RefillPhone.php

@@ -0,0 +1,154 @@
+<?php
+
+namespace refill\xingchuang_trd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/xingchuang_trd/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): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $order_sn;
+        $params['szPhoneNum'] = $phone;
+        $params['nMoney'] = $amount;
+        $params['nSortType'] = config::operator[$card_type];
+
+        $productId = config::Product[$card_type][$amount] ?? false;
+        if ($productId === false) {
+            return [];
+        }
+        $params['szProductId'] = $productId;
+        $params['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szTimeStamp'] = date("Y-m-d H:i:s");
+        $params['szNotifyUrl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+        if (empty($params)) {
+            return [false, '参数错误', false];
+        }
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            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];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $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);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误', ''];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误', ''];
+            }
+
+            $official_sn = '';
+
+            $status = $resp['nRtn'];
+            if ($status === 5012) {
+                $official_sn = $resp['szRtnMsg'];
+
+                $updata['official_sn'] = $official_sn;
+                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'], ''];
+            }
+
+            return [true, $order_state, $official_sn];
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['nRtn'] === 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    private function sign($params): string
+    {
+        $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}";
+        return md5($content);
+    }
+}

+ 37 - 0
helper/refill/api/xyz/xingchuang_trd/config.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace refill\xingchuang_trd;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://121.43.238.2:16188/plat/api/hf/submitorder';
+    const QUERY_URL= 'http://121.43.238.2:16188/plat/api/queryorder';
+    const BALANCE_URL = 'http://121.43.238.2:16188/plat/api/querybalance';
+
+    const USER_ID= '100006';
+    const KEY = 'aabb82748e484189bbe1d57a1d86eafb';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_xingchuang_trd.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    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 Product = [
+        mtopcard\ChinaMobileCard => [
+            100  => 1000100,
+            200  => 1000200,
+        ],
+        mtopcard\ChinaUnicomCard => [
+        ],
+        mtopcard\ChinaTelecomCard => [
+        ],
+    ];
+}

+ 43 - 0
helper/refill/api/yl/menshang/API.MD

@@ -0,0 +1,43 @@
+
+## 门上全国1号
+
+### 账号信息
+- 后台登录地址:http://123.249.40.234:10060
+- 登录名:福清全国wt
+- 初始密码:123456
+
+### 接口信息
+- 用户id:10002648
+- 密钥:PHMtTBf535FGsEJXCBb8wbT5hPPm3SQX
+
+## 接口地址
+话费充值接口:http://123.249.40.234:9086/onlinepay.do
+订单查询接口:http://123.249.40.234:9086/searchpay.do
+账户余额查询接口:http://123.249.40.234:9086/searchbalance.do
+
+## 店铺账号
+- 账号:menshang
+- 密码:menshang67890
+
+## 编码
+- 商品编号 商品名称
+- 30000000739 全国电信200元直充
+- 30000000738 全国电信100元直充
+- 30000000737 全国电信50元直充
+- 30000000736 全国电信30元直充
+
+
+- 商品编号 商品名称
+- 30000000992 全国联通200元直充
+- 30000000733 全国联通100元直充
+- 30000000732 全国联通50元直充
+- 30000000731 全国联通30元直充
+
+
+- 商品编号 商品名称
+- 30000000911 全国移动200元直充
+- 30000000910 全国移动100元直充
+- 30000000909 全国移动50元直充
+- 商品编号 商品名称
+- 30000000907 全国移动20元直充
+- 30000000906 全国移动10元直充

BIN
helper/refill/api/yl/menshang/API.doc


+ 52 - 0
helper/refill/api/yl/menshang/RefillCallBack.php

@@ -0,0 +1,52 @@
+<?php
+namespace refill\menshang;
+
+require_once(BASE_HELPER_RAPI_PATH . '/menshang/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): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid=$userid&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key=$key";
+
+        return strtoupper(md5($content));
+    }
+
+    public function notify($params): array
+    {
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
+        $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 === 1) {
+            $official_sn = $params['remark1'] ?? '';
+            $ch_trade_no = $params['orderid'] ?? '';
+            Model('refill_order')->edit($order_id, ['official_sn' => $official_sn, 'ch_trade_no' => $ch_trade_no]);
+            return [$order_id, true, false, true, $official_sn];
+        } elseif ($status === 9) {
+            $ch_trade_no = $params['orderid'] ?? '';
+            Model('refill_order')->edit($order_id, ['ch_trade_no' => $ch_trade_no]);
+            return [$order_id, false, true, true, ''];
+        } else {
+            return [$order_id, false, false, false, ''];
+        }
+    }
+}

+ 155 - 0
helper/refill/api/yl/menshang/RefillPhone.php

@@ -0,0 +1,155 @@
+<?php
+
+namespace refill\menshang;
+
+require_once(BASE_HELPER_RAPI_PATH . '/menshang/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, $card_type, string $order_sn): array
+    {
+        $params['userid'] = config::USER_ID;
+        $params['productid'] = config::ProductIdS[$card_type][$amount];
+        $params['price'] = $amount;
+        $params['num'] = 1;
+        $params['mobile'] = $phone;
+        $params['spordertime'] = date("YmdHis");
+        $params['sporderid'] = $order_sn;
+        $params['back_url'] = config::NOTIFY_URL;
+        $params['paytype'] = config::operator[$card_type];
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            }
+
+            $resultno = $resp['resultno'];
+            if (in_array($resultno, ['0', '2'], true)) {
+                return [true, $resp['orderid'], false];
+            } elseif (in_array($resultno, config::ERR_NOS, true)) {
+                return [false, $resultno, false];
+            } elseif ($resultno === '9999' || $resultno === '5006') {
+                $net_errno = "HTTP-{$resultno}";
+                return [false, $resultno, true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resultno, true];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $params['userid'] = config::USER_ID;
+        $params['sporderid'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&sporderid={$params['sporderid']}&key={$key}";
+        $params['sign'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误', ''];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp))
+            {
+                return [false, '网络错误', ''];
+            }
+            else
+            {
+                $official_sn = $resp['remark1'] ?? '';
+                $ch_trade_no = $resp['orderid'] ?? '';
+
+                $resultno = $resp['resultno'];
+                if ($resultno === '1') {
+                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $official_sn,'ch_trade_no' => $ch_trade_no]);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($resultno === '9') {
+                    Model('refill_order')->edit($refill_info['order_id'], ['ch_trade_no' => $ch_trade_no]);
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($resultno === '5007' && (time() - $refill_info['commit_time'] > 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
+                } else {
+                    $order_state = ORDER_STATE_SEND;
+                }
+
+                return [true, $order_state, $official_sn];
+            }
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['userid'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&key={$key}";
+        $params['sign'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['resultno'] === '1') {
+                return [true, $resp['balance']];
+            } else {
+                return [false, $resp['resultno']];
+            }
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
+        $content .= "&sporderid={$params['sporderid']}&key={$key}";
+        return md5($content);
+    }
+
+    public function xmlToArray($xml)
+    {
+        $replace_str = str_replace(' ','','encoding="gb2312"');
+        $xml = mb_convert_encoding($xml,"UTF-8","gb2312");
+        $xml = str_replace($replace_str, "encoding='utf-8'", $xml);
+        return refill\util::xmlToArray($xml);
+    }
+}

+ 46 - 0
helper/refill/api/yl/menshang/config.php

@@ -0,0 +1,46 @@
+<?php
+
+
+namespace refill\menshang;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://123.249.40.234:9086/onlinepay.do';
+    const QUERY_URL= 'http://123.249.40.234:9086/searchpay.do';
+    const BALANCE_URL= 'http://123.249.40.234:9086/searchbalance.do';
+    const USER_ID= '10002648';
+    const KEY = 'PHMtTBf535FGsEJXCBb8wbT5hPPm3SQX';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_menshang.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ERR_NOS = [
+        '5001', '5002', '5003', '5004', '5005', '5008', '5009', '5010', '5011', '5012', '7001'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard => [
+            10 => '30000000906',
+            20 => '30000000907',
+            50 => '30000000909',
+            100 => '30000000910',
+            200 => '30000000911'
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30 => '30000000731',
+            50 => '30000000732',
+            100 => '30000000733',
+            200 => '30000000992'
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30 => '30000000736',
+            50 => '30000000737',
+            100 => '30000000738',
+            200 => '30000000739'
+        ],
+    ];
+}

BIN
helper/refill/api/yl/menshang_fs/20240126_all.jpg


+ 89 - 0
helper/refill/api/yl/menshang_fs/API.MD

@@ -0,0 +1,89 @@
+
+## 门上分省
+> copy dongyefs
+
+### 账号信息
+- 后台登录地址:http://123.249.40.234:10060
+- 登录名:福清分省
+- 初始密码:123456
+
+### 接口信息
+- 用户id:10002650
+- 密钥:reFifPhfPrNFF4Jxim5EmybMSfcHmfRx
+
+## 接口地址
+话费充值接口:http://123.249.40.234:9086/onlinepay.do
+订单查询接口:http://123.249.40.234:9086/searchpay.do
+账户余额查询接口:http://123.249.40.234:9086/searchbalance.do
+
+## 店铺账号
+- 账号:menshang_fs
+- 密码:menshang_fs67890
+
+## 编码
+- 商品编号 商品名称
+- 35577 湖北移动200元直充
+- 3520 湖北移动100元直充
+- 3519 湖北移动50元直充
+- 3518 湖北移动30元直充
+- 商品编号 商品名称
+- 36578 山东移动200元直充
+- 3624 山东移动100元直充
+- 3623 山东移动50元直充
+- 3622 山东移动30元直充
+- 商品编号
+- 商品名称
+- 315621 广西移动200元直充
+- 31562 广西移动100元直充
+- 31561 广西移动50元直充
+- 31560 广西移动30元直充
+- 商品编号 商品名称
+- 318624 天津移动200元直充
+- 31874 天津移动100元直充
+- 31873 天津移动50元直充
+- 31872 天津移动30元直充
+- 商品编号 商品名称
+- 328631 青海移动200元直充
+- 328106 青海移动100元直充
+- 328105 青海移动50元直充
+- 328104 青海移动30元直充
+- 商品编号 商品名称
+- 274591 湖南电信200元直充
+- 274331 湖南电信100元直充
+- 274330 湖南电信50元直充
+- 274329 湖南电信30元直充
+- 商品编号 商品名称
+- 271588 四川电信200元直充
+- 271316 四川电信100元直充
+- 271315 四川电信50元直充
+- 271314 四川电信30元直充
+- 商品编号 商品名称
+- 270587 山东电信200元直充
+- 270311 山东电信100元直充
+- 270310 山东电信50元直充
+- 270309 山东电信30元直充
+- 商品编号 商品名称
+- 282601 天津电信200元直充
+- 282371 天津电信100元直充
+- 282370 天津电信50元直充
+- 282369 天津电信30元直充
+- 商品编号 商品名称
+- 276593 河北电信200元直充
+- 276341 河北电信100元直充
+- 276340 河北电信50元直充
+- 276339 河北电信30元直充
+- 商品编号 商品名称
+- 289609 宁夏电信200元直充
+- 289406 宁夏电信100元直充
+- 289405 宁夏电信50元直充
+- 289404 宁夏电信30元直充
+- 商品编号 商品名称
+- 290610 青海电信200元直充
+- 290411 青海电信100元直充
+- 290410 青海电信50元直充
+- 290409 青海电信30元直充 正常
+- 商品编号 商品名称
+- 269586 湖北电信200元直充
+- 269306 湖北电信100元直充
+- 269305 湖北电信50元直充
+- 269304 湖北电信30元直充

BIN
helper/refill/api/yl/menshang_fs/API.doc


+ 52 - 0
helper/refill/api/yl/menshang_fs/RefillCallBack.php

@@ -0,0 +1,52 @@
+<?php
+namespace refill\menshang_fs;
+
+require_once(BASE_HELPER_RAPI_PATH . '/menshang_fs/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): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid=$userid&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key=$key";
+
+        return strtoupper(md5($content));
+    }
+
+    public function notify($params): array
+    {
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
+        $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 === 1) {
+            $official_sn = $params['remark1'] ?? '';
+            $ch_trade_no = $params['orderid'] ?? '';
+            Model('refill_order')->edit($order_id, ['official_sn' => $official_sn, 'ch_trade_no' => $ch_trade_no]);
+            return [$order_id, true, false, true, $official_sn];
+        } elseif ($status === 9) {
+            $ch_trade_no = $params['orderid'] ?? '';
+            Model('refill_order')->edit($order_id, ['ch_trade_no' => $ch_trade_no]);
+            return [$order_id, false, true, true, ''];
+        } else {
+            return [$order_id, false, false, false, ''];
+        }
+    }
+}

+ 174 - 0
helper/refill/api/yl/menshang_fs/RefillPhone.php

@@ -0,0 +1,174 @@
+<?php
+
+namespace refill\menshang_fs;
+
+require_once(BASE_HELPER_RAPI_PATH . '/menshang_fs/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    public function goods($quality,int $amount,int $card_type,$regin_no,$other)
+    {
+        [$goods_id, $price] = parent::goods($quality,$amount,$card_type,$regin_no,$other);
+        if($goods_id <= 0) return [0,0];
+        $key = "{$card_type}-{$amount}-{$regin_no}";
+        $price = config::Price[$key];
+        if(empty($price)) {
+            Log::record("channel cannot find price where name={$this->mName}, goods_id = {$goods_id} card_type={$card_type} amount={$amount} regin_no={$regin_no}",Log::ERR);
+            return [0,0];
+        } else {
+            return [$goods_id,ncPriceFormat($price)];
+        }
+    }
+
+    private function req_params(int $phone, int $amount, $card_type, string $order_sn, $regin_no)
+    {
+        $params['userid'] = config::USER_ID;
+        $params['productid'] = config::product_id[$card_type][$regin_no][$amount];
+        $params['price'] = $amount;
+        $params['num'] = 1;
+        $params['mobile'] = $phone;
+        $params['spordertime'] = date("YmdHis");
+        $params['sporderid'] = $order_sn;
+        $params['back_url'] = config::NOTIFY_URL;
+        $params['paytype'] = config::operator[$card_type];
+
+        return $params;
+    }
+
+    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, $regin_no);
+        if(empty($params['productid'])) {
+            return [false, '商品编号错误', false];
+        }
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            }
+
+            $resultno = $resp['resultno'];
+            if (in_array($resultno, ['0', '2'], true)) {
+                return [true, $resp['orderid'], false];
+            } elseif (in_array($resultno, config::ERR_NOS, true)) {
+                return [false, $resultno, false];
+            } elseif ($resultno === '9999' || $resultno === '5006') {
+                $net_errno = "HTTP-{$resultno}";
+                return [false, $resultno, true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resultno, true];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $params['userid'] = config::USER_ID;
+        $params['sporderid'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&sporderid={$params['sporderid']}&key={$key}";
+        $params['sign'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误', ''];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp))
+            {
+                return [false, '网络错误', ''];
+            }
+            else
+            {
+                $official_sn = $resp['remark1'] ?? '';
+                $ch_trade_no = $resp['orderid'] ?? '';
+
+                $resultno = $resp['resultno'];
+                if ($resultno === '1') {
+                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $official_sn,'ch_trade_no' => $ch_trade_no]);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($resultno === '9') {
+                    Model('refill_order')->edit($refill_info['order_id'], ['ch_trade_no' => $ch_trade_no]);
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($resultno === '5007' && (time() - $refill_info['commit_time'] > 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
+                } else {
+                    $order_state = ORDER_STATE_SEND;
+                }
+
+                return [true, $order_state, $official_sn];
+            }
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['userid'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&key={$key}";
+        $params['sign'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['resultno'] === '1') {
+                return [true, $resp['balance']];
+            } else {
+                return [false, $resp['resultno']];
+            }
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
+        $content .= "&sporderid={$params['sporderid']}&key={$key}";
+        return md5($content);
+    }
+
+    public function xmlToArray($xml)
+    {
+        $replace_str = str_replace(' ','','encoding="gb2312"');
+        $xml = mb_convert_encoding($xml,"UTF-8","gb2312");
+        $xml = str_replace($replace_str, "encoding='utf-8'", $xml);
+        return refill\util::xmlToArray($xml);
+    }
+}

+ 93 - 0
helper/refill/api/yl/menshang_fs/config.php

@@ -0,0 +1,93 @@
+<?php
+namespace refill\menshang_fs;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://123.249.40.234:9086/onlinepay.do';
+    const QUERY_URL= 'http://123.249.40.234:9086/searchpay.do';
+    const BALANCE_URL = 'http://123.249.40.234:9086/searchbalance.do';
+
+    const USER_ID= '10002650';
+    const KEY = 'reFifPhfPrNFF4Jxim5EmybMSfcHmfRx';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_menshang_fs.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ERR_NOS = [
+        '5001','5002','5003','5004','5005','5008','5009','5010','5011','5012'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+
+    const product_id = [
+        mtopcard\ChinaMobileCard => [
+            17 => [
+                30 => '3518', 50 => '3519', 100 => '3520', 200 => '35577'
+            ],//湖北
+            15 => [
+                30 => '3622', 50 => '3623', 100 => '3624', 200 => '36578'
+            ],//山东
+            20 => [
+                30 => '31560', 50 => '31561', 100 => '31562', 200 => '315621'
+            ],//广西
+            2 => [
+                30 => '31872', 50 => '31873', 100 => '31874', 200 => '318624'
+            ],//天津
+            29 => [
+                30 => '328104', 50 => '328105', 100 => '328106', 200 => '328631'
+            ],//青海
+        ],
+
+        mtopcard\ChinaUnicomCard => [
+
+        ],
+
+        mtopcard\ChinaTelecomCard => [
+            18 => [
+                30 => '274329', 50 => '274330', 100 => '274331', 200 => '274591'
+            ],//湖南
+            23 => [
+                30 => '271314', 50 => '271315', 100 => '271316', 200 => '271588'
+            ],//四川
+            15 => [
+                30 => '270309', 50 => '270310', 100 => '270311', 200 => '270587'
+            ],//山东
+            2 => [
+                30 => '282369', 50 => '282370', 100 => '282371', 200 => '282601'
+            ],//天津
+            3 => [
+                30 => '276339', 50 => '276340', 100 => '276341', 200 => '276593'
+            ],//河北
+            30 => [
+                30 => '289404', 50 => '289405', 100 => '289406', 200 => '289609'
+            ],//宁夏
+            29 => [
+                30 => '290409', 50 => '290410', 100 => '290411', 200 => '290610'
+            ],//青海
+            17 => [
+                30 => '269304', 50 => '269305', 100 => '269306', 200 => '269586'
+            ],//湖北
+        ]
+    ];
+    //key格式 卡类型-面值-regin_no
+    const Price = [
+        //移动
+        "4-30-17" => 28.56, "4-50-17" => 47.6, "4-100-17" => 95.2, "4-200-17" => 190.4,//湖北 17
+        "4-30-15" => 28.56, "4-50-15" => 47.6, "4-100-15" => 95.2, "4-200-15" => 190.4,//山东 15
+        "4-30-20" => 28.56, "4-50-20" => 47.6, "4-100-20" => 95.2, "4-200-20" => 190.4,//广西 20
+        "4-30-2" => 28.56, "4-50-2" => 47.6, "4-100-2" => 95.2, "4-200-2" => 190.4,//天津 2
+        "4-30-29" => 28.56, "4-50-29" => 47.6, "4-100-29" => 95.2, "4-200-29" => 190.4,//青海 29
+
+        //电信
+        "6-30-18" => 27.69, "6-50-18" => 46.15, "6-100-18" => 92.3, "6-200-18" => 184.6,//湖南 18
+        "6-30-23" => 27.24, "6-50-23" => 45.4, "6-100-23" => 90.8, "6-200-23" => 181.6,//四川 23
+        "6-30-15" => 27.69, "6-50-15" => 46.15, "6-100-15" => 92.3, "6-200-15" => 184.6,//山东 15
+        "6-30-2" => 27.75, "6-50-2" => 46.25, "6-100-2" => 92.5, "6-200-2" => 185,//天津 2
+        "6-30-3" => 28.26, "6-50-3" => 47.1, "6-100-3" => 94.2, "6-200-3" => 188.4,//河北 3
+        "6-30-30" => 28.26, "6-50-30" => 47.1, "6-100-30" => 94.2, "6-200-30" => 188.4,//宁夏 30
+        "6-30-29" => 27.84, "6-50-29" => 46.4, "6-100-29" => 92.8, "6-200-29" => 185.6,//青海 29
+        "6-30-17" => 28.2, "6-50-17" => 47, "6-100-17" => 94, "6-200-17" => 188,//湖北 17
+    ];
+}

+ 4 - 0
mobile/callback/refill_kachong_new.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('kachong_new',$_POST);
+echo ('ok');

+ 4 - 0
mobile/callback/refill_menshang.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('menshang',$_POST);
+echo ('OK');

+ 4 - 0
mobile/callback/refill_menshang_fs.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('menshang_fs',$_POST);
+echo ('OK');

+ 4 - 0
mobile/callback/refill_menshang_sec.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('menshang_sec',$_POST);
+echo ('OK');

+ 4 - 0
mobile/callback/refill_xingchuang_trd.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('xingchuang_trd',$_POST);
+echo ('ok');

+ 36 - 0
test/TestRefill.php

@@ -5946,6 +5946,42 @@ class TestRefill extends TestCase
         $provider = $this->getProvider('xingchuang_sec');
         $resp = $provider->balance();
     }
+
+    public function testkachong_new()
+    {
+        $provider = $this->getProvider('kachong_new');
+        $resp = $provider->balance();
+    }
+
+    public function testxingchuang_trd()
+    {
+        $provider = $this->getProvider('xingchuang_trd');
+        $resp = $provider->balance();
+        $resp = $provider->query(['order_sn' => '56641701227303096134']);
+    }
+
+    public function testmenshang_sec()
+    {
+        $provider = $this->getProvider('menshang_sec');
+        $resp = $provider->balance();
+        $resp = $provider->query(['order_sn' => '56641701227303096134']);
+    }
+
+    public function testmenshang()
+    {
+        $provider = $this->getProvider('menshang');
+        $resp = $provider->balance();
+        $resp = $provider->query(['order_sn' => '56641701227303096134']);
+    }
+
+    public function testmenshang_fs()
+    {
+        $provider = $this->getProvider('menshang_fs');
+        $resp = $provider->balance();
+//        $resp = $provider->add(15811535608, 6, 30, ['order_sn' => $this->make_sn(), 'regin_no' => 3]);
+        $resp = $provider->query(['order_sn' => '56641701227303096134']);
+    }
+
 }