stanley-king 3 vuotta sitten
vanhempi
commit
3864a7a2dc

+ 11 - 0
docker/compose/stanley/docker-compose.yml

@@ -106,6 +106,17 @@ services:
     depends_on:
       - "redisrv"
 
+  sendsrv:
+    image: php-swool-redis:latest
+    volumes:
+      - ../../conf/etc/localtime:/etc/localtime:ro
+      - ../../../:/var/www/html
+      - /Volumes/Transcend/upload:/var/www/html/data/upload
+      - /Users/stanley-king/work/PHPProject/shoplog:/var/www/html/data/log
+      - ../../conf/php/php-swoole-debug.ini:/usr/local/etc/php/php.ini
+    container_name: "panda-sender"
+    command: [php,"/var/www/html/server/send_refill.php"]
+
   websrv:
       image: php-fpm:alpine
       ports:

+ 17 - 0
docker/compose/xyzt-sender/docker-compose.yml

@@ -0,0 +1,17 @@
+version: "3.7"
+
+services:
+  sendsrv:
+    image: php-swool-redis:latest
+    volumes:
+      - ../../conf/etc/localtime:/etc/localtime:ro
+      - ../../../:/var/www/html
+      - /nfs/upload:/var/www/html/data/upload
+      - /mnt/testlog:/var/www/html/data/log
+      - ../../conf/php/xyzt-php-swoole.ini:/usr/local/etc/php/php.ini
+    container_name: "worker-sender"
+    command: [php,"/var/www/html/server/send_refill.php"]
+    deploy:
+      resources:
+        limits:
+          cpus: '8'

+ 3 - 1
helper/queue/iqueue.php

@@ -80,7 +80,9 @@ class IQueueDB
     public function lpush($value)
     {
         try {
-            return $this->_redis->lPush($this->_queue_name,$value);
+            $ret = $this->_redis->lPush($this->_queue_name,$value);
+            Log::record("IQueueDB::lpush ret={$ret}",Log::DEBUG);
+            return $ret;
         } catch(Exception $e) {
             Log::record("IQueueDB::lpush " . $e->getMessage(),Log::ERR);
             return false;

+ 10 - 10
mchsrv/control/merchant.php

@@ -21,16 +21,16 @@ class merchantControl
             throw new Exception("机构已被关闭。");
         }
 
-        $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 Exception("请求地址不在白名单中");
-            }
-        }
+//        $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 Exception("请求地址不在白名单中");
+//            }
+//        }
 
         $this->mUseKey = intval($mchinfo['use_key']);
         if($this->mUseKey && !$this->verify_md5($mchinfo['secure_key'])) {

+ 7 - 0
mobile/callback/bridge_test.php

@@ -0,0 +1,7 @@
+<?php
+
+$content = $_SERVER['post_content'];
+$order_sn = $content['order_sn'];
+Log::record("BridgeCB order_sn = {$order_sn}",Log::DEBUG);
+
+echo ('SUCCESS');

+ 51 - 0
server/send_refill.php

@@ -0,0 +1,51 @@
+<?php
+
+declare(strict_types=0);
+
+define('APP_ID', 'sender');
+define('BASE_ROOT_PATH',str_replace('/server','',dirname(__FILE__)));
+define('BASE_PATH',BASE_ROOT_PATH . '/server');
+
+require_once(BASE_ROOT_PATH . '/global.php');
+require_once(BASE_ROOT_PATH . '/fooder.php');
+require_once(BASE_CORE_PATH . '/framework/function/http.php');
+require_once(BASE_HELPER_PATH . '/refill_proxy.php');
+
+//Co::set(['hook_flags' => SWOOLE_HOOK_NATIVE_CURL|SWOOLE_HOOK_SLEEP]);
+
+class RefillSender
+{
+    public function send()
+    {
+        $time = time();
+        Log::record("push message start:{$time}",Log::DEBUG);
+
+        for ($i = 0; $i < 100000; $i++)
+        {
+            $this->push_order(1092,$time,$i);
+        }
+        Log::record("push message end",Log::DEBUG);
+    }
+
+    private function push_order($mchid,$time,$index)
+    {
+        $notify_url = "http://test.xyzshops.cn/mobile/callback/bridge_test.php";
+        $params = [ 'mchid' => $mchid,
+            'amount' => 30,
+            'order_sn' => "{$time}" . sprintf("%'010d",$index),
+            'card_no' => '13911129867',
+            "act" => "refill",
+            "op" => "add",
+            'notifyurl' => $notify_url
+        ];
+
+        $proxy = new refill_proxy("210fe406954220f56085997d6a4c5b80");
+        $resp = $proxy->send("http://test.xyzshops.cn/mobile/index.php", $params);
+    }
+}
+
+$sender = new RefillSender();
+$sender->send();
+
+
+