Parcourir la source

去掉忽略文件

xiang il y a 6 ans
Parent
commit
50b9875597

+ 3 - 0
.gitignore

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

+ 56 - 0
application/config.bak.php

@@ -0,0 +1,56 @@
+<?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 [
+    // +----------------------------------------------------------------------
+    // | 应用设置
+    // +----------------------------------------------------------------------
+
+    // 当前系统版本
+    'version' => 'v1.0.1',
+
+    // 加密盐
+    'salt' => '~NickBai!@#',
+
+    // socket server
+    'socket' => 'wss://link.281570.com',
+
+    // 管理员登录时间
+    'save_time' => 86400,
+
+
+    'cache' => [
+        'type' => 'File',
+        'path' => CACHE_PATH,
+        'prefix' => '',
+        'expire' => 0,
+    ],
+
+
+    // 应用命名空间
+    'app_namespace' => 'app',
+
+    //'exception_tmpl' => APP_PATH.'404.html',
+    'exception_tmpl' => '',
+    'http_exception_template' => [
+        // 定义404错误的重定向页面地址
+        '404' => APP_PATH . '404.html',
+        // 还可以定义其它的HTTP status
+        '401' => APP_PATH . '404.html',
+        '403' => APP_PATH . '404.html',
+    ],
+
+    // 应用调试模式
+    '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,
-];

+ 71 - 2
vendor/GatewayWorker_windows/Applications/whisper/Events.php

@@ -774,8 +774,72 @@ class Events
         return false;
     }
 
-    public
-    static function getUserIPinfo($ip)
+    static function CurlGet($url, $header)
+    {
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
+        $handles = curl_exec($ch);
+        curl_close($ch);
+        return $handles;
+    }
+
+
+    ////ip信息转换---begin
+    public static function getUserIPinfo($ip)
+    {
+        $info = self::getUserIPinfo_db($ip);
+        if (!empty($info)) {
+            return $info;
+        }
+        $info = self::getUserIPinfo_v2($ip);
+        if (empty($info)) {
+            $info = self::getUserIPinfo_v1($ip);
+        }
+        if ($info) {
+            self::writeUserIpinfo($ip, $info);
+        }
+        return $info;
+    }
+
+    public static function getUserIPinfo_v2($ip)
+    {
+        $url = 'http://api.ip138.com/query/?datatype=jsonp&ip=' . $ip;
+        $header = array('token:db48a8df731a5b0bf023de966dae9d9b');
+        $ret = self::CurlGet($url, $header);
+
+        if (empty($ret)) {
+            return '';
+        }
+        $ret = json_decode($ret, true);
+
+        if ($ret && isset($ret['ret']) && strtolower($ret['ret']) == 'ok') {
+            if (isset($ret['data']) && isset($ret['data']['0']) && isset($ret['data']['1']) && isset($ret['data']['2'])) {
+                return trim($ret['data']['0'] . '.' . $ret['data']['1'] . '.' . $ret['data']['2'], '.');
+            }
+        }
+        return '';
+    }
+
+    public static function getUserIPinfo_db($ip)
+    {
+        $ret = self::$db->select('info')->from('ws_ipinfocache')->where("ip='$ip'")->row();
+        if ($ret) {
+            return $ret['info'];
+        }
+        return '';
+    }
+
+    public static function writeUserIpinfo($ip, $info)
+    {
+        $ret = self::$db->insert('ws_ipinfocache')->cols(['ip' => $ip, 'info' => $info])->query();
+        return $ret;
+    }
+
+    public static function getUserIPinfo_v1($ip)
     {
         $url = 'http://www.ip168.com/chxip/doGetIp.do?keyword=' . $ip;
         $ret = file_get_contents($url);
@@ -798,8 +862,13 @@ class Events
             }
         }
         return $defret;
+
     }
 
+
+    ////ip信息转换---end
+
+
 //用户发送邦定用户事件
     public
     static function userInitEnt($client_id, $message)