فهرست منبع

Merge branch 'fix' into mh

stanley-king 1 سال پیش
والد
کامیت
a10237009b
97فایلهای تغییر یافته به همراه2283 افزوده شده و 657 حذف شده
  1. 18 0
      crontab/control/minutes.php
  2. 63 3
      data/config/xyz/refill.ini.php
  3. 46 0
      data/config/yl/refill.ini.php
  4. 3 0
      docker/compose/docker-compose.networks.yml
  5. 9 0
      docker/compose/homecuda/ReadMe.MD
  6. 0 29
      docker/compose/homecuda/acc/docker-compose.yml
  7. 38 19
      docker/compose/homecuda/admin/docker-compose.yml
  8. 0 18
      docker/compose/homecuda/admin_vendor/docker-compose.yml
  9. 3 28
      docker/compose/homecuda/cli/docker-compose.yml
  10. 24 0
      docker/compose/homecuda/compose.env
  11. 17 0
      docker/compose/homecuda/conf/crontab/master_root
  12. 124 0
      docker/compose/homecuda/conf/nginx/admin.conf
  13. 67 0
      docker/compose/homecuda/conf/nginx/macc.conf
  14. 68 0
      docker/compose/homecuda/conf/nginx/racc.conf
  15. 0 12
      docker/compose/homecuda/conf/php/mch-spwan-start
  16. 0 11
      docker/compose/homecuda/conf/php/mobile-spwan-start
  17. 17 0
      docker/compose/homecuda/conf/php/spwan-start
  18. 0 11
      docker/compose/homecuda/conf/php/vapi-spwan-start
  19. 1 1
      docker/compose/homecuda/conf/php/vender-init
  20. 2 0
      docker/compose/homecuda/container.env
  21. 10 0
      docker/compose/homecuda/cpenv
  22. 0 19
      docker/compose/homecuda/database/docker-compose.yml
  23. 37 0
      docker/compose/homecuda/macc/docker-compose.yml
  24. 24 15
      docker/compose/homecuda/master-crond/docker-compose.yml
  25. 0 14
      docker/compose/homecuda/plot/docker-compose.yml
  26. 35 0
      docker/compose/homecuda/racc/docker-compose.yml
  27. 30 33
      docker/compose/homecuda/slave-crond/docker-compose.yml
  28. 0 42
      docker/compose/homecuda/statcalc/docker-compose.yml
  29. 0 16
      docker/compose/homecuda/statwriter/docker-compose.yml
  30. 6 6
      docker/compose/homecuda/storage/docker-compose.yml
  31. 20 0
      docker/compose/homecuda/vendor/docker-compose.yml
  32. 25 20
      docker/compose/homecuda/worker/docker-compose.yml
  33. 9 0
      docker/compose/netcreate
  34. 0 5
      fooder.php
  35. 1 1
      helper/fcgisrv/BaseServer.php
  36. 35 5
      helper/fcgisrv/XYZRAccServer.php
  37. BIN
      helper/refill/api/xyz/guochuang/20231109辽宁移动调价函.jpg
  38. BIN
      helper/refill/api/xyz/guochuang/20231113广东辽宁移动调价函.jpg
  39. 2 2
      helper/refill/api/xyz/guochuang/config.php
  40. 3 1
      helper/refill/api/xyz/lechongquan/RefillPhone.php
  41. 9 0
      helper/refill/api/xyz/lechongquan/api.txt
  42. 20 0
      helper/refill/api/xyz/lechongquan/config.php
  43. 40 0
      helper/refill/api/xyz/liantuo_high/API.MD
  44. 49 0
      helper/refill/api/xyz/liantuo_high/RefillCallBack.php
  45. 163 0
      helper/refill/api/xyz/liantuo_high/RefillPhone.php
  46. 50 0
      helper/refill/api/xyz/liantuo_high/config.php
  47. 22 0
      helper/refill/api/xyz/miaoxt_tax_trd/API.MD
  48. 52 0
      helper/refill/api/xyz/miaoxt_tax_trd/RefillCallBack.php
  49. 141 0
      helper/refill/api/xyz/miaoxt_tax_trd/RefillPhone.php
  50. 27 0
      helper/refill/api/xyz/miaoxt_tax_trd/config.php
  51. 2 2
      helper/refill/api/yl/guochuang/config.php
  52. 22 0
      helper/refill/api/yl/miaoxt_tax_sec/API.MD
  53. 52 0
      helper/refill/api/yl/miaoxt_tax_sec/RefillCallBack.php
  54. 141 0
      helper/refill/api/yl/miaoxt_tax_sec/RefillPhone.php
  55. 27 0
      helper/refill/api/yl/miaoxt_tax_sec/config.php
  56. 4 0
      mobile/callback/refill_liantuo_high.php
  57. 4 0
      mobile/callback/refill_miaoxt_tax_sec.php
  58. 4 0
      mobile/callback/refill_miaoxt_tax_trd.php
  59. 0 1
      mobile/config/config.ini.php
  60. 4 1
      mobile/index.php
  61. 0 4
      racc/callback/lingzh/aming.php
  62. 0 4
      racc/callback/lingzh/amingjd.php
  63. 0 4
      racc/callback/lingzh/amingjdman.php
  64. 0 10
      racc/callback/lingzh/amingyd.php
  65. 0 4
      racc/callback/lingzh/baizeyd.php
  66. 0 4
      racc/callback/lingzh/binghc.php
  67. 0 4
      racc/callback/lingzh/chuka.php
  68. 0 4
      racc/callback/lingzh/feiniao.php
  69. 0 10
      racc/callback/lingzh/fensheng.php
  70. 0 4
      racc/callback/lingzh/haohao.php
  71. 0 4
      racc/callback/lingzh/juzhuo.php
  72. 0 4
      racc/callback/lingzh/legou.php
  73. 0 4
      racc/callback/lingzh/riying.php
  74. 0 4
      racc/callback/lingzh/ruishun.php
  75. 0 4
      racc/callback/lingzh/sctongqian.php
  76. 0 4
      racc/callback/lingzh/shengying.php
  77. 0 4
      racc/callback/lingzh/wailing.php
  78. 0 4
      racc/callback/lingzh/weishengy.php
  79. 0 4
      racc/callback/lingzh/weishengyjd.php
  80. 0 4
      racc/callback/lingzh/weishengysix.php
  81. 0 4
      racc/callback/lingzh/weishengywt.php
  82. 0 8
      racc/callback/lingzh/wuchen.php
  83. 0 4
      racc/callback/lingzh/yezi.php
  84. 0 5
      racc/callback/lingzh/yibao.php
  85. 5 0
      racc/config/config.ini.php
  86. 0 151
      racc/control/base.php
  87. 3 3
      racc/control/merchant.php
  88. 421 57
      racc/control/refill.php
  89. 9 0
      racc/framework/function/function.php
  90. 1 0
      racc/framework/index.html
  91. 4 2
      racc/index.php
  92. 0 0
      racc/language/index.html
  93. 10 0
      racc/language/zh_cn/mobile.php
  94. 3 15
      racc/racc.php
  95. 1 0
      racc/templates/index.html
  96. 231 0
      racc/util/errcode.php
  97. 25 1
      test/TestRefill.php

+ 18 - 0
crontab/control/minutes.php

@@ -457,6 +457,24 @@ class minutesControl extends BaseCronControl
         }
     }
 
+    //更新统计业务数据
+    public function statOp()
+    {
+        Log::short_name('stat');
+        while (true)
+        {
+            try {
+                $this->_update_earlist_send();
+                $this->_calc_arrears();
+
+            } catch (Exception $ex) {
+                Log::record($ex->getMessage(), Log::ERR);
+            }
+
+            sleep(1);
+        }
+    }
+
     private function _update_earlist_send()
     {
         //查找最早的充值中的订单时间

+ 63 - 3
data/config/xyz/refill.ini.php

@@ -7650,15 +7650,15 @@ $lechongquan_phone = ['name' => 'lechongquan', 'store_id' => 273, 'qualitys' =>
     'amount' => [
         10 => [
             ['goods_id' => 8271, 'price' => 10.2, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 8271, 'price' => 10.4, 'quality' => 2, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 8271, 'price' => 10.35, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         20 => [
             ['goods_id' => 8272, 'price' => 20.4, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 8272, 'price' => 20.4, 'quality' => 2, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 8272, 'price' => 20.32, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         30 => [
             ['goods_id' => 8273, 'price' => 30.39, 'quality' => 2, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 8273, 'price' => 30.45, 'quality' => 2, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 8273, 'price' => 30.42, 'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         50 => [
             ['goods_id' => 8274, 'price' => 50.25, 'quality' => 2, 'card_type' => 'chinamobile'],
@@ -9918,6 +9918,64 @@ $yiqiandq_fs_phone = ['name' => 'yiqiandq_fs', 'store_id' => 378, 'qualitys' =>
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$liantuo_high_phone = ['name' => 'liantuo_high', 'store_id' => 379, 'qualitys' => '1',
+    'amount' => [
+//        10 => [['goods_id' => 8969, 'price' => 9.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        20 => [['goods_id' => 8970, 'price' => 19.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 8971, 'price' => 29.4, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 8972, 'price' => 49, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 8973, 'price' => 98, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 8974, 'price' => 196, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        300 => [['goods_id' => 8975, 'price' => 294, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        500 => [['goods_id' => 8976, 'price' => 490, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$miaoxt_tax_trd_phone = ['name' => 'miaoxt_tax_trd', 'store_id' => 380, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 8977, 'price' => 10, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8977, 'price' => 10, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8977, 'price' => 10, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 8978, 'price' => 20, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8978, 'price' => 20, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8978, 'price' => 20, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        30 => [
+//            ['goods_id' => 8979, 'price' => 30, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8979, 'price' => 30, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8979, 'price' => 30, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        50 => [
+            ['goods_id' => 8980, 'price' => 52.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8980, 'price' => 51.65, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8980, 'price' => 52.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8981, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8981, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8981, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8982, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8982, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8982, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+//        300 => [
+//            ['goods_id' => 8983, 'price' => 300, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8983, 'price' => 300, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8983, 'price' => 300, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8984, 'price' => 500, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8984, 'price' => 500, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8984, 'price' => 500, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_p hone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -10217,6 +10275,8 @@ $phone_providers = [
     ['name' => 'yeyekami', 'cfg' => $yeyekami_phone],
     ['name' => 'yiqiandq', 'cfg' => $yiqiandq_phone],
     ['name' => 'yiqiandq_fs', 'cfg' => $yiqiandq_fs_phone],
+    ['name' => 'liantuo_high', 'cfg' => $liantuo_high_phone],
+    ['name' => 'miaoxt_tax_trd', 'cfg' => $miaoxt_tax_trd_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

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

@@ -7793,6 +7793,51 @@ $liantuo_fs_phone = ['name' => 'liantuo_fs', 'store_id' => 303, 'qualitys' => '1
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$miaoxt_tax_sec_phone = ['name' => 'miaoxt_tax_sec', 'store_id' => 304, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 8435, 'price' => 10.025, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8435, 'price' => 10.05, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8435, 'price' => 10.17, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 8436, 'price' => 20.05, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8436, 'price' => 20.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8436, 'price' => 20.34, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        30 => [
+//            ['goods_id' => 8437, 'price' => 30.105, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8437, 'price' => 30.03, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8437, 'price' => 30.51, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        50 => [
+            ['goods_id' => 8438, 'price' => 52.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8438, 'price' => 51.65, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8438, 'price' => 52.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8439, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8439, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8439, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8440, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8440, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8440, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+//        300 => [
+//            ['goods_id' => 8441, 'price' => 300.75, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8441, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8441, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8442, 'price' => 501.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8442, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8442, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -8043,6 +8088,7 @@ $phone_providers = [
     ['name' => 'beirui_fs', 'cfg' => $beirui_fs_phone],
     ['name' => 'liantuo_nation', 'cfg' => $liantuo_nation_phone],
     ['name' => 'liantuo_fs', 'cfg' => $liantuo_fs_phone],
+    ['name' => 'miaoxt_tax_sec', 'cfg' => $miaoxt_tax_sec_phone],
 ];
 
 $config['phone_providers'] = $phone_providers;

+ 3 - 0
docker/compose/docker-compose.networks.yml

@@ -0,0 +1,3 @@
+networks:
+  homecuda_network:
+    external: true

+ 9 - 0
docker/compose/homecuda/ReadMe.MD

@@ -0,0 +1,9 @@
+## macc
+对应模块mobile,老版本的处理充值。
+
+## racc
+对应模块racc,新的独立版本的处理充值。
+
+
+# Port映射表 
+acc-> 8100:80

+ 0 - 29
docker/compose/homecuda/acc/docker-compose.yml

@@ -1,29 +0,0 @@
-version: "3.7"
-
-services:
-  nginx:
-    image: nginx:alpine
-    ports:
-      - 8100:80
-    volumes:
-      - ../../../../:/var/www/html
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - ../conf/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
-      - /mnt/upload:/var/www/html/data/upload
-      - /mnt/merchant:/var/www/html/merchant
-    container_name: "panda-nginx"
-    command: [nginx,'-g','daemon off;']
-    extra_hosts:
-      - "docker.hostip:172.17.0.1"
-
-  mobile:
-    image: php-zts:7.3.18
-    volumes:
-      - ../../../../:/var/www/html
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - ../conf/php/php-debug.ini:/usr/local/etc/php/php.ini
-      - /mnt/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-      - ../conf/php/mobile-spwan-start:/usr/local/bin/docker-spwan-start
-    container_name: "panda-mobile"
-    command: ['docker-spwan-start']

+ 38 - 19
docker/compose/homecuda/admin/docker-compose.yml

@@ -1,32 +1,51 @@
-version: "3.7"
+version: "3.9"
+
+include:
+  - ../../docker-compose.networks.yml
 
 services:
-  mchsrv:
-    image: php-zts:7.3.18
+  nginx:
+    image: nginx:alpine
     ports:
-      - "9102:9102"
+      - ${ADMINGINX_PORT}:80
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
+      - ../conf/etc/localtime:/etc/localtime:ro
+      - ../conf/nginx/admin.conf:/etc/nginx/nginx.conf:ro
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${MERCHANT_PATH}:${SHOP_ROOT_PATH}/merchant
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-adnginx"
+    command: [ nginx,'-g','daemon off;' ]
+    extra_hosts:
+      - docker.hostip:172.17.0.1
+    networks:
+      - ${DOCKER_NET_NAME}
+
+  mch:
+    image: php-zts:7.3.18
+    volumes:
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php.ini:/usr/local/etc/php/php.ini
-      - ../conf/php/mch-spwan-start:/usr/local/bin/docker-spwan-start
-      - /mnt/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-merchant"
-    command: [docker-spwan-start]
+      - ../conf/php/spwan-start:/usr/local/bin/spwan-start
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: '${CONTAINER_PREFIX}-admch'
+    command: [ spwan-start,"/mchsrv/mchsrv_run.php","mchsrv.log" ]
+    networks:
+      - ${DOCKER_NET_NAME}
 
-  websrv:
+  web:
     image: php-fpm:alpine
-    ports:
-      - 9000:9000
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php-debug.ini:/usr/local/etc/php/php.ini
       - ../conf/php-fpm/php-fpm.conf:/usr/local/etc/php-fpm.conf
-      - /mnt/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-web"
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: '${CONTAINER_PREFIX}-adweb'
     command: [php-fpm]
-    extra_hosts:
-      - "docker.hostip:172.17.0.1"
+    networks:
+      - ${DOCKER_NET_NAME}

+ 0 - 18
docker/compose/homecuda/admin_vendor/docker-compose.yml

@@ -1,18 +0,0 @@
-version: "3.7"
-
-services:
-  nginx:
-    image: nginx:alpine
-    ports:
-      - "8080:80"
-    volumes:
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - ../conf/nginx/nginx_vendor.conf:/etc/nginx/nginx.conf:ro
-    container_name: "yl-nginx"
-    command: [nginx,'-g','daemon off;']
-    extra_hosts:
-      - "docker.hostip:172.17.0.1"
-    deploy:
-      resources:
-        limits:
-          cpus: '8'

+ 3 - 28
docker/compose/homecuda/cli/docker-compose.yml

@@ -1,4 +1,4 @@
-version: "3.7"
+version: "3.9"
 
 services:
   phpcli:
@@ -7,7 +7,7 @@ services:
       - /mnt/xyzshop:/var/www/html
       - /mnt/xyzshop/docker/compose/homecuda/conf/etc/localtime:/etc/localtime:ro
       - /mnt/xyzshop/docker/compose/homecuda/conf/php/php-debug.ini:/usr/local/etc/php/php.ini
-      - /data/shop_share/upload:/var/www/html/data/upload
+      - /mnt/upload:/var/www/html/data/upload
       - /mnt/shoplog:/var/www/html/data/log
     container_name: "panda-php"
 
@@ -20,29 +20,4 @@ services:
       - /mnt/upload:/var/www/html/data/upload
       - /mnt/shoplog:/var/www/html/data/log
       - ../conf/php/vender-init:/usr/local/bin/vender-init
-    container_name: "panda-swoole"
-
-  vender:
-    image: php-zts:7.3.18
-    volumes:
-      - ../../../../:/var/www/html
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - ../conf/php/vender-init:/usr/local/bin/vender-init
-      - ../conf/php/php.ini:/usr/local/etc/php/php.ini
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-vender"
-    command: ['vender-init']
-
-  pythoncli:
-    image: pycpu:3.7.10
-#    ports:
-#      - 5000:5000
-    volumes:
-      - /mnt/xyzshop/docker/compose/homecuda/conf/etc/localtime:/etc/localtime:ro
-      - /mnt/xyzshop:/var/www/html
-      - /mnt/shoplog:/var/www/html/data/log
-      - /mnt/stdata:/var/www/html/data/stdata
-    container_name: "panda-python"
-    extra_hosts:
-      - "docker.hostip:172.17.0.1"
+    container_name: "panda-swoole"

+ 24 - 0
docker/compose/homecuda/compose.env

@@ -0,0 +1,24 @@
+#Mobile接入层Nigix端口
+MACCNGINX_PORT=8100
+#Refill接入层Nginx端口
+RACCNGINX_PORT=8200
+#Admin后台Nginx端口
+ADMINGINX_PORT=8300
+#ReadMine Nigix 端口
+RMINE_NGINX_PORT=8080
+#主站上传文件路径
+SHOP_UPLOAD_PATH=/mnt/upload
+#日志路径
+SHOP_LOG_PATH=/mnt/shoplog
+#机构后台页面路径
+MERCHANT_PATH=/mnt/merchant
+#大数据存储路径
+STDATA_PATH=/mnt/stdata
+#docker 网络名称
+DOCKER_NET_NAME=homecuda_network
+#docker 容器名称前缀
+CONTAINER_PREFIX=shome
+#商城部署到容器的根目录
+SHOP_ROOT_PATH=/var/www/html
+#系统REDIS端口
+SHOP_REDIS_PORT=6379

+ 17 - 0
docker/compose/homecuda/conf/crontab/master_root

@@ -0,0 +1,17 @@
+# do daily/weekly/monthly maintenance
+# min	hour	day	month	weekday	command
+#*/15	*	*	*	*	run-parts /etc/periodic/15min
+#0	*	*	*	*	run-parts /etc/periodic/hourly
+#0	2	*	*	*	run-parts /etc/periodic/daily
+#0	3	*	*	6	run-parts /etc/periodic/weekly
+#0	5	1	*	*	run-parts /etc/periodic/monthly
+#0   3   *   *   *   php /var/www/html/crontab/index.php date index
+#0   9   *   *   *   php /var/www/html/crontab/index.php date nine_clock
+#0   10  *   *   *   php /var/www/html/crontab/index.php date ten_clock
+*    *   *   *   *   php /var/www/html/crontab/index.php minutes index
+#0   10-20/1 *   *   *   php /var/www/html/crontab/index.php hour index
+#0   3   1   */1 *   php /var/www/html/crontab/index.php month index
+*    *   *   *   *   echo "test" >> /var/test.log
+
+#0   1   *   *   *   php /var/www/html/crontab/index.php date _order_stats
+

+ 124 - 0
docker/compose/homecuda/conf/nginx/admin.conf

@@ -0,0 +1,124 @@
+user nginx;
+worker_processes  16;
+error_log   /var/www/html/data/log/anginx.log  debug;
+worker_rlimit_nofile 10240;
+
+events {
+    worker_connections  8192;
+    multi_accept on;
+    use epoll;
+}
+
+http 
+{
+    include       mime.types;
+    default_type  application/octet-stream;
+
+    underscores_in_headers on;
+    client_max_body_size 32M;
+    client_body_buffer_size 1024K;
+
+    tcp_nopush on;
+
+    sendfile            on;
+    keepalive_timeout   300;
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    server 
+    {
+    	listen       80;
+        set  $folder_name /var/www/html;
+        server_name 192.168.3.104;
+        root $folder_name;
+        index index.html index.php; 
+
+    	proxy_connect_timeout 500s;
+        proxy_read_timeout 500s;
+        proxy_send_timeout 500s;
+
+        fastcgi_connect_timeout 75;
+        fastcgi_read_timeout 600;   
+        fastcgi_send_timeout 600;
+        fastcgi_buffer_size  32K;
+        fastcgi_buffers      32 32K;
+
+        set_real_ip_from 100.64.0.0/10;
+        real_ip_header X-Forwarded-For;
+
+        charset utf-8;
+
+        location /data/log {
+            deny all;
+            return 403;
+        }
+        location / {
+            index  index.html index.htm index.php;
+        }
+
+        location ~ /mobile {
+            deny all;
+            return 403;
+        }
+
+        location ~ /racc {
+            deny all;
+            return 403;
+        }
+
+        location /mshop {
+            root $folder_name;
+            autoindex on;        
+            index  index.html index.htm index.php;
+	        try_files $uri $uri/ /mshop/index.html;
+        }
+
+        location /plot {
+            root $folder_name;
+            proxy_pass         http://docker.hostip:5000;
+            proxy_redirect     off;
+
+            proxy_set_header   Host                 $host;
+            proxy_set_header   X-Real-IP            $remote_addr;
+            proxy_set_header   X-Forwarded-For      $proxy_add_x_forwarded_for;
+            proxy_set_header   X-Forwarded-Proto    $scheme;
+        }
+
+        location /merchant {
+            root $folder_name;
+            autoindex on;
+            index  index.html index.htm index.php;
+            try_files $uri $uri/ /merchant/index.html;
+        }
+
+        location ~ /mchsrv/[/\w]+\.php$ {
+            root           $folder_name;
+            fastcgi_pass   mch:9102;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME  $folder_name$fastcgi_script_name;
+            fastcgi_param SIGN $http_sign;
+            include fastcgi_params;
+        }
+
+        location ~ \.php$ {
+	        add_header Cache-Control no-store;
+            root           $folder_name;
+            fastcgi_pass   web:9000;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME  $folder_name$fastcgi_script_name;
+            fastcgi_buffer_size  1024K;
+            fastcgi_buffers      32 1024K;
+            proxy_buffer_size  128k;     #设置缓冲区的大小和数量
+            proxy_buffers 100  128k;     #
+            proxy_read_timeout 900s;
+            proxy_send_timeout 900s;
+            fastcgi_read_timeout 900;
+            fastcgi_send_timeout 900;
+            keepalive_timeout    900;
+
+            include        fastcgi_params;
+        }
+    }
+}

+ 67 - 0
docker/compose/homecuda/conf/nginx/macc.conf

@@ -0,0 +1,67 @@
+user nginx;
+worker_processes  16;
+error_log   /var/www/html/data/log/mnginx.log info;
+worker_rlimit_nofile 10240;
+
+events {
+    worker_connections  8192;
+    multi_accept on;
+    use epoll;
+}
+
+http 
+{
+    include       mime.types;
+    default_type  application/octet-stream;
+
+    underscores_in_headers on;
+    client_max_body_size 32M;
+    client_body_buffer_size 1024K;
+
+    tcp_nopush on;
+
+    sendfile            on;
+    keepalive_timeout   300;
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    server 
+    {
+    	listen       80;
+        set  $folder_name /var/www/html;
+        server_name 192.168.3.104;
+        root $folder_name;
+        index index.html index.php; 
+
+    	proxy_connect_timeout 500s;
+        proxy_read_timeout 500s;
+        proxy_send_timeout 500s;
+
+        fastcgi_connect_timeout 75;
+        fastcgi_read_timeout 600;   
+        fastcgi_send_timeout 600;
+        fastcgi_buffer_size  32K;
+        fastcgi_buffers      32 32K;
+
+        set_real_ip_from 100.64.0.0/10;
+        real_ip_header X-Forwarded-For;
+
+        charset utf-8;
+
+        location ~ /mobile/[/\w]+\.php$ {
+            root           $folder_name;
+            fastcgi_pass   macc:9000;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME  $folder_name$fastcgi_script_name;
+            fastcgi_param  SIGN $http_sign;
+            include fastcgi_params;
+        }
+
+        location / {
+            deny all;
+            return 403;
+        }
+    }
+}

+ 68 - 0
docker/compose/homecuda/conf/nginx/racc.conf

@@ -0,0 +1,68 @@
+user nginx;
+worker_processes  16;
+error_log   /var/www/html/data/log/rnginx.log debug;
+worker_rlimit_nofile 10240;
+
+events {
+    worker_connections  8192;
+    multi_accept on;
+    use epoll;
+}
+
+http 
+{
+    include       mime.types;
+    default_type  application/octet-stream;
+
+    underscores_in_headers on;
+    client_max_body_size 32M;
+    client_body_buffer_size 1024K;
+
+    tcp_nopush on;
+
+    sendfile            on;
+    keepalive_timeout   300;
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                      '$status $body_bytes_sent "$http_referer" '
+                      '"$http_user_agent" "$http_x_forwarded_for"';
+
+    server 
+    {
+    	listen       80;
+        set  $folder_name /var/www/html;
+        server_name 192.168.3.104;
+        root $folder_name;
+        index index.html index.php; 
+
+    	proxy_connect_timeout 500s;
+        proxy_read_timeout 500s;
+        proxy_send_timeout 500s;
+
+        fastcgi_connect_timeout 75;
+        fastcgi_read_timeout 600;   
+        fastcgi_send_timeout 600;
+        fastcgi_buffer_size  32K;
+        fastcgi_buffers      32 32K;
+
+        set_real_ip_from 100.64.0.0/10;
+        real_ip_header X-Forwarded-For;
+
+        charset utf-8;
+
+
+        location ~ /racc/[/\w]+\.php$ {
+            root           $folder_name;
+            fastcgi_pass   racc:9000;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME  $folder_name$fastcgi_script_name;
+            fastcgi_param  SIGN $http_sign;
+            include fastcgi_params;
+        }
+
+        location / {
+            deny all;
+            return 403;
+        }
+    }
+}

+ 0 - 12
docker/compose/homecuda/conf/php/mch-spwan-start

@@ -1,12 +0,0 @@
-#!/bin/sh
-set -e
-spawn-fcgi -a 0.0.0.0 -p 9102 -F 1 -f "php /var/www/html/mchsrv/mchsrv_run.php"
-
-
-time=$(date "+%Y%m%d")
-
-if [ ! -f "/var/www/html/data/log/${time}-mchsrv.log" ]; then
-    touch "/var/www/html/data/log/${time}-mchsrv.log"
-fi
-
-tail -f "/var/www/html/data/log/${time}-mchsrv.log"

+ 0 - 11
docker/compose/homecuda/conf/php/mobile-spwan-start

@@ -1,11 +0,0 @@
-#!/bin/sh
-set -e
-spawn-fcgi -a 0.0.0.0 -p 9000 -F 1 -f "php /var/www/html/mobile/mobile_run.php"
-
-time=$(date "+%Y%m%d")
-
-if [ ! -f "/var/www/html/data/log/${time}-mobile.log" ]; then
-    touch "/var/www/html/data/log/${time}-mobile.log"
-fi
-
-tail -f "/var/www/html/data/log/${time}-mobile.log"

+ 17 - 0
docker/compose/homecuda/conf/php/spwan-start

@@ -0,0 +1,17 @@
+#!/bin/sh
+set -e
+
+cmd="php /var/www/html$1"
+time=$(date "+%Y%m%d")
+file="/var/www/html/data/log/${time}-$2"
+
+spawn-fcgi -a 0.0.0.0 -p 9000 -F 1 -f "$cmd"
+
+#trap 'echo "Container is exiting"; exit' EXIT
+#tail -f /dev/null
+
+if [ ! -f $file ]; then
+    touch $file
+fi
+
+tail -f $file

+ 0 - 11
docker/compose/homecuda/conf/php/vapi-spwan-start

@@ -1,11 +0,0 @@
-#!/bin/sh
-set -e
-spawn-fcgi -a 0.0.0.0 -p 9100 -F 1 -f "php /var/www/html/vapi/vapi.php"
-
-time=$(date "+%Y%m%d")
-
-if [ ! -f "/var/www/html/data/log/${time}-vapi.log" ]; then
-    touch "/var/www/html/data/log/${time}-vapi.log"
-fi
-
-tail -f "/var/www/html/data/log/${time}-vapi.log"

+ 1 - 1
docker/compose/homecuda/conf/php/vender-init

@@ -1,3 +1,3 @@
 #!/bin/sh
-cd /var/www/html
+cd /var/wwww/html
 php ./composer.phar require phpoffice/phpspreadsheet

+ 2 - 0
docker/compose/homecuda/container.env

@@ -0,0 +1,2 @@
+
+#mobile 模块接入层配置

+ 10 - 0
docker/compose/homecuda/cpenv

@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# shellcheck disable=SC2039
+dest_dirs=("macc" "admin" "vendor" "cli" "cluster" "master-crond" "racc" "slave-crond" "worker")
+src_file=".env"
+
+for dir in "${dest_dirs[@]}"; do
+    cp "$src_file" "$dir/"
+    echo "$dir/"
+done

+ 0 - 19
docker/compose/homecuda/database/docker-compose.yml

@@ -1,19 +0,0 @@
-version: "3.7"
-
-services:
-  mysql:
-    image: mysql:latest
-    ports:
-      - 3306:3306
-    volumes:
-      - /mnt/homedb/logs:/var/log/mysql
-      - /mnt/homedb/data:/var/lib/mysql
-      - /mnt/homedb/conf/my.cnf:/etc/my.cnf
-    container_name: docker-mysqld
-    restart: always
-    environment:
-      MYSQL_ROOT_PASSWORD: 55668899
-    deploy:
-      resources:
-        limits:
-          cpus: '16'

+ 37 - 0
docker/compose/homecuda/macc/docker-compose.yml

@@ -0,0 +1,37 @@
+version: "3.9"
+
+include:
+  - ../../docker-compose.networks.yml
+
+services:
+  nginx:
+    image: nginx:alpine
+    ports:
+      - ${MACCNGINX_PORT}:80
+    volumes:
+      - ../../../../:${SHOP_ROOT_PATH}
+      - ../conf/etc/localtime:/etc/localtime:ro
+      - ../conf/nginx/macc.conf:/etc/nginx/nginx.conf:ro
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${MERCHANT_PATH}:${SHOP_ROOT_PATH}/merchant
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-mnginx"
+    command: [nginx,'-g','daemon off;']
+    extra_hosts:
+      - docker.hostip:172.17.0.1
+    networks:
+      - ${DOCKER_NET_NAME}
+
+  macc:
+    image: php-zts:7.3.18
+    volumes:
+      - ../../../../:${SHOP_ROOT_PATH}
+      - ../conf/etc/localtime:/etc/localtime:ro
+      - ../conf/php/php.ini:/usr/local/etc/php/php.ini
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+      - ../conf/php/spwan-start:/usr/local/bin/spwan-start
+    container_name: "${CONTAINER_PREFIX}-macc"
+    command: [ spwan-start,"/mobile/mobile_run.php","mobile.log" ]
+    networks:
+      - ${DOCKER_NET_NAME}

+ 24 - 15
docker/compose/homecuda/master-crond/docker-compose.yml

@@ -1,36 +1,45 @@
 version: "3.7"
 
+include:
+  - ../../docker-compose.networks.yml
+
 services:
   crontabsrv:
     image: php-zts-debug:7.3.18
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php.ini:/usr/local/etc/php/php.ini
-      - ../conf/crontab/root:/var/spool/cron/crontabs/root
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-crontab"
+      - ../conf/crontab/master_root:/var/spool/cron/crontabs/root
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-master-crontab"
     command: [crond,"-f"]
+    networks:
+      - ${DOCKER_NET_NAME}
 
   cronsec:
     image: php-zts-debug:7.3.18
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php.ini:/usr/local/etc/php/php.ini
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-cronsec"
-    command: [php,"/var/www/html/crontab/index.php",'minutes','second_queue']
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-master-cronsec"
+    command: [php,"${SHOP_ROOT_PATH}/crontab/index.php",'minutes','second_queue']
+    networks:
+      - ${DOCKER_NET_NAME}
 
   accedit:
     image: php-zts-debug:7.3.18
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php.ini:/usr/local/etc/php/php.ini
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-accedit"
-    command: [php,"/var/www/html/crontab/index.php",'minutes','account_edit']
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-master-accedit"
+    command: [php,"${SHOP_ROOT_PATH}/crontab/index.php",'minutes','account_edit']
+    networks:
+      - ${DOCKER_NET_NAME}

+ 0 - 14
docker/compose/homecuda/plot/docker-compose.yml

@@ -1,14 +0,0 @@
-version: "3.7"
-
-services:
-  flasksrv:
-    image: pycpu:3.7.10
-    ports:
-      - "5000:5000"
-    volumes:
-      - ../../../../:/var/www/html
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - /mnt/shoplog:/var/www/html/data/log
-      - /mnt/stdata:/var/www/html/data/stdata
-    container_name: "panda-flask"
-    command: ['python','app.py']

+ 35 - 0
docker/compose/homecuda/racc/docker-compose.yml

@@ -0,0 +1,35 @@
+version: "3.9"
+
+include:
+  - ../../docker-compose.networks.yml
+
+services:
+  nginx:
+    image: nginx:alpine
+    ports:
+      - ${RACCNGINX_PORT}:80
+    volumes:
+      - ../../../../:${SHOP_ROOT_PATH}
+      - ../conf/etc/localtime:/etc/localtime:ro
+      - ../conf/nginx/racc.conf:/etc/nginx/nginx.conf:ro
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${MERCHANT_PATH}:${SHOP_ROOT_PATH}/merchant
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-rnginx"
+    command: [nginx,'-g','daemon off;']
+    networks:
+      - ${DOCKER_NET_NAME}
+
+  racc:
+    image: php-zts:7.3.18
+    volumes:
+      - ../../../../:${SHOP_ROOT_PATH}
+      - ../conf/etc/localtime:/etc/localtime:ro
+      - ../conf/php/php-debug.ini:/usr/local/etc/php/php.ini
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+      - ../conf/php/spwan-start:/usr/local/bin/spwan-start
+    container_name: "${CONTAINER_PREFIX}-racc"
+    command: [ spwan-start,"/racc/racc_run.php","racc.log" ]
+    networks:
+      - ${DOCKER_NET_NAME}

+ 30 - 33
docker/compose/homecuda/slave-crond/docker-compose.yml

@@ -1,61 +1,58 @@
 version: "3.7"
 
+include:
+  - ../../docker-compose.networks.yml
+
 services:
   crontabslave:
     image: php-zts-debug:7.3.18
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php.ini:/usr/local/etc/php/php.ini
       - ../conf/crontab/slave_root:/var/spool/cron/crontabs/root
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-slavecron"
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-slave-cron"
     command: [crond,"-f"]
-    deploy:
-      resources:
-        limits:
-          cpus: '8'
+    networks:
+      - ${DOCKER_NET_NAME}
 
   taska:
     image: php-zts-debug:7.3.18
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php.ini:/usr/local/etc/php/php.ini
-      - ../conf/crontab/slave_root:/var/spool/cron/crontabs/root
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-taska"
-    command: [php,"/var/www/html/crontab/index.php",'minutes','task']
-    deploy:
-      resources:
-        limits:
-          cpus: '8'
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-slave-taska"
+    command: [php,"${SHOP_ROOT_PATH}/crontab/index.php",'minutes','task']
+    networks:
+      - ${DOCKER_NET_NAME}
 
   taskb:
     image: php-zts-debug:7.3.18
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php.ini:/usr/local/etc/php/php.ini
-      - ../conf/crontab/slave_root:/var/spool/cron/crontabs/root
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-taskb"
-    command: [php,"/var/www/html/crontab/index.php",'minutes','task']
-    deploy:
-      resources:
-        limits:
-          cpus: '8'
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-slave-taskb"
+    command: [php,"${SHOP_ROOT_PATH}/crontab/index.php",'minutes','task']
+    networks:
+      - ${DOCKER_NET_NAME}
 
   statutil:
     image: php-zts-debug:7.3.18
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php-debug.ini:/usr/local/etc/php/php.ini
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-statutil"
-    command: [php,"/var/www/html/crontab/index.php",'minutes','stat_util']
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-slave-stat"
+    command: [php,"${SHOP_ROOT_PATH}/crontab/index.php",'minutes','stat']
+    networks:
+      - ${DOCKER_NET_NAME}

+ 0 - 42
docker/compose/homecuda/statcalc/docker-compose.yml

@@ -1,42 +0,0 @@
-version: "3.7"
-
-services:
-  mamount:
-    image: pycpu:3.7.10
-    volumes:
-      - ../../../../:/var/www/html
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - /mnt/shoplog:/var/www/html/data/log
-      - /mnt/stdata:/var/www/html/data/stdata
-    container_name: "panda-mamount"
-    command: ['python','mamount_lack.py', '-h', '192.168.3.104', '-p', '6379']
-
-  mpratios:
-    image: pycpu:3.7.10
-    volumes:
-      - ../../../../:/var/www/html
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - /mnt/shoplog:/var/www/html/data/log
-      - /mnt/stdata:/var/www/html/data/stdata
-    container_name: "panda-mpratios"
-    command: ['python','mprofit_ratio.py', '-h', '192.168.3.104', '-p', '6379']
-
-  mtimesratios:
-    image: pycpu:3.7.10
-    volumes:
-      - ../../../../:/var/www/html
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - /mnt/shoplog:/var/www/html/data/log
-      - /mnt/stdata:/var/www/html/data/stdata
-    container_name: "panda-mtimesratios"
-    command: [ 'python','mtimesratio.py', '-h', '192.168.3.104', '-p', '6379' ]
-
-  chspeedratio:
-    image: pycpu:3.7.10
-    volumes:
-      - ../../../../:/var/www/html
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - /mnt/shoplog:/var/www/html/data/log
-      - /mnt/stdata:/var/www/html/data/stdata
-    container_name: "panda-chspeedratio"
-    command: ['python','chspeedratio.py', '-h', '192.168.3.104', '-p', '6379']

+ 0 - 16
docker/compose/homecuda/statwriter/docker-compose.yml

@@ -1,16 +0,0 @@
-version: "3.7"
-
-services:
-  qreader:
-    image: pycpu:3.7.10
-    volumes:
-      - ../../../../:/var/www/html
-      - ../conf/etc/localtime:/etc/localtime:ro
-      - /mnt/shoplog:/var/www/html/data/log
-      - /mnt/stdata:/var/www/html/data/stdata
-    container_name: "panda-qreader"
-    command: ['python','qreader.py','-h', '192.168.3.104', '-p', '6379']
-    deploy:
-      resources:
-        limits:
-          cpus: '8'

+ 6 - 6
docker/compose/homecuda/storage/docker-compose.yml

@@ -1,18 +1,18 @@
 version: "3.7"
 
+include:
+  - ../../docker-compose.networks.yml
+
 services:
   redisrv:
     image: redis:alpine
     ports:
-      - "6379:6379"
+      - ${SHOP_REDIS_PORT}:6379
     volumes:
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/redis/6379.conf:/etc/redis/redis.conf
       - /mnt/redisdata:/data
-    restart: always
     container_name: "panda-redis"
     command: [redis-server,"/etc/redis/redis.conf"]
-    deploy:
-      resources:
-        limits:
-          cpus: '8'
+    networks:
+      - ${DOCKER_NET_NAME}

+ 20 - 0
docker/compose/homecuda/vendor/docker-compose.yml

@@ -0,0 +1,20 @@
+version: "3.9"
+
+include:
+  - ../../docker-compose.networks.yml
+
+services:
+  nginx:
+    image: nginx:alpine
+    env_file:
+      - ../.env
+    ports:
+      - ${RMINE_NGINX_PORT}:80
+    volumes:
+      - ../conf/etc/localtime:/etc/localtime:ro
+      - ../conf/nginx/nginx_vendor.conf:/etc/nginx/nginx.conf:ro
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+    container_name: "readmine-nginx"
+    command: [nginx,'-g','daemon off;']
+    networks:
+      - ${DOCKER_NET_NAME}

+ 25 - 20
docker/compose/homecuda/worker/docker-compose.yml

@@ -1,39 +1,44 @@
-version: "3.7"
+version: "3.9"
+
+include:
+  - ../../docker-compose.networks.yml
 
 services:
   cordsrv:
     image: php-swool-redis:latest
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php-swoole-debug.ini:/usr/local/etc/php/php.ini
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-codispatcher"
-    command: [php,"/var/www/html/rdispatcher/codispatcher.php","1"]
-    deploy:
-      resources:
-        limits:
-          cpus: '8'
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-wcodispatcher"
+    command: [php,"${SHOP_ROOT_PATH}/rdispatcher/codispatcher.php","1"]
+    networks:
+      - ${DOCKER_NET_NAME}
 
   queuesrv:
     image: php-zts-debug:7.3.18
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php.ini:/usr/local/etc/php/php.ini
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-queue"
-    command: [php,"/var/www/html/queue/index.php", "queue", "index"]
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-wqueue"
+    command: [php,"${SHOP_ROOT_PATH}/queue/index.php", "queue", "index"]
+    networks:
+      - ${DOCKER_NET_NAME}
 
   searcher:
     image: php-zts-debug:7.3.18
     volumes:
-      - ../../../../:/var/www/html
+      - ../../../../:${SHOP_ROOT_PATH}
       - ../conf/etc/localtime:/etc/localtime:ro
       - ../conf/php/php.ini:/usr/local/etc/php/php.ini
-      - /data/shop_share/upload:/var/www/html/data/upload
-      - /mnt/shoplog:/var/www/html/data/log
-    container_name: "panda-searcher"
-    command: [php, "/var/www/html/searcher.php"]
+      - ${SHOP_UPLOAD_PATH}:${SHOP_ROOT_PATH}/data/upload
+      - ${SHOP_LOG_PATH}:${SHOP_ROOT_PATH}/data/log
+    container_name: "${CONTAINER_PREFIX}-wsearcher"
+    command: [php, "${SHOP_ROOT_PATH}/searcher.php"]
+    networks:
+      - ${DOCKER_NET_NAME}

+ 9 - 0
docker/compose/netcreate

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+DOCKER_NETWORK=`docker network ls | grep $1 | wc -l`
+if [ $DOCKER_NETWORK -eq 0 ]; then
+  echo "docker network create $1"
+  docker network create $1
+fi
+
+docker network ls | grep $1

+ 0 - 5
fooder.php

@@ -1,11 +1,6 @@
 <?php
 
 require_once(BASE_CORE_PATH .   '/lrlz.php');
-require_once(BASE_MOBILE_PATH . '/config/config.ini.php');
-require_once(BASE_MOBILE_PATH . '/framework/function/function.php');
-require_once(BASE_MOBILE_PATH . '/util/errcode.php');
-require_once(BASE_MOBILE_PATH . '/control/log.php');
-
 require_once(BASE_CORE_PATH . '/framework/libraries/queue.php');
 require_once(BASE_CORE_PATH . '/framework/libraries/tpl.php');
 require_once(BASE_CORE_PATH . '/framework/function/core.php');

+ 1 - 1
helper/fcgisrv/BaseServer.php

@@ -68,7 +68,7 @@ abstract class BaseServer
         while(($ret = fcgi_accept()) >= 0)
         {
             $mem = memory_get_usage();
-            Log::record("index = {$i} memory={$mem} ",Log::DEBUG);
+            Log::record("index = $i memory=$mem ",Log::DEBUG);
             ++$i;
 
             $start = microtime(true);

+ 35 - 5
helper/fcgisrv/XYZRAccServer.php

@@ -8,6 +8,7 @@ require_once(BASE_CORE_PATH . '/framework/function/http.php');
 require_once(BASE_ROOT_PATH . '/helper/session_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/sensitive_word/dfa.php');
 require_once(BASE_ROOT_PATH . '/helper/exceptionex.php');
+
 require_once(BASE_HELPER_PATH . '/fcgisrv/BaseServer.php');
 require_once(BASE_HELPER_PATH . '/refill/util.php');
 
@@ -18,12 +19,12 @@ use Exception;
 use merchantControl;
 use errcode;
 
-class XYZRAccServer extends BaseServer
+class RAccServer extends BaseServer
 {
+
     public function __construct($subPath)
     {
         parent::__construct($subPath);
-
         $exfiles = [
 
         ];
@@ -35,12 +36,41 @@ class XYZRAccServer extends BaseServer
     static public function instance()
     {
         if(self::$stInstance == NULL) {
-            self::$stInstance = new XYZRAccServer('racc');
-
+            self::$stInstance = new RAccServer('racc');
         }
+
         return self::$stInstance;
     }
 
+    protected function is_exclude($file)
+    {
+        $exister = function ($file,$subex)
+        {
+            $path = BASE_ROOT_PATH . "/" . $this->mSubPath . "/$subex";
+            $basename = basename($file);
+            $tmp = "$path/$basename";
+
+            return file_exists($tmp);
+        };
+
+        $ret = parent::is_exclude($file);
+        if ($ret) {
+            return true;
+        }
+
+        global $config;
+        $exclude_dirs = $config['racc_exclude_dirs'];
+
+        foreach ($exclude_dirs as $dir)
+        {
+            if($exister($file,$dir)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
     function handle_req($file)
     {
         try
@@ -49,7 +79,7 @@ class XYZRAccServer extends BaseServer
             if(file_exists($file))
             {
                 if($this->is_exclude($file)) {
-                    Log::record("Call {$file}",Log::DEBUG);
+                    Log::record("Call $file", Log::DEBUG);
                     include $file;
                 } else {
                     Base::mobile_control();

BIN
helper/refill/api/xyz/guochuang/20231109辽宁移动调价函.jpg


BIN
helper/refill/api/xyz/guochuang/20231113广东辽宁移动调价函.jpg


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

@@ -64,7 +64,7 @@ class config
     const Price = [
         //移动
         "4-10-2" => 10.18, "4-20-2" => 20.36, "4-30-2" => 30.18, "4-50-2" => 50.3, "4-100-2" => 100.3, "4-200-2" => 200.6, "4-300-2" => 300.9, "4-500-2" => 501.5,//天津 2
-        "4-10-6" => 9.74, "4-20-6" => 19.48, "4-30-6" => 29.22, "4-50-6" => 48.7, "4-100-6" => 97.4, "4-200-6" => 194.8, "4-300-6" => 292.2, "4-500-6" => 487,//辽宁 6
+        "4-10-6" => 9.77, "4-20-6" => 19.54, "4-30-6" => 29.31, "4-50-6" => 48.85, "4-100-6" => 97.7, "4-200-6" => 195.4, "4-300-6" => 293.1, "4-500-6" => 488.5,//辽宁 6
         "4-10-9" => 9.94, "4-20-9" => 19.88, "4-30-9" => 29.82, "4-50-9" => 49.7, "4-100-9" => 99.4,//上海 9
         "4-10-8" => 9.98, "4-20-8" => 19.96, "4-30-8" => 29.94, "4-50-8" => 49.9, "4-100-8" => 99.8, "4-200-8" => 199.6, "4-300-8" => 299.4, "4-500-8" => 499,//黑龙江 8
         "4-10-29" => 9.86, "4-20-29" => 19.72, "4-30-29" => 29.58, "4-50-29" => 49.3, "4-100-29" => 98.6, "4-200-29" => 197.2, "4-300-29" => 295.8, "4-500-29" => 493,//青海 29
@@ -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" => 29.985, "4-50-19" => 49.975, "4-100-19" => 99.95, "4-200-19" => 199.9, "4-300-19" => 299.85, "4-500-19" => 499.75,//广东 19
+        "4-10-19" => 10.1, "4-20-19" => 20.2, "4-30-19" => 29.97, "4-50-19" => 49.95, "4-100-19" => 99.9, "4-200-19" => 199.8, "4-300-19" => 299.7, "4-500-19" => 499.5,//广东 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

+ 3 - 1
helper/refill/api/xyz/lechongquan/RefillPhone.php

@@ -21,7 +21,9 @@ class RefillPhone extends refill\IRefillPhone
         $params['szPhoneNum'] = $phone;
         $params['nMoney'] = $amount;
         $params['nSortType'] = config::operator[$card_type];
-        $params['szProductId'] = '';
+
+        $product_id = config::ProductIdS[$card_type][$amount] ?? '';
+        $params['szProductId'] = $product_id;
         $params['nProductClass'] = 1;
         $params['nProductType'] = 1;
         $params['szTimeStamp'] = date("Y-m-d H:i:s");

+ 9 - 0
helper/refill/api/xyz/lechongquan/api.txt

@@ -13,3 +13,12 @@ ID:200036
 账户:guoyanwuxianzhi
 
 密码:123456
+
+说明:只有配置移动编码,其余上游自动识别
+----------移动编码
+10  1000010
+20  1000020
+30  1000030
+50   125
+100  126
+200  127

+ 20 - 0
helper/refill/api/xyz/lechongquan/config.php

@@ -25,4 +25,24 @@ class config
     const ERR_NOS = [
         1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
     ];
+
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard =>
+            [
+                10 => '1000010',
+                20 => '1000020',
+                30 => '1000030',
+                50 => '125',
+                100 => '126',
+                200 => '127',
+            ],
+        mtopcard\ChinaUnicomCard =>
+            [
+
+            ],
+        mtopcard\ChinaTelecomCard =>
+            [
+
+            ]
+    ];
 }

+ 40 - 0
helper/refill/api/xyz/liantuo_high/API.MD

@@ -0,0 +1,40 @@
+
+## 联拓普充话费全国
+
+### 账号:
+- 登陆账号:福庆顺高价
+- 登陆密码:123456
+- 商户号:10002623
+- 秘钥:ZnxYb4PH34HhznSZDhfnmJYx53EJeRdF
+### 下游客户注册和登录地址:
+> http://139.9.203.254:7080/
+- api接口文档地址:
+ - https://www.showdoc.com.cn/AQL666666/
+- 话费下单地址:
+ - http://139.9.203.254:9086/onlinepay.do
+- 订单主动查询地址:
+ - http://139.9.203.254:9086/searchpay.do
+- 余额查询:
+- http://139.9.203.254:9086/searchbalance.do
+## 店铺
+- 账号:liantuo_high
+- 密码:liantuo_high67890
+
+### 编码
+- 全国移动
+  - 30面值编码101687,  
+  - 50面值编码101688 ,
+  - 100面值编码101689,  
+  - 200面值编码101690
+
+- 全国联通
+  - 30面值编码101705,
+  - 50面值编码101706,
+  - 100面值编码101707,
+  - 200面值编码101708
+
+- 全国电信
+  - 30面值编码101723,
+  - 50面值编码101724,
+  - 100面值编码101725,
+  - 200面值编码101726

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

@@ -0,0 +1,49 @@
+<?php
+namespace refill\liantuo_high;
+
+require_once(BASE_HELPER_RAPI_PATH . '/liantuo_high/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
+    public function notify($params): array
+    {
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false, false, ''];
+        }
+
+        $order_id = $order_info['order_id'];
+        if ($status === 1) {
+            $official_sn = strtolower($params['remark1']) == 'null' ? '' : $params['remark1'];
+            $data['official_sn'] = $official_sn;
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true, $official_sn];
+        } elseif ($status === 9) {
+            return [$order_id, false, true, true, ''];
+        } else {
+            return [$order_id, false, false, false, ''];
+        }
+    }
+}

+ 163 - 0
helper/refill/api/xyz/liantuo_high/RefillPhone.php

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

+ 50 - 0
helper/refill/api/xyz/liantuo_high/config.php

@@ -0,0 +1,50 @@
+<?php
+
+
+namespace refill\liantuo_high;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://139.9.203.254:9086/onlinepay.do';
+    const QUERY_URL= 'http://139.9.203.254:9086/searchpay.do';
+    const BALANCE_URL = 'http://139.9.203.254:9086/searchbalance.do';
+
+    const USER_ID= '10002623';
+    const KEY = 'ZnxYb4PH34HhznSZDhfnmJYx53EJeRdF';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_liantuo_high.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ERR_NOS = [
+        '5001', '5002', '5003', '5004', '5005', '5008', '5009', '5010', '5011', '5012', '7001'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard =>
+            [
+                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'
+            ]
+    ];
+}

+ 22 - 0
helper/refill/api/xyz/miaoxt_tax_trd/API.MD

@@ -0,0 +1,22 @@
+
+## 秒信通带票3号
+
+### 账号信息
+- 后台登录地址:http://47.118.46.242:10186/plat/index
+- 登录名:23111301
+- 初始密码:yj123456
+
+### 接口信息
+- ID:200136
+- 密钥:7cf33fd121344c2d80194688b234f246
+## 接口地址
+- 话费下单地址:http://47.118.46.242:10186/plat/api/old/submitorder
+- 查询地址:http://47.118.46.242:10186/plat/api/old/queryorder
+- 查询余额地址:http://47.118.46.242:10186/plat/api/old/queryBalance
+
+## API 文档
+> https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+## 店铺账号
+- 账号:miaoxt_tax_trd
+- 密码:miaoxt_tax_trd67890

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

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

+ 141 - 0
helper/refill/api/xyz/miaoxt_tax_trd/RefillPhone.php

@@ -0,0 +1,141 @@
+<?php
+
+namespace refill\miaoxt_tax_trd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/miaoxt_tax_trd/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $order_sn;
+        $params['szPhoneNum'] = $phone;
+        $params['nMoney'] = $amount;
+        $params['nSortType'] = config::operator[$card_type];
+        $params['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szTimeStamp'] = date("Y-m-d H:i:s");
+        $params['szNotifyUrl'] = config::NOTIFY_URL;
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $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)) {
+                if($nRtn === 2003) {
+                    refill\util::set_black($card_no);
+                }
+                return [false, $resp['szRtnCode'], false];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szOrderId={$params['szOrderId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误', ''];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误', ''];
+            }
+            $official_sn = $resp['szRtnMsg'] ?? '';
+
+            $status = intval($resp['nRtn']);
+            if ($status === 5012) {
+                $updata['official_sn'] = $official_sn;
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif ($status === 5011) {
+                $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, $official_sn];
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['nRtn'] == 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nMoney={$params['nMoney']}&nSortType={$params['nSortType']}";
+        $content .= "&nProductClass={$params['nProductClass']}&nProductType={$params['nProductType']}&szTimeStamp={$params['szTimeStamp']}&szKey={$key}";
+        return md5($content);
+    }
+}

+ 27 - 0
helper/refill/api/xyz/miaoxt_tax_trd/config.php

@@ -0,0 +1,27 @@
+<?php
+
+
+namespace refill\miaoxt_tax_trd;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.118.46.242:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.118.46.242:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.118.46.242:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200136';
+    const KEY = '7cf33fd121344c2d80194688b234f246';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_miaoxt_tax_trd.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+
+    const ERR_NOS = [
+        1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
+    ];
+}

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

@@ -64,7 +64,7 @@ class config
     const Price = [
         //移动
         "4-10-2" => 10.18, "4-20-2" => 20.36, "4-30-2" => 30.18, "4-50-2" => 50.3, "4-100-2" => 100.3, "4-200-2" => 200.6, "4-300-2" => 300.9, "4-500-2" => 501.5,//天津 2
-        "4-10-6" => 9.74, "4-20-6" => 19.48, "4-30-6" => 29.22, "4-50-6" => 48.7, "4-100-6" => 97.4, "4-200-6" => 194.8, "4-300-6" => 292.2, "4-500-6" => 487,//辽宁 6
+        "4-10-6" => 9.77, "4-20-6" => 19.54, "4-30-6" => 29.31, "4-50-6" => 48.85, "4-100-6" => 97.7, "4-200-6" => 195.4, "4-300-6" => 293.1, "4-500-6" => 488.5,//辽宁 6
         "4-10-9" => 9.94, "4-20-9" => 19.88, "4-30-9" => 29.82, "4-50-9" => 49.7, "4-100-9" => 99.4,//上海 9
         "4-10-8" => 9.98, "4-20-8" => 19.96, "4-30-8" => 29.94, "4-50-8" => 49.9, "4-100-8" => 99.8, "4-200-8" => 199.6, "4-300-8" => 299.4, "4-500-8" => 499,//黑龙江 8
         "4-10-29" => 9.86, "4-20-29" => 19.72, "4-30-29" => 29.58, "4-50-29" => 49.3, "4-100-29" => 98.6, "4-200-29" => 197.2, "4-300-29" => 295.8, "4-500-29" => 493,//青海 29
@@ -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" => 29.985, "4-50-19" => 49.975, "4-100-19" => 99.95, "4-200-19" => 199.9, "4-300-19" => 299.85, "4-500-19" => 499.75,//广东 19
+        "4-10-19" => 10.1, "4-20-19" => 20.2, "4-30-19" => 29.97, "4-50-19" => 49.95, "4-100-19" => 99.9, "4-200-19" => 199.8, "4-300-19" => 299.7, "4-500-19" => 499.5,//广东 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

+ 22 - 0
helper/refill/api/yl/miaoxt_tax_sec/API.MD

@@ -0,0 +1,22 @@
+
+## 秒信通带票2号
+
+### 账号信息
+- 后台登录地址:http://47.118.46.242:10186/plat/index
+- 登录名:23111302
+- 初始密码:yl123456
+
+### 接口信息
+- ID:200137
+- 密钥:918a37966def4aaf833fec0bfce511bd
+## 接口地址
+- 话费下单地址:http://47.118.46.242:10186/plat/api/old/submitorder
+- 查询地址:http://47.118.46.242:10186/plat/api/old/queryorder
+- 查询余额地址:http://47.118.46.242:10186/plat/api/old/queryBalance
+
+## API 文档
+> https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+## 店铺账号
+- 账号:miaoxt_tax_sec
+- 密码:miaoxt_tax_sec67890

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

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

+ 141 - 0
helper/refill/api/yl/miaoxt_tax_sec/RefillPhone.php

@@ -0,0 +1,141 @@
+<?php
+
+namespace refill\miaoxt_tax_sec;
+
+require_once(BASE_HELPER_RAPI_PATH . '/miaoxt_tax_sec/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $order_sn;
+        $params['szPhoneNum'] = $phone;
+        $params['nMoney'] = $amount;
+        $params['nSortType'] = config::operator[$card_type];
+        $params['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szTimeStamp'] = date("Y-m-d H:i:s");
+        $params['szNotifyUrl'] = config::NOTIFY_URL;
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $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)) {
+                if($nRtn === 2003) {
+                    refill\util::set_black($card_no);
+                }
+                return [false, $resp['szRtnCode'], false];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szOrderId={$params['szOrderId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::QUERY_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误', ''];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误', ''];
+            }
+            $official_sn = $resp['szRtnMsg'] ?? '';
+
+            $status = intval($resp['nRtn']);
+            if ($status === 5012) {
+                $updata['official_sn'] = $official_sn;
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif ($status === 5011) {
+                $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, $official_sn];
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['nRtn'] == 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nMoney={$params['nMoney']}&nSortType={$params['nSortType']}";
+        $content .= "&nProductClass={$params['nProductClass']}&nProductType={$params['nProductType']}&szTimeStamp={$params['szTimeStamp']}&szKey={$key}";
+        return md5($content);
+    }
+}

+ 27 - 0
helper/refill/api/yl/miaoxt_tax_sec/config.php

@@ -0,0 +1,27 @@
+<?php
+
+
+namespace refill\miaoxt_tax_sec;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.118.46.242:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.118.46.242:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.118.46.242:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200137';
+    const KEY = '918a37966def4aaf833fec0bfce511bd';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_miaoxt_tax_sec.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+
+    const ERR_NOS = [
+        1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
+    ];
+}

+ 4 - 0
mobile/callback/refill_liantuo_high.php

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

+ 4 - 0
mobile/callback/refill_miaoxt_tax_sec.php

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

+ 4 - 0
mobile/callback/refill_miaoxt_tax_trd.php

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

+ 0 - 1
mobile/config/config.ini.php

@@ -1,3 +1,2 @@
 <?php
 defined('InShopNC') or exit('Access Invalid!');
-

+ 4 - 1
mobile/index.php

@@ -4,6 +4,9 @@
  *
  *
  */
+
+
+require_once(BASE_PATH . '/config/config.ini.php');
 require_once(BASE_PATH . '/util/errcode.php');
 require_once(BASE_PATH . '/framework/function/function.php');
-require_once(BASE_PATH . '/control/control.php');
+require_once(BASE_PATH . '/control/control.php');

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

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

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

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

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

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

+ 0 - 10
racc/callback/lingzh/amingyd.php

@@ -1,10 +0,0 @@
-<?php
-
-$content = $_SERVER['post_content'];
-$input = json_decode($content,true);
-refill\util::push_notify('amingyd',$input);
-
-$data['code'] = 'success';
-$data['message'] = '成功';
-$content = json_encode($data);
-echo $content;

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

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

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

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

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

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

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

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

+ 0 - 10
racc/callback/lingzh/fensheng.php

@@ -1,10 +0,0 @@
-<?php
-
-$content = $_SERVER['post_content'];
-
-$inputs = json_decode($content,true);
-foreach ($inputs as $input) {
-    refill\util::push_notify('fensheng',$input);
-}
-
-echo ('SUCCESS');

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 0 - 8
racc/callback/lingzh/wuchen.php

@@ -1,8 +0,0 @@
-<?php
-$content = $_SERVER['post_content'];
-$input = json_decode($content,true);
-refill\util::push_notify('wuchen',$input);
-$data['code'] = 1000;
-$data['message'] = '订单处理成功';
-$content = json_encode($data);
-echo $content;

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

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

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

@@ -1,5 +0,0 @@
-<?php
-$content = $_SERVER['post_content'];
-$input = json_decode($content,true);
-refill\util::push_notify('yibao',$input);
-echo ('success');

+ 5 - 0
racc/config/config.ini.php

@@ -0,0 +1,5 @@
+<?php
+defined('InShopNC') or exit('Access Invalid!');
+
+$config['racc_exclude_dirs'] = ['callback/lingzh','callback/mh'];
+

+ 0 - 151
racc/control/base.php

@@ -1,151 +0,0 @@
-<?php
-
-class lzbaseControl
-{
-    private $mMchid;
-    private $mAdminid;
-    private $mUseKey;
-    protected $merchant_available;
-    protected $member_available;
-
-    public function __construct()
-    {
-        $mchid = $_POST['usr'];
-        $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
-        if(empty($mchinfo)) {
-            throw new LzException(self::text_content(-5,0));
-        }
-        else {
-            $this->mAdminid = intval($mchinfo['admin_id']);
-        }
-
-        $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $mchid]);
-
-        $mod_member = Model('member');
-        $minfo = $mod_member->getMemberInfo(['member_id' => $this->mAdminid], '*', true);
-        $this->merchant_available = ncPriceFormat($minfo['available_predeposit'] - $mchinfo['credit_bonus']);
-        $this->member_available = $minfo['available_predeposit'];
-
-
-        if ($mchinfo['merchant_state'] != 1) {
-            throw new LzException(self::text_content(-7,$this->merchant_available));
-        }
-
-        $ips = unserialize($mchinfo['ip_white_list']);
-        if(!empty($ips)) {
-            $addr = $_SERVER['REMOTE_ADDR'];
-            Log::record("request ip:{$addr}",Log::DEBUG);
-
-            if(!in_array($addr,$ips)) {
-                throw new LzException(self::text_content(-12,$this->merchant_available));
-            }
-        }
-
-        $this->mUseKey = intval($mchinfo['use_key']);
-        if($this->mUseKey && !$this->verify_md5($mchinfo['secure_key'])) {
-            throw new LzException(self::text_content(-4,$this->merchant_available));
-        }
-
-        $this->mMchid = intval($mchid);
-    }
-
-    public function mchid() : int
-    {
-        return $this->mMchid;
-    }
-    public function adminid() : int {
-        return $this->mAdminid;
-    }
-
-
-    private function verify_md5($key)
-    {
-        $input = $_GET;
-        $sign = $input['sgn'];
-
-        $body = $this->sign_body($input);
-        if($this->mUseKey) {
-            $body .= $key;
-        }
-
-        return ($sign == strtoupper(md5($body)));
-    }
-
-    private function sign_body($params)
-    {
-        $op = $params['op'];
-        if($op == 'add_mob') {
-            $content = $params['usr'] . $params['ord'] . $params['mob'] . $params['amt'] . $params['tim'];
-        }
-        elseif($op == 'balance') {
-            $content = $params['usr'];
-        }
-        elseif($op == 'query') {
-            $content = $params['usr'] . $params['ord'];
-        }
-        elseif($op == 'add_third') {
-            $content = $params['usr'] . $params['ord'] . $params['mob'] . $params['product_code'] . $params['tim'];
-        }
-        else {
-            $content = 'error';
-        }
-        return $content;
-    }
-
-    public static function msg($code)
-    {
-        static $msgs = [0 => '订单提交成功',
-            2 => '运营商充值账户余额不足',
-            4 => '账户余额不足',
-            6 => '暂不支持此商品',
-            7 => '连接该运营商设备失败',
-            8 => '在规定时间内不得重复提交同一号码',
-            10 => '该帐号不能在此计算机缴费',
-            11 => '流水号重复',
-            30 => '面值不符',
-            41 => '该地区维护',
-            42 => '运营商设备忙',
-            43 => '暂不支持该面额的缴费',
-            44 => '无该地区缴费权限',
-            -2 => '命令已发送,请查看交易流水是否有缴费成功(这种情况是服务器在排队等待处理,间隔10-20分钟后查单核实)',
-            -3 => '数据添加失败',
-            -4 => '签名错误',
-            -5 => '没有此代理商',
-            -6 => '提交失败',
-            -7 => '无此接口权限',
-            -8 => '提交日期不是当天日期',
-            -9 => '参数不对',
-            -11 => '手机号码位数不符',
-            -12 => '绑定IP不符',
-            1001 => '销售数量请大于0',
-            1002 => '该商品库存维护',
-            1003 => '该供货商品库存维护'];
-
-        if(array_key_exists($code,$msgs)) {
-            return $msgs[$code];
-        }
-        else {
-            return '';
-        }
-    }
-
-    public static function text_content($code,$available)
-    {
-        $msg = self::msg($code);
-        $available = ncPriceFormat($available);
-        $content = "{$code}|{$msg}|{$available}";
-        return $content;
-    }
-
-    public static function outsuccess($available)
-    {
-        echo self::text_content(0,$available);
-        return true;
-    }
-
-    public static function outerr($code,$available)
-    {
-        echo self::text_content($code,$available);
-        return true;
-    }
-}

+ 3 - 3
racc/control/merchant.php

@@ -1,5 +1,6 @@
 <?php
 
+
 class merchantControl
 {
     private $mMchid;
@@ -21,8 +22,8 @@ class merchantControl
         }
 
         $ips = unserialize($mchinfo['ip_white_list']);
-
-        if(!empty($ips)) {
+        if(!empty($ips))
+        {
             $addr = $_SERVER['REMOTE_ADDR'];
             Log::record("request ip:{$addr}",Log::DEBUG);
 
@@ -103,7 +104,6 @@ class merchantControl
         joutput_data($data);
         return true;
     }
-
     public static function outerr($code, $msg = '')
     {
         joutput_error($code, $msg);

+ 421 - 57
racc/control/refill.php

@@ -14,8 +14,10 @@ class refillControl extends merchantControl
 
     public function goodsOp()
     {
-        $result = refill\RefillFactory::instance()->goods();
-        $sorter = function (array $items) {
+        $goods_list = refill\RefillFactory::instance()->goods();
+
+        $sorter = function (array $items)
+        {
             $ret = [];
             foreach ($items as $key => $val) {
                 sort($val);
@@ -24,7 +26,25 @@ class refillControl extends merchantControl
             return $ret;
         };
 
-        $result = $sorter($result);
+        $goods_list = $sorter($goods_list);
+
+        $result = [];
+        $mchid = $this->mchid();
+        $merchant_goods = rcache('merchant_goods', 'refill-', $mchid);
+        $goods = $merchant_goods[$mchid] ?? serialize([]);
+        $goods = unserialize($goods);
+        foreach ($goods_list as $card_type => $value) {
+            $key = mtopcard\scard_type($card_type);
+            if (array_key_exists($key, $goods)) {
+                $result[$key] = $goods[$key];
+            } else {
+                $result[$key] = $value;
+            }
+        }
+        $thrid_refill = Model('thrid_refill');
+        $pcode = $thrid_refill->getMerchantPcode($mchid);
+        $result['third'] = $pcode;
+
         return self::outsuccess($result);
     }
 
@@ -39,7 +59,6 @@ class refillControl extends merchantControl
 
         $card_no = $_GET['cardno'];
         $card_type = mtopcard\simple_card_type($card_no);
-
         if($card_type == mtopcard\UnknownCard) {
             return [false,'卡类型无法识别'];
         }
@@ -54,6 +73,7 @@ class refillControl extends merchantControl
         return [true,""];
     }
 
+
     public function addOp()
     {
         [$success,$error] = $this->check_params($_GET);
@@ -62,56 +82,357 @@ class refillControl extends merchantControl
         }
 
         $amount = intval($_GET['amount']);
-        $card_no = $_GET['cardno'];
+        $card_no = trim($_GET['cardno']);
         $notify_url = $_GET['notifyurl'];
-        $mch_order = $_GET['order_sn']; //对方的order编号
+        $mch_order = $_GET['order_sn'];   //对方的order编号
         $quality = $_GET['quality'] ?? 0;
+        $bind_phone = $_GET['bind_phone'] ?? '';
 
         if(!$this->check_mchorder($this->mchid(),$mch_order)) {
             return self::outerr(205,"客户订单号重复或者为空.");
         }
 
-        if(!$this->can_refill($card_no)) {
-            return self::outerr(206,"平台不支持该卡充值.");
+        $card_type = mtopcard\simple_card_type($card_no);
+        if($card_type === mtopcard\SinopecCard || $card_type === mtopcard\PetroChinaCard)
+        {
+            refill\util::write_card($card_no,$card_type,$bind_phone);
+            if(!$this->can_refill($card_no)) {
+                return self::outerr(206,"平台不支持该卡充值.");
+            }
+
+            $allow = true;
+            if(!$allow)
+            {
+                if ($card_type === mtopcard\SinopecCard) {
+                    $text = "中石化";
+                }
+                else {
+                    $text = "中石油";
+                }
+                return self::outerr(207,"今日贵司{$amount}{$text}充值库存已经用完.");
+            }
         }
 
-//        $card_type = mtopcard\card_type($card_no,$regin_no);
-//        if($card_type === mtopcard\SinopecCard || $card_type === mtopcard\PetroChinaCard)
-//        {
-//            $allow = refill\RefillFactory::instance()->allow($this->mchid(),$card_type,$amount);
-//            if(!$allow) {
-//                if ($card_type === mtopcard\SinopecCard) {
-//                    $text = "中石化";
-//                }
-//                else {
-//                    $text = "中石油";
-//                }
-//                return self::outerr(207,"今日贵司{$amount}{$text}充值库存已经用完.");
-//            }
-//        }
+        $order_time = time();
+        $params = ['mchid' => $this->mchid(),
+            'buyer_id' => $this->adminid(),
+            'amount' => $amount,
+            'card_no' => $card_no,
+            'mch_order' => $mch_order,
+            'notify_url' => $notify_url,
+            'org_quality' => $quality,
+            'order_time' => $order_time
+        ];
 
-        $minfo = new member_info($this->adminid());
-        $available = $minfo->available_predeposit();
+        refill\util::push_queue_order($this->mchid(),$mch_order,ORDER_STATE_QUEUE);
+        Model('refill_order')->add_detail($this->mchid(),$mch_order,$order_time,$params,ORDER_STATE_QUEUE);
+
+        [$can_refill, $period] = refill\util::can_commit($card_no, $card_type);
+        if ($can_refill === false) {
+            $state = refill\util::async_add($params, $period);
+        } else {
+            $state = refill\util::push_add($params);
+        }
+
+        $mchid = $this->mchid();
+        if ($state === true) {
+            Log::record("refill::util::push_add success mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
+            return self::outsuccess(['state' => true]);
+        } else {
+            refill\util::del_queue_order($this->mchid(),$mch_order);
+            Model('refill_order')->del_detail($this->mchid(),$mch_order);
+            Log::record("refill::util::push_add error mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
+            return self::outerr(208, '提交失败');
+        }
+    }
+
+    private function check_third($params)
+    {
+        if(empty($params['product_code'])) {
+            return [false,'参数没有包含product_code'];
+        }
+
+        $pcode = $params['product_code'];
+        if($this->check_pcode($pcode) == false) {
+            return [false,"对应的产品编码{$pcode}"];
+        }
+
+        if(empty($params['quantity']) || intval($params['quantity']) < 1) {
+            return [false,"购买数量参数不存在,或者小于0"];
+        }
+
+        if(empty($params['notifyurl'])) {
+            return [false,'参数没有包含notifyurl'];
+        }
+        if(empty($params['order_sn'])) {
+            return [false,'参数没有包含贵方唯一订单号:order_sn'];
+        }
+
+        return [true,""];
+    }
+
+    private function check_pcode($pcode)
+    {
+        $mod_third = Model('thrid_refill');
+        $product = $mod_third->getProduct(['system_code' => $pcode]);
+        return !empty($product);
+    }
+
+    private function add_third_product($third_product_type)
+    {
+        [$success,$error] = $this->check_third($_GET);
+        if($success === false) {
+            return self::outerr(201,$error);
+        }
 
-        if($amount > $available) {
-            return self::outerr(203, "余额不足");
+        $amount = refill\util::ThirdRefillAmount;
+        $notify_url = $_GET['notifyurl'];
+        $mch_order = $_GET['order_sn'];   //对方的order编号
+
+        $product_code = $_GET['product_code'];
+        $card_no = $_GET['cardno'] ?? '';
+        $quantity = $_GET['quantity'];
+        $third_card_type = $_GET['card_type'] ?? 1;
+
+        //三方充值没有质量
+        $quality = 1;
+        $card_type = mtopcard\ThirdRefillCard;
+
+        if(!$this->check_mchorder($this->mchid(),$mch_order)) {
+            return self::outerr(205,"客户订单号重复或者为空.");
         }
 
         $order_time = time();
         $params = ['mchid' => $this->mchid(),
             'buyer_id' => $this->adminid(),
             'amount' => $amount,
+            'mch_order' => $mch_order,
+            'notify_url' => $notify_url,
+            'org_quality' => $quality,
+            'card_type' => $card_type,
             'card_no' => $card_no,
+            'product_code' => $product_code,
+            'quantity' => $quantity,
+            'third_card_type' => $third_card_type,
+            'third_product_type' => $third_product_type,
+            'order_time' => $order_time
+        ];
+
+        refill\util::push_queue_order($this->mchid(),$mch_order,ORDER_STATE_QUEUE);
+        Model('refill_order')->add_detail($this->mchid(), $mch_order, $order_time, $params, ORDER_STATE_QUEUE);
+
+        $state = refill\util::push_addthird($params);
+        if ($state === true) {
+            return self::outsuccess(['state' => true]);
+        } else {
+            refill\util::del_queue_order($this->mchid(),$mch_order);
+            Model('refill_order')->del_detail($this->mchid(),$mch_order);
+            return self::outerr(208, '提交失败');
+        }
+    }
+
+    public function add_thirdOp()
+    {
+        return $this->add_third_product(mtopcard\ThirdOnlineProduct);
+    }
+
+    public function add_netOp()
+    {
+        return $this->add_third_product(mtopcard\ThirdNetTrafficPoroduct);
+    }
+
+    private function check_electirc($params)
+    {
+        if(empty($params['cardno'])) {
+            return [false,'参数没有包含cardno'];
+        }
+        if(empty($params['notifyurl'])) {
+            return [false,'参数没有包含notifyurl'];
+        }
+        if(empty($params['order_sn'])) {
+            return [false,'参数没有包含贵方唯一订单号:order_sn'];
+        }
+        if(empty($params['amount']) || intval($params['amount']) <= 0) {
+            return [false,'参数没有包含充值金额:amount'];
+        }
+
+        if(empty($params['company_type']) || !in_array($params['company_type'],mtopcard\ElectricCompanyTypes)) {
+            return [false,'没有电卡类型参数(nation,south)'];
+        }
+        if(empty($params['use_type']) || !in_array($params['use_type'],mtopcard\ElectricUseTypes)) {
+            return [false,"没有电卡用途参数(home,commerce,pedlar)"];
+        }
+        if(empty($params['province']) || !array_key_exists($params['province'],mtopcard\ProvinceList)) {
+            return [false,"请传入省份"];
+        }
+        if(empty($params['city'])) {
+            return [false,"请传入城市名称"];
+        }
+        //如果是南方电网需要带身份证后六位
+        if($params['company_type'] === 'south')
+        {
+            $card_id = $params['card_id'];
+            if(empty($card_id) || strlen($card_id) != mtopcard\CardidVerifyLength || !mtopcard\is_alpha($card_id)) {
+                return [false,"请传入正确的身份证后6位"];
+            }
+        }
+
+        return [true,""];
+    }
+
+    public function add_electricOp()
+    {
+        [$success,$error] = $this->check_electirc($_GET);
+        if($success === false) {
+            return self::outerr(201,$error);
+        }
+
+        $notify_url = $_GET['notifyurl'];
+        $mch_order = $_GET['order_sn'];   //对方的order编号
+
+        $card_no = $_GET['cardno'] ?? '';
+
+        $quantity = 1;
+        $third_card_type = mtopcard\ThirdCardElect;
+        $company_type = $_GET['company_type'];
+        $use_type = $_GET['use_type'];
+        $province = intval($_GET['province']);
+        $city = $_GET['city'];
+        $amount = intval($_GET['amount']);
+
+        if($company_type == 'nation') {
+            $card_id = '';
+        } else {
+            $card_id = $_GET['card_id'] ?? '';
+        }
+
+        $product_code = mtopcard\electric_product_code($company_type,$use_type,$amount);
+        $amount = refill\util::ThirdRefillAmount;
+
+        //三方充值没有质量
+        $quality = 1;
+        $card_type = mtopcard\ThirdRefillCard;
+
+        if(!$this->check_mchorder($this->mchid(),$mch_order)) {
+            return self::outerr(205,"客户订单号重复或者为空.");
+        }
+
+        $order_time = time();
+        $params = ['mchid' => $this->mchid(),
+            'buyer_id' => $this->adminid(),
+            'amount' => $amount,
             'mch_order' => $mch_order,
             'notify_url' => $notify_url,
+
             'org_quality' => $quality,
+            'card_type' => $card_type,
+
+            'card_no' => $card_no,
+            'product_code' => $product_code,
+            'quantity' => $quantity,
+            'third_card_type' => $third_card_type,
+            'third_product_type' => mtopcard\ThirdElectricProduct,
+
+            'company_type' => $company_type,
+            'use_type' => $use_type,
+            'province' => $province,
+            'city' => $city,
+            'card_id' => $card_id,
+            'order_time' => $order_time
+        ];
+
+        refill\util::push_queue_order($this->mchid(), $mch_order, ORDER_STATE_QUEUE);
+        Model('refill_order')->add_detail($this->mchid(), $mch_order, $order_time, $params, ORDER_STATE_QUEUE);
+
+        $state = refill\util::push_addthird($params);
+        if ($state === true) {
+            return self::outsuccess(['state' => true]);
+        } else {
+            refill\util::del_queue_order($this->mchid(),$mch_order);
+            Model('refill_order')->del_detail($this->mchid(),$mch_order);
+            return self::outerr(208, '提交失败');
+        }
+    }
+
+    private function check_sinopec_coupon($params)
+    {
+        if(empty($params['cardno'])) {
+            return [false,'参数没有包含cardno'];
+        }
+        if(empty($params['notifyurl'])) {
+            return [false,'参数没有包含notifyurl'];
+        }
+        if(empty($params['order_sn'])) {
+            return [false,'参数没有包含贵方唯一订单号:order_sn'];
+        }
+        if(empty($params['amount']) || intval($params['amount']) <= 0) {
+            return [false,'参数没有包含充值金额:amount'];
+        }
+        if(empty($params['province']) || !array_key_exists($params['province'],mtopcard\ProvinceList)) {
+            return [false,"请传入省份"];
+        }
+
+        return [true,""];
+    }
+
+    public function add_sinopec_couponOp()
+    {
+        [$success,$error] = $this->check_sinopec_coupon($_GET);
+        if($success === false) {
+            return self::outerr(201,$error);
+        }
+
+        $notify_url = $_GET['notifyurl'];
+        $mch_order  = $_GET['order_sn'];   //对方的order编号
+
+        $card_no = $_GET['cardno'] ?? '';
+
+        $quantity = 1;
+        $third_card_type = mtopcard\ThirdCardPhone;
+        $province = intval($_GET['province']);
+        $amount   = intval($_GET['amount']);
+
+        $product_code = mtopcard\sino_coupon_product_code($amount);
+        $amount = refill\util::ThirdRefillAmount;
+
+        //三方充值没有质量
+        $quality = 1;
+        $card_type = mtopcard\ThirdRefillCard;
+
+        if(!$this->check_mchorder($this->mchid(),$mch_order)) {
+            return self::outerr(205,"客户订单号重复或者为空.");
+        }
+
+        $order_time = time();
+        $params = ['mchid' => $this->mchid(),
+            'buyer_id' => $this->adminid(),
+            'amount' => $amount,
+            'mch_order' => $mch_order,
+            'notify_url' => $notify_url,
+
+            'org_quality' => $quality,
+            'card_type' => $card_type,
+
+            'card_no' => $card_no,
+            'product_code' => $product_code,
+            'quantity' => $quantity,
+            'third_card_type' => $third_card_type,
+            'third_product_type' => mtopcard\ThirdSinopecECouponPoroduct,
+            'province' => $province,
             'order_time' => $order_time
         ];
 
         refill\util::push_queue_order($this->mchid(),$mch_order,ORDER_STATE_QUEUE);
         Model('refill_order')->add_detail($this->mchid(), $mch_order, $order_time, $params, ORDER_STATE_QUEUE);
-        refill\util::push_add($params);
-        return self::outsuccess(['state' => true]);
+
+        $state = refill\util::push_addthird($params);
+        if ($state === true) {
+            return self::outsuccess(['state' => true]);
+        } else {
+            refill\util::del_queue_order($this->mchid(),$mch_order);
+            Model('refill_order')->partition(refill\util::part_query($order_time))->del_detail($this->mchid(),$mch_order);
+            return self::outerr(208, '提交失败');
+        }
     }
 
     private function can_refill($cardno)
@@ -124,14 +445,12 @@ class refillControl extends merchantControl
 
     private function check_mchorder($mchid,$mch_order)
     {
-        if(empty($mch_order)) {
+        if (empty($mch_order)) {
             return false;
-        }
-        else {
+        } else {
             $refill_order = Model('refill_order');
-            $ret = $refill_order->getOrderInfo(['mchid' => $mchid,'mch_order' => $mch_order]);
-
-            return empty($ret);
+            $ret = $refill_order->exist($mchid, $mch_order, refill\util::part_query());
+            return ($ret == false);
         }
     }
 
@@ -140,7 +459,11 @@ class refillControl extends merchantControl
         $uid = $this->adminid();
         $minfo = new member_info($uid);
         $available = $minfo->available_predeposit();
-        return self::outsuccess(['balance' => $available]);
+        $mchinfo = Model('merchant')->getMerchantInfo(['mchid' => $this->mchid()]);
+        $available = ncPriceFormat($available - $mchinfo['credit_bonus']);
+        $credit = ncPriceFormat($mchinfo['credit_bonus']);
+
+        return self::outsuccess(['balance' => $available,'credit' => $credit]);
     }
 
     public function query_tradeOp()
@@ -169,7 +492,6 @@ class refillControl extends merchantControl
     private function format($order_info,$refill_info)
     {
         $result = [];
-
         $result['mchid'] = $refill_info['mchid'];
         $result['trade_no'] = $refill_info['order_sn'];
         $result['order_sn'] = $refill_info['mch_order'];
@@ -179,8 +501,8 @@ class refillControl extends merchantControl
         $result['order_amount'] = $refill_info['mch_amount'];
         $result['order_time'] = $refill_info['order_time'];
         $result['success_time'] = $refill_info['notify_time'];
+        $result['official_sn'] = $refill_info['official_sn'] ?? "";
         $result['order_state'] = $order_info['order_state'];
-        $result['official_sn'] = $refill_info['official_sn'];
 
         return $result;
     }
@@ -194,26 +516,68 @@ class refillControl extends merchantControl
             return self::outerr(201,"客户订单号order_sn错误");
         }
 
-        $mod_refill = Model('refill_order');
-        $refill_info = $mod_refill->getOrderInfo(['mch_order' => $order_sn,'mchid' => $mchid,'inner_status' => 0]);
-
-        if(empty($refill_info)) {
-            return self::outerr(201,"无此订单");
-        }
-
-        $vr_order = Model('vr_order');
-        $order_info = $vr_order->getOrderInfo(['order_sn' => $refill_info['order_sn']]);
-
-        if(empty($order_info)) {
-            return self::outerr(201,"无此交易号");
+        $order_state = refill\util::query_queue_order($mchid,$order_sn);
+        if ($order_state == ORDER_STATE_QUEUE || $order_state == ORDER_STATE_SEND) {
+            Log::record("query_state in queue mchid={$mchid} mch_order={$order_sn} order_state={$order_state}" ,Log::DEBUG);
+            $result['mchid'] = $mchid;
+            $result['order_sn'] = $order_sn;
+            $result['order_state'] = $order_state;
+            return self::outsuccess($result);
         }
-
-        if($order_info['order_state'] == ORDER_STATE_SEND) {
-            QueueClient::push("QueryRefillState",['order_id' => $refill_info['order_id']]);
+        else
+        {
+            $mod_refill = Model('refill_order');
+            $refill_info = $mod_refill->partition(refill\util::part_query())->getOrderInfo(['mch_order' => $order_sn,'mchid' => $mchid,'inner_status' => 0]);
+
+            if(empty($refill_info))
+            {
+                $mod_qerr = Model('refill_query_err');
+                $insert = ['mch_order' => $order_sn,'mchid' => $mchid];
+
+                $items = $mod_refill->getOrderInfo(['mch_order' => $order_sn,'mchid' => $mchid]);
+                if (empty($items)) {
+                    Log::record("query_state in db no order mchid={$mchid} mch_order={$order_sn}", Log::DEBUG);
+
+                    $insert['code'] = 202;
+                    $insert['msg'] = "检索充值中的单子,查不到任何订单信息.";
+                    $mod_qerr->add($insert);
+
+                    return self::outerr(202, "无此订单,请人工确认处理.");
+                } else {
+                    Log::record("DEBUG_TAG: query_state in db mchid={$mchid} mch_order={$order_sn} order_state not completed.", Log::DEBUG);
+
+
+                    $insert['code'] = 200;
+                    $insert['msg'] = "检索充值中的单子能查到,但inner_status=0时查不到,回调充值中状态.";
+                    $mod_qerr->add($insert);
+
+                    $result['mchid'] = $mchid;
+                    $result['order_sn'] = $order_sn;
+                    $result['order_state'] = ORDER_STATE_SEND;
+                    return self::outsuccess($result);
+                }
+            }
+            else
+            {
+                $vr_order = Model('vr_order');
+                $order_info = $vr_order->partition(refill\util::part_query())->getOrderInfo(['order_sn' => $refill_info['order_sn']]);
+                Log::record("query_state in db mchid={$mchid} mch_order={$order_sn} order_state={$order_info['order_state']}" ,Log::DEBUG);
+
+                if (empty($order_info))
+                {
+                    $mod_qerr = Model('refill_query_err');
+                    $insert = ['mch_order' => $order_sn,'mchid' => $mchid];
+
+                    $insert['code'] = 203;
+                    $insert['msg'] = "检索充值中的单子能查到,但inner_status=0时查不到vr_order中的订单.";
+                    $mod_qerr->add($insert);
+
+                    return self::outerr(203, "无此交易,请人工确认处理.");
+                } else {
+                    $result = $this->format($order_info, $refill_info);
+                    return self::outsuccess($result);
+                }
+            }
         }
-
-        $result = $this->format($order_info,$refill_info);
-
-        return self::outsuccess($result);
     }
-}
+}

+ 9 - 0
racc/framework/function/function.php

@@ -0,0 +1,9 @@
+<?php
+/**
+ * mobile公共方法
+ *
+ * 公共方法
+ *
+ */
+
+defined('InShopNC') or exit('Access Invalid!');

+ 1 - 0
racc/framework/index.html

@@ -0,0 +1 @@
+ 

+ 4 - 2
racc/index.php

@@ -5,5 +5,7 @@
  *
  */
 
-require_once(BASE_PATH . '/control/merchant.php');
-require_once(BASE_PATH . '/control/lzbase.php');
+require_once(BASE_PATH . '/config/config.ini.php');
+require_once(BASE_PATH . '/util/errcode.php');
+require_once(BASE_PATH . '/framework/function/function.php');
+require_once(BASE_PATH . '/control/merchant.php');

+ 0 - 0
racc/language/index.html


+ 10 - 0
racc/language/zh_cn/mobile.php

@@ -0,0 +1,10 @@
+<?php
+defined('InShopNC') or exit('Access Invalid!');
+
+$lang['order_state_cancel'] = '已取消';
+$lang['order_state_new'] = '待付款';
+$lang['order_state_pay'] = '待发货';
+$lang['order_state_send'] = '待收货';
+$lang['order_state_success'] = '交易完成';
+$lang['order_state_eval'] = '已评价';
+

+ 3 - 15
racc/racc.php

@@ -9,7 +9,6 @@ define('BASE_PATH', BASE_ROOT_PATH . '/racc');
 require_once(BASE_ROOT_PATH . '/global.php');
 require_once(BASE_ROOT_PATH . '/fooder.php');
 require_once(BASE_PATH . '/index.php');
-
 require_once(BASE_ROOT_PATH . '/helper/http_header.php');
 require_once(BASE_ROOT_PATH . '/helper/session.php');
 require_once(BASE_ROOT_PATH . '/helper/img_helper.php');
@@ -35,6 +34,7 @@ require_once(BASE_ROOT_PATH . '/helper/fcode/present_manager.php');
 require_once(BASE_ROOT_PATH . '/helper/url_helper.php');
 require_once(BASE_ROOT_PATH . '/helper/activity_helper.php');
 require_once(BASE_HELPER_PATH . '/refill/util.php');
+require_once(BASE_HELPER_PATH . '/fcgisrv/RAccServer.php');
 
 function all_channels() {
     return ['refill'];
@@ -42,24 +42,12 @@ function all_channels() {
 
 Base::mobile_init();
 $trdid = Thread::getCurrentThreadId();
-Log::record("thread id = {$trdid}",Log::INFO);
+Log::record("thread id = $trdid",Log::INFO);
 
 $gMessageStates = new MsgStates();
 StatesHelper::init();
 $listener = new message\subscriber($gMessageStates);
 $listener->start();
 
-if(defined('COMPANY_NAME') && COMPANY_NAME == 'LZKJ_COMPANY') {
-    require_once(BASE_HELPER_PATH . '/fcgisrv/LZRAccServer.php');
-    Log::record("fcgisrv\LZRAccServer start",Log::DEBUG);
-    fcgisrv\LZRAccServer::instance()->run_looper();
-}
-elseif(defined('COMPANY_NAME') && COMPANY_NAME == 'XYZ_COMPANY') {
-    require_once(BASE_HELPER_PATH . '/fcgisrv/XYZRAccServer.php');
-    Log::record("fcgisrv\XYZRAccServer start",Log::DEBUG);
-    fcgisrv\XYZRAccServer::instance()->run_looper();
-}
-else {
-    Log::record("fcgisrv Not any server can start",Log::DEBUG);
-}
+fcgisrv\RAccServer::instance()->run_looper();
 

+ 1 - 0
racc/templates/index.html

@@ -0,0 +1 @@
+ 

+ 231 - 0
racc/util/errcode.php

@@ -0,0 +1,231 @@
+<?php
+declare(strict_types=1);
+
+class errcode //extends SplEnum
+{
+    const __default = self::Success;
+
+    const Success = 200;
+
+    const ErrProtocolDisabled = 300;
+
+    const ErrApptype = 10000;
+    const ErrParamter = 10001;
+    const ErrLogin = 10002;
+    const ErrHasLogined = 10003;
+    const ErrUsertype = 10004;
+    const ErrTokenExpire = 10005;
+    const ErrSmscodeExpire = 10006;
+    const ErrSmscode = 10007;
+    const ErrIDbinded = 10008;
+    const ErrUserExisted = 10009;
+    const ErrPasswd = 10010;
+    const ErrMobileNotBinded = 10011;
+    const ErrOperRepeat = 10012;
+    const ErrAccountStop = 10013;
+    const ErrUnLogin = 10014;
+    const ErrRegister = 10015;
+    const ErrUserOrPass = 10016;
+
+    const ErrFrequentlyRequest = 10017;//请求频繁
+    const ErrUploadFileFailed = 10018; //上传文件失败
+    const ErrUnImplements = 10019;
+    const ErrLittleParamter = 10020;
+    const ErrSignParamter = 10021;
+
+    const ErrSpecial = 10100;
+
+    // 购物车模块(10200-10299)
+    const ErrCart = 10200;
+    const ErrGoodsOff = 10201;
+    const ErrCanNotBuyOwn = 10202;
+    const ErrStorageShort = 10203;
+    const ErrAddCart = 10204;
+    const ErrGoodsOutofStock = 10205;
+    const ErrGoodsSpecial = 10206;
+    const ErrCartDelError = 10207;
+
+    // 订单错误内容
+    const ErrOrder = 10300;
+    const ErrOrderCanNotCancel = 10301;
+    const ErrOrderNotExist = 10302;
+    const ErrOrderState = 10303;
+    const ErrOrderRefundError = 10304;
+    const ErrRefundNotExist = 10305;
+
+
+    const ErrAddress = 10400;
+    const ErrInvoice = 10500;
+    const ErrPayment = 10600;
+    // 快递内容
+    const ErrExpress = 10700;
+    const ErrExpressNotExist = 10701;
+
+    const ErrBonus = 10800;
+    const ErrBonusType = 10801;
+    const ErrBonusMake = 10802;
+    const ErrBonusGrabNull = 10803;
+    const ErrBonusNotEnough = 10804;
+    const ErrBonusSN = 10805;
+    const ErrBonusBinded = 10806;
+    const ErrBonusComment = 10807;
+    const ErrBonusShake = 10808;
+    const ErrBonusDailyRank = 10809;
+
+    //套装
+    const ErrBLUnExist = 10900;
+
+    const ErrDB = 11000;
+    const ErrShake = 11100;
+    const ErrRelation = 11200;
+
+    const ErrTopCard = 11300;
+
+    const ErrSms = 12000;
+    const ErrSmsLessRepeateMinTime = 12001;
+
+    const ErrGoodsNotExist = 13000;
+    const ErrMemberNotExist = 13001;
+    const ErrInputParam = 13002;
+    const ErrVerifyCode = 13003;
+    const ErrMemberExist = 13004;
+    const ErrWxNotExist = 13005;
+    const ErrLoginType = 13006;
+    const ErrGetConfig = 14000;
+    const ErrUpfile = 15000;
+    const ErrAuthor = 16000;
+    const ErrUGC = 17000;
+
+    const ErrRoom = 18000;
+    const ErrRoomCreate = 18001;
+    const ErrRoomInvite = 18002;
+    const ErrRoomLeave   = 18003;
+    const ErrRoomBuild  = 18004;
+    const ErrRoomParam  = 18005;
+    const ErrRoomFactoryOp  = 18006;
+    const ErrRoomAccessOp  = 18007;
+    const ErrRoomPush  = 18008;
+    const ErrRoomChange = 18009;
+    const ErrRoomKickout = 18010;
+    const ErrRoomTwoFace = 18011;
+    const ErrRoomNotice = 18012;
+
+    const ErrAccess = 19000;
+    const ErrTalk = 20000;
+
+    const ErrSafeIp = 21000;
+    const ErrOperation = 22000;
+    const ErrPushQueue = 23000;
+
+    static function msg($code)
+    {
+        switch ($code) {
+            case errcode::Success:
+                return '成功';
+            case errcode::ErrProtocolDisabled:
+                return '协议未启用';
+            case errcode::ErrApptype :
+                return '应用类型错误';
+            case errcode::ErrParamter :
+                return '错误的参数.';
+            case errcode::ErrLogin :
+                return '用户名或密码错误';
+            case errcode::ErrHasLogined :
+                return '当前在登录状态,请先登出再登录.';
+            case errcode::ErrUsertype :
+                return '用户类型错误';
+            case errcode::ErrTokenExpire :
+                return 'token过期';
+            case errcode::ErrSmscodeExpire :
+                return '验证码过期';
+            case errcode::ErrSmscode:
+                return '验证码错误';
+            case errcode::ErrIDbinded:
+                return '用户已经绑定';
+            case errcode::ErrMobileNotBinded :
+                return '手机号尚未绑定';
+            case errcode::ErrOperRepeat :
+                return '抱歉,您登录重试次数超过限制,请十分钟后再试~';
+            case errcode::ErrAccountStop :
+                return '该帐号已经被停用';
+            case errcode::ErrUnLogin :
+                return '您没有登录不能做此操作.';
+            case errcode::ErrSpecial:
+                return 'ErrSpecial.';
+            case errcode::ErrPayment:
+                return '支付错误.';
+            case errcode::ErrGoodsNotExist:
+                return '商品库存不足或已下架.';
+            case errcode::ErrMemberNotExist:
+                return '用户不存在.';
+            case errcode::ErrInputParam:
+                return '输入参数错误';
+            case errcode::ErrVerifyCode:
+                return '验证码错误';
+            case errcode::ErrMemberExist:
+                return '用户已经存在';
+            case errcode::ErrPasswd:
+                return '账号或密码错误';
+            case errcode::ErrWxNotExist:
+                return '该微信账号还没有注册';
+            case errcode::ErrLoginType:
+                return '登陆类型错误';
+            case errcode::ErrOrderCanNotCancel:
+                return '订单已支付或已发送,不能取消';
+            case errcode::ErrOrderNotExist:
+                return '订单不存在';
+            case errcode::ErrExpress:
+                return '查询快递出错';
+            case errcode::ErrGoodsOff:
+                return '商品下架';
+            case errcode::ErrCanNotBuyOwn:
+                return '不能购买自己商品';
+            case errcode::ErrStorageShort:
+                return '商品库存不足';
+            case errcode::ErrAddCart:
+                return '添加购物车失败';
+            case errcode::ErrGoodsOutofStock :
+                return '商品缺货.';
+            case errcode::ErrGoodsSpecial :
+                return '该商品不允许加入购物车,请直接购买';
+            case errcode::ErrCartDelError :
+                return '购物车删除失败.';
+            case errcode::ErrGetConfig:
+                return '获取配置文件出错';
+
+            case errcode::ErrBLUnExist:
+                return '该优惠套装已不存在,建议您单独购买';
+
+            case errcode::ErrDB :
+                return '系统错误';
+            case errcode::ErrSms :
+                return '验证码发送错误';
+            case errcode::ErrSmsLessRepeateMinTime:
+                return '一分钟内只能发送一次验证码,请稍后再试.';
+            case errcode::ErrRoom:
+                return '房间出错';
+            case errcode::ErrRoomCreate:
+                    return '房间创建出错.';
+            case errcode::ErrRoomInvite:
+                return '房间邀请出错.';
+            case errcode::ErrRoomLeave:
+                return '退出房间出错.';
+            case errcode::ErrRoomBuild:
+                return '房间重建出错.';
+            case errcode::ErrRoomParam:
+                return '房间重建参数出错,不存在此房间号.';
+            case errcode::ErrRoomFactoryOp:
+                return '房间不支持此操作.';
+            case errcode::ErrRoomAccessOp:
+                return '房间服务器不支持此access操作.';
+            case errcode::ErrSignParamter:
+                return '请求参数需要做签名.';
+            case errcode::ErrSafeIp:
+                return '无权限的IP.';
+            case errcode::ErrOperation:
+                return '操作失败.';
+            default :
+                return '系统错误.';
+        }
+    }
+}

+ 25 - 1
test/TestRefill.php

@@ -2941,7 +2941,9 @@ class TestRefill extends TestCase
     public function testLechongquan()
     {
         $provider = $this->getProvider('lechongquan');
-        $resp = $provider->balance();
+//        $resp = $provider->balance();
+        $net_errno = '';
+        $resp = $provider->add(15811535608, 4, 5, ['order_sn' => $this->make_sn()], $net_errno);
     }
 
     public function testLechongYin()
@@ -5767,6 +5769,28 @@ class TestRefill extends TestCase
         $provider = $this->getProvider('guangxinxiaome');
         $resp = $provider->balance();
     }
+
+    public function testliantuo_high()
+    {
+        $provider = $this->getProvider('liantuo_high');
+//        $resp = $provider->balance();
+        $resp = $provider->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
+    }
+
+    public function testmiaoxt_tax_trd()
+    {
+        $provider = $this->getProvider('miaoxt_tax_trd');
+//        $resp = $provider->balance();
+        $resp = $provider->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
+    }
+
+    public function testmiaoxt_tax_sec()
+    {
+        $provider = $this->getProvider('miaoxt_tax_sec');
+        $resp = $provider->balance();
+//        $resp = $provider->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
+    }
+
 }