Sfoglia il codice sorgente

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

xiaoyu 3 anni fa
parent
commit
c7b93e276b

+ 1 - 1
admin/templates/default/third.product.add.php

@@ -5,7 +5,7 @@
         <div class="item-title">
             <h3>增值业务管理</h3>
             <ul class="tab-base">
-                <li><a href="index.php?act=refill_third&op=index"><span><?php echo $lang['nc_manage'] ?></span></a></li>
+                <li><a href="index.php?act=refill_third&op=index"><span>增值产品列表</span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_new'] ?>产品</span></a></li>
             </ul>
         </div>

+ 1 - 1
admin/templates/default/third.product.edit.php

@@ -5,7 +5,7 @@
         <div class="item-title">
             <h3>增值业务管理</h3>
             <ul class="tab-base">
-                <li><a href="index.php?act=refill_third&op=index"><span><?php echo $lang['nc_manage'] ?></span></a></li>
+                <li><a href="index.php?act=refill_third&op=index"><span>增值产品列表</span></a></li>
                 <li><a href="JavaScript:void(0);" class="current"><span><?php echo $lang['nc_update'] ?></span></a></li>
             </ul>
         </div>

+ 99 - 41
data/config/xyz/refill.ini.php

@@ -961,24 +961,24 @@ $yunsuoyao_phone = ['name' => 'yunsuoyao', 'store_id' => 55, 'qualitys' => '1',
 //            ['goods_id' => 6572, 'price' => 19.06, 'quality' => 1, 'card_type' => 'chinatelecom']
 //        ],
         30 => [
-            ['goods_id' => 6573, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6573, 'price' => 28.86, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6573, 'price' => 28.53, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6573, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6573, 'price' => 28.56, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 6574, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6574, 'price' => 48.1, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6574, 'price' => 47.55, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6574, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6574, 'price' => 47.6, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 6575, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6575, 'price' => 96.2, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6575, 'price' => 95.1, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6575, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6575, 'price' => 95.2, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 6576, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6576, 'price' => 192.4, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 6576, 'price' => 190.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 6576, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 6576, 'price' => 190.4, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
 
         300 => [
@@ -1901,10 +1901,22 @@ $lechong_phone = ['name' => 'lechong', 'store_id' => 99, 'qualitys' => '1',
     'amount' => [
         10 => [['goods_id' => 6885, 'price' => 9.56, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         20 => [['goods_id' => 6886, 'price' => 19.12, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        30 => [['goods_id' => 6887, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        50 => [['goods_id' => 6888, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        100 => [['goods_id' => 6889, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
-        200 => [['goods_id' => 6890, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [
+            ['goods_id' => 6887, 'price' => 28.92, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6887, 'price' => 28.68, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6888, 'price' => 48.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6888, 'price' => 47.8, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6889, 'price' => 96.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6889, 'price' => 95.6, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6890, 'price' => 192.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6890, 'price' => 191.2, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
         300 => [['goods_id' => 6891, 'price' => 286.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
         500 => [['goods_id' => 6892, 'price' => 478, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
     ],
@@ -2274,22 +2286,22 @@ $yilin_phone = ['name' => 'yilin', 'store_id' => 115, 'qualitys' => '1',
         ],
         30 => [
             ['goods_id' => 7005, 'price' => 28.92, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7005, 'price' => 28.95, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7005, 'price' => 28.77, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7005, 'price' => 28.83, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
             ['goods_id' => 7006, 'price' => 48.2, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7006, 'price' => 48.25, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7006, 'price' => 47.95, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7006, 'price' => 48.05, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
             ['goods_id' => 7007, 'price' => 96.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7007, 'price' => 96.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7007, 'price' => 95.9, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7007, 'price' => 96.1, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 7008, 'price' => 192.8, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7008, 'price' => 193, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7008, 'price' => 191.8, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7008, 'price' => 192.2, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         300 => [
@@ -2505,7 +2517,7 @@ $guochuang_nation_phone = ['name' => 'guochuang_nation', 'store_id' => 121, 'qua
 
         10 => [
             ['goods_id' => 7060, 'price' => 10.31, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7060, 'price' => 10.05, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7060, 'price' => 10.04, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7060, 'price' => 10.26, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         20 => [
@@ -2741,12 +2753,12 @@ $yuanta_phone = ['name' => 'yuanta', 'store_id' => 128, 'qualitys' => '5',
 //        ],
         100 => [
 //            ['goods_id' => 7120, 'price' => 91.8, 'quality' => 5, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7120, 'price' => 92, 'quality' => 5, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7120, 'price' => 91, 'quality' => 5, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7120, 'price' => 95.6, 'quality' => 5, 'card_type' => 'chinatelecom']
         ],
         200 => [
 //            ['goods_id' => 7121, 'price' => 183.6, 'quality' => 5, 'card_type' => 'chinamobile'],
-            ['goods_id' => 7121, 'price' => 184, 'quality' => 5, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7121, 'price' => 182, 'quality' => 5, 'card_type' => 'chinaunicom'],
 //            ['goods_id' => 7121, 'price' => 191.2, 'quality' => 5, 'card_type' => 'chinatelecom']
         ]
 //        300 => [
@@ -3129,24 +3141,24 @@ $feimingyu_phone = ['name' => 'feimingyu', 'store_id' => 147, 'qualitys' => '1',
 //            ['goods_id' => 7260, 'price' => 19, 'quality' => 1, 'card_type' => 'chinatelecom']
 //        ],
         30 => [
-            ['goods_id' => 7261, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7261, 'price' => 28.89, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7261, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7261, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7261, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 7262, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7262, 'price' => 48.15, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7262, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7262, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 7262, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         100 => [
-            ['goods_id' => 7263, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7263, 'price' => 96.3, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7263, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7263, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7263, 'price' => 95, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 7264, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7264, 'price' => 192.6, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7264, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7264, 'price' => 191, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7264, 'price' => 190, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
 //        300 => [
 //            ['goods_id' => 7265, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinamobile'],
@@ -3871,22 +3883,22 @@ $ruixunda_phone = ['name' => 'ruixunda', 'store_id' => 169, 'qualitys' => '1',
         30 => [
             ['goods_id' => 7441, 'price' => 28.65, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7441, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7441, 'price' => 28.62, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7441, 'price' => 28.56, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
             ['goods_id' => 7442, 'price' => 47.75, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7442, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7442, 'price' => 47.7, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7442, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
             ['goods_id' => 7443, 'price' => 95.5, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7443, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7443, 'price' => 95.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7443, 'price' => 95, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 7444, 'price' => 191, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7444, 'price' => 189, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7444, 'price' => 190.8, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7444, 'price' => 190, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         300 => [
             ['goods_id' => 7445, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinamobile'],
@@ -4005,22 +4017,22 @@ $cangxin_phone = ['name' => 'cangxin', 'store_id' => 174, 'qualitys' => '1',
         30 => [
             ['goods_id' => 7474, 'price' => 28.77, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7474, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7474, 'price' => 28.59, 'quality' => 1, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 7474, 'price' => 28.41, 'quality' => 1, 'card_type' => 'chinatelecom'],
         ],
         50 => [
             ['goods_id' => 7475, 'price' => 47.95, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7475, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7475, 'price' => 47.65, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7475, 'price' => 47.35, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
             ['goods_id' => 7476, 'price' => 95.9, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7476, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7476, 'price' => 95.3, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7476, 'price' => 94.7, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 7477, 'price' => 191.8, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7477, 'price' => 189, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 7477, 'price' => 190.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+            ['goods_id' => 7477, 'price' => 189.4, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
 //        300 => [['goods_id' => 7478, 'price' => 286.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
 //        500 => [['goods_id' => 7479, 'price' => 477.5, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
@@ -4294,32 +4306,32 @@ $huoshenguo_high_phone = ['name' => 'huoshenguo_high', 'store_id' => 181,'qualit
 //            ['goods_id' => 7529, 'price' => 19.26, 'quality' => 1, 'card_type' => 'chinatelecom']
 //        ],
         30 => [
-            ['goods_id' => 7530, 'price' => 28.89, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7530, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7530, 'price' => 28.26, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7530, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 7531, 'price' => 48.15, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7531, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7531, 'price' => 47.1, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7531, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 7532, 'price' => 96.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7532, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7532, 'price' => 94.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7532, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 7533, 'price' => 192.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7533, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7533, 'price' => 188.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7533, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         300 => [
-            ['goods_id' => 7534, 'price' => 288.9, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7534, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7534, 'price' => 282.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7534, 'price' => 287.1, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         500 => [
-            ['goods_id' => 7535, 'price' => 481.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7535, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile'],
             ['goods_id' => 7535, 'price' => 471, 'quality' => 1, 'card_type' => 'chinaunicom'],
             ['goods_id' => 7535, 'price' => 478.5, 'quality' => 1, 'card_type' => 'chinatelecom']
         ]
@@ -4582,6 +4594,51 @@ $ruierxun_phone = ['name' => 'ruierxun', 'store_id' => 189,'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$ningying_phone = ['name' => 'ningying', 'store_id' => 190,'qualitys' => '1',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 7609, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7609, 'price' => 9.58, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7609, 'price' => 9.67, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 7610, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 7610, 'price' => 19.16, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7610, 'price' => 19.34, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+        30 => [
+            ['goods_id' => 7611, 'price' => 28.89, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7611, 'price' => 28.29, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7611, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 7612, 'price' => 48.15, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7612, 'price' => 47.15, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7612, 'price' => 47.85, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 7613, 'price' => 96.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7613, 'price' => 94.3, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7613, 'price' => 95.7, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 7614, 'price' => 192.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7614, 'price' => 188.6, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7614, 'price' => 191.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 7615, 'price' => 288.9, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7615, 'price' => 282.9, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7615, 'price' => 287.1, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 7616, 'price' => 481.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7616, 'price' => 471.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 7616, 'price' => 478.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -4734,6 +4791,7 @@ $phone_providers = [
     ['name' => 'ruixunda_lt', 'cfg' => $ruixunda_lt_phone],
     ['name' => 'ruizhi', 'cfg' => $ruizhi_phone],
     ['name' => 'ruierxun', 'cfg' => $ruierxun_phone],
+    ['name' => 'ningying', 'cfg' => $ningying_phone],
 
 ];
 $config['phone_providers'] = $phone_providers;

+ 1 - 1
helper/refill/IRefill.php

@@ -135,7 +135,7 @@ abstract class IRefill
         $key = "{$amount}-{$card_type}";
         if(array_key_exists($key,$maps)) {
             $params = $maps[$key];
-            return [$params['goods_id'], round($params['price'],2)];
+            return [$params['goods_id'], round($params['price'],4)];
         }
         else {
             return [0,0];

BIN
helper/refill/api/xyz/guochuang/20220223黑龙江移动调价函.png


BIN
helper/refill/api/xyz/guochuang/20220224辽宁移动调价.png


+ 2 - 2
helper/refill/api/xyz/guochuang/config.php

@@ -64,9 +64,9 @@ class config
     const Price = [
         //移动
         "4-10-2" => 9.99, "4-20-2" => 19.98, "4-30-2" => 29.895, "4-50-2" => 49.825, "4-100-2" => 99.65, "4-200-2" => 199.3, "4-300-2" => 298.95, "4-500-2" => 498.25,//天津 2
-        "4-10-6" => 9.75, "4-20-6" => 19.5, "4-30-6" => 29.25, "4-50-6" => 48.75, "4-100-6" => 97.5, "4-200-6" => 195, "4-300-6" => 292.5, "4-500-6" => 487.5,//辽宁 6
+        "4-10-6" => 9.745, "4-20-6" => 19.49, "4-30-6" => 29.235, "4-50-6" => 48.725, "4-100-6" => 97.45, "4-200-6" => 194.9, "4-300-6" => 292.35, "4-500-6" => 487.25,//辽宁 6
         "4-10-9" => 9.94, "4-20-9" => 19.88, "4-30-9" => 29.82, "4-50-9" => 49.7, "4-100-9" => 99.4,//上海 9
-        "4-10-8" => 9.96, "4-20-8" => 19.92, "4-30-8" => 29.88, "4-50-8" => 49.8, "4-100-8" => 99.6, "4-200-8" => 199.2, "4-300-8" => 298.8, "4-500-8" => 498 ,//黑龙江 8
+        "4-10-8" => 9.95, "4-20-8" => 19.9, "4-30-8" => 29.85, "4-50-8" => 49.75, "4-100-8" => 99.5, "4-200-8" => 199, "4-300-8" => 298.5, "4-500-8" => 497.5 ,//黑龙江 8
         "4-10-29" => 9.82, "4-20-29" => 19.64, "4-30-29" => 29.46, "4-50-29" => 49.1, "4-100-29" => 98.2, "4-200-29" => 196.4, "4-300-29" => 294.6, "4-500-29" => 491,//青海 29
         "4-10-28" => 9.985, "4-20-28" => 19.97, "4-30-28" => 29.955, "4-50-28" => 49.925, "4-100-28" => 99.85, "4-200-28" => 199.7, "4-300-28" => 299.55, "4-500-28" => 499.25,//甘肃 28
         "4-10-13" => 10.22, "4-20-13" => 19.94, "4-30-13" => 29.91, "4-50-13" => 49.85, "4-100-13" => 99.7, "4-200-13" => 199.4, "4-300-13" => 300.9, "4-500-13" => 501.5,//福建 13

+ 4 - 6
helper/refill/api/xyz/huoshenguo_high/config.php

@@ -29,12 +29,10 @@ class config
             200 => 100037,
         ],
         mtopcard\ChinaTelecomCard => [
-            30  => 100012,
-            50  => 100010,
-            100 => 100011,
-            200 => 100017,
-            300 => 100048,
-            500 => 100049,
+            30  => 100090,
+            50  => 100091,
+            100 => 100092,
+            200 => 100093,
         ],
     ];
     const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];

+ 7 - 1
helper/refill/api/xyz/huoshenguo_high/开户信息.txt

@@ -43,4 +43,10 @@ appSecret:PfeOsZRoMsAcmweP
 100034	快充联通30
 100035	快充联通50
 100036	快充联通100
-100037	快充联通200
+100037	快充联通200
+
+2022.2.25更改电信编码
+100090 WX电信30
+100091 WX电信50
+100092  WX电信100
+100093  WX电信200

+ 67 - 0
helper/refill/api/xyz/ningying/RefillCallBack.php

@@ -0,0 +1,67 @@
+<?php
+namespace refill\ningying;
+
+require_once(BASE_HELPER_RAPI_PATH . '/ningying/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $input = $params;
+        unset($input['sign']);
+        $sign = $this->sign($input);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $params['appSecret'] = config::APP_SECRET;
+        ksort($params);
+        $content = '';
+        foreach ($params as $key => $value) {
+            if($this->check_empty($value) === false) {
+                $content .= "{$key}={$value}&";
+            }
+        }
+        $content = rtrim($content, '&');
+        return md5($content);
+    }
+
+    private function check_empty($value)
+    {
+        if (!isset($value))
+            return true;
+        if ($value === null)
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    public function notify($params)
+    {
+        $status = intval($params['orderStatus']);
+        $order_sn = $params['outOrderId'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+
+        $order_id = $order_info['order_id'];
+        if ($status === 2) {
+            $data['official_sn'] = strtolower($params['ext1']) == 'null' ? '' : $params['ext1'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true];
+        } elseif ($status === 3) {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

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

@@ -0,0 +1,155 @@
+<?php
+
+namespace refill\ningying;
+
+require_once(BASE_HELPER_RAPI_PATH . '/ningying/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['appId'] = config::APP_ID;
+        $params['outOrderId'] = $order_sn;
+        $params['uuid'] = $phone;
+        $params['itemId'] = config::PRODUCT[$card_type][$amount];
+        $params['itemFace'] = $amount;
+        $params['callbackUrl'] = config::NOTIFY_URL;
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
+        return $params;
+    }
+
+    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);
+        if(empty($params['itemId'])) {
+            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 = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($resp['code'] === '00') {
+                return [true, $resp['orderId'], false];
+            } elseif (in_array($resp['code'], config::ERRCODES, true)) {
+                return [false, $resp['msg'], false];
+            } elseif (in_array($resp['code'], ['-22', '-23', '-99'], true)) {
+                $net_errno = "HTTP-{$resp['code']}";
+                return [false, $resp['msg'], true];
+            } else {
+                $net_errno = "HTTP-998";
+                return [false, $resp['msg'], true];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['appId'] = config::APP_ID;
+        $params['outOrderId'] = $refill_info['order_sn'];
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+            elseif ($resp['code'] === '00')
+            {
+                $status = $resp['orderStatus'];
+                if ($status === '2') {
+                    $updata['official_sn'] = $resp['ext1'];
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($status === '3') {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($status === '1') {
+                    $order_state = ORDER_STATE_SEND;
+                } elseif ($status === '4' && (time() - $refill_info['commit_time'] >= 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
+                } else {
+                    return [false, $resp['msg']];
+                }
+                return [true, $order_state];
+            }
+            else
+            {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    public function balance()
+    {
+        $params['appId'] = config::APP_ID;
+        $params['timestamp'] = date("YmdHis").$this->get_millisecond();
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['code'] === '00') {
+                return [true, $resp['balance']];
+            } else {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    /**
+     * 获取毫秒级别的时间戳
+     */
+    private function get_millisecond()
+    {
+        list($usec, $sec) = explode(" ", microtime());
+        return round($usec*1000);
+    }
+
+    private function sign($params)
+    {
+        $params['appSecret'] = config::APP_SECRET;
+        ksort($params);
+        $content = '';
+        foreach ($params as $key => $value) {
+            if($this->check_empty($value) === false) {
+                $content .= "{$key}={$value}&";
+            }
+        }
+        $content = rtrim($content, '&');
+        return md5($content);
+    }
+}

+ 44 - 0
helper/refill/api/xyz/ningying/config.php

@@ -0,0 +1,44 @@
+<?php
+
+
+namespace refill\ningying;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.97.218.21:8911/api/hf/order/submit';
+    const QUERY_URL = 'http://47.97.218.21:8911/api/order/query';
+    const BALANCE_URL = 'http://47.97.218.21:8911/api/account/balance';
+
+    const APP_ID = 'O8y6eOzWY1';
+    const APP_SECRET = 'qkTxoSgYBBXZDjYy';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_ningying.php";
+    const PRODUCT = [
+        mtopcard\ChinaMobileCard => [
+            30  => 100001,
+            50  => 100002,
+            100 => 100003,
+            200 => 100004,
+            300 => 100005,
+            500 => 100006
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30  => 100007,
+            50  => 100008,
+            100 => 100009,
+            200 => 100010,
+            300 => 100011,
+            500 => 100012
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30  => 100013,
+            50  => 100014,
+            100 => 100015,
+            200 => 100016,
+            300 => 100017,
+            500 => 100018
+        ],
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+    const ERRCODES = ['-10', '-12', '-13', '-14', '-15', '-16', '-18', '-21'];
+}

+ 40 - 0
helper/refill/api/xyz/ningying/开户信息.txt

@@ -0,0 +1,40 @@
+后台地址:http://47.97.218.21:8888
+帐号:椰子
+密码:398381
+二级密码:RovB4678
+appId:O8y6eOzWY1
+appSecret:qkTxoSgYBBXZDjYy
+后台-商品列表,可查看已配置商品信息
+后台-安全中心,可配置IP白名单
+接口文档:https://www.showdoc.com.cn/1686453783298366/7925312871840290
+话费直充接口:http://47.97.218.21:8911/api/hf/order/submit
+通用直充接口:http://47.97.218.21:8911/api/order/submit
+卡密提取接口:http://47.97.218.21:8911/api/card/get
+查单接口接口:http://47.97.218.21:8911/api/order/query
+余额接口接口:http://47.97.218.21:8911/api/account/balance
+
+
+
+
+100001 全国移动30
+100002 全国移动50
+100003 全国移动100
+100004 全国移动200
+100005 全国移动300
+100006 全国移动500
+
+
+100007 全国联通30
+100008 全国联通50
+100009 全国联通100
+100010 全国联通200
+100011 全国联通300
+100012 全国联通500
+
+
+100013 全国电信30
+100014 全国电信50
+100015 全国电信100
+100016 全国电信200
+100017 全国电信300
+100018 全国电信500

+ 329 - 0
helper/refill/ops/order_clear.php

@@ -0,0 +1,329 @@
+<?php
+
+namespace refill;
+use Log;
+use trans_wapper;
+use Exception;
+
+class order_clear
+{
+    public function clear($start_date, $end_date, $start_line = 0)
+    {
+        $mchorder_gen = function ($start)
+        {
+            $end = $start + 3600;
+            $cond = ['order_time&order_time' => ['_multi' => true, ['egt', $start], ['lt', $end]], 'inner_status' => 0];
+
+            $i = 0;
+            while (true)
+            {
+                $start = $i * 1000;
+                $items = Model()->table('refill_order')
+                    ->field('mchid,mch_order,order_time')
+                    ->where($cond)
+                    ->order('order_time desc')->limit("{$start},1000")->select();
+                $i++;
+
+                if(empty($items)) break;
+                foreach ($items as $item) {
+                    yield $item;
+                }
+            }
+        };
+
+        $mchorder_saver = function ($start,$file) use ($mchorder_gen)
+        {
+            if (file_exists($file)) {
+                return true;
+            }
+
+            $fp = fopen($file,'w');
+            if($fp === false) {
+                Log::record("Cannot open file {$file} with write.",Log::ERR);
+                return false;
+            }
+
+            $end = $start + 86400;
+            for ($hour = $start; $hour < $end; $hour += 3600)
+            {
+                $orders = $mchorder_gen($hour);
+                foreach ($orders as $order)
+                {
+                    $ret = fputcsv($fp,$order);
+                    if($ret === false) {
+                        return false;
+                    }
+                }
+            }
+            fclose($fp);
+
+            return true;
+        };
+
+        $handle_days = function ($start_date, $end_date,$line = 0) use ($mchorder_saver)
+        {
+            for ($date = $start_date; $date < $end_date; $date += 86400)
+            {
+                $sdate = date('Y-m-d',$date);
+
+                $morder_file = BASE_DATA_PATH . "/log/order/{$sdate}-morder.csv";
+                $check_file  = BASE_DATA_PATH . "/log/order/{$sdate}-check.csv";
+                $refill_file = BASE_DATA_PATH . "/log/order/{$sdate}-refill.csv";
+                $vr_file     = BASE_DATA_PATH . "/log/order/{$sdate}-vr.csv";
+
+                $ret = $mchorder_saver($date,$morder_file);
+                if($ret === false) {
+                    Log::record("fetch or save {$sdate} mch_order fail.",Log::ERR);
+                    break;
+                }
+
+                $this->order_delete($morder_file,$check_file,$refill_file,$vr_file,$line);
+            }
+        };
+
+        $handle_days($start_date, $end_date,$start_line);
+    }
+
+    private function order_delete($mch_file, $check_file, $refill_file, $vr_file, $line)
+    {
+        $rorder_getter = function ($mchid,$mch_order,$mod_refill)
+        {
+            $result = [];
+            $i = 0;
+            while(true)
+            {
+                $start = $i * 1000;
+                $ritems = $mod_refill->table('refill_order')->field('*')
+                    ->where(['mchid' => $mchid, 'mch_order' => $mch_order])
+                    ->order('order_id desc')
+                    ->limit("{$start},1000")->master(true)->select();
+                $i++;
+
+                $result = array_merge($ritems,$result);
+                if(count($ritems) < 1000) {
+                    break;
+                }
+            }
+
+            return $result;
+        };
+
+        $vorder_getter = function ($order_ids,$mod_vr)
+        {
+            $result = [];
+            $i = 0;
+            while(true)
+            {
+                $start = $i * 1000;
+
+                $vitems = $mod_vr->table('vr_order')->field('*')
+                    ->where(['order_id' => ['in', $order_ids]])
+                    ->order('order_id asc')
+                    ->limit("{$start},1000")->master(true)->select();
+                $i++;
+
+                $result = array_merge($vitems,$result);
+                if(count($vitems) < 1000) {
+                    break;
+                }
+            }
+
+            return $result;
+        };
+
+        $order_checker = function ($mchid,$mch_order,$frefill,$fvr) use($rorder_getter,$vorder_getter)
+        {
+            $mod_refill = Model('refill_order');
+            $ritems = $rorder_getter($mchid,$mch_order,$mod_refill);
+
+            if(empty($ritems)) {
+                return [false, [], 'order count = 0'];
+            }
+
+            $oids = [];
+            $inner_state = [0 => 0 ,1 => 0];
+            $is_retrying = 0;
+            $mch_notify_counts = 0;
+            foreach ($ritems as $item)
+            {
+                $oids[] = $item['order_id'];
+                $state = intval($item['inner_status']);
+                $inner_state[$state] += 1;
+                $mch_notify_counts   += intval($item['mch_notify_state']);
+
+                if($state === 0 && $is_retrying === 0) {
+                    $is_retrying = intval($item['is_retrying']);
+                }
+            }
+
+            //检查inner_status=0唯一性。
+            if($inner_state[0] != 1) {
+                return [false, [], "inner_status=0 counts={$inner_state[0]}"];
+            }
+
+            if($mch_notify_counts === 0) {
+                return [false, [], "not notify merchant"];
+            }
+            elseif($mch_notify_counts > 1) {
+                return [false, [], "more than one order notify merchant"];
+            }
+
+            if($is_retrying) {
+                return [false, [], 'is_retrying = 1'];
+            }
+
+            $mod_vr = Model('vr_order');
+            $vitems = $vorder_getter($oids,$mod_vr);
+
+            //检查refill 表记录和vr_order表记录是否一致
+            if(count($ritems) !== count($vitems)) {
+                return [false, [], 'refill count != vr count'];
+            }
+
+            $order_state = [];
+            foreach ($vitems as $item)
+            {
+                $state = intval($item['order_state']);
+                if(!array_key_exists($state,$order_state)) {
+                    $order_state[$state] = 0;
+                }
+
+                $order_state[$state] += 1;
+            }
+
+            //检查一种订单只能有,成功或者失败状态.
+            $vcount = count($vitems);
+            if($vcount != $order_state[ORDER_STATE_SUCCESS] + $order_state[ORDER_STATE_CANCEL]) {
+                return [false, [], 'ORDER: SUCCESS + CANCEL != COUNT.'];
+            }
+            elseif($order_state[ORDER_STATE_SUCCESS] > 1) {
+                //成功订单只能小于等于1,否则为错误
+                return [false, [], 'ORDER:SUCCESS COUNT > 1'];
+            }
+            else
+            {
+                foreach ($ritems as $item) {
+                    fputcsv($frefill,$item);
+                }
+                foreach ($vitems as $item) {
+                    fputcsv($fvr,$item);
+                }
+            }
+
+            $inner_oids = [];
+            foreach ($ritems as $item)
+            {
+                $status = intval($item['inner_status']);
+                if($status === 1) {
+                    $inner_oids[] = $item['order_id'];
+                }
+            }
+
+            return [true,$inner_oids,''];
+        };
+
+        $delter = function ($order_ids,$order_time)
+        {
+            if(empty($order_ids)) return;
+
+            try {
+                $mod_refill = Model('refill_order');
+                $mod_vr = Model('vr_order');
+
+                $trans = new trans_wapper($mod_refill, __METHOD__);
+                $mod_refill->table('refill_order')->where(['order_id' => ['in',$order_ids],'order_time' => $order_time])->delete();
+                $mod_vr->table('vr_order')->where(['order_id' => ['in',$order_ids]])->delete();
+                $trans->commit();
+            } catch (Exception $e) {
+                $trans->rollback();
+            }
+        };
+
+        $file_opener = function ($mch_file, $check_file, $refill_file, $vr_file)
+        {
+            $fp = fopen($mch_file,'r');
+            $fcheck = fopen($check_file,'a+');
+            $frefill = fopen($refill_file,'a+');
+            $fvr = fopen($vr_file,'a+');
+
+            if($fp === false || $fcheck === false || $frefill === false || $fvr === false)
+            {
+                if($fp !== false) {
+                    fclose($fp);
+                }
+                if($fcheck !== false) {
+                    fclose($fcheck);
+                }
+                if($frefill !== false) {
+                    fclose($frefill);
+                }
+                if($fvr !== false) {
+                    fclose($fvr);
+                }
+
+                return [false,false,false,false,false];
+            }
+            else {
+                return [true,$fp,$fcheck,$frefill,$fvr];
+            }
+        };
+
+        $file_closer = function($files)
+        {
+            foreach ($files as $fp) {
+                fclose($fp);
+            }
+        };
+
+        $goto_line = function ($fp,$line)
+        {
+            $index = 0;
+            while(!feof($fp) && $index < $line) {
+                $items = fgetcsv($fp);
+                $index += 1;
+            }
+        };
+
+        $mch_order_reader = function($fp)
+        {
+            while(!feof($fp))
+            {
+                [$mchid, $mch_order, $order_time] = fgetcsv($fp);
+
+                if(empty($mchid) || empty($mch_order)) continue;
+                yield [$mchid,$mch_order,$order_time];
+            }
+        };
+
+        $mod_refill_err = Model('refill_error');
+        $err_recorder = function($fcheck,$mchid,$mch_order,$order_time,$err) use($mod_refill_err)
+        {
+            fputcsv($fcheck,[$mchid,$mch_order,$err]);
+            $mod_refill_err->insert(['mchid' => $mchid, 'mch_order' => $mch_order, 'order_time' => $order_time, 'msg' => $err, 'add_time' => time()]);
+        };
+
+        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+        [$succ,$fp,$fcheck,$frefill,$fvr] = $file_opener($mch_file, $check_file, $refill_file, $vr_file);
+        if(!$succ) {
+            return false;
+        }
+
+        $goto_line($fp,$line);
+
+        $mch_orders = $mch_order_reader($fp);
+        foreach ($mch_orders as $order)
+        {
+            [$mchid, $mch_order, $order_time] = $order;
+            [$succ, $order_ids, $err] = $order_checker($mchid, $mch_order, $frefill, $fvr);
+            if ($succ) {
+                $delter($order_ids, $order_time);
+            } else {
+                $err_recorder($fcheck, $mchid, $mch_order, $order_time, $err);
+            }
+        }
+
+        $file_closer([$fp,$fcheck,$frefill,$fvr]);
+
+        return true;
+    }
+}

+ 11 - 0
helper/refill/ops/pdlog_clear.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace refill;
+use Log;
+use trans_wapper;
+use Exception;
+
+class pdlog_clear
+{
+
+}

+ 4 - 0
mobile/callback/refill_ningying.php

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

+ 28 - 0
test/TestLanguage.php

@@ -0,0 +1,28 @@
+<?php
+
+
+use PHPUnit\Framework\TestCase;
+
+class TestLanguage extends TestCase
+{
+    public function testYield()
+    {
+        $checker = function ($val) {
+          return $val > 5 ? true : false;
+        };
+
+        $map_adder = function ($datas,$delta)
+        {
+            foreach ($datas as $val) {
+                $k = yield $val + $delta;
+            }
+        };
+
+        $datas = [1,2,3,4,5,6];
+        $x = $map_adder($datas,2);
+
+        foreach ($x as $v) {
+            $t = $checker($v);
+        }
+    }
+}

+ 14 - 0
test/TestRefill.php

@@ -1806,6 +1806,20 @@ class TestRefill extends TestCase
         $resp = $provider->notify($params);
     }
 
+    public function testNingying()
+    {
+//        $provider = $this->getProvider('ningying');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(13699279618, 4, 30, ['order_sn' => $this->make_sn()]);
+//        $resp = $provider->query(['order_sn' => '59481645434420716297']);
+
+        $body = '{"orderId":"220221170704698128","appId":"O8y6eOzWY1","outOrderId":"59481645434420716297","sign":"7476bd7d6cb51a5b25a183145d4a0ada","orderStatus":"3","completeTime":"20220221171148","orderDesc":"\u8ba2\u5355\u5931\u8d25"}';
+        $params = json_decode($body, true);
+        $provider = $this->getProvider('ningying','RefillCallBack');
+        $ret = $provider->verify($params);
+        $resp = $provider->notify($params);
+    }
+
     public function testAmingjd()
     {
 //        $provider = new refill\amingjd\RefillPhone([]);

+ 20 - 321
test/TestRefillClear.php

@@ -10,6 +10,8 @@ require_once(BASE_ROOT_PATH . '/global.php');
 require_once(BASE_CORE_PATH . '/lrlz.php');
 require_once(BASE_ROOT_PATH . '/fooder.php');
 
+require_once(BASE_HELPER_PATH . '/refill/ops/order_clear.php');
+
 class TestRefillClear extends TestCase
 {
     public static function setUpBeforeClass(): void
@@ -17,13 +19,23 @@ class TestRefillClear extends TestCase
         Base::run_util();
     }
 
+    public function testOrderClear()
+    {
+        $start_date = strtotime('2021-09-11');
+        $end_date   = strtotime('2021-09-13');
+
+        $clear = new refill\order_clear();
+        $clear->clear($start_date,$end_date);
+    }
+
     //docker-compose run phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillClear::testClearFirstDay)( .*)?$/" --test-suffix TestRefillClear.php /var/www/html/test
     public function testClearFirstDay()
     {
         $start_date = strtotime($this->earlist_orderday());
         $end_date   = $start_date + 86400;
 
-        $this->clear($start_date,$end_date);
+        $clear = new refill\order_clear();
+        $clear->clear($start_date,$end_date);
     }
     //2021年,8、9、10、11
 
@@ -32,331 +44,18 @@ class TestRefillClear extends TestCase
     {
         $start_date = strtotime('2021-12-20');
         $end_date   = strtotime('2022-12-28');
-        $this->clear($start_date,$end_date);
+
+        $clear = new refill\order_clear();
+        $clear->clear($start_date,$end_date);
     }
 
     //docker-compose run -d phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillClear::test202202)( .*)?$/" --test-suffix TestRefillClear.php /var/www/html/test
     public function test202202()
     {
-        $start_date = strtotime('2022-02-18');
-        $end_date   = strtotime('2022-02-20');
-        $this->clear($start_date,$end_date);
-    }
-
-    public function testAllRecords()
-    {
-        $rorder_getter = function ($mchid,$mch_order,$mod_refill)
-        {
-            $result = [];
-            $i = 0;
-            while(true)
-            {
-                $start = $i * 1000;
-                $ritems = $mod_refill->table('refill_order')->field('*')
-                    ->where(['mchid' => $mchid, 'mch_order' => $mch_order])
-                    ->order('order_id desc')
-                    ->limit("{$start},1000")->master(true)->select();
-                $i++;
-
-                $result = array_merge($ritems,$result);
-                if(count($ritems) < 1000) {
-                    break;
-                }
-            }
-
-            return $result;
-        };
-
-        $vorder_getter = function ($order_ids,$mod_vr)
-        {
-            $result = [];
-            $i = 0;
-            while(true)
-            {
-                $start = $i * 1000;
-
-                $vitems = $mod_vr->table('vr_order')->field('*')
-                    ->where(['order_id' => ['in', $order_ids]])
-                    ->order('order_id asc')
-                    ->limit("{$start},1000")->master(true)->select();
-                $i++;
-
-                $result = array_merge($vitems,$result);
-                if(count($vitems) < 1000) {
-                    break;
-                }
-            }
-
-            return $result;
-        };
-
-        $mod_refill = Model('refill_order');
-        $ritems = $rorder_getter(10234,'2021120700113026892979',$mod_refill);
-        $oids = [];
-        foreach ($ritems as $item) {
-            $oids[] = $item['order_id'];
-        }
-
-        $mod_vr = Model('vr_order');
-        $vitems = $vorder_getter($oids,$mod_vr);
-
-        $ret = count($vitems) == count($ritems);
-    }
-
-    private function clear($start_date, $end_date,$line = 0)
-    {
-        $order_finder = function ($start,$fp)
-        {
-            $end = $start + 3600;
-            $cond = ['order_time&order_time' => ['_multi' => true, ['egt', $start], ['lt', $end]],
-                     'inner_status' => 0];
-
-            $i = 0;
-            while (true)
-            {
-                $start = $i * 1000;
-                $items = Model()->table('refill_order')
-                    ->field('mchid,mch_order,order_time')
-                    ->where($cond)
-                    ->order('order_time desc')->limit("{$start},1000")->select();
-                $i++;
-
-                if(empty($items)) break;
-                foreach ($items as $item) {
-                    fputcsv($fp,$item);
-                }
-            }
-        };
-
-        $order_saver = function ($start,$file) use ($order_finder)
-        {
-            if(file_exists($file)) {
-                return $file;
-            }
-
-            $fp = fopen($file,'w+');
-            if($fp === false) {
-                Log::record("Cannot open file {$file}.",Log::ERR);
-                return false;
-            }
-
-            $end = $start + 86400;
-            for ($hour = $start; $hour < $end; $hour += 3600) {
-                $order_finder($hour,$fp);
-            }
-            fclose($fp);
-
-            return $file;
-        };
-
-        $handle_days = function ($start_date, $end_date,$line = 0) use ($order_saver)
-        {
-            for ($date = $start_date; $date < $end_date; $date += 86400)
-            {
-                $sdate = date('Y-m-d',$date);
-
-                $morder_file = BASE_DATA_PATH . "/log/order/{$sdate}-morder.csv";
-                $check_file  = BASE_DATA_PATH . "/log/order/{$sdate}-check.csv";
-                $refill_file  = BASE_DATA_PATH . "/log/order/{$sdate}-refill.csv";
-                $vr_file  = BASE_DATA_PATH . "/log/order/{$sdate}-vr.csv";
-
-                $file = $order_saver($date,$morder_file);
-                if($file === false) {
-                    Log::record("order_saver cannot open morder file.",Log::ERR);
-                    break;
-                }
-
-                $this->order_delete($file,$check_file,$refill_file,$vr_file,$line);
-            }
-        };
-
-        $handle_days($start_date, $end_date,$line);
-    }
-
-    private function order_delete($file,$check_file,$refill_file,$vr_file,$line)
-    {
-        $rorder_getter = function ($mchid,$mch_order,$mod_refill)
-        {
-            $result = [];
-            $i = 0;
-            while(true)
-            {
-                $start = $i * 1000;
-                $ritems = $mod_refill->table('refill_order')->field('*')
-                    ->where(['mchid' => $mchid, 'mch_order' => $mch_order])
-                    ->order('order_id desc')
-                    ->limit("{$start},1000")->master(true)->select();
-                $i++;
-
-                $result = array_merge($ritems,$result);
-                if(count($ritems) < 1000) {
-                    break;
-                }
-            }
-
-            return $result;
-        };
-
-        $vorder_getter = function ($order_ids,$mod_vr)
-        {
-            $result = [];
-            $i = 0;
-            while(true)
-            {
-                $start = $i * 1000;
-
-                $vitems = $mod_vr->table('vr_order')->field('*')
-                    ->where(['order_id' => ['in', $order_ids]])
-                    ->order('order_id asc')
-                    ->limit("{$start},1000")->master(true)->select();
-                $i++;
-
-                $result = array_merge($vitems,$result);
-                if(count($vitems) < 1000) {
-                    break;
-                }
-            }
-
-            return $result;
-        };
-
-
-        $order_checker = function ($mchid,$mch_order,$frefill,$fvr) use($rorder_getter,$vorder_getter)
-        {
-            $mod_refill = Model('refill_order');
-            $ritems = $rorder_getter($mchid,$mch_order,$mod_refill);
-
-            if(empty($ritems)) {
-                return [false,'没查到记录.'];
-            }
-            elseif(count($ritems) === 1) {
-                return [true,[]];
-            }
-
-            $oids = [];
-            $inner_state = [0 => 0 ,1 => 1];
-            foreach ($ritems as $item) {
-                $oids[] = $item['order_id'];
-                $state = intval($item['inner_status']);
-                $inner_state[$state] += 1;
-            }
-
-            //检查inner_status=0唯一。
-            if($inner_state[0] != 1) {
-                return [false,"inner_status=0 counts = {$inner_state[0]}"];
-            }
-
-            $mod_vr = Model('vr_order');
-            $vitems = $vorder_getter($oids,$mod_vr);
-
-            //检查refill 表记录和vr_order表记录是否一致
-            if(count($ritems) !== count($vitems)) {
-                return [false,'refill_orders != vr_orders'];
-            }
-
-            $order_state = [];
-            foreach ($vitems as $item)
-            {
-                $state = intval($item['order_state']);
-                if(!array_key_exists($state,$order_state)) {
-                    $order_state[$state] = 0;
-                }
-
-                $order_state[$state] += 1;
-            }
-
-            //检查一种订单只能有,成功或者失败状态.
-            $vcount = count($vitems);
-            if($vcount != $order_state[ORDER_STATE_SUCCESS] + $order_state[ORDER_STATE_CANCEL]) {
-                return [false,'ORDER_STATE_SUCCESS + ORDER_STATE_CANCEL != order count.'];
-            }
-            elseif($order_state[ORDER_STATE_SUCCESS] > 1) {
-                //成功订单只能小于等于1,否则为错误
-                return [false,'ORDER_STATE_SUCCESS count > 1'];
-            }
-            else {
-                foreach ($ritems as $item) {
-                    fputcsv($frefill,$item);
-                }
-                foreach ($vitems as $item) {
-                    fputcsv($fvr,$item);
-                }
-            }
-
-            $inner_orders = [];
-            foreach ($ritems as $item)
-            {
-                $status = intval($item['inner_status']);
-                if($status === 1) {
-                    $inner_orders[] = $item['order_id'];
-                }
-            }
-
-            return [true,$inner_orders];
-        };
-
-        $delter = function ($order_ids,$order_time)
-        {
-            try {
-                $mod_refill = Model('refill_order');
-                $mod_vr = Model('vr_order');
-
-                $trans = new trans_wapper($mod_refill, __METHOD__);
-                $mod_refill->table('refill_order')->where(['order_id' => ['in',$order_ids],'order_time' => $order_time])->delete();
-                $mod_vr->table('vr_order')->where(['order_id' => ['in',$order_ids]])->delete();
-                $trans->commit();
-            } catch (Exception $e) {
-                $trans->rollback();
-            }
-        };
-
-        $position = function ($fp,$line)
-        {
-            $index = 0;
-            while(!feof($fp) && $index < $line) {
-                $items = fgetcsv($fp);
-                $index += 1;
-            }
-        };
-
-
-        $fp = fopen($file,'r');
-        if($fp === false) {
-            return false;
-        }
-
-        $fcheck = fopen($check_file,'a+');
-        if($fcheck === false) {
-            fclose($fp);
-            return false;
-        }
-        $frefill = fopen($refill_file,'a+');
-        $fvr = fopen($vr_file,'a+');
-
-        $position($fp,$line);
-        while(!feof($fp))
-        {
-            [$mchid, $mch_order, $order_time] = fgetcsv($fp);
-
-            if(empty($mchid) || empty($mch_order)) continue;
-
-            [$succ,$err] = $order_checker($mchid,$mch_order,$frefill,$fvr);
-            if($succ === false) {
-                fputcsv($fcheck,[$mchid,$mch_order,$err]);
-            }
-            else
-            {
-                $order_ids = $err;
-                if(!empty($order_ids)) {
-                    $delter($order_ids,$order_time);
-                }
-            }
-        }
-
-        fclose($fp);
-        fclose($fcheck);
-        fclose($frefill);
-        fclose($fvr);
+        $start_date = strtotime('2022-02-21');
+        $end_date   = strtotime('2022-02-24');
+        $clear = new refill\order_clear();
+        $clear->clear($start_date,$end_date);
     }
 
     private function earlist_orderday()

+ 1 - 5
test/TestRefillCommand.php

@@ -22,11 +22,7 @@ class TestRefillCommand extends TestCase
     public function testRefillStat()
     {
         $dates = [
-            '2022-01-13',
-            '2022-01-16',
-            '2022-01-17',
-            '2022-01-18',
-            '2022-01-19'
+            '2022-02-22'
         ];
         $refill = new statistics\stat_refill();
         $refill->restat($dates);