Prechádzať zdrojové kódy

Merge branch 'raccount' into rstanley

stanley-king 1 rok pred
rodič
commit
8f1adebd54
34 zmenil súbory, kde vykonal 460 pridanie a 415 odobranie
  1. 10 14
      admin/control/merchant.php
  2. 6 2
      admin/control/provider.php
  3. 7 4
      admin/control/refill_order_manual.php
  4. 4 0
      admin/control/refill_third.php
  5. 1 1
      admin/templates/default/provider.recharge.php
  6. 19 17
      data/config/xyz/refill.ini.php
  7. 14 3
      data/logic/queue.logic.php
  8. 2 2
      docker/compose/xyz/worker/docker-compose.yml
  9. 19 13
      helper/refill/api/xyz/feimingyu/RefillCallBack.php
  10. 71 58
      helper/refill/api/xyz/feimingyu/RefillPhone.php
  11. 37 52
      helper/refill/api/xyz/feimingyu/config.php
  12. 29 0
      helper/refill/api/xyz/feimingyu/对接文档-yezi.txt
  13. 0 33
      helper/refill/api/xyz/feimingyu/开户信息.txt
  14. BIN
      helper/refill/api/xyz/hanwei_fs/20230522广西辽宁移动江苏天津电信调价函.jpg
  15. 4 4
      helper/refill/api/xyz/hanwei_fs/config.php
  16. 6 5
      helper/refill/api/xyz/jiuyi/RefillCallBack.php
  17. 7 5
      helper/refill/api/xyz/jiuyi/RefillPhone.php
  18. 6 5
      helper/refill/api/xyz/lechongquan/RefillCallBack.php
  19. 7 5
      helper/refill/api/xyz/lechongquan/RefillPhone.php
  20. 3 3
      helper/refill/api/xyz/meixu/config.php
  21. 7 0
      helper/refill/api/xyz/meixu/对接文档-yezi.txt
  22. 6 5
      helper/refill/api/xyz/miaoxt_sec/RefillCallBack.php
  23. 7 5
      helper/refill/api/xyz/miaoxt_sec/RefillPhone.php
  24. 6 5
      helper/refill/api/xyz/tianchen/RefillCallBack.php
  25. 7 5
      helper/refill/api/xyz/tianchen/RefillPhone.php
  26. 6 5
      helper/refill/api/xyz/yiqian/RefillCallBack.php
  27. 8 6
      helper/refill/api/xyz/yiqian/RefillPhone.php
  28. 19 13
      helper/refill/api/yl/feimingyu/RefillCallBack.php
  29. 71 55
      helper/refill/api/yl/feimingyu/RefillPhone.php
  30. 37 52
      helper/refill/api/yl/feimingyu/config.php
  31. 29 0
      helper/refill/api/yl/feimingyu/对接文档-yelin.txt
  32. 0 33
      helper/refill/api/yl/feimingyu/开户信息.txt
  33. 4 4
      helper/refill/api/yl/hanwei_fs/config.php
  34. 1 1
      mobile/callback/refill_feimingyu.php

+ 10 - 14
admin/control/merchant.php

@@ -399,21 +399,17 @@ class merchantControl extends SystemControl
                         $insert['card_types'] = $param['card_type'];
                         $insert['quality'] = $quality;
                         $insert['pcode'] = $param['pcode'];
-                    }
-                    //删除旧费率
-                    $res = $model_merchant->delPrices(['mchid' => $mchid, 'quality' => $quality, 'pcode' => $param['pcode']]);
-                    if(!$res) {
-                        $trans->rollback();
-                        showMessage('删除旧费率失败');
-                    }
-                    $ret = true;
-                    //更新新费率
-                    if (!empty($insert)) {
+                        //删除旧费率
+                        $res = $model_merchant->delPrices(['mchid' => $mchid, 'quality' => $quality, 'pcode' => $param['pcode']]);
+                        if(!$res) {
+                            $trans->rollback();
+                            showMessage('删除旧费率失败');
+                        }
                         $ret = $model_merchant->table('merchant_price')->insert($insert);
-                    }
-                    if(!$ret) {
-                        $trans->rollback();
-                        showMessage('更新费率失败');
+                        if(!$ret) {
+                            $trans->rollback();
+                            showMessage('更新费率失败');
+                        }
                     }
                 }
                 $trans->commit();

+ 6 - 2
admin/control/provider.php

@@ -118,8 +118,12 @@ class providerControl extends SystemControl
     public function recharge_manualOp()
     {
         $provider_id = $_GET['provider_id'] ?? $_POST['provider_id'];
-        $provider_model = Model('refill_provider');
-        $provider_info = $provider_model->getProviderInfo(['provider_id' => $provider_id]);
+        $provider_info = Model('')->table('refill_provider,store')
+            ->field('refill_provider.*,store.store_name')
+            ->join('inner')
+            ->on('store.store_id=refill_provider.store_id')
+            ->where(['provider_id' => $provider_id])
+            ->find();
         if (empty($provider_info)) {
             showMessage('通道信息有误');
         }

+ 7 - 4
admin/control/refill_order_manual.php

@@ -239,6 +239,7 @@ class refill_order_manualControl extends SystemControl
             $merge = $input['merge'];
             $mchids = array_column($orders, 'mchid');
             $mchids = $this->unique_array($mchids);
+            $merchants = $providers = [];
             if($merge > 0 && count($mchids) > 1) {
                 showMessage('下游机构多家时,返销记录不可合并');
             }
@@ -322,7 +323,7 @@ class refill_order_manualControl extends SystemControl
 
                     if($ret && !$cbproxy)
                     {
-                        $provider_bz = "通道:{$store_id},椰子单号:{$order['order_sn']},卡号:{$order['card_no']},返销退款:{$order['channel_amount']}";
+                        $provider_bz = "店铺ID:{$store_id},椰子单号:{$order['order_sn']},卡号:{$order['card_no']},返销退款:{$order['channel_amount']}";
                         $this->credit_save_money($order['channel_amount'], 'add', $account_id, $provider_bz);
                         if ($merge > 0)
                         {
@@ -335,7 +336,7 @@ class refill_order_manualControl extends SystemControl
                                 $provider_amount['count'] += 1;
                             }
                         } else {
-                            $this->ct_provider_amount(['channel_amount' => $order['channel_amount']], $provider_info, $cur_time, $admininfo);
+                            $this->ct_provider_amount(['channel_amount' => $order['channel_amount']], $provider_info, $cur_time, $admininfo, $provider_bz);
                         }
                     }
 
@@ -352,8 +353,9 @@ class refill_order_manualControl extends SystemControl
                 $this->ct_refill_evidence(['mch_amount' => $refill_evidence['mch_amount'], 'bz' => $merchant_bz], $merchant_info, $cur_time, $admininfo);
             }
             if(!empty($provider_amount)) {
+                $provider_bz = "店铺ID:{$store_id},共返销单数:{$provider_amount['count']},返销退款总金额:{$provider_amount['channel_amount']}";
                 $provider_info = $providers[$store_id];
-                $this->ct_provider_amount(['channel_amount' => $provider_amount['channel_amount']], $provider_info, $cur_time, $admininfo);
+                $this->ct_provider_amount(['channel_amount' => $provider_amount['channel_amount']], $provider_info, $cur_time, $admininfo, $provider_bz);
             }
         }
         else
@@ -640,13 +642,14 @@ class refill_order_manualControl extends SystemControl
         return $ids;
     }
 
-    private function ct_provider_amount($params, $provider_info, $cur_time, $admininfo)
+    private function ct_provider_amount($params, $provider_info, $cur_time, $admininfo, $bz)
     {
         $input['provider_id'] = $provider_info['provider_id'];
         $input['memeber_id'] = $provider_info['account_id'];
         $input['amount'] = $params['channel_amount'];
         $input['operation'] = $admininfo['name'];
         $input['add_time'] = $cur_time;
+        $input['bz'] = $bz;
 
         return Model('provider_amount')->addAmount($input);
     }

+ 4 - 0
admin/control/refill_third.php

@@ -126,6 +126,10 @@ class refill_thirdControl extends SystemControl
         {
             $condition['store_id'] = $_GET['store_id'];
         }
+        if (trim($_GET['channel_product_name']) != '')
+        {
+            $condition['channel_product_name'] = ['like', '%' . $_GET['channel_product_name'] . '%'];
+        }
         $list = $mod->getProviderProductList($condition, 30);
 
         $providers = $this->providers(['type' => 3]);

+ 1 - 1
admin/templates/default/provider.recharge.php

@@ -20,7 +20,7 @@
             </tr>
             <tr class="noborder">
                 <td class="vatop rowform">
-                    <?php echo $output['provider']['name']; ?>
+                    <?php echo $output['provider']['name']; ?>(<?php echo $output['provider']['store_name']; ?>)
                 <td class="vatop tips"></td>
             </tr>
             <tr class="noborder">

+ 19 - 17
data/config/xyz/refill.ini.php

@@ -7527,38 +7527,40 @@ $bier_fs_phone = ['name' => 'bier_fs', 'store_id' => 272, 'qualitys' => '1',
 $lechongquan_phone = ['name' => 'lechongquan', 'store_id' => 273, 'qualitys' => '2',
     'amount' => [
         10 => [
-            ['goods_id' => 8271, 'price' => 10.35, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8271, 'price' => 10.4, 'quality' => 2, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 8271, 'price' => 10.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8271, 'price' => 10.4, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         20 => [
-            ['goods_id' => 8272, 'price' => 20.7, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8272, 'price' => 20.4, 'quality' => 2, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 8272, 'price' => 20.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8272, 'price' => 20.4, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         30 => [
-            ['goods_id' => 8273, 'price' => 30.66, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8273, 'price' => 30.45, 'quality' => 2, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 8273, 'price' => 30.39, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8273, 'price' => 30.45, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         50 => [
-            ['goods_id' => 8274, 'price' => 50.175, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8274, 'price' => 49.95, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8274, 'price' => 50.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8274, 'price' => 50.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 8274, 'price' => 50.5, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         100 => [
-            ['goods_id' => 8275, 'price' => 100.35, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8275, 'price' => 99.9, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8275, 'price' => 100.9, 'quality' => 2, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 8275, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8275, 'price' => 100.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8275, 'price' => 100.4, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         200 => [
-            ['goods_id' => 8276, 'price' => 200.7, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8276, 'price' => 199.8, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8276, 'price' => 200.6, 'quality' => 2, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 8276, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8276, 'price' => 200.4, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8276, 'price' => 200.8, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         300 => [
-            ['goods_id' => 8277, 'price' => 299.7, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8277, 'price' => 300.9, 'quality' => 2, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 8277, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8277, 'price' => 300.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8277, 'price' => 301.2, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         500 => [
-            ['goods_id' => 8278, 'price' => 501.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 8278, 'price' => 501, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8278, 'price' => 502, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];

+ 14 - 3
data/logic/queue.logic.php

@@ -1495,14 +1495,22 @@ class queueLogic
                 'except_desc' => $desc,
                 'add_time' => time()];
 
-            return $mod_except->add_except($params);
+            $mod_except->add_except($params);
+
+            return [$order_info,$refill_info];
         };
 
         $store_id = intval($params['store_id']);
         $channel_name = $params['channel_name'];
         $order_id = intval($params['order_id']);
 
-        $msg_adder($order_id);
+        $ret = $msg_adder($order_id);
+        if($ret === false) {
+            return callback(false, 'OnRiskSN:没找到订单');
+        }
+
+        [$order_info, $refill_info] = $ret;
+        $quality = intval($refill_info['quality']);
 
         if($store_id <= 0 || empty($channel_name)) {
             return callback(false, 'OnRiskSN 参数有空');
@@ -1512,7 +1520,10 @@ class queueLogic
         $item = $mod_provider->getProviderInfo(['store_id' => $store_id,'name' => $channel_name]);
 
         if (empty($item)) {
-            return callback(false, 'OnRiskSN 检查出多个通道');
+            return callback(false, 'OnRiskSN:没找到通道');
+        }
+        elseif($quality === 2) {
+            return callback(true, 'OnRiskSN:快充无需禁用通道.');
         }
         else
         {

+ 2 - 2
docker/compose/xyz/worker/docker-compose.yml

@@ -17,7 +17,7 @@ services:
           cpus: '8'
 
   queuesrv:
-    image: php-zts:7.3.18
+    image: php-zts-debug:7.3.18
     volumes:
       - ../../../../:/var/www/html
       - ../conf/etc/localtime:/etc/localtime:ro
@@ -28,7 +28,7 @@ services:
     command: [php,"/var/www/html/queue/index.php", "queue", "index"]
 
   searcher:
-    image: php-zts:7.3.18
+    image: php-zts-debug:7.3.18
     volumes:
       - ../../../../:/var/www/html
       - ../conf/etc/localtime:/etc/localtime:ro

+ 19 - 13
helper/refill/api/xyz/feimingyu/RefillCallBack.php

@@ -8,9 +8,7 @@ class RefillCallBack implements refill\IRefillCallBack
 {
     public function verify($params): bool
     {
-        $input = $params;
-        unset($input['sign']);
-        $sign = config::sign($input);
+        $sign = $this->sign($params);
         if ($params['sign'] == $sign) {
             return true;
         } else {
@@ -18,25 +16,33 @@ class RefillCallBack implements refill\IRefillCallBack
         }
     }
 
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
     public function notify($params)
     {
-        $status = $params['orderStatus'];
-        $order_sn = $params['applyNo'];
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false, false, ''];
+            return [false, false, false,false];
         }
 
         $order_id = $order_info['order_id'];
-        if ($status === 'SUCCESS') {
-            $official_sn = strtolower($params['ext1']) == 'null' ? '' : $params['ext1'];
-            $data['official_sn'] = $official_sn;
+        if ($status === 1) {
+            $data['official_sn'] = strtolower($params['remark1']) == 'null' ? '' : $params['remark1'];
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false, true, $official_sn];
-        } elseif ($status === 'FAILED') {
-            return [$order_id, false, true, true, ''];
+            return [$order_id, true, false, true];
+        } elseif ($status === 9) {
+            return [$order_id, false, true, true];
         } else {
-            return [$order_id, false, false, false, ''];
+            return [$order_id, false, false, false];
         }
     }
 }

+ 71 - 58
helper/refill/api/xyz/feimingyu/RefillPhone.php

@@ -14,15 +14,18 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
     }
 
-    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    private function req_params(int $phone, int $amount, $card_type, string $order_sn)
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['applyNo'] = $order_sn;
-        $params['rechargeNo'] = $phone;
-        $params['agentProductId'] = config::PRODUCT[$card_type][$amount];
-        $params['denomination'] = $amount;
-        $params['callbackUrl'] = config::NOTIFY_URL;
+        $params['userid'] = config::USER_ID;
+        $params['productid'] = config::ProductIdS[$card_type][$amount];
+        $params['price'] = $amount;
+        $params['num'] = 1;
+        $params['mobile'] = $phone;
+        $params['spordertime'] = date("YmdHis");
+        $params['sporderid'] = $order_sn;
+        $params['back_url'] = config::NOTIFY_URL;
+        $params['paytype'] = config::operator[$card_type];
+
         return $params;
     }
 
@@ -30,14 +33,9 @@ class RefillPhone extends refill\IRefillPhone
     {
         $order_sn = $params['order_sn'];
         $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
-        if(empty($params['agentProductId'])) {
-            return [false, '商品编号错误', false];
-        }
-        $sign = config::sign($params);
-        $params['sign'] = $sign;
 
-        $json_str = json_encode($params);
-        Log::record("feimingyu body : {$json_str}", Log::DEBUG);
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
 
@@ -47,69 +45,77 @@ class RefillPhone extends refill\IRefillPhone
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
+            $resp = $this->xmlToArray($resp);
             if (empty($resp)) {
                 return [false, '网络错误', true];
-            } elseif ($resp['code'] === '00000') {
-                return [true, $resp['data']['orderNo'], false];
-            } elseif ($resp['code'] === 'A0503') {
-                $net_errno = "HTTP-{$resp['code']}";
-                return [false, $resp['msg'], true];
+            }
+
+            $resultno = $resp['resultno'];
+            if (in_array($resultno, ['0', '2'], true)) {
+                return [true, $resp['orderid'], false];
+            } elseif (in_array($resultno, config::ERR_NOS, true)) {
+                return [false, $resultno, false];
+            } elseif ($resultno === '9999' || $resultno === '5006') {
+                $net_errno = "HTTP-{$resultno}";
+                return [false, $resultno, true];
             } else {
-                return [false, $resp['msg'], false];
+                //未知结果码
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resultno, true];
             }
         }
     }
 
     public function query($refill_info)
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['applyNo'] = $refill_info['order_sn'];
-        $params['sign'] = config::sign($params);
+        $params['userid'] = config::USER_ID;
+        $params['sporderid'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&sporderid={$params['sporderid']}&key={$key}";
+        $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
-            return [false, '网络错误', ''];
+            return [false, '网络错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
-            if (empty($resp)) {
-                return [false, '网络错误', ''];
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp))
+            {
+                return [false, '网络错误'];
             }
-            elseif ($resp['code'] === '00000')
+            else
             {
-                $offical_sn = '';
-                $status = $resp['data']['orderStatus'];
-                if ($status === 'SUCCESS') {
-                    $offical_sn = $resp['data']['ext1'];
-                    $updata['official_sn'] = $offical_sn;
+                $resultno = $resp['resultno'];
+                if ($resultno === '1') {
+                    $updata['official_sn'] = $resp['remark1'];
                     Model('refill_order')->edit($refill_info['order_id'], $updata);
                     $order_state = ORDER_STATE_SUCCESS;
-                } elseif ($status === 'FAILED') {
+                } elseif ($resultno === '9') {
                     $order_state = ORDER_STATE_CANCEL;
-                } elseif ($status === 'PROCESSING' || $status === 'INIT') {
+                } elseif (in_array($resultno, ['0','2'], true)) {
                     $order_state = ORDER_STATE_SEND;
+                } elseif ($resultno === '5007' && (time() - $refill_info['commit_time'] > 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
                 } else {
-                    return [false, $resp['msg'], $offical_sn];
+                    return [false, $resultno];
                 }
-                return [true, $order_state, $offical_sn];
-            }
-            else
-            {
-                return [false, $resp['msg'], ''];
+
+                return [true, $order_state];
             }
         }
     }
 
     public function balance()
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['sign'] = config::sign($params);
+        $params['userid'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&key={$key}";
+        $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
 
@@ -119,24 +125,31 @@ class RefillPhone extends refill\IRefillPhone
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
+            $resp = $this->xmlToArray($resp);
             if (empty($resp)) {
                 return [false, '网络错误'];
-            } elseif ($resp['code'] === '00000') {
-                return [true, $resp['data']['balance']];
+            } elseif ($resp['resultno'] === '1') {
+                return [true, $resp['balance']];
             } else {
-                return [false, $resp['msg']];
+                return [false, $resp['resultno']];
             }
         }
     }
 
-    /**
-     * 获取毫秒级别的时间戳
-     */
-    private function get_millisecond()
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
+        $content .= "&sporderid={$params['sporderid']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
+    public function xmlToArray($xml)
     {
-        list($msec, $sec) = explode(' ', microtime());
-        $msectime =  (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
-        return date('YmdHis').substr($msectime, -3);
+        $replace_str = str_replace(' ','','encoding="gb2312"');
+        $xml = mb_convert_encoding($xml,"UTF-8","gb2312");
+        $xml = str_replace($replace_str, "encoding='utf-8'", $xml);
+        return refill\util::xmlToArray($xml);
     }
 }

+ 37 - 52
helper/refill/api/xyz/feimingyu/config.php

@@ -6,59 +6,44 @@ namespace refill\feimingyu;
 use mtopcard;
 class config
 {
-    const ORDER_URL = 'http://119.91.194.222:9999/api/v1/order/submit';
-    const QUERY_URL = 'http://119.91.194.222:9999/api/v1/order/query';
-    const BALANCE_URL = 'http://119.91.194.222:9999/api/v1/agent/balance';
+    //https://www.showdoc.com.cn/AQL666666/
+    const ORDER_URL = 'http://60.204.138.14:9086/onlinepay.do';
+    const QUERY_URL= 'http://60.204.138.14:9086/searchpay.do';
+    const BALANCE_URL = 'http://60.204.138.14:9086/searchbalance.do';
 
-    const APP_ID = 'VIP006';
-    const APP_SECRET = 'Ik5APKkMhUJ9NQ6ntJ2R7g==';
+    const USER_ID= '10002543';
+    const KEY = 'NFBQYxrAKPGcDP32GWZhYeKTsPzDFjAi';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_feimingyu.php";
-    const PRODUCT = [
-        mtopcard\ChinaMobileCard => [
-            30  => 334,
-            50  => 335,
-            100 => 336,
-            200 => 337,
-        ],
-
-        mtopcard\ChinaUnicomCard => [
-            30  => 331,
-            50  => 330,
-            100 => 332,
-            200 => 333,
-        ],
-        mtopcard\ChinaTelecomCard => [
-            30  => 338,
-            50  => 339,
-            100 => 340,
-            200 => 341,
-        ]
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ERR_NOS = [
+        '5001','5002','5003','5004','5005','5008','5009','5010','5011','5012'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard =>
+            [
+                30  => '101687',
+                50  => '101688',
+                100 => '101689',
+                200 => '101690',
+            ],
+        mtopcard\ChinaUnicomCard =>
+            [
+                30  => '101705',
+                50  => '101706',
+                100 => '101707',
+                200 => '101708',
+            ],
+        mtopcard\ChinaTelecomCard =>
+            [
+                30  => '101723',
+                50  => '101724',
+                100 => '101725',
+                200 => '101726',
+            ]
     ];
-    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
-
-    public static function sign($params)
-    {
-        $params['appSecret'] = config::APP_SECRET;
-        ksort($params);
-        $content = '';
-        foreach ($params as $key => $value) {
-            if(self::check_empty($value) === false) {
-                $content .= "{$key}={$value}&";
-            }
-        }
-        $content = rtrim($content, '&');
-        return md5($content);
-    }
-
-    public static function check_empty($value)
-    {
-        if (!isset($value))
-            return true;
-        if ($value === null)
-            return true;
-        if (trim($value) === "")
-            return true;
-
-        return false;
-    }
 }

+ 29 - 0
helper/refill/api/xyz/feimingyu/对接文档-yezi.txt

@@ -0,0 +1,29 @@
+登录名:椰子全国
+密码:12345
+用户编码:10002543
+密钥:NFBQYxrAKPGcDP32GWZhYeKTsPzDFjAi
+客户注册和登录地址:
+http://60.204.138.14:7080/
+api接口文档地址:
+https://www.showdoc.com.cn/AQL666666/
+话费下单地址:
+http://60.204.138.14:9086/onlinepay.do
+订单主动查询地址:
+http://60.204.138.14:9086/searchpay.do
+余额查询:
+http://60.204.138.14:9086/searchbalance.do
+
+101687 全国移动话费30元直充
+101688 全国移动话费50元直充
+101689 全国移动话费100元直充
+101690 全国移动话费200元直充   折扣96.3
+
+101705 全国联通话费30元直充
+101706 全国联通话费50元直充
+101707 全国联通话费100元直充
+101708 全国联通话费200元直充  折扣93.5
+
+101723 全国电信话费30元直充
+101724 全国电信话费50元直充
+101725 全国电信话费100元直充
+101726 全国电信话费200元直充    折扣96

+ 0 - 33
helper/refill/api/xyz/feimingyu/开户信息.txt

@@ -1,33 +0,0 @@
-后台地址:http://119.91.194.222/login
-账号:VIP006
-默认密码:123456
-
-APPID:VIP006
-APPSECRET:Ik5APKkMhUJ9NQ6ntJ2R7g==
-
-后台-产品列表,可查看已配置商品信息
-后台-个人中心,可配置IP白名单
-回调地址请在提单接口动态传入
-产品已配置,产品ID请登录后台进行查看
-
-对接文档: https://galaxy168.yuque.com/yxumsu/dbqgf8?#%20%E3%80%8A%E6%98%9F%E4%BA%91%E5%B9%B3%E5%8F%B0%E3%80%8B
-
-话费直充接口:http://119.91.194.222:9999/api/v1/order/submit
-订单查询接口:http://119.91.194.222:9999/api/v1/order/query
-余额查询接口:http://119.91.194.222:9999/api/v1/agent/balance
-
-
-334	全国移动快充30
-335	全国移动快充50
-336	全国移动快充100
-337	全国移动快充200
-
-331	全国联通快充30
-330	全国联通快充50
-332	全国联通快充100
-333	全国联通快充200
-
-338	全国电信快充30
-339	全国电信快充50
-340	全国电信快充100
-341	全国电信快充200

BIN
helper/refill/api/xyz/hanwei_fs/20230522广西辽宁移动江苏天津电信调价函.jpg


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

@@ -176,10 +176,10 @@ class config
         "4-30-13" => 28.26, "4-50-13" => 47.1, "4-100-13" => 94.2, "4-200-13" => 188.4,//福建 13
         "4-30-10" => 28.65, "4-50-10" => 47.75, "4-100-10" => 95.5, "4-200-10" => 191,//江苏 10
         "4-50-3" => 47.5, "4-100-3" => 95, "4-200-3" => 190,//河北 3
-        "4-30-20" => 28.5, "4-50-20" => 47.5, "4-100-20" => 95, "4-200-20" => 190,//广西 20
+        "4-30-20" => 28.65, "4-50-20" => 47.75, "4-100-20" => 95.5, "4-200-20" => 191,//广西 20
         "4-50-22" => 47.4, "4-100-22" => 94.8, "4-200-22" => 189.6,//重庆 22
         "4-50-23" => 47.4, "4-100-23" => 94.8, "4-200-23" => 189.6,//四川 23
-        "4-30-6" => 28.29, "4-50-6" => 47.15, "4-100-6" => 94.3, "4-200-6" => 188.6,//辽宁 6
+        "4-30-6" => 28.29, "4-50-6" => 47.4, "4-100-6" => 94.8, "4-200-6" => 189.6,//辽宁 6
         "4-30-19" => 28.59, "4-50-19" => 47.65, "4-100-19" => 95.3, "4-200-19" => 190.6,//广东 19
         "4-50-14" => 47.25, "4-100-14" => 94.5, "4-200-14" => 189,//江西 14
         "4-50-17" => 47.5, "4-100-17" => 95, "4-200-17" => 190,//湖北 17
@@ -188,8 +188,8 @@ class config
         "6-30-11" => 28.2, "6-50-11" => 47, "6-100-11" => 94, "6-200-11" => 188,//浙江 11
         "6-30-23" => 28.2, "6-50-23" => 47, "6-100-23" => 94, "6-200-23" => 188,//四川 23
         "6-30-13" => 28.2, "6-50-13" => 47, "6-100-13" => 94, "6-200-13" => 188,//福建 13
-        "6-30-10" => 28.38, "6-50-10" => 47.3, "6-100-10" => 94.6, "6-200-10" => 189.2,//江苏 10
-        "6-30-2" => 28.38, "6-50-2" => 47.3, "6-100-2" => 94.6, "6-200-2" => 189.2,//天津 2
+        "6-30-10" => 28.44, "6-50-10" => 47.4, "6-100-10" => 94.8, "6-200-10" => 189.6,//江苏 10
+        "6-30-2" => 28.44, "6-50-2" => 47.4, "6-100-2" => 94.8, "6-200-2" => 189.6,//天津 2
         "6-30-12" => 28.38, "6-50-12" => 47.3, "6-100-12" => 94.6, "6-200-12" => 189.2,//安徽 12
         "6-30-19" => 28.38, "6-50-19" => 47.3, "6-100-19" => 94.6, "6-200-19" => 189.2,//广东 19
     ];

+ 6 - 5
helper/refill/api/xyz/jiuyi/RefillCallBack.php

@@ -39,20 +39,21 @@ class RefillCallBack implements refill\IRefillCallBack
         $order_sn = $params['out_trade_no'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false,false];
+            return [false, false, false, false, ''];
         }
         $order_id = $order_info['order_id'];
 
         if ($status === 2) {
-            $data['official_sn'] = strtolower($params['data']['official_id']) == 'null' ? '' : $params['data']['official_id'];
+            $official_sn = strtolower($params['data']['official_id']) == 'null' ? '' : $params['data']['official_id'];
+            $data['official_sn'] = $official_sn;
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false,true];
+            return [$order_id, true, false, true, $official_sn];
         }
         elseif ($status === 3) {
-            return [$order_id, false, true,true];
+            return [$order_id, false, true, true, ''];
         }
         else {
-            return [$order_id, false, false,false];
+            return [$order_id, false, false, false, ''];
         }
     }
 }

+ 7 - 5
helper/refill/api/xyz/jiuyi/RefillPhone.php

@@ -73,20 +73,22 @@ class RefillPhone extends refill\IRefillPhone
         $resp = http_post_data(config::QUERY_URL, $params , config::ExtHeaders);
 
         if (empty($resp)) {
-            return [false, '系统错误'];
+            return [false, '网络错误', ''];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
             if (empty($resp)) {
-                return [false, '系统错误'];
+                return [false, '网络错误', ''];
             }
             else
             {
+                $offical_sn = '';
                 $status = intval($resp['code']);
                 if ($status === 2) {
-                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $resp['data']['official_id']]);
+                    $offical_sn = $resp['data']['official_id'];
+                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $offical_sn]);
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($status === 3) {
                     $order_state = ORDER_STATE_CANCEL;
@@ -95,9 +97,9 @@ class RefillPhone extends refill\IRefillPhone
                 } elseif ($status === 5 && (time() - $refill_info['commit_time'] > 600)) {
                     $order_state = ORDER_STATE_NOEXIST;
                 } else {
-                    return [false, $resp['msg']];
+                    return [false, $resp['msg'], $offical_sn];
                 }
-                return [true, $order_state];
+                return [true, $order_state, $offical_sn];
             }
         }
     }

+ 6 - 5
helper/refill/api/xyz/lechongquan/RefillCallBack.php

@@ -31,20 +31,21 @@ class RefillCallBack implements refill\IRefillCallBack
         $order_sn = $params['szOrderId'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false,false];
+            return [false, false, false, false, ''];
         }
         $order_id = $order_info['order_id'];
 
         if ($status === 2) {
-            $data['official_sn'] = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            $official_sn = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            $data['official_sn'] = $official_sn;
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false,true];
+            return [$order_id, true, false, true, $official_sn];
         }
         elseif ($status === 3) {
-            return [$order_id, false, true,true];
+            return [$order_id, false, true, true, ''];
         }
         else {
-            return [$order_id, false, false,false];
+            return [$order_id, false, false, false, ''];
         }
     }
 }

+ 7 - 5
helper/refill/api/xyz/lechongquan/RefillPhone.php

@@ -76,19 +76,21 @@ class RefillPhone extends refill\IRefillPhone
         $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
-            return [false, '网络错误'];
+            return [false, '网络错误', ''];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
             if (empty($resp)) {
-                return [false, '网络错误'];
+                return [false, '网络错误', ''];
             }
 
+            $offical_sn = '';
             $status = $resp['nRtn'];
             if ($status === 5012) {
-                $updata['official_sn'] = $resp['szRtnMsg'];
+                $offical_sn = $resp['szRtnMsg'];
+                $updata['official_sn'] = $offical_sn;
                 Model('refill_order')->edit($refill_info['order_id'], $updata);
                 $order_state = ORDER_STATE_SUCCESS;
             } elseif ($status === 5013) {
@@ -98,10 +100,10 @@ class RefillPhone extends refill\IRefillPhone
             } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
                 $order_state = ORDER_STATE_NOEXIST;
             } else {
-                return [false, $resp['szRtnMsg']];
+                return [false, $resp['szRtnMsg'], $offical_sn];
             }
 
-            return [true, $order_state];
+            return [true, $order_state, $offical_sn];
         }
     }
 

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

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

+ 7 - 0
helper/refill/api/xyz/meixu/对接文档-yezi.txt

@@ -51,3 +51,10 @@
 
 2023.4.14
 100012 全国联通沃支付话费 50 元
+
+
+20230521
+100012 全国联通沃支付话费50元
+100013 全国联通沃支付话费100元
+100014 全国联通沃支付话费200元
+100015 全国联通沃支付话费300元

+ 6 - 5
helper/refill/api/xyz/miaoxt_sec/RefillCallBack.php

@@ -31,20 +31,21 @@ class RefillCallBack implements refill\IRefillCallBack
         $order_sn = $params['szOrderId'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false,false];
+            return [false, false, false, false, ''];
         }
         $order_id = $order_info['order_id'];
 
         if ($status === 2) {
-            $data['official_sn'] = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            $official_sn = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            $data['official_sn'] = $official_sn;
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false,true];
+            return [$order_id, true, false, true, $official_sn];
         }
         elseif ($status === 3) {
-            return [$order_id, false, true,true];
+            return [$order_id, false, true, true, ''];
         }
         else {
-            return [$order_id, false, false,false];
+            return [$order_id, false, false, false, ''];
         }
     }
 }

+ 7 - 5
helper/refill/api/xyz/miaoxt_sec/RefillPhone.php

@@ -79,18 +79,20 @@ class RefillPhone extends refill\IRefillPhone
         $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
-            return [false, '网络错误'];
+            return [false, '网络错误', ''];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
             if (empty($resp)) {
-                return [false, '网络错误'];
+                return [false, '网络错误', ''];
             }
+            $offical_sn = '';
             $status = intval($resp['nRtn']);
             if ($status === 5012) {
-                $updata['official_sn'] = $resp['szRtnMsg'];
+                $offical_sn = $resp['szRtnMsg'];
+                $updata['official_sn'] = $offical_sn;
                 Model('refill_order')->edit($refill_info['order_id'], $updata);
                 $order_state = ORDER_STATE_SUCCESS;
             } elseif ($status === 5013) {
@@ -100,9 +102,9 @@ class RefillPhone extends refill\IRefillPhone
             } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
                 $order_state = ORDER_STATE_NOEXIST;
             } else {
-                return [false, $status];
+                return [false, $status, $offical_sn];
             }
-            return [true, $order_state];
+            return [true, $order_state, $offical_sn];
         }
     }
 

+ 6 - 5
helper/refill/api/xyz/tianchen/RefillCallBack.php

@@ -30,19 +30,20 @@ class RefillCallBack implements refill\IRefillCallBack
         $order_sn = $params['orderid'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false,false];
+            return [false, false, false, false, ''];
         }
 
         $order_id = $order_info['order_id'];
         $status = intval($params['status']);
         if ($status === 1) {
-            $data['official_sn'] = strtolower($params['voucher']) == 'null' ? '' : $params['voucher'];
+            $official_sn = strtolower($params['voucher']) == 'null' ? '' : $params['voucher'];
+            $data['official_sn'] = $official_sn;
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false, true];
+            return [$order_id, true, false, true, $official_sn];
         } elseif ($status === 2) {
-            return [$order_id, false, true, true];
+            return [$order_id, false, true, true, ''];
         } else {
-            return [$order_id, false, false, false];
+            return [$order_id, false, false, false, ''];
         }
     }
 }

+ 7 - 5
helper/refill/api/xyz/tianchen/RefillPhone.php

@@ -67,19 +67,21 @@ class RefillPhone extends refill\IRefillPhone
         $resp = http_post_data(config::QUERY_URL, $params , config::ExtHeaders);
 
         if (empty($resp)) {
-            return [false, '系统错误'];
+            return [false, '系统错误', ''];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
             $resp = json_decode($resp, true);
             if (empty($resp)) {
-                return [false, '系统错误'];
+                return [false, '系统错误', ''];
             }
             else {
+                $offical_sn = '';
                 $status = $resp['status'];
                 if ($status === 2) {
-                    $updata['official_sn'] = $resp['voucher'];
+                    $offical_sn = $resp['voucher'];
+                    $updata['official_sn'] = $offical_sn;
                     Model('refill_order')->edit($refill_info['order_id'], $updata);
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($status === 3) {
@@ -89,9 +91,9 @@ class RefillPhone extends refill\IRefillPhone
                 } elseif ($status === 4 && (time() - $refill_info['commit_time'] >= 600)) {
                     $order_state = ORDER_STATE_NOEXIST;
                 } else {
-                    return [false, $status];
+                    return [false, $status, $offical_sn];
                 }
-                return [true, $order_state];
+                return [true, $order_state, $offical_sn];
             }
         }
     }

+ 6 - 5
helper/refill/api/xyz/yiqian/RefillCallBack.php

@@ -29,17 +29,18 @@ class RefillCallBack implements refill\IRefillCallBack
         $order_sn = $params['extOrderId'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false,false];
+            return [false, false, false, false, ''];
         }
 
         $order_id = $order_info['order_id'];
         if ($status === 4) {
-            Model('refill_order')->edit($order_id, ['official_sn' => $params['exchangeTraded'], 'ch_trade_no' => $params['orderId']]);
-            return [$order_id, true, false, true];
+            $official_sn = $params['exchangeTraded'];
+            Model('refill_order')->edit($order_id, ['official_sn' => $official_sn, 'ch_trade_no' => $params['orderId']]);
+            return [$order_id, true, false, true, $official_sn];
         } elseif ($status === 5) {
-            return [$order_id, false, true, true];
+            return [$order_id, false, true, true, ''];
         } else {
-            return [$order_id, false, false, false];
+            return [$order_id, false, false, false, ''];
         }
     }
 }

+ 8 - 6
helper/refill/api/xyz/yiqian/RefillPhone.php

@@ -60,7 +60,7 @@ class RefillPhone extends refill\IRefillPhone
 
         $resp = http_request(config::QUERY_URL, $params, 'POST');
         if (empty($resp)) {
-            return [false, '系统错误'];
+            return [false, '网络错误', ''];
         }
         else
         {
@@ -68,13 +68,15 @@ class RefillPhone extends refill\IRefillPhone
             $resp = json_decode($resp, true);
             if (empty($resp))
             {
-                return [false, '系统错误'];
+                return [false, '网络错误', ''];
             }
             elseif ($resp['code'] === 0)
             {
+                $offical_sn = '';
                 $status = intval($resp['data']);
                 if ($status === 4) {
-                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $resp['ext']['exchangeTraded']]);
+                    $offical_sn = $resp['ext']['exchangeTraded'];
+                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $offical_sn]);
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($status === 5) {
                     $order_state = ORDER_STATE_CANCEL;
@@ -83,14 +85,14 @@ class RefillPhone extends refill\IRefillPhone
                 } elseif ($status === -1 && time() - $refill_info['commit_time'] > 600){
                     $order_state = ORDER_STATE_NOEXIST;
                 } else {
-                    return [false, $status];
+                    return [false, $status, $offical_sn];
                 }
 
-                return [true, $order_state];
+                return [true, $order_state, $offical_sn];
             }
             else
             {
-                return [false, $resp['msg']];
+                return [false, $resp['msg'], ''];
             }
         }
     }

+ 19 - 13
helper/refill/api/yl/feimingyu/RefillCallBack.php

@@ -8,9 +8,7 @@ class RefillCallBack implements refill\IRefillCallBack
 {
     public function verify($params): bool
     {
-        $input = $params;
-        unset($input['sign']);
-        $sign = config::sign($input);
+        $sign = $this->sign($params);
         if ($params['sign'] == $sign) {
             return true;
         } else {
@@ -18,25 +16,33 @@ class RefillCallBack implements refill\IRefillCallBack
         }
     }
 
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
     public function notify($params)
     {
-        $status = $params['orderStatus'];
-        $order_sn = $params['applyNo'];
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
         $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
         if (empty($order_info)) {
-            return [false, false, false, false, ''];
+            return [false, false, false,false];
         }
 
         $order_id = $order_info['order_id'];
-        if ($status === 'SUCCESS') {
-            $official_sn = strtolower($params['ext1']) == 'null' ? '' : $params['ext1'];
-            $data['official_sn'] = $official_sn;
+        if ($status === 1) {
+            $data['official_sn'] = strtolower($params['remark1']) == 'null' ? '' : $params['remark1'];
             Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false, true, $official_sn];
-        } elseif ($status === 'FAILED') {
-            return [$order_id, false, true, true, ''];
+            return [$order_id, true, false, true];
+        } elseif ($status === 9) {
+            return [$order_id, false, true, true];
         } else {
-            return [$order_id, false, false, false, ''];
+            return [$order_id, false, false, false];
         }
     }
 }

+ 71 - 55
helper/refill/api/yl/feimingyu/RefillPhone.php

@@ -14,15 +14,18 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
     }
 
-    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    private function req_params(int $phone, int $amount, $card_type, string $order_sn)
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['applyNo'] = $order_sn;
-        $params['rechargeNo'] = $phone;
-        $params['agentProductId'] = config::PRODUCT[$card_type][$amount];
-        $params['denomination'] = $amount;
-        $params['callbackUrl'] = config::NOTIFY_URL;
+        $params['userid'] = config::USER_ID;
+        $params['productid'] = config::ProductIdS[$card_type][$amount];
+        $params['price'] = $amount;
+        $params['num'] = 1;
+        $params['mobile'] = $phone;
+        $params['spordertime'] = date("YmdHis");
+        $params['sporderid'] = $order_sn;
+        $params['back_url'] = config::NOTIFY_URL;
+        $params['paytype'] = config::operator[$card_type];
+
         return $params;
     }
 
@@ -30,10 +33,8 @@ class RefillPhone extends refill\IRefillPhone
     {
         $order_sn = $params['order_sn'];
         $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
-        if(empty($params['agentProductId'])) {
-            return [false, '商品编号错误', false];
-        }
-        $sign = config::sign($params);
+
+        $sign = $this->sign($params);
         $params['sign'] = $sign;
 
         $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
@@ -44,69 +45,77 @@ class RefillPhone extends refill\IRefillPhone
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
+            $resp = $this->xmlToArray($resp);
             if (empty($resp)) {
                 return [false, '网络错误', true];
-            } elseif ($resp['code'] === '00000') {
-                return [true, $resp['data']['orderNo'], false];
-            } elseif ($resp['code'] === 'A0503') {
-                $net_errno = "HTTP-{$resp['code']}";
-                return [false, $resp['msg'], true];
+            }
+
+            $resultno = $resp['resultno'];
+            if (in_array($resultno, ['0', '2'], true)) {
+                return [true, $resp['orderid'], false];
+            } elseif (in_array($resultno, config::ERR_NOS, true)) {
+                return [false, $resultno, false];
+            } elseif ($resultno === '9999' || $resultno === '5006') {
+                $net_errno = "HTTP-{$resultno}";
+                return [false, $resultno, true];
             } else {
-                return [false, $resp['msg'], false];
+                //未知结果码
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resultno, true];
             }
         }
     }
 
     public function query($refill_info)
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['applyNo'] = $refill_info['order_sn'];
-        $params['sign'] = config::sign($params);
+        $params['userid'] = config::USER_ID;
+        $params['sporderid'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&sporderid={$params['sporderid']}&key={$key}";
+        $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
 
         if (empty($resp)) {
-            return [false, '网络错误', ''];
+            return [false, '网络错误'];
         }
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
-            if (empty($resp)) {
-                return [false, '网络错误', ''];
+            $resp = $this->xmlToArray($resp);
+            if (empty($resp))
+            {
+                return [false, '网络错误'];
             }
-            elseif ($resp['code'] === '00000')
+            else
             {
-                $offical_sn = '';
-                $status = $resp['data']['orderStatus'];
-                if ($status === 'SUCCESS') {
-                    $offical_sn = $resp['data']['ext1'];
-                    $updata['official_sn'] = $offical_sn;
+                $resultno = $resp['resultno'];
+                if ($resultno === '1') {
+                    $updata['official_sn'] = $resp['remark1'];
                     Model('refill_order')->edit($refill_info['order_id'], $updata);
                     $order_state = ORDER_STATE_SUCCESS;
-                } elseif ($status === 'FAILED') {
+                } elseif ($resultno === '9') {
                     $order_state = ORDER_STATE_CANCEL;
-                } elseif ($status === 'PROCESSING' || $status === 'INIT') {
+                } elseif (in_array($resultno, ['0','2'], true)) {
                     $order_state = ORDER_STATE_SEND;
+                } elseif ($resultno === '5007' && (time() - $refill_info['commit_time'] > 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
                 } else {
-                    return [false, $resp['msg'], $offical_sn];
+                    return [false, $resultno];
                 }
-                return [true, $order_state, $offical_sn];
-            }
-            else
-            {
-                return [false, $resp['msg'], ''];
+
+                return [true, $order_state];
             }
         }
     }
 
     public function balance()
     {
-        $params['appId'] = config::APP_ID;
-        $params['timestamp'] = $this->get_millisecond();
-        $params['sign'] = config::sign($params);
+        $params['userid'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&key={$key}";
+        $params['sign'] = strtoupper(md5($content));
 
         $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
 
@@ -116,24 +125,31 @@ class RefillPhone extends refill\IRefillPhone
         else
         {
             Log::record($resp, Log::DEBUG);
-            $resp = json_decode($resp, true);
+            $resp = $this->xmlToArray($resp);
             if (empty($resp)) {
                 return [false, '网络错误'];
-            } elseif ($resp['code'] === '00000') {
-                return [true, $resp['data']['balance']];
+            } elseif ($resp['resultno'] === '1') {
+                return [true, $resp['balance']];
             } else {
-                return [false, $resp['msg']];
+                return [false, $resp['resultno']];
             }
         }
     }
 
-    /**
-     * 获取毫秒级别的时间戳
-     */
-    private function get_millisecond()
+    private function sign($params)
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
+        $content .= "&sporderid={$params['sporderid']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
+    public function xmlToArray($xml)
     {
-        list($msec, $sec) = explode(' ', microtime());
-        $msectime =  (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
-        return date('YmdHis').substr($msectime, -3);
+        $replace_str = str_replace(' ','','encoding="gb2312"');
+        $xml = mb_convert_encoding($xml,"UTF-8","gb2312");
+        $xml = str_replace($replace_str, "encoding='utf-8'", $xml);
+        return refill\util::xmlToArray($xml);
     }
 }

+ 37 - 52
helper/refill/api/yl/feimingyu/config.php

@@ -6,59 +6,44 @@ namespace refill\feimingyu;
 use mtopcard;
 class config
 {
-    const ORDER_URL = 'http://119.91.194.222:9999/api/v1/order/submit';
-    const QUERY_URL = 'http://119.91.194.222:9999/api/v1/order/query';
-    const BALANCE_URL = 'http://119.91.194.222:9999/api/v1/agent/balance';
+    //https://www.showdoc.com.cn/AQL666666/
+    const ORDER_URL = 'http://60.204.138.14:9086/onlinepay.do';
+    const QUERY_URL= 'http://60.204.138.14:9086/searchpay.do';
+    const BALANCE_URL = 'http://60.204.138.14:9086/searchbalance.do';
 
-    const APP_ID = 'VIP007';
-    const APP_SECRET = 'UuF9LDamNNYV70iZ8hjHdQ==';
+    const USER_ID= '10002544';
+    const KEY = 'eixtp3Gm7HfzDJXW2ziNTy5GW5AehWz3';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_feimingyu.php";
-    const PRODUCT = [
-        mtopcard\ChinaMobileCard => [
-            30  => 347,
-            50  => 348,
-            100 => 349,
-            200 => 350,
-        ],
-
-        mtopcard\ChinaUnicomCard => [
-            30  => 344,
-            50  => 343,
-            100 => 345,
-            200 => 346,
-        ],
-        mtopcard\ChinaTelecomCard => [
-            30  => 351,
-            50  => 352,
-            100 => 353,
-            200 => 354,
-        ]
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ERR_NOS = [
+        '5001','5002','5003','5004','5005','5008','5009','5010','5011','5012'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard =>
+            [
+                30  => '101687',
+                50  => '101688',
+                100 => '101689',
+                200 => '101690',
+            ],
+        mtopcard\ChinaUnicomCard =>
+            [
+                30  => '101705',
+                50  => '101706',
+                100 => '101707',
+                200 => '101708',
+            ],
+        mtopcard\ChinaTelecomCard =>
+            [
+                30  => '101723',
+                50  => '101724',
+                100 => '101725',
+                200 => '101726',
+            ]
     ];
-    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
-
-    public static function sign($params)
-    {
-        $params['appSecret'] = config::APP_SECRET;
-        ksort($params);
-        $content = '';
-        foreach ($params as $key => $value) {
-            if(self::check_empty($value) === false) {
-                $content .= "{$key}={$value}&";
-            }
-        }
-        $content = rtrim($content, '&');
-        return md5($content);
-    }
-
-    public static function check_empty($value)
-    {
-        if (!isset($value))
-            return true;
-        if ($value === null)
-            return true;
-        if (trim($value) === "")
-            return true;
-
-        return false;
-    }
 }

+ 29 - 0
helper/refill/api/yl/feimingyu/对接文档-yelin.txt

@@ -0,0 +1,29 @@
+登录名:椰林全国
+密码:12345
+用户编码:10002544
+密钥:eixtp3Gm7HfzDJXW2ziNTy5GW5AehWz3
+客户注册和登录地址:
+http://60.204.138.14:7080/
+api接口文档地址:
+https://www.showdoc.com.cn/AQL666666/
+话费下单地址:
+http://60.204.138.14:9086/onlinepay.do
+订单主动查询地址:
+http://60.204.138.14:9086/searchpay.do
+余额查询:
+http://60.204.138.14:9086/searchbalance.do
+
+101687 全国移动话费30元直充
+101688 全国移动话费50元直充
+101689 全国移动话费100元直充
+101690 全国移动话费200元直充   折扣96.3
+
+101705 全国联通话费30元直充
+101706 全国联通话费50元直充
+101707 全国联通话费100元直充
+101708 全国联通话费200元直充  折扣93.5
+
+101723 全国电信话费30元直充
+101724 全国电信话费50元直充
+101725 全国电信话费100元直充
+101726 全国电信话费200元直充    折扣96

+ 0 - 33
helper/refill/api/yl/feimingyu/开户信息.txt

@@ -1,33 +0,0 @@
-后台地址:http://119.91.194.222/login
-账号:VIP007
-默认密码:123456
-
-APPID:VIP007
-APPSECRET:UuF9LDamNNYV70iZ8hjHdQ==
-
-后台-产品列表,可查看已配置商品信息
-后台-个人中心,可配置IP白名单
-回调地址请在提单接口动态传入
-产品已配置,产品ID请登录后台进行查看
-
-对接文档: https://galaxy168.yuque.com/yxumsu/dbqgf8?#%20%E3%80%8A%E6%98%9F%E4%BA%91%E5%B9%B3%E5%8F%B0%E3%80%8B
-
-话费直充接口:http://119.91.194.222:9999/api/v1/order/submit
-订单查询接口:http://119.91.194.222:9999/api/v1/order/query
-余额查询接口:http://119.91.194.222:9999/api/v1/agent/balance
-
-
-347	全国移动快充30
-348	全国移动快充50
-349	全国移动快充100
-350	全国移动快充200
-
-344	全国联通快充30
-343	全国联通快充50
-345	全国联通快充100
-346	全国联通快充200
-
-351	全国电信快充30
-352	全国电信快充50
-353	全国电信快充100
-354	全国电信快充200

+ 4 - 4
helper/refill/api/yl/hanwei_fs/config.php

@@ -176,10 +176,10 @@ class config
         "4-30-13" => 28.26, "4-50-13" => 47.1, "4-100-13" => 94.2, "4-200-13" => 188.4,//福建 13
         "4-30-10" => 28.65, "4-50-10" => 47.75, "4-100-10" => 95.5, "4-200-10" => 191,//江苏 10
         "4-50-3" => 47.5, "4-100-3" => 95, "4-200-3" => 190,//河北 3
-        "4-30-20" => 28.5, "4-50-20" => 47.5, "4-100-20" => 95, "4-200-20" => 190,//广西 20
+        "4-30-20" => 28.65, "4-50-20" => 47.75, "4-100-20" => 95.5, "4-200-20" => 191,//广西 20
         "4-50-22" => 47.4, "4-100-22" => 94.8, "4-200-22" => 189.6,//重庆 22
         "4-50-23" => 47.4, "4-100-23" => 94.8, "4-200-23" => 189.6,//四川 23
-        "4-30-6" => 28.29, "4-50-6" => 47.15, "4-100-6" => 94.3, "4-200-6" => 188.6,//辽宁 6
+        "4-30-6" => 28.29, "4-50-6" => 47.4, "4-100-6" => 94.8, "4-200-6" => 189.6,//辽宁 6
         "4-30-19" => 28.59, "4-50-19" => 47.65, "4-100-19" => 95.3, "4-200-19" => 190.6,//广东 19
         "4-50-14" => 47.25, "4-100-14" => 94.5, "4-200-14" => 189,//江西 14
         "4-50-17" => 47.5, "4-100-17" => 95, "4-200-17" => 190,//湖北 17
@@ -188,8 +188,8 @@ class config
         "6-30-11" => 28.2, "6-50-11" => 47, "6-100-11" => 94, "6-200-11" => 188,//浙江 11
         "6-30-23" => 28.2, "6-50-23" => 47, "6-100-23" => 94, "6-200-23" => 188,//四川 23
         "6-30-13" => 28.2, "6-50-13" => 47, "6-100-13" => 94, "6-200-13" => 188,//福建 13
-        "6-30-10" => 28.38, "6-50-10" => 47.3, "6-100-10" => 94.6, "6-200-10" => 189.2,//江苏 10
-        "6-30-2" => 28.38, "6-50-2" => 47.3, "6-100-2" => 94.6, "6-200-2" => 189.2,//天津 2
+        "6-30-10" => 28.44, "6-50-10" => 47.4, "6-100-10" => 94.8, "6-200-10" => 189.6,//江苏 10
+        "6-30-2" => 28.44, "6-50-2" => 47.4, "6-100-2" => 94.8, "6-200-2" => 189.6,//天津 2
         "6-30-12" => 28.38, "6-50-12" => 47.3, "6-100-12" => 94.6, "6-200-12" => 189.2,//安徽 12
         "6-30-19" => 28.38, "6-50-19" => 47.3, "6-100-19" => 94.6, "6-200-19" => 189.2,//广东 19
     ];

+ 1 - 1
mobile/callback/refill_feimingyu.php

@@ -1,4 +1,4 @@
 <?php
 
 refill\util::push_notify('feimingyu',$_POST);
-echo json_encode(['code' => '00000']);
+echo ('OK');