Przeglądaj źródła

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

stanley-king 2 miesięcy temu
rodzic
commit
0a917d8a58
31 zmienionych plików z 1124 dodań i 374 usunięć
  1. 3 1
      admin/control/ordersendlist.php
  2. 22 1
      admin/templates/default/arw.monitor.php
  3. 7 1
      admin/templates/default/merchant.index.php
  4. 51 20
      admin/templates/default/monitor_transfer.php
  5. 396 317
      admin/templates/default/refill_amount_stats.index.php
  6. 7 3
      admin/templates/default/refill_quota_stats.index.php
  7. 70 19
      data/config/xyz/phone.ini.php
  8. 46 0
      data/config/yl/phone.ini.php
  9. BIN
      helper/refill/api/xyz/guochuang/20250205_dx_anhui.jpg
  10. BIN
      helper/refill/api/xyz/guochuang/20250205_dx_henan_hebei.jpg
  11. BIN
      helper/refill/api/xyz/guochuang/20250208_yd_guangdong.jpg
  12. BIN
      helper/refill/api/xyz/guochuang/20250211_dx_henan.png
  13. BIN
      helper/refill/api/xyz/guochuang/20250211_yd_guangdong.jpg
  14. BIN
      helper/refill/api/xyz/guochuang/20250213_yd_guangdong.png
  15. 4 3
      helper/refill/api/xyz/guochuang/config.php
  16. 15 0
      helper/refill/api/xyz/kachong70/API.MD
  17. 49 0
      helper/refill/api/xyz/kachong70/RefillCallBack.php
  18. 137 0
      helper/refill/api/xyz/kachong70/RefillPhone.php
  19. 39 0
      helper/refill/api/xyz/kachong70/config.php
  20. 0 1
      helper/refill/api/xyz/meixu/RefillPhone.php
  21. 4 4
      helper/refill/api/xyz/meixu/config.php
  22. 8 1
      helper/refill/api/xyz/meixu/对接文档-yezi.txt
  23. 4 3
      helper/refill/api/yl/guochuang/config.php
  24. 17 0
      helper/refill/api/yl/kachong_trd/API.MD
  25. 49 0
      helper/refill/api/yl/kachong_trd/RefillCallBack.php
  26. 137 0
      helper/refill/api/yl/kachong_trd/RefillPhone.php
  27. 39 0
      helper/refill/api/yl/kachong_trd/config.php
  28. BIN
      helper/refill/api/yl/kachong_trd/price.png
  29. 4 0
      mobile/callback/refill_kachong70.php
  30. 4 0
      mobile/callback/refill_kachong_trd.php
  31. 12 0
      test/TestRefill.php

+ 3 - 1
admin/control/ordersendlist.php

@@ -214,7 +214,7 @@ class ordersendlistControl extends SystemControl
 
         $base_cond['refill_order.inner_status'] = 0;
 
-        if(!empty($_GET['order_state'])) {
+        if (in_array($_GET['order_state'], ['0', '10', '20', '30', '40'])) {
             $base_cond['vr_order.order_state'] = intval($_GET['order_state']);
         }
 //        else {
@@ -262,11 +262,13 @@ class ordersendlistControl extends SystemControl
         }
 
         $cur_time = time();
+        $order_by = 'refill_order.order_time desc';
         $order_list = Model('')->table('refill_order,vr_order,merchant')
             ->join('inner,inner')
             ->on('refill_order.order_id=vr_order.order_id,refill_order.mchid=merchant.mchid')
             ->field("refill_order.*,vr_order.order_state,({$cur_time} - refill_order.order_time - merchant.time_out) as mtime_out")
             ->where($base_cond)
+            ->order($order_by)
             ->select();
 
 

+ 22 - 1
admin/templates/default/arw.monitor.php

@@ -133,6 +133,27 @@
             },function() {
                 $(this)[0].style.backgroundColor = '#fff'
             })
-        })
+        });
+        //可用容量列样式设置,小于一定数值显示为空色
+        function checkAndColor(cell) {
+            const text = cell.text().trim();
+            const regex = /\((\d+(\.\d+)?)%\)/;
+            const match = text.match(regex);
+
+            if (match) {
+                const percentage = parseFloat(match[1]);
+                if (percentage < 20) {
+                    cell.css('color', 'red');
+                }
+            }
+        }
+
+        $('#tbody tr').each(function() {
+            const $mnt = $(this).find('td').eq(3); // 第四列:/mnt(可用/容量)
+            const $data = $(this).find('td').eq(4); // 第五列:/data(可用/容量)
+
+            checkAndColor($mnt);
+            checkAndColor($data);
+        });
     })
 </script>

+ 7 - 1
admin/templates/default/merchant.index.php

@@ -131,7 +131,13 @@ defined('InShopNC') or exit('Access Invalid!'); ?>
                                     <td class="align-right"><?php echo $v['debt']['send_amounts']; ?></td>
                                     <td class="align-right"><?php echo $v['credit_bonus']; ?></td>
 
-                                    <td class="align-right"><?php echo -1 * number_format($v['debt']['debt'],2,'.',''); ?></td>
+                                    <td class="align-right">
+                                        <?php  if ($v['debt']['debt'] != 0) {
+                                            echo -1 * number_format($v['debt']['debt'], 2, '.', '');
+                                        } else {
+                                            echo '0';
+                                        }?>
+                                    </td>
                                     <td class="align-right"><?php echo $v['debt']['lack_amounts']; ?></td>
 
                                     <td class="align-right"><?php echo $v['alarm_amount']; ?></td>

+ 51 - 20
admin/templates/default/monitor_transfer.php

@@ -1,7 +1,7 @@
 <style>
     th label {
         display: inline-block;
-        width: 60px;
+        min-width: 60px;
     }
     .lineLi {
         display: inline-block;
@@ -113,6 +113,16 @@
                            id="endTime" name="query_end_time" autocomplete="off" style="width:120px" />
                 </td>
 
+                <th><label>近期时间(小时内)</label></th>
+                <td>
+                    <select name="time" class="querySelect">
+                        <option value=""><?php echo $lang['nc_please_choose']; ?></option>
+                        <?php for ($i = 1; $i<=3; $i++) { ?>
+                            <option value="<?php echo $i; ?>"<?php if ($_GET['time'] == $i){ ?>selected<?php } ?>><?php echo $i;?>小时</option>
+                        <?php } ?>
+                    </select>
+                </td>
+
                 <th><label>订单状态</label></th>
                 <td>
                     <select name="order_state" class="querySelect order_state">
@@ -354,6 +364,7 @@
         charset="utf-8"></script>
 <script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/refill/layer.js"></script>
 <script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/js/xm-select.js"></script>
+<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL; ?>/refill/moment-with-locales.js"></script>
 <script type="text/javascript" src="<?php echo ADMIN_TEMPLATES_URL;?>/layui/layui.js"></script>
 <link rel="stylesheet" type="text/css" href="<?php echo ADMIN_TEMPLATES_URL; ?>/layui/css/layui.css"/>
 <link rel="stylesheet" type="text/css"
@@ -558,25 +569,45 @@
                 layer.close(ii);
             }, 800);
         });
-            // 导出
-    $('#ncexport').click(function () {
-        $('input[name="export"]').val('1');
-        $('input[name="op"]').val('index');
-        // 不包含客户
-        let selectArr = selest_nc.getValue();
-        let selectStr = ''
-        for (let i = 0; i < selectArr.length; i++) {
-            selectStr += selectArr[i].value+','
-        }
-        selectStr = selectStr.substr(0, selectStr.length-1)
-        $('input[name="no_mchid"]').val(selectStr);
-        $('#formSearch').submit();
-        $('input[name="export"]').val('');
-        let ii = layer.load();
-        setTimeout(function(){
-            layer.close(ii);
-        }, 800);
-    })
+
+        // 导出
+        $('#ncexport').click(function () {
+            $('input[name="export"]').val('1');
+            $('input[name="op"]').val('index');
+            // 不包含客户
+            let selectArr = selest_nc.getValue();
+            let selectStr = ''
+            for (let i = 0; i < selectArr.length; i++) {
+                selectStr += selectArr[i].value+','
+            }
+            selectStr = selectStr.substr(0, selectStr.length-1)
+            $('input[name="no_mchid"]').val(selectStr);
+            $('#formSearch').submit();
+            $('input[name="export"]').val('');
+            let ii = layer.load();
+            setTimeout(function(){
+                layer.close(ii);
+            }, 800);
+        });
+
+        //近期时间
+        $("select[name='time']").change(function () {
+            let startTime = "";
+
+            const selectedValue = $(this).val();
+            if (selectedValue === "") {
+                startTime = moment().startOf('day').format('YYYY-MM-DD HH:mm:ss');
+            } else {
+                const date = new Date();
+                const selectedValue = $(this).val();
+                const leftTime = parseInt(selectedValue);
+                const time = date.getTime() - 3600000 * leftTime;
+                startTime = moment(time).format("YYYY-M-DD HH:mm:ss");
+            }
+
+            $("input[name='query_start_time']").val(startTime);
+            $("input[name='query_end_time']").val("");
+        });
     });
     function hCopyOrder(e) {
         let str = ''

Plik diff jest za duży
+ 396 - 317
admin/templates/default/refill_amount_stats.index.php


+ 7 - 3
admin/templates/default/refill_quota_stats.index.php

@@ -327,6 +327,10 @@
         color: blue !important;
     }
 
+    #tb-summary + .layui-table-view .layui-table-header th[data-field="channel_mch_delta"] {
+        background-color: #FFB800;
+    }
+
     .chinese-money {
         font-size: 12px;
         color: red;
@@ -1315,9 +1319,9 @@
                         {field: 'subject_quota', title: '本月总额度', width: 200},
                         {field: 'channel_amounts', title: '上游本月需开票', width: 150},
                         {field: 'channel_total_invoiced', title: '上游已开票', width: 150},
-                        {field: 'channel_invoice_quota', title: '上游开票', width: 150},
+                        {field: 'channel_invoice_quota', title: '上游开票', width: 150},
                         {field: 'subject_channel_delta', title: '差额(主体-上游)', width: 150},
-                        {field: 'mch_invoice_quota', title: '下游开票', width: 150},
+                        {field: 'mch_invoice_quota', title: '下游开票', width: 150},
                         {field: 'subject_mch_delta', title: '差额(主体-下游)', width: 150},
                         {field: 'channel_mch_delta', title: '差额(上-下)<br>ps:还需进货', width: 150}
                     ]],
@@ -1393,7 +1397,7 @@
                             subjectChannelDeltaTd.html(formatDecimals(subject_quota - channel_invoice_quota));
                             mchInvoiceQuotaTd.html(formatDecimals(mch_invoice_quota));
                             subjectMchDeltaTd.html(formatDecimals(subject_quota - mch_invoice_quota));
-                            channelMchDeltaTd.html(formatDecimals(channel_amounts - mch_invoice_quota));
+                            channelMchDeltaTd.html(formatDecimals(channel_invoice_quota - mch_invoice_quota));
                         });
 
                         that.setValueClass(['subject_quota', 'channel_invoice_quota', 'subject_channel_delta', 'mch_invoice_quota', 'subject_mch_delta', 'channel_mch_delta']);

+ 70 - 19
data/config/xyz/phone.ini.php

@@ -624,40 +624,45 @@ $meixu_phone = [
 	'name' => 'meixu', 'store_id' => 160, 'qualitys' => '2', 'official_sn' => true, 'refill_type' => 'api',	
 	'amount' => [
 		10 => [
-			['goods_id' => 7349, 'price' => 10.28, 'quality' => 2, 'card_type' => 'chinamobile'],
-			['goods_id' => 7349, 'price' => 10.09, 'quality' => 2, 'card_type' => 'chinaunicom'],
-			['goods_id' => 7349, 'price' => 10.36, 'quality' => 2, 'card_type' => 'chinatelecom']
+			['goods_id' => 7349, 'price' => 10.92, 'quality' => 2, 'card_type' => 'chinamobile'],
+			['goods_id' => 7349, 'price' => 10.26, 'quality' => 2, 'card_type' => 'chinaunicom'],
+			['goods_id' => 7349, 'price' => 10.37, 'quality' => 2, 'card_type' => 'chinatelecom']
 			],
 		20 => [
-			['goods_id' => 7350, 'price' => 20.56, 'quality' => 2, 'card_type' => 'chinamobile'],
+			['goods_id' => 7350, 'price' => 20.99, 'quality' => 2, 'card_type' => 'chinamobile'],
 			['goods_id' => 7350, 'price' => 20.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
-			['goods_id' => 7350, 'price' => 20.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+			['goods_id' => 7350, 'price' => 20.52, 'quality' => 2, 'card_type' => 'chinatelecom']
 			],
 		30 => [
-			['goods_id' => 7351, 'price' => 30.84, 'quality' => 2, 'card_type' => 'chinamobile'],
+			['goods_id' => 7351, 'price' => 31.14, 'quality' => 2, 'card_type' => 'chinamobile'],
 			['goods_id' => 7351, 'price' => 30.12, 'quality' => 2, 'card_type' => 'chinaunicom'],
-			['goods_id' => 7351, 'price' => 30.54, 'quality' => 2, 'card_type' => 'chinatelecom']
+			['goods_id' => 7351, 'price' => 30.66, 'quality' => 2, 'card_type' => 'chinatelecom']
 			],
 		50 => [
-			['goods_id' => 7352, 'price' => 50.4, 'quality' => 2, 'card_type' => 'chinamobile'],
-			['goods_id' => 7352, 'price' => 50.08, 'quality' => 2, 'card_type' => 'chinaunicom'],
-			['goods_id' => 7352, 'price' => 50.35, 'quality' => 2, 'card_type' => 'chinatelecom']
+			['goods_id' => 7352, 'price' => 50.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+			['goods_id' => 7352, 'price' => 50.125, 'quality' => 2, 'card_type' => 'chinaunicom'],
+			['goods_id' => 7352, 'price' => 50.3, 'quality' => 2, 'card_type' => 'chinatelecom']
 			],
 		100 => [
 			['goods_id' => 7353, 'price' => 100.18, 'quality' => 2, 'card_type' => 'chinamobile'],
-			['goods_id' => 7353, 'price' => 100.16, 'quality' => 2, 'card_type' => 'chinaunicom'],
-			['goods_id' => 7353, 'price' => 100.23, 'quality' => 2, 'card_type' => 'chinatelecom']
+			['goods_id' => 7353, 'price' => 100.15, 'quality' => 2, 'card_type' => 'chinaunicom'],
+			['goods_id' => 7353, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinatelecom']
 			],
 		200 => [
-			['goods_id' => 7354, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinamobile'],
-			['goods_id' => 7354, 'price' => 200.32, 'quality' => 2, 'card_type' => 'chinaunicom'],
-			['goods_id' => 7354, 'price' => 200.36, 'quality' => 2, 'card_type' => 'chinatelecom']
+			['goods_id' => 7354, 'price' => 200.36, 'quality' => 2, 'card_type' => 'chinamobile'],
+			['goods_id' => 7354, 'price' => 200.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+			['goods_id' => 7354, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinatelecom']
 			],
 		300 => [
-			['goods_id' => 7355, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinamobile'],
-			['goods_id' => 7355, 'price' => 300.48, 'quality' => 2, 'card_type' => 'chinaunicom'],
-			['goods_id' => 7355, 'price' => 300.54, 'quality' => 2, 'card_type' => 'chinatelecom']
-			]
+			['goods_id' => 7355, 'price' => 300.54, 'quality' => 2, 'card_type' => 'chinamobile'],
+			['goods_id' => 7355, 'price' => 300.45, 'quality' => 2, 'card_type' => 'chinaunicom'],
+			['goods_id' => 7355, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+			],
+        500 => [
+//            ['goods_id' => 7356, 'price' => 500, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 7356, 'price' => 500.75, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 7356, 'price' => 500, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ]
 		]
 	];
 $dongye_phone = [
@@ -4007,6 +4012,51 @@ $jietaiyu_phone = [
         ]
     ]
 ];
+$kachong70_phone = [
+    'name' => 'kachong70', 'store_id' => 431, 'qualitys' => '2', 'official_sn' => true, 'refill_type' => 'api',
+    'amount' => [
+        10 => [
+            ['goods_id' => 9402, 'price' => 10, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9402, 'price' => 10, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9402, 'price' => 10, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 9403, 'price' => 20, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9403, 'price' => 19.96, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9403, 'price' => 20, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 9404, 'price' => 30, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9404, 'price' => 30, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9404, 'price' => 30, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 9405, 'price' => 49.925, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9405, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9405, 'price' => 50.07, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 9406, 'price' => 99.95, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9406, 'price' => 94.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9406, 'price' => 100.85, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 9407, 'price' => 200, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9407, 'price' => 188.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9407, 'price' => 200, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 9408, 'price' => 300, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9408, 'price' => 300, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9408, 'price' => 300, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 9409, 'price' => 500, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9409, 'price' => 500, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9409, 'price' => 500, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ]
+];
 
 $phone_providers = [
 	[ 'name' => 'xunyin', 'cfg' => $xunyin_phone ],
@@ -4125,4 +4175,5 @@ $phone_providers = [
 //    [ 'name' => 'masheng', 'cfg' => $masheng_phone ],
     [ 'name' => 'qingyu_sec', 'cfg' => $qingyu_sec_phone ],
     [ 'name' => 'jietaiyu', 'cfg' => $jietaiyu_phone ],
+    [ 'name' => 'kachong70', 'cfg' => $kachong70_phone ],
 	];

+ 46 - 0
data/config/yl/phone.ini.php

@@ -2503,6 +2503,51 @@ $jizheng_phone = [
 //        ]
     ]
 ];
+$kachong_trd_phone = [
+    'name' => 'kachong_trd', 'store_id' => 355, 'qualitys' => '2', 'official_sn' => true, 'refill_type' => 'api',
+    'amount' => [
+        10 => [
+            ['goods_id' => 8849, 'price' => 10.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8849, 'price' => 10.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8849, 'price' => 10.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 8850, 'price' => 20.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8850, 'price' => 20.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8850, 'price' => 20.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 8851, 'price' => 30.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8851, 'price' => 30.12, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8851, 'price' => 30.42, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 8852, 'price' => 50.8, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8852, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8852, 'price' => 50.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8853, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8853, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8853, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8854, 'price' => 200.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8854, 'price' => 200.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8854, 'price' => 200.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 8855, 'price' => 300.12, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8855, 'price' => 300.12, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8855, 'price' => 300.21, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 8856, 'price' => 500.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8856, 'price' => 500.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8856, 'price' => 500.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ]
+];
 
 $phone_providers = [
 	[ 'name' => 'zhongst', 'cfg' => $zhongst_phone ],
@@ -2585,4 +2630,5 @@ $phone_providers = [
     [ 'name' => 'kadanhuitpc', 'cfg' => $kadanhuitpc_phone ],
     [ 'name' => 'techaohe', 'cfg' => $techaohe_phone ],
     [ 'name' => 'jizheng', 'cfg' => $jizheng_phone ],
+    [ 'name' => 'kachong_trd', 'cfg' => $kachong_trd_phone ],
 	];

BIN
helper/refill/api/xyz/guochuang/20250205_dx_anhui.jpg


BIN
helper/refill/api/xyz/guochuang/20250205_dx_henan_hebei.jpg


BIN
helper/refill/api/xyz/guochuang/20250208_yd_guangdong.jpg


BIN
helper/refill/api/xyz/guochuang/20250211_dx_henan.png


BIN
helper/refill/api/xyz/guochuang/20250211_yd_guangdong.jpg


BIN
helper/refill/api/xyz/guochuang/20250213_yd_guangdong.png


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

@@ -72,7 +72,7 @@ class config
         "4-10-13" => 9.965, "4-20-13" => 19.93, "4-30-13" => 29.895, "4-50-13" => 49.825, "4-100-13" => 99.65, "4-200-13" => 199.3, "4-300-13" => 298.95, "4-500-13" => 498.25,//福建 13
         "4-10-5" => 10.035, "4-20-5" => 20.07, "4-30-5" => 30.09, "4-50-5" => 50.15, "4-100-5" => 100.3, "4-200-5" => 200.4, "4-300-5" => 300.6, "4-500-5" => 501,//内蒙古 5
         "4-30-18" => 29.835, "4-50-18" => 49.725, "4-100-18" => 99.45, "4-200-18" => 198.3,//湖南 18
-        "4-10-19" => 10.1, "4-20-19" => 20.2, "4-30-19" => 30.03, "4-50-19" => 50.5, "4-100-19" => 101, "4-200-19" => 202, "4-300-19" => 303, "4-500-19" => 505,//广东 19
+        "4-10-19" => 10.1, "4-20-19" => 20.2, "4-30-19" => 30.03, "4-50-19" => 50.475, "4-100-19" => 100.95, "4-200-19" => 201.9, "4-300-19" => 302.85, "4-500-19" => 504.75,//广东 19
         "4-10-7" => 9.93, "4-20-7" => 19.86, "4-30-7" => 29.52, "4-50-7" => 49.2, "4-100-7" => 98.4, "4-200-7" => 196.8, "4-300-7" => 295.2, "4-500-7" => 492,//吉林 7
         "4-10-1" => 10.31, "4-20-1" => 20.32, "4-30-1" => 30.33, "4-50-1" => 50.35, "4-100-1" => 100.4, "4-200-1" => 200.3, "4-300-1" => 300.45, "4-500-1" => 500.75,//北京 1
         "4-10-22" => 10.015, "4-20-22" => 20.03, "4-30-22" => 30.045, "4-50-22" => 50.075, "4-100-22" => 100.15, "4-200-22" => 200.3, "4-300-22" => 300.45, "4-500-22" => 500.75,//重庆 22
@@ -102,14 +102,15 @@ class config
         "6-10-4" => 10.37, "6-20-4" => 20.39, "6-30-4" => 30.42, "6-50-4" => 50.45, "6-100-4" => 100.6, "6-200-4" => 201.2, "6-300-4" => 301.8, "6-500-4" => 503,//山西 4
         "6-10-18" => 10.04, "6-20-18" => 20.08, "6-30-18" => 30.12, "6-50-18" => 50.15, "6-100-18" => 100.3, "6-200-18" => 200.6, "6-300-18" => 300.9, "6-500-18" => 501.5,//湖南 18
         "6-10-15" => 10.37, "6-20-15" => 20.38, "6-30-15" => 30.42, "6-50-15" => 50.8, "6-100-15" => 101, "6-200-15" => 200.4, "6-300-15" => 300.6, "6-500-15" => 501,//山东 15
-        "6-10-12" => 10.22, "6-20-12" => 20.24, "6-30-12" => 30.3, "6-50-12" => 50.4, "6-100-12" => 100.7, "6-200-12" => 200.6, "6-300-12" => 300.9, "6-500-12" => 501.5,//安徽 12
+        "6-10-12" => 10.22, "6-20-12" => 20.24, "6-30-12" => 30.3, "6-50-12" => 50.3, "6-100-12" => 100.4, "6-200-12" => 200.4, "6-300-12" => 300.9, "6-500-12" => 501.5,//安徽 12
         "6-10-2" => 10.12, "6-20-2" => 20.16, "6-30-2" => 30.21, "6-50-2" => 50.175, "6-100-2" => 100.35, "6-200-2" => 200.7, "6-300-2" => 301.05, "6-500-2" => 501.75,//天津 2
         "6-10-20" => 10.15, "6-20-20" => 20.18, "6-30-20" => 30.21, "6-50-20" => 50.3, "6-100-20" => 100.45, "6-200-20" => 200.6, "6-300-20" => 300.9, "6-500-20" => 501.5,//广西 20
         "6-10-29" => 10.13, "6-20-29" => 20.14, "6-30-29" => 30.18, "6-50-29" => 50.25, "6-100-29" => 100.35, "6-200-29" => 200.6, "6-300-29" => 300.9, "6-500-29" => 501.5,//青海 29
         "6-100-1" => 100.2, "6-200-1" => 200.2, "6-300-1" => 300.3, "6-500-1" => 500.5,//北京 1
-        "6-10-16" => 10.37, "6-20-16" => 20.44, "6-30-16" => 30.51, "6-50-16" => 50.5, "6-100-16" => 100.5, "6-200-16" => 200.5, "6-300-16" => 300.75, "6-500-16" => 501.25,//河南 16
+        "6-10-16" => 10.13, "6-20-16" => 20.24, "6-30-16" => 30.36, "6-50-16" => 50.3, "6-100-16" => 100.5, "6-200-16" => 200.8, "6-300-16" => 301.2, "6-500-16" => 502,//河南 16
         "6-10-13" => 10.07, "6-20-13" => 20.14, "6-30-13" => 30.21, "6-50-13" => 50.5, "6-100-13" => 100.9, "6-200-13" => 200.8, "6-300-13" => 300.9, "6-500-13" => 501.5,//福建 13
         "6-10-6" => 10.21, "6-20-6" => 20.24, "6-30-6" => 30.27, "6-50-6" => 50.175, "6-100-6" => 100.35, "6-200-6" => 200.7, "6-300-6" => 301.05, "6-500-6" => 501.75,//辽宁 6
         "6-10-17" => 10.23, "6-20-17" => 20.46, "6-30-17" => 30.69, "6-50-17" => 51.1,//湖北 17
+        "6-10-3" => 10.15, "6-20-3" => 20.3, "6-30-3" => 30.45, "6-50-3" => 50.45, "6-100-3" => 100.9, "6-200-3" => 201.6, "6-300-3" => 302.4, "6-500-3" => 504,//河北 3
     ];
 }

+ 15 - 0
helper/refill/api/xyz/kachong70/API.MD

@@ -0,0 +1,15 @@
+## 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 话费
+
+- http://www.70chong.com
+- 登录账号:13699279618 
+- 初始密码:a123456
+- ID :201779 密钥:2d7b02f0b857d3f556c68ed02afae415
+
+## 店铺账号:
+- kachong70
+- kachong7067890

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

@@ -0,0 +1,49 @@
+<?php
+namespace refill\kachong70;
+
+require_once(BASE_HELPER_RAPI_PATH . '/kachong70/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' => config::extractOfficialSn($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/kachong70/RefillPhone.php

@@ -0,0 +1,137 @@
+<?php
+
+namespace refill\kachong70;
+
+require_once(BASE_HELPER_RAPI_PATH . '/kachong70/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' => config::extractOfficialSn($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);
+    }
+}

+ 39 - 0
helper/refill/api/xyz/kachong70/config.php

@@ -0,0 +1,39 @@
+<?php
+namespace refill\kachong70;
+
+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= '201779';
+    const KEY = '2d7b02f0b857d3f556c68ed02afae415';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_kachong70.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
+    ];
+
+    static function extractOfficialSn($officialSnStr): string
+    {
+        $officialSn = '';
+
+        if (preg_match_all("/(\d+)/", $officialSnStr, $matches)) {
+            foreach ($matches[1] as $item) {
+                if (strlen($officialSn) < strlen($item)) {
+                    $officialSn = $item;
+                }
+            }
+        }
+
+        return $officialSn;
+    }
+}

+ 0 - 1
helper/refill/api/xyz/meixu/RefillPhone.php

@@ -38,7 +38,6 @@ class RefillPhone extends refill\IRefillPhone
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, [], $net_errno);
-
         if (empty($resp)) {
             return [false, '网络错误', true];
         }

+ 4 - 4
helper/refill/api/xyz/meixu/config.php

@@ -37,10 +37,10 @@ class config
             10 => 30000001581,
             20 => 30000001582,
             30 => 30000001583,
-            50 => 100012,
-            100 => 100013,
-            200 => 100014,
-            300 => 100015,
+            50 => 30000001584,
+            100 => 30000001585,
+            200 => 30000001586,
+            300 => 30000001587,
             500 => 30000001588,
         ],
         mtopcard\ChinaTelecomCard => [

+ 8 - 1
helper/refill/api/xyz/meixu/对接文档-yezi.txt

@@ -68,4 +68,11 @@
 30000003442	全国电信电渠话费10元
 30000003443	全国电信电渠话费20元
 30000003444	全国电信电渠话费30元
-30000003445	全国电信电渠话费50元
+30000003445	全国电信电渠话费50元
+
+2025.2.4
+全国联通掌厅话费50元  编码 30000001584	       折扣100.25
+全国联通掌厅话费100元 编码 30000001585	       折扣100.15
+全国联通掌厅话费200元 编码 30000001586	       折扣100.15
+全国联通掌厅话费300元 编码 30000001587	       折扣100.15
+全国联通掌厅话费500元 编码 30000001588	       折扣100.15

+ 4 - 3
helper/refill/api/yl/guochuang/config.php

@@ -72,7 +72,7 @@ class config
         "4-10-13" => 9.965, "4-20-13" => 19.93, "4-30-13" => 29.895, "4-50-13" => 49.825, "4-100-13" => 99.65, "4-200-13" => 199.3, "4-300-13" => 298.95, "4-500-13" => 498.25,//福建 13
         "4-10-5" => 10.035, "4-20-5" => 20.07, "4-30-5" => 30.09, "4-50-5" => 50.15, "4-100-5" => 100.3, "4-200-5" => 200.4, "4-300-5" => 300.6, "4-500-5" => 501,//内蒙古 5
         "4-30-18" => 29.835, "4-50-18" => 49.725, "4-100-18" => 99.45, "4-200-18" => 198.3,//湖南 18
-        "4-10-19" => 10.1, "4-20-19" => 20.2, "4-30-19" => 30.03, "4-50-19" => 50.5, "4-100-19" => 101, "4-200-19" => 202, "4-300-19" => 303, "4-500-19" => 505,//广东 19
+        "4-10-19" => 10.1, "4-20-19" => 20.2, "4-30-19" => 30.03, "4-50-19" => 50.475, "4-100-19" => 100.95, "4-200-19" => 201.9, "4-300-19" => 302.85, "4-500-19" => 504.75,//广东 19
         "4-10-7" => 9.93, "4-20-7" => 19.86, "4-30-7" => 29.52, "4-50-7" => 49.2, "4-100-7" => 98.4, "4-200-7" => 196.8, "4-300-7" => 295.2, "4-500-7" => 492,//吉林 7
         "4-10-1" => 10.31, "4-20-1" => 20.32, "4-30-1" => 30.33, "4-50-1" => 50.35, "4-100-1" => 100.4, "4-200-1" => 200.3, "4-300-1" => 300.45, "4-500-1" => 500.75,//北京 1
         "4-10-22" => 10.015, "4-20-22" => 20.03, "4-30-22" => 30.045, "4-50-22" => 50.075, "4-100-22" => 100.15, "4-200-22" => 200.3, "4-300-22" => 300.45, "4-500-22" => 500.75,//重庆 22
@@ -102,14 +102,15 @@ class config
         "6-10-4" => 10.37, "6-20-4" => 20.39, "6-30-4" => 30.42, "6-50-4" => 50.45, "6-100-4" => 100.6, "6-200-4" => 201.2, "6-300-4" => 301.8, "6-500-4" => 503,//山西 4
         "6-10-18" => 10.04, "6-20-18" => 20.08, "6-30-18" => 30.12, "6-50-18" => 50.15, "6-100-18" => 100.3, "6-200-18" => 200.6, "6-300-18" => 300.9, "6-500-18" => 501.5,//湖南 18
         "6-10-15" => 10.37, "6-20-15" => 20.38, "6-30-15" => 30.42, "6-50-15" => 50.8, "6-100-15" => 101, "6-200-15" => 200.4, "6-300-15" => 300.6, "6-500-15" => 501,//山东 15
-        "6-10-12" => 10.22, "6-20-12" => 20.24, "6-30-12" => 30.3, "6-50-12" => 50.4, "6-100-12" => 100.7, "6-200-12" => 200.6, "6-300-12" => 300.9, "6-500-12" => 501.5,//安徽 12
+        "6-10-12" => 10.22, "6-20-12" => 20.24, "6-30-12" => 30.3, "6-50-12" => 50.3, "6-100-12" => 100.4, "6-200-12" => 200.4, "6-300-12" => 300.9, "6-500-12" => 501.5,//安徽 12
         "6-10-2" => 10.12, "6-20-2" => 20.16, "6-30-2" => 30.21, "6-50-2" => 50.175, "6-100-2" => 100.35, "6-200-2" => 200.7, "6-300-2" => 301.05, "6-500-2" => 501.75,//天津 2
         "6-10-20" => 10.15, "6-20-20" => 20.18, "6-30-20" => 30.21, "6-50-20" => 50.3, "6-100-20" => 100.45, "6-200-20" => 200.6, "6-300-20" => 300.9, "6-500-20" => 501.5,//广西 20
         "6-10-29" => 10.13, "6-20-29" => 20.14, "6-30-29" => 30.18, "6-50-29" => 50.25, "6-100-29" => 100.35, "6-200-29" => 200.6, "6-300-29" => 300.9, "6-500-29" => 501.5,//青海 29
         "6-100-1" => 100.2, "6-200-1" => 200.2, "6-300-1" => 300.3, "6-500-1" => 500.5,//北京 1
-        "6-10-16" => 10.37, "6-20-16" => 20.44, "6-30-16" => 30.51, "6-50-16" => 50.5, "6-100-16" => 100.5, "6-200-16" => 200.5, "6-300-16" => 300.75, "6-500-16" => 501.25,//河南 16
+        "6-10-16" => 10.13, "6-20-16" => 20.24, "6-30-16" => 30.36, "6-50-16" => 50.3, "6-100-16" => 100.5, "6-200-16" => 200.8, "6-300-16" => 301.2, "6-500-16" => 502,//河南 16
         "6-10-13" => 10.07, "6-20-13" => 20.14, "6-30-13" => 30.21, "6-50-13" => 50.5, "6-100-13" => 100.9, "6-200-13" => 200.8, "6-300-13" => 300.9, "6-500-13" => 501.5,//福建 13
         "6-10-6" => 10.21, "6-20-6" => 20.24, "6-30-6" => 30.27, "6-50-6" => 50.175, "6-100-6" => 100.35, "6-200-6" => 200.7, "6-300-6" => 301.05, "6-500-6" => 501.75,//辽宁 6
         "6-10-17" => 10.23, "6-20-17" => 20.46, "6-30-17" => 30.69, "6-50-17" => 51.1,//湖北 17
+        "6-10-3" => 10.15, "6-20-3" => 20.3, "6-30-3" => 30.45, "6-50-3" => 50.45, "6-100-3" => 100.9, "6-200-3" => 201.6, "6-300-3" => 302.4, "6-500-3" => 504,//河北 3
     ];
 }

+ 17 - 0
helper/refill/api/yl/kachong_trd/API.MD

@@ -0,0 +1,17 @@
+## 70快充3号
+
+- 下单地址: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 话费
+
+## 账号
+- http://www.70chong.com
+- 登录账号:18510683168
+- 初始密码:a123456
+- ID:201734
+- 密钥:c60cd062c064cab05ae083ab548f1a68
+
+## 店铺账号:
+- kachong_trd
+- kachong_trd67890

+ 49 - 0
helper/refill/api/yl/kachong_trd/RefillCallBack.php

@@ -0,0 +1,49 @@
+<?php
+namespace refill\kachong_trd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/kachong_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)
+    {
+        $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' => config::extractOfficialSn($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/yl/kachong_trd/RefillPhone.php

@@ -0,0 +1,137 @@
+<?php
+
+namespace refill\kachong_trd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/kachong_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)
+    {
+        $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' => config::extractOfficialSn($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);
+    }
+}

+ 39 - 0
helper/refill/api/yl/kachong_trd/config.php

@@ -0,0 +1,39 @@
+<?php
+namespace refill\kachong_trd;
+
+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= '201734';
+    const KEY = 'c60cd062c064cab05ae083ab548f1a68';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_kachong_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,1023,1024,1025,1026,2001,2002,2003,2020,2021,2025,2026,1006,2030,3003
+    ];
+
+    static function extractOfficialSn($officialSnStr): string
+    {
+        $officialSn = '';
+
+        if (preg_match_all("/(\d+)/", $officialSnStr, $matches)) {
+            foreach ($matches[1] as $item) {
+                if (strlen($officialSn) < strlen($item)) {
+                    $officialSn = $item;
+                }
+            }
+        }
+
+        return $officialSn;
+    }
+}

BIN
helper/refill/api/yl/kachong_trd/price.png


+ 4 - 0
mobile/callback/refill_kachong70.php

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

+ 4 - 0
mobile/callback/refill_kachong_trd.php

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

+ 12 - 0
test/TestRefill.php

@@ -6449,6 +6449,18 @@ class TestRefill extends TestCase
         $provider = $this->getProvider('jizheng');
         $resp = $provider->balance();
     }
+
+    public function testkachong_trd()
+    {
+        $provider = $this->getProvider('kachong_trd');
+        $resp = $provider->balance();
+    }
+
+    public function testkachong70()
+    {
+        $provider = $this->getProvider('kachong70');
+        $resp = $provider->balance();
+    }
 }