ayHaru 4 年之前
父節點
當前提交
e199a68b92

+ 36 - 0
application/index/controller/Cabinet.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace app\index\controller;
+
+use think\Controller;
+
+class Cabinet extends Controller{
+
+    /**
+     * 检查取件码
+     */
+    public function check_fcode(){
+        $code = input('param.code');
+    }
+    /**
+     * 自提柜向服务器上报
+     */
+    public function record_store(){
+        $order_sn   = input('param.order_sn');
+        $trunk      = input('param.trunk');
+        $cabinet    = input('param.cabinet');
+
+        $state      = input('param.state');
+    }
+    /**
+     * 自提柜向服务器上报用户取走商品。
+    */
+    public function record_fetch(){
+        $trunk      = input('param.trunk');
+        $cabinet    = input('param.cabinet');
+        $state      = input('param.state');
+
+
+
+    }
+}

+ 16 - 0
application/index/controller/Order.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace app\index\controller;
+
+use think\Controller;
+
+class Order extends Controller{
+
+    /**
+     * 验证订单是否存在
+    */
+    public function check_rcode(){
+        $order_sn = input('param.order_sn');
+
+    }
+}

+ 0 - 26
application/index/controller/daemon.php

@@ -1,26 +0,0 @@
-<?php
-
-class Daemon{
-
-    protected $handler = null;
-
-    public function init(){
-        $this->handler = new \Redis();
-        $this->handler->connect('39.97.239.116', 6379);
-        $this->handler->auth('huaxiashangmeng');
-        $this->handler->select(1);
-    }
-
-    public function btoc($listname){
-        $result = $this->handler->BRPOP($listname,0);
-        if($result){
-
-        }
-    }
-}
-
-$daemon = new Daemon();
-$daemon->init();
-while (true){
-
-}

+ 3 - 3
conf/crontab/docker-start

@@ -3,8 +3,8 @@
 crond
 
 time=$(date "+%Y%m%d")
-if [ ! -f "/var/www/html/xyzshop/data/log/${time}-crontab.log" ]; then
-    touch "/var/www/html/xyzshop/data/log/${time}-crontab.log"
+if [ ! -f "/var/www/html/data/log/${time}-crontab.log" ]; then
+    touch "/var/www/html/data/log/${time}-crontab.log"
 fi
 
-tail -f "/var/www/html/xyzshop/data/log/${time}-crontab.log"
+tail -f "/var/www/html/data/log/${time}-crontab.log"

+ 12 - 23
conf/nginx/nginx-debug-http.conf

@@ -27,21 +27,21 @@ http
 
     server 
     {
-    	listen       80;
-        set  $folder_name /var/www/html;
-        server_name 192.168.1.200;
+    	listen       8080;
+        set  $folder_name /var/www/html/public;
+        server_name 127.0.0.1;
         root $folder_name;
-        index index.html index.php; 
+        index index.html index.php;
     	client_max_body_size 100m;
     	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_read_timeout 600;
+        fastcgi_send_timeout 600;
 
         charset utf-8;
-        
+
         location /logs {
             deny all;
             return 403;
@@ -54,30 +54,19 @@ http
         location / {
             index  index.html index.htm index.php;
         }
+
         location /mshop {
             root $folder_name;
-            autoindex on;        
+            autoindex on;
             index  index.html index.htm index.php;
 	        try_files $uri $uri/ /mshop/index.html;
         }
 
-        location ~ /mobile/[/\w]+\.php$ {
-            root           $folder_name;
-            fastcgi_pass   mobilesrv:9100;
-            fastcgi_index  index.php;
-            fastcgi_param  SCRIPT_FILENAME  $folder_name$fastcgi_script_name;
-            include fastcgi_params;
-        }
-
-        location ~ /mobile/[/\w]+\.html$ {
-            try_files $uri $uri/ /mobile/index.html;
-        }
-
         location ~ \.php {
-	        add_header Cache-Control no-store;
-	        set  $folder_name /var/www/html;
+         add_header Cache-Control no-store;
+            set  $folder_name /var/www/html/public;
             root           $folder_name;
-            fastcgi_pass   fpmsrv:9000;
+            fastcgi_pass   devfpm:9000;
             fastcgi_index  index.php;
             fastcgi_split_path_info ^(.+\.php)(.*)$;
             fastcgi_param PATH_INFO $fastcgi_path_info;

+ 86 - 0
conf/nginx/nginx-test-http.conf

@@ -0,0 +1,86 @@
+
+user nginx;
+worker_processes  1;
+error_log   /var/error.log  info;
+#pid        logs/nginx.pid;
+worker_rlimit_nofile 1024;
+
+events {
+    worker_connections  1024;
+}
+
+http 
+{
+    include       mime.types;
+    default_type  application/octet-stream;
+    fastcgi_buffer_size 32k;
+    fastcgi_buffers 8 32k;
+    underscores_in_headers on;
+    client_max_body_size 1024M;
+
+    sendfile            on;
+    keepalive_timeout   65;
+
+    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 www.xyzshops.cn;
+        root $folder_name;
+        index index.html index.php; 
+    	client_max_body_size 100m;
+    	proxy_connect_timeout 500s;
+        proxy_read_timeout 500s;
+        proxy_send_timeout 500s;
+        fastcgi_connect_timeout 75;
+        fastcgi_read_timeout 600;   
+        fastcgi_send_timeout 600;   
+
+        charset utf-8;
+        
+        location /logs {
+            deny all;
+            return 403;
+        }
+
+        location /data/log {
+            deny all;
+            return 403;
+        }
+        location / {
+            index  index.html index.htm index.php;
+        }
+        
+        location /mshop {
+            root $folder_name;
+            autoindex on;        
+            index  index.html index.htm index.php;
+	        try_files $uri $uri/ /mshop/index.html;
+        }
+
+        location ~ /mobile/[/\w]+\.php$ {
+            root           $folder_name;
+            fastcgi_pass   tmobilesrv:9100;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME  $folder_name$fastcgi_script_name;
+            include fastcgi_params;
+        }
+
+        location ~ /mobile/[/\w]+\.html$ {
+            try_files $uri $uri/ /mobile/index.html;
+        }
+
+        location ~ \.php$ {
+	        add_header Cache-Control no-store;
+            root           $folder_name;
+            fastcgi_pass   tfpmsrv:9000;
+            fastcgi_index  index.php;
+            fastcgi_param  SCRIPT_FILENAME  $folder_name$fastcgi_script_name;
+            include        fastcgi_params;
+        }
+    }
+}

+ 1 - 1
conf/php-fpm/php.ini

@@ -1324,7 +1324,7 @@ bcmath.scale = 0
 ; Handler used to store/retrieve data.
 ; http://php.net/session.save-handler
 session.save_handler = redis
-session.save_path = "tcp://redisrv:6379"
+session.save_path = "tcp://devredis:6380"
 
 ;session.save_handler = files
 

+ 4 - 4
conf/php/docker-php-spwan-start

@@ -1,13 +1,13 @@
 #!/bin/sh
 set -e
-spawn-fcgi -a 0.0.0.0 -p 9100 -F 1 -f "php /var/www/html/xyzshop/fcgi_run.php"
+spawn-fcgi -a 0.0.0.0 -p 9100 -F 1 -f "php /var/www/html/fcgi_run.php"
 
 time=$(date "+%Y%m%d")
 #$logfile="/var/www/html/data/log/${time}-mobile.log"
 #echo $logfile
 
-if [ ! -f "/var/www/html/xyzshop/data/log/${time}-mobile.log" ]; then
-    touch "/var/www/html/xyzshop/data/log/${time}-mobile.log"
+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/xyzshop/data/log/${time}-mobile.log"
+tail -f "/var/www/html/data/log/${time}-mobile.log"

+ 1 - 1
conf/php/php.ini

@@ -1325,7 +1325,7 @@ bcmath.scale = 0
 ; http://php.net/session.save-handler
 ;session.save_handler = file
 session.save_handler = redis
-session.save_path = tcp://redisrv:6379
+session.save_path = tcp://devredis:6380
 
 ; Argument passed to save_handler.  In the case of files, this is the path
 ; where data files are stored. Note: Windows users have to change this

+ 13 - 1
conf/queue/docker-queue-start

@@ -1,6 +1,7 @@
 #!/bin/sh
 set -e
 
+<<<<<<< HEAD
 php /var/www/html/xyzshop/queue/index.php queue index
 
 time=$(date "+%Y%m%d")
@@ -9,4 +10,15 @@ if [ ! -f "/var/www/html/xyzshop/data/log/${time}-queue.log" ]; then
     touch "/var/www/html/xyzshop/data/log/${time}-queue.log"
 fi
 
-tail -f "/var/www/html/xyzshop/data/log/${time}-queue.log"
+tail -f "/var/www/html/xyzshop/data/log/${time}-queue.log"
+=======
+php /var/www/html/queue/index.php queue index
+
+time=$(date "+%Y%m%d")
+
+if [ ! -f "/var/www/html/data/log/${time}-queue.log" ]; then
+    touch "/var/www/html/data/log/${time}-queue.log"
+fi
+
+tail -f "/var/www/html/data/log/${time}-queue.log"
+>>>>>>> 228203e29f1a9f93eda3c1d8badd5fc640808e8c

+ 2 - 1
conf/redis/6380.conf

@@ -40,7 +40,8 @@
 
 # By default Redis does not run as a daemon. Use 'yes' if you need it.
 # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
-daemonize yes
+
+daemonize no
 
 # When running daemonized, Redis writes a pid file in /var/run/redis.pid by
 # default. You can specify a custom pid file location here.

+ 2 - 2
config/cache.php

@@ -15,9 +15,9 @@
 
 return [
     // 驱动方式
-    'type'   => 'File',
+    'type'   => 'redis',
     // 缓存保存目录
-    'path'   => '',
+    'path'   => 'tcp://devredis:6380',
     // 缓存前缀
     'prefix' => '',
     // 缓存有效期 0表示永久缓存

+ 1 - 1
config/session.php

@@ -20,7 +20,7 @@ return [
     // SESSION 前缀
     'prefix'         => 'think',
     // 驱动方式 支持redis memcache memcached
-    'type'           => '',
+    'type'           => 'redis',
     // 是否自动开启 SESSION
     'auto_start'     => true,
 ];

+ 25 - 91
docker-compose-dev.yml

@@ -1,131 +1,65 @@
 version: "3.7"
 
 services:
-  nginxsrv:
+  devnginx:
     image: nginx:alpine
     ports:
       - "8080:8080"
-      - "443:443"
     volumes:
       - $PWD/conf/etc/localtime:/etc/localtime:ro
-      - $PWD:/var/www/html
-      - /Volumes/Transcend/upload:/var/www/html/data/upload
-      - $PWD/conf/nginx/cert:/etc/nginx/cert
       - $PWD/conf/nginx/nginx-debug-http.conf:/etc/nginx/nginx.conf:ro
+      - $PWD:/var/www/html
     links:
-      - mobilesrv
-      - fpmsrv
-    container_name: "panda-nginx"
+      - devfpm
+    container_name: "dev-nginx"
     command: [nginx,'-g','daemon off;']
 
-  redisrv:
+  devredis:
     image: redis:alpine
     ports:
-      - "6380:6379"
+      - "6380:6380"
     volumes:
       - $PWD/conf/etc/localtime:/etc/localtime:ro
-      - $PWD/conf/redis/6379.conf:/usr/local/etc/redis/redis.conf
-      - $PWD/conf/redis:/var/redis
-    container_name: "panda-redis"
+    container_name: "dev-redis"
     command: [ "redis-server"]
 
-  mobilesrv:
-    image: php-zts-debug:7.3.18
-    ports:
-      - "9100:9100"
+  devfpm:
+    image: php-fpm:alpine
     volumes:
       - $PWD/conf/etc/localtime:/etc/localtime:ro
       - $PWD:/var/www/html
-      - $PWD/conf/php/php-debug.ini:/usr/local/etc/php/php.ini
-      - /Volumes/Transcend/upload:/var/www/html/data/upload
-      - $PWD/conf/php/docker-php-spwan-start:/usr/local/bin/docker-php-spwan-start
-    links:
-      - redisrv
-    container_name: "panda-mobile"
-    command: ['docker-php-spwan-start']
+      - $PWD/conf/php-fpm/php-debug.ini:/usr/local/etc/php/php.ini
+      - $PWD/conf/php-fpm/php-fpm.conf:/usr/local/etc/php-fpm.conf
+      - $PWD/conf/php-fpm/docker-php-fpm-start:/usr/local/bin/docker-php-fpm-start
+    container_name: "dev-web"
+    command: [docker-php-fpm-start]
     depends_on:
-      - "redisrv"
-      - "SearchSrv"
-    #docker run -it -v $PWD:/var/www/html -v $PWD/conf/php/php-debug.ini:/usr/local/etc/php/php.ini -p 9100:9100 --name mobilesrv  php-zts-debug:7.3.18
-    #spawn-fcgi -a 127.0.0.1 -p 9100 -F 1 -f "php /var/www/html/fcgi_run.php"
-
-  fpmsrv:
-      image: php-fpm:alpine
-      ports:
-        - "9000:9000"
-      volumes:
-        - $PWD/conf/etc/localtime:/etc/localtime:ro
-        - $PWD:/var/www/html
-        - /Volumes/Transcend/upload:/var/www/html/data/upload
-        - $PWD/conf/php-fpm/php-debug.ini:/usr/local/etc/php/php.ini
-        - $PWD/conf/php-fpm/php-fpm.conf:/usr/local/etc/php-fpm.conf
-        - $PWD/conf/php-fpm/docker-php-fpm-start:/usr/local/bin/docker-php-fpm-start
-      container_name: "panda-web"
-      command: [docker-php-fpm-start]
-      depends_on:
-        - "redisrv"
-        - "SearchSrv"
-      #docker run -it -v $PWD:/var/www/html -v $PWD/conf/php/php-debug.ini:/usr/local/etc/php/php.ini -p 9000:9000
-      #--name websrv  php-fpm:alpine
+      - devredis
 
-  phpcli:
+  devphp:
     image: php-zts-debug:7.3.18
     volumes:
       - $PWD/conf/etc/localtime:/etc/localtime:ro
       - $PWD/conf/php/php-debug.ini:/usr/local/etc/php/php.ini
       - $PWD:/var/www/html
-      - /Volumes/Transcend/upload:/var/www/html/data/upload
-    links:
-      - redisrv
-    container_name: "panda-php"
-    depends_on:
-      - "redisrv"
-      - "fpmsrv"
-      - "SearchSrv"
-
-  QueueSrv:
-    image: php-zts-debug:7.3.18
-    volumes:
-      - $PWD/conf/etc/localtime:/etc/localtime:ro
-      - $PWD:/var/www/html
-      - /Volumes/Transcend/upload:/var/www/html/data/upload
-      - $PWD/conf/php/php-debug.ini:/usr/local/etc/php/php.ini
-      - $PWD/conf/queue/docker-queue-start:/usr/local/bin/docker-queue-start
     links:
-      - redisrv
-    container_name: "panda-queue"
-    command: [docker-queue-start]
+      - devredis
+    container_name: "dev-php"
     depends_on:
-      - "redisrv"
+      - "devredis"
 
-  SearchSrv:
+  crontabsrv:
     image: php-zts-debug:7.3.18
     volumes:
       - $PWD/conf/etc/localtime:/etc/localtime:ro
       - $PWD:/var/www/html
       - /Volumes/Transcend/upload:/var/www/html/data/upload
       - $PWD/conf/php/php-debug.ini:/usr/local/etc/php/php.ini
-      - $PWD/conf/searcher/docker-search-start:/usr/local/bin/docker-start
+      - $PWD/conf/crontab/debug-root:/var/spool/cron/crontabs/root
+      - $PWD/conf/crontab/docker-start:/usr/local/bin/docker-start
     links:
-      - redisrv
-    container_name: "panda-searcher"
+      - devredis
+    container_name: "dev-crontab"
     command: [docker-start]
     depends_on:
-      - "redisrv"
-
-  crontabsrv:
-      image: php-zts-debug:7.3.18
-      volumes:
-        - $PWD/conf/etc/localtime:/etc/localtime:ro
-        - $PWD:/var/www/html
-        - /Volumes/Transcend/upload:/var/www/html/data/upload
-        - $PWD/conf/php/php-debug.ini:/usr/local/etc/php/php.ini
-        - $PWD/conf/crontab/debug-root:/var/spool/cron/crontabs/root
-        - $PWD/conf/crontab/docker-start:/usr/local/bin/docker-start
-      links:
-        - redisrv
-      container_name: "panda-crontab"
-      command: [docker-start]
-      depends_on:
-        - "redisrv"
-  docker tag 39.97.239.116:5000/php-zts-debug:7.3.18 php-zts-debug:7.3.18
+      - "devredis"

+ 65 - 0
docker-compose-windows.yml

@@ -0,0 +1,65 @@
+version: "3.7"
+
+services:
+  devnginx:
+    image: nginx:alpine
+    ports:
+      - "8080:8080"
+    volumes:
+      - /d/phpstudy_pro/WWW/tp51/conf/etc/localtime:/etc/localtime:ro
+      - /d/phpstudy_pro/WWW/tp51/conf/nginx/nginx-debug-http.conf:/etc/nginx/nginx.conf:ro
+      - /d/phpstudy_pro/WWW/tp51:/var/www/html
+    links:
+      - devfpm
+    container_name: "dev-nginx"
+    command: [nginx,'-g','daemon off;']
+
+  devredis:
+    image: redis:alpine
+    ports:
+      - "6380:6380"
+    volumes:
+      - /d/phpstudy_pro/WWW/tp51/conf/etc/localtime:/etc/localtime:ro
+    container_name: "dev-redis"
+    command: [ "redis-server"]
+
+  devfpm:
+      image: php-fpm:alpine
+      volumes:
+        - /d/phpstudy_pro/WWW/tp51/conf/etc/localtime:/etc/localtime:ro
+        - /d/phpstudy_pro/WWW/tp51:/var/www/html
+        - /d/phpstudy_pro/WWW/tp51/conf/php-fpm/php-debug.ini:/usr/local/etc/php/php.ini
+        - /d/phpstudy_pro/WWW/tp51/conf/php-fpm/php-fpm.conf:/usr/local/etc/php-fpm.conf
+        - /d/phpstudy_pro/WWW/tp51/conf/php-fpm/docker-php-fpm-start:/usr/local/bin/docker-php-fpm-start
+      container_name: "dev-web"
+      command: [docker-php-fpm-start]
+      depends_on:
+        - devredis
+
+  devphp:
+    image: php-zts-debug:7.3.18
+    volumes:
+      - /d/phpstudy_pro/WWW/tp51/conf/etc/localtime:/etc/localtime:ro
+      - /d/phpstudy_pro/WWW/tp51/conf/php/php-debug.ini:/usr/local/etc/php/php.ini
+      - /d/phpstudy_pro/WWW/tp51:/var/www/html
+    links:
+      - devredis
+    container_name: "dev-php"
+    depends_on:
+      - "devredis"
+
+  crontabsrv:
+      image: php-zts-debug:7.3.18
+      volumes:
+        - /d/phpstudy_pro/WWW/tp51/conf/etc/localtime:/etc/localtime:ro
+        - /d/phpstudy_pro/WWW/tp51:/var/www/html
+        - /Volumes/Transcend/upload:/var/www/html/data/upload
+        - /d/phpstudy_pro/WWW/tp51/conf/php/php-debug.ini:/usr/local/etc/php/php.ini
+        - /d/phpstudy_pro/WWW/tp51/conf/crontab/debug-root:/var/spool/cron/crontabs/root
+        - /d/phpstudy_pro/WWW/tp51/conf/crontab/docker-start:/usr/local/bin/docker-start
+      links:
+        - devredis
+      container_name: "dev-crontab"
+      command: [docker-start]
+      depends_on:
+        - "devredis"

+ 1 - 1
thinkphp/library/think/cache/driver/Redis.php

@@ -23,7 +23,7 @@ use think\cache\Driver;
 class Redis extends Driver
 {
     protected $options = [
-        'host'       => '127.0.0.1',
+        'host'       => 'devredis',
         'port'       => 6379,
         'password'   => '',
         'select'     => 0,

+ 1 - 1
thinkphp/library/think/session/driver/Redis.php

@@ -19,7 +19,7 @@ class Redis implements SessionHandlerInterface
     /** @var \Redis */
     protected $handler = null;
     protected $config  = [
-        'host'         => '127.0.0.1', // redis主机
+        'host'         => 'devredis', // redis主机
         'port'         => 6379, // redis端口
         'password'     => '', // 密码
         'select'       => 0, // 操作库