stanley-king 4 anos atrás
pai
commit
b0053bb2b3

+ 55 - 19
admin/control/merchant.php

@@ -776,9 +776,9 @@ class merchantControl extends SystemControl
 
     public function OrderQueryOp()
     {
-        $model_refill_order = Model('vr_order');
+        $model_vr_order = Model('vr_order');
         $condition['order_state'] = ORDER_STATE_SEND;
-        $orders = $model_refill_order->getOrderList($condition);
+        $orders = $model_vr_order->getOrderList($condition);
         if(!empty($orders)) {
             foreach ($orders as $order) {
                 $order_id = $order['order_id'];
@@ -788,6 +788,26 @@ class merchantControl extends SystemControl
         showMessage('操作成功', 'index.php?act=merchant&op=refill_order');
     }
 
+    public function mch_notifyOp()
+    {
+        $model_refill_order = Model('refill_order');
+
+        $condition['mch_notify_state'] = 0;
+        $condition['inner_status'] = 0;
+        $orders = $model_refill_order->getMerchantOrderList($condition, 1000, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
+        if(!empty($orders)) {
+            foreach ($orders as $order) {
+                $order_id = $order['order_id'];
+                if($order['order_state'] == ORDER_STATE_SEND) {
+                    QueueClient::push("QueryRefillState",['order_id' => $order_id]);
+                }else{
+                    QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id,'manual' => true]);
+                }
+            }
+        }
+        showMessage('操作成功', 'index.php?act=merchant&op=refill_order');
+    }
+
     public function refill_orderOp()
     {
         $model_refill_order = Model('refill_order');
@@ -831,8 +851,7 @@ class merchantControl extends SystemControl
         }
 
         $start_unixtime = strtotime($_GET['query_start_time']);
-        $end_unixtime = strtotime($_GET['query_end_time']);
-
+        $end_unixtime   = strtotime($_GET['query_end_time']);
         if ($start_unixtime >0 && $end_unixtime >0) {
             $condition['refill_order.order_time'] = ['between', [$start_unixtime, $end_unixtime]];
         }
@@ -856,10 +875,7 @@ class merchantControl extends SystemControl
         }
         $order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
 
-        $stat = Model('')->table('refill_order,vr_order')->join('inner')
-            ->on('refill_order.order_id=vr_order.order_id')
-            ->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
-            ->where($condition)->select();
+        $stat = $this->all_order_state_stat($condition);
         $count = $this->refill_stat($condition);
         foreach ($order_list as $order_id => $order_info)
         {
@@ -877,7 +893,7 @@ class merchantControl extends SystemControl
             }
         }
         $provider_list = Model('')->table('refill_provider')->limit(100)->select();
-        Tpl::output('stat', $stat[0]);
+        Tpl::output('stat', $stat);
         Tpl::output('count', $count);
         Tpl::output('order_list', $order_list);
         Tpl::output('provider_list', $provider_list);
@@ -1320,20 +1336,40 @@ class merchantControl extends SystemControl
 
     private function refill_stat($condition)
     {
+        $stat_order = function ($condition) {
+            $stat = Model('')->table('refill_order,vr_order')->join('inner')
+                ->on('refill_order.order_id=vr_order.order_id')
+                ->field('count(*) as order_count ')
+                ->where($condition)->find();
 
-        $condition['order_state'] = ORDER_STATE_SEND;
+            return $stat['order_count'];
+        };
 
+        $condition['order_state'] = ORDER_STATE_SEND;
         $condition['refill_order.order_time'] = ['between', [(time() - 300) , (time() - 180)]];
-        $three_minute_stats = Model('')->table('refill_order,vr_order')->join('inner')
-            ->on('refill_order.order_id=vr_order.order_id')
-            ->field('count(*) as order_count ')
-            ->where($condition)->find();
+        $three_minute_stats = $stat_order($condition);
         $condition['refill_order.order_time'] = ['lt', (time() - 300)];
-        $five_minute_stats = Model('')->table('refill_order,vr_order')->join('inner')
-            ->on('refill_order.order_id=vr_order.order_id')
-            ->field('count(*) as order_count ')
-            ->where($condition)->find();
-        return ['exceed_three' => $three_minute_stats['order_count'] , 'exceed_five' => $five_minute_stats['order_count']];
+        $five_minute_stats = $stat_order($condition);
+        return ['exceed_three' => $three_minute_stats , 'exceed_five' => $five_minute_stats];
+    }
+
+    private function all_order_state_stat($condition)
+    {
+        $stat_order = function ($condition) {
+            return Model('')->table('refill_order,vr_order')->join('inner')
+                ->on('refill_order.order_id=vr_order.order_id')
+                ->field('count(*) as order_count ,sum(refill_amount) as refill_amounts, sum(channel_amount) as channel_amounts, sum(mch_amount) as mch_amounts')
+                ->where($condition)->find();
+        };
+        $all = $stat_order($condition);
+        $condition['order_state'] = ORDER_STATE_SEND;
+        $sending = $stat_order($condition);
+        $condition['order_state'] = ORDER_STATE_SUCCESS;
+        $success = $stat_order($condition);
+        $condition['order_state'] = ORDER_STATE_CANCEL;
+        $cancel = $stat_order($condition);
+
+        return ['all' => $all , 'sending' => $sending , 'success' => $success , 'cancel' => $cancel];
     }
 
 

+ 27 - 7
admin/templates/default/refill.order.index.php

@@ -154,6 +154,9 @@
                     <a href="index.php?act=merchant&op=OrderQuery" class="btns" >
                         <span><i class="icon-edit"></i>更新待收货订单状态</span>
                     </a>
+                    <a href="index.php?act=merchant&op=mch_notify" class="btns" >
+                        <span><i class="icon-edit"></i>向客户回调</span>
+                    </a>
                 </td>
             </tr>
             </tbody>
@@ -169,15 +172,32 @@
             <td>
                 <ul>
                     <div style="display:inlin-block;min-width:250px;width:250px;background:none">
-                        <li class="lineLi" style="color:#000;">总计充值金额:<?php echo $output['stat']['refill_amounts'] ?? 0?></li>
-                        <li class="lineLi" style="color:#000;">总计供方扣款金额:<?php echo $output['stat']['channel_amounts'] ?? 0?></li>
-                        <li class="lineLi" style="color:#000;">总计客户扣款金额:<?php echo $output['stat']['mch_amounts'] ?? 0?></li>
-                        <li class="lineLi" style="color:#000;">总计利润:<?php echo ncPriceFormat($output['stat']['mch_amounts'] - $output['stat']['channel_amounts'])?></li>
+                        <li class="lineLi" style="color:#000;">总计订单数量:<?php echo $output['stat']['all']['order_count'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值金额:<?php echo $output['stat']['all']['refill_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计供方扣款金额:<?php echo $output['stat']['all']['channel_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计客户扣款金额:<?php echo $output['stat']['all']['mch_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计利润:<?php echo ncPriceFormat($output['stat']['all']['mch_amounts'] - $output['stat']['all']['channel_amounts'])?></li>
+                    </div>
+                    <div style="display:inlin-block;min-width:250px;width:250px;background:none">
+                        <li class="lineLi" style="color:#000;">总计充值中订单数量:<?php echo $output['stat']['sending']['order_count'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值中订单金额:<?php echo $output['stat']['sending']['refill_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值中供方扣款金额:<?php echo $output['stat']['sending']['channel_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值中客户扣款金额:<?php echo $output['stat']['sending']['mch_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值中利润:<?php echo ncPriceFormat($output['stat']['sending']['mch_amounts'] - $output['stat']['sending']['channel_amounts'])?></li>
+                    </div>
+                    <div style="display:inlin-block;min-width:250px;width:250px;background:none">
+                        <li class="lineLi" style="color:#000;">总计充值成功订单数量:<?php echo $output['stat']['success']['order_count'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值成功订单金额:<?php echo $output['stat']['success']['order_count'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值成功供方扣款金额:<?php echo $output['stat']['success']['channel_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值成功客户扣款金额:<?php echo $output['stat']['success']['mch_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值成功利润:<?php echo ncPriceFormat($output['stat']['success']['mch_amounts'] - $output['stat']['success']['channel_amounts'])?></li>
                     </div>
                     <div style="display:inlin-block;min-width:250px;width:250px;background:none">
-                    <li class="lineLi" style="color:#000;">总计订单数量:<?php echo $output['stat']['order_count'] ?? 0?></li>
-                    <li class="lineLi" style="color:#000;">超过3分钟订单数量:<?php echo $output['count']['exceed_three'] ?? 0?></li>
-                    <li class="lineLi" style="color:#000;">超过5分钟订单数量:<?php echo $output['count']['exceed_five'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值失败订单数量:<?php echo $output['stat']['cancel']['order_count'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值失败订单金额:<?php echo $output['stat']['cancel']['order_count'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值失败供方扣款金额:<?php echo $output['stat']['cancel']['channel_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值失败客户扣款金额:<?php echo $output['stat']['cancel']['mch_amounts'] ?? 0?></li>
+                        <li class="lineLi" style="color:#000;">总计充值失败利润:<?php echo ncPriceFormat($output['stat']['cancel']['mch_amounts'] - $output['stat']['cancel']['channel_amounts'])?></li>
                     </div>
                 </ul>
             </td>

+ 14 - 0
data/config/lingzh/refill.ini.php

@@ -118,11 +118,25 @@ $wuchen_phone = ['name' => 'wuchen', 'store_id' => 37,
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$yibao_phone = ['name' => 'yibao', 'store_id' => 38,
+    'amount' => [
+        30 => [['goods_id' => 41, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 41, 'price' => 28.8, 'quality' => 2, 'card_type' => 'chinamobile']],
+        50 => [['goods_id' => 42, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 42, 'price' => 48, 'quality' => 2, 'card_type' => 'chinamobile']],
+        100 => [['goods_id' => 43, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 43, 'price' => 96, 'quality' => 2, 'card_type' => 'chinamobile']],
+        200 => [['goods_id' => 44, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 44, 'price' => 192, 'quality' => 2, 'card_type' => 'chinamobile']],
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
     ['name' => 'baizeyd', 'cfg' => $baizeyd, 'opened' => true, 'sort' => 1],
     ['name' => 'aming', 'cfg' => $aming_phone, 'opened' => true, 'sort' => 1],
     ['name' => 'binghc', 'cfg' => $binghc_phone, 'opened' => true, 'sort' => 1],
     ['name' => 'ruishun', 'cfg' => $ruishun_phone, 'opened' => true, 'sort' => 1],
     ['name' => 'wuchen', 'cfg' => $wuchen_phone, 'opened' => true, 'sort' => 1],
+    ['name' => 'yibao', 'cfg' => $yibao_phone, 'opened' => true, 'sort' => 1],
     ];
 $config['phone_providers'] = $phone_providers;

+ 2 - 2
helper/fcgisrv/LZRAccServer.php

@@ -26,7 +26,7 @@ class LZRAccServer extends BaseServer
 
         $exfiles = [
             'callback/lingzh/baizeyd.php','callback/lingzh/aming.php','callback/lingzh/binghc.php',
-            'callback/lingzh/ruishun.php','callback/lingzh/wuchen.php'
+            'callback/lingzh/ruishun.php','callback/lingzh/wuchen.php','callback/lingzh/yibao.php'
         ];
 
         $this->setExFiles($exfiles);
@@ -36,7 +36,7 @@ class LZRAccServer extends BaseServer
     static public function instance()
     {
         if(self::$stInstance == NULL) {
-            self::$stInstance = new RAccServer('racc');
+            self::$stInstance = new LZRAccServer('racc');
 
         }
         return self::$stInstance;

+ 1 - 0
helper/fcgisrv/XYZRAccServer.php

@@ -25,6 +25,7 @@ class XYZRAccServer extends BaseServer
         parent::__construct($subPath);
 
         $exfiles = [
+
         ];
 
         $this->setExFiles($exfiles);

+ 3 - 3
helper/refill/api/lingzh/aming/RefillPhone.php

@@ -34,14 +34,14 @@ class RefillPhone extends refill\IRefillPhone
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
         if ($resp === false) {
-            return [false, '系统错误'];
+            return [false, '系统错误', true];
         } else {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
             if($resp['result'] == 'SUCCESS') {
-                return [true, $resp['orderNo']];
+                return [true, $resp['orderNo'], false];
             }
-            return [false , $resp['msg']];
+            return [false , $resp['msg'], false];
         }
     }
 

+ 3 - 0
helper/refill/api/lingzh/api.php

@@ -17,3 +17,6 @@ require_once(BASE_HELPER_RAPI_PATH . '/weisyd/RefillCallBack.php');
 
 require_once(BASE_HELPER_RAPI_PATH . '/wuchen/RefillPhone.php');
 require_once(BASE_HELPER_RAPI_PATH . '/wuchen/RefillCallBack.php');
+
+require_once(BASE_HELPER_RAPI_PATH . '/yibao/RefillPhone.php');
+require_once(BASE_HELPER_RAPI_PATH . '/yibao/RefillCallBack.php');

+ 3 - 3
helper/refill/api/lingzh/baizeyd/RefillPhone.php

@@ -33,14 +33,14 @@ class RefillPhone extends refill\IRefillPhone
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
         if ($resp === false) {
-            return [false, '系统错误'];
+            return [false, '系统错误', true];
         } else {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
             if($resp['state'] == 'success' && $resp['code'] == 000) {
-                return [true, $resp['data']['id']];
+                return [true, $resp['data']['id'], false];
             }
-            return [false , $resp['message']];
+            return [false , $resp['message'], false];
         }
     }
 

+ 3 - 3
helper/refill/api/lingzh/binghc/RefillPhone.php

@@ -34,14 +34,14 @@ class RefillPhone extends refill\IRefillPhone
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
         if ($resp === false) {
-            return [false, '系统错误'];
+            return [false, '系统错误', true];
         } else {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
             if($resp['result'] == 'SUCCESS') {
-                return [true, $resp['orderNo']];
+                return [true, $resp['orderNo'], false];
             }
-            return [false , $resp['msg']];
+            return [false , $resp['msg'], false];
         }
     }
 

+ 3 - 3
helper/refill/api/lingzh/legou/RefillPhone.php

@@ -41,14 +41,14 @@ class RefillPhone extends refill\IRefillPhone
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
         if ($resp === false) {
-            return [false, '系统错误'];
+            return [false, '系统错误', true];
         } else {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
             if($resp['code']['status'] == 100000) {
-                return [true, $resp['obj']];
+                return [true, $resp['obj'], false];
             }
-            return [false , $resp['code']['desc']];
+            return [false , $resp['code']['desc'], false];
         }
     }
 

+ 3 - 3
helper/refill/api/lingzh/ruishun/RefillPhone.php

@@ -34,14 +34,14 @@ class RefillPhone extends refill\IRefillPhone
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false);
         if ($resp === false) {
-            return [false, '系统错误'];
+            return [false, '系统错误', true];
         } else {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
             if($resp['result'] == 'SUCCESS') {
-                return [true, $resp['orderNo']];
+                return [true, $resp['orderNo'], false];
             }
-            return [false , $resp['msg']];
+            return [false , $resp['msg'], false];
         }
     }
 

+ 3 - 3
helper/refill/api/lingzh/weisyd/RefillPhone.php

@@ -33,14 +33,14 @@ class RefillPhone extends refill\IRefillPhone
 
         $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
         if ($resp === false) {
-            return [false, '系统错误'];
+            return [false, '系统错误', true];
         } else {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
             if($resp['state'] == 'success' && $resp['code'] == 000) {
-                return [true, $resp['data']['id']];
+                return [true, $resp['data']['id'], false];
             }
-            return [false , $resp['message']];
+            return [false , $resp['message'], false];
         }
     }
 

+ 4 - 4
helper/refill/api/lingzh/wuchen/RefillPhone.php

@@ -50,18 +50,18 @@ class RefillPhone extends refill\IRefillPhone
         $params = json_encode($params);
         $resp = http_post_data(config::ORDER_URL, $params , $header);
         if ($resp === false) {
-            return [false, '系统错误'];
+            return [false, '系统错误', true];
         } else {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp ,true);
             if($resp['code'] == 10000) {
                 if($resp['data']['orders_success'][0]['state'] == 'success') {
-                    return [true, $resp['orders_success'][0]['sys_sn']];
+                    return [true, $resp['orders_success'][0]['sys_sn'], false];
                 }else{
-                    return [false , $resp['orders_failure'][0]['message']];
+                    return [false , $resp['orders_failure'][0]['message'], false];
                 }
             }else{
-                return [false , $resp['message']];
+                return [false , $resp['message'], false];
             }
         }
     }

+ 59 - 0
helper/refill/api/lingzh/yibao/RefillCallBack.php

@@ -0,0 +1,59 @@
+<?php
+
+
+namespace refill\yibao;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yibao/config.php');
+
+
+use refill;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $content  = $params['result'] . $params['msg'];
+        if(is_null($params['order'])) {
+            $content .= "null";
+        }else{
+            $content .= $params['order'];
+        }
+        $content .= $params['phone_no'] . $params['amount'] . $params['op_no'] . config::KEY;
+        return md5($content);
+    }
+
+
+    public function notify($params)
+    {
+        $status = intval($params['orderStatus']);
+        $order_sn = $params['orderNo'];
+        $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'];
+        
+        $data['official_sn'] = strtolower($params['carrierOrderNo']) == 'null' ? '' : $params['carrierOrderNo'];
+
+        if ($status === 2) {
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, false,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 120 - 0
helper/refill/api/lingzh/yibao/RefillPhone.php

@@ -0,0 +1,120 @@
+<?php
+
+namespace refill\yibao;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yibao/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, string $order_sn)
+    {
+        $params['appId'] = config::APP_ID;
+        $params['mobile'] = $phone;
+        $params['amount'] = $amount;
+        $params['orderNo'] = $order_sn;
+        $params['notifyUrl'] = config::NOTIFY_URL;
+
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params)
+    {
+        $params = $this->req_params($card_no, $amount, $params['order_sn']);
+        $productNo = $this->getproductNo($amount);
+        if($productNo == 0) {
+            return [false, '商品编号错误', false];
+        }
+        $params['productNo'] = $productNo;
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params , 'POST' , false , config::ExtHeaders);
+        if ($resp === false) {
+            return [false, '系统错误', true];
+        } else {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp ,true);
+            if($resp['code'] == 200) {
+                return [true, $resp['data']['tradeNo'], false];
+            }
+            return [false , $resp['msg'], false];
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['orderNo'] = $refill_info['order_sn'];
+        $params['appId'] = config::APP_ID;
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::QUERY_URL, $params , 'POST' , false , config::ExtHeaders);
+        if ($resp === false) {
+            return [false, '系统错误'];
+        } else {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+
+            if ($resp['code'] == 200) {
+                $order_state = -1;
+                $data = $resp['data'];
+                if ($data['orderStatus'] == 2) {
+                    $order_state = ORDER_STATE_SUCCESS;
+                    $save['official_sn'] = strtolower($data['carrierOrderNo']) == 'null' ? '' : $data['carrierOrderNo'];
+                    Model('refill_order')->edit($refill_info['order_id'], $save);
+                } elseif ($data['orderStatus'] == 3) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($data['orderStatus'] == 1) {
+                    $order_state = ORDER_STATE_SEND;
+                }
+                if ($order_state == -1) {
+                    return [false, $resp['msg']];
+                }
+                return [true, $order_state];
+            } else {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $content = '';
+        ksort($params);
+        foreach ($params as $key => $val){
+            if (false === $this->check_empty($val) && "@" != substr($val, 0, 1)) {
+                $content .= "{$key}={$val}&";
+            }
+        }
+        $content .= "key=".config::KEY;
+
+        return md5($content);
+    }
+
+    private function getproductNo(int $amount)
+    {
+        switch ($amount){
+            case 30:
+                return 2110000030101;
+                break;
+            case 50:
+                return 2110000050000;
+                break;
+            case 100:
+                return 21100000100000;
+                break;
+            case 200:
+                return 21100000200101;
+                break;
+            default:
+                return 0;
+        }
+    }
+}

+ 16 - 0
helper/refill/api/lingzh/yibao/config.php

@@ -0,0 +1,16 @@
+<?php
+
+
+namespace refill\yibao;
+
+
+class config
+{
+    const ORDER_URL = 'http://hxx.nvtu.ren/gateway/recharge';
+    const QUERY_URL = 'http://hxx.nvtu.ren/gateway/recharge/order';
+
+    const APP_ID = 'RC6f3bd0202e3e4489876ca876854ef813';
+    const KEY = 'ab2f6127ca8b4fe2b848228c1fceb12c';
+    const NOTIFY_URL = "http://121.89.212.167/racc/callback/lingzh/yibao.php";
+    const ExtHeaders = ['ContentType: application/x-www-form-urlencoded;'];
+}

+ 4 - 0
racc/callback/lingzh/yibao.php

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

+ 7 - 0
test/TestRefill.php

@@ -211,6 +211,13 @@ class TestRefill extends TestCase
 //        refill\RefillFactory::instance()->notify('wuchen',$input);
     }
 
+    public function testYibaoPhone()
+    {
+        $providers = new refill\yibao\RefillPhone([]);
+        $resp = $providers->add('13699279618', 5, 30, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '790668630498425006']);
+    }
+
     public function testWeisPhone()
     {
         $providers = new refill\weisyd\RefillPhone([]);