Browse Source

Merge branch 'master' of http://git.bocai108.com:10180/aqm/Customer-Service

vali 6 years ago
parent
commit
9525e0cad1

+ 3 - 0
.gitignore

@@ -2,3 +2,6 @@
 composer.lock
 *.log
 runtime
+/application/config.php
+/application/database.php
+/application/redis.php

+ 4 - 4
application/config.php → application/config.bak.php

@@ -23,7 +23,7 @@ return [
     // socket server
     'socket' => 'wss://link.281570.com',
 
-   // 管理员登录时间
+    // 管理员登录时间
     'save_time' => 86400,
 
 
@@ -38,8 +38,8 @@ return [
     // 应用命名空间
     'app_namespace' => 'app',
 
-    'exception_tmpl' => APP_PATH.'404.html',
-    //'exception_tmpl' => '',
+    //'exception_tmpl' => APP_PATH.'404.html',
+    'exception_tmpl' => '',
     'http_exception_template' => [
         // 定义404错误的重定向页面地址
         '404' => APP_PATH . '404.html',
@@ -52,5 +52,5 @@ return [
     'app_debug' => true,
     // 应用Trace
     'app_trace' => true,
+    "is_https" => true,
 ];
-

+ 0 - 53
application/database.php

@@ -1,53 +0,0 @@
-<?php
-// +----------------------------------------------------------------------
-// | ThinkPHP [ WE CAN DO IT JUST THINK ]
-// +----------------------------------------------------------------------
-// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
-// +----------------------------------------------------------------------
-// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
-// +----------------------------------------------------------------------
-// | Author: liu21st <liu21st@gmail.com>
-// +----------------------------------------------------------------------
-
-return [
-    // 数据库类型
-    'type'            => 'mysql',
-    // 服务器地址
-    'hostname'        => '172.17.0.4',
-    // 数据库名
-    'database'        => 'customer_service',
-    // 用户名
-    'username'        => 'root',
-    // 密码
-    'password'        => 'root1234',
-    // 端口
-    'hostport'        => '3306',
-    // 连接dsn
-    'dsn'             => '',
-    // 数据库连接参数
-    'params'          => [],
-    // 数据库编码默认采用utf8
-    'charset'         => 'utf8mb4',
-    // 数据库表前缀
-    'prefix'          => 'ws_',
-    // 数据库调试模式
-    'debug'           => false,
-    // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
-    'deploy'          => 0,
-    // 数据库读写是否分离 主从式有效
-    'rw_separate'     => false,
-    // 读写分离后 主服务器数量
-    'master_num'      => 1,
-    // 指定从服务器序号
-    'slave_no'        => '',
-    // 是否严格检查字段是否存在
-    'fields_strict'   => false,
-    // 数据集返回类型
-    'resultset_type'  => 'array',
-    // 自动写入时间戳字段
-    'auto_timestamp'  => false,
-    // 时间字段取出后的默认时间格式
-    'datetime_format' => 'Y-m-d H:i:s',
-    // 是否需要进行SQL性能分析
-    'sql_explain'     => false,
-];

+ 0 - 24
application/redis.php

@@ -1,24 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2019/7/25
- * Time: 14:30
- */
-
-return [
-    //'host' => 'ky.281570.com',
-    //'port' => 12379,
-    
-    'host' => '172.17.0.2',
-    'port' => 6379,
-
-    'passwd' => 'aqm1728',
-    'password' => 'aqm1728',
-
-    'db' => 1,
-    'select' => 1,
-
-    'overtime' => 1,
-    'timeout' => 1,
-];

+ 11 - 4
vendor/GatewayWorker_linux/GatewayWorker/Applications/whisper/start_gateway.php

@@ -1,4 +1,5 @@
 <?php
+
 /**
  * This file is part of workerman.
  *
@@ -51,7 +52,7 @@ if ($ifssl) {
 // gateway名称,status方便查看
 $gateway->name = 'WhisperGateway';
 // gateway进程数
-$gateway->count = 4;
+$gateway->count = 8;
 // 本机ip,分布式部署时使用内网ip
 $gateway->lanIp = '127.0.0.1';
 // 内部通讯起始端口,假如$gateway->count=4,起始端口为4000
@@ -78,7 +79,7 @@ $gateway->onConnect = function ($connection) {
         $apiToken = md5(strtolower('Customer-Service' . $_SERVER['HTTP_ORIGIN']));
         //echo $apiToken."/".$_GET['apiToken'];
         $_SESSION['userAgent'] = $_SERVER['HTTP_USER_AGENT'];
-        $_SESSION['origin'] = $_SERVER['HTTP_ORIGIN'];//
+        $_SESSION['origin'] = $_SERVER['HTTP_ORIGIN']; //
         $getToken = isset($_GET['apiToken']) ? $_GET['apiToken'] : '';
 
         if ($getToken !== $apiToken) {
@@ -88,7 +89,14 @@ $gateway->onConnect = function ($connection) {
         }
         $_SESSION['remotip'] = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $connection->getRemoteIp();
         $_SESSION['remotport'] = $connection->getRemotePort();
-		$_SERVER['REMOTE_ADDR'] = $_SESSION['remotip'];
+        //cdn处理
+        $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+
+        if (isset($ips[0])  && $ips[0]) {
+            $_SESSION['remotip'] = $ips[0];
+        }
+        //cdn处理
+        $_SERVER['REMOTE_ADDR'] = $_SESSION['remotip'];
 
 
         // 可以在这里判断连接来源是否合法,不合法就关掉连接
@@ -106,4 +114,3 @@ $gateway->onConnect = function ($connection) {
 if (!defined('GLOBAL_START')) {
     Worker::runAll();
 }
-