mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
Merge branch 'master' of https://github.com/top-think/framework
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
ThinkPHP 目前使用 Git 来控制程序版本,如果你想为 ThinkPHP 贡献源代码,请先大致了解 Git 的使用方法。我们目前把项目托管在 GitHub 上,任何 GitHub 用户都可以向我们贡献代码。
|
||||
|
||||
参与的方式很简单,`fork`一份 ThinkPHP 的代码到你的仓库中,修改后提交,并向我们发起`pull request`申请,我们会及时对代码进行审查并处理你的申请并。审查通过后,你的代码将被`merge`进我们的仓库中,这样你就会自动出现在贡献者名单里了,非常方便。
|
||||
参与的方式很简单,`fork`一份 ThinkPHP 的代码到你的仓库中,修改后提交,并向我们发起`pull request`申请,我们会及时对代码进行审查并处理你的申请。审查通过后,你的代码将被`merge`进我们的仓库中,这样你就会自动出现在贡献者名单里了,非常方便。
|
||||
|
||||
我们希望你贡献的代码符合:
|
||||
|
||||
|
||||
@@ -1103,9 +1103,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
// 检测字段
|
||||
$allowFields = $this->checkAllowField(array_merge($this->auto, $this->insert));
|
||||
if (!empty($allowFields)) {
|
||||
$result = $this->getQuery()->strict(false)->field($allowFields)->insert($this->data);
|
||||
$result = $this->getQuery()->strict(false)->field($allowFields)->insert($this->data, false, false, $sequence);
|
||||
} else {
|
||||
$result = $this->getQuery()->insert($this->data);
|
||||
$result = $this->getQuery()->insert($this->data, false, false, $sequence);
|
||||
}
|
||||
|
||||
// 获取自动增长主键
|
||||
|
||||
@@ -1265,7 +1265,7 @@ class Request
|
||||
* @param boolean $adv 是否进行高级模式获取(有可能被伪装)
|
||||
* @return mixed
|
||||
*/
|
||||
public function ip($type = 0, $adv = false)
|
||||
public function ip($type = 0, $adv = true)
|
||||
{
|
||||
$type = $type ? 1 : 0;
|
||||
static $ip = null;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
namespace think\log\driver;
|
||||
|
||||
use think\App;
|
||||
use think\Request;
|
||||
|
||||
/**
|
||||
* 本地化调试输出到文件
|
||||
@@ -20,10 +21,10 @@ class File
|
||||
{
|
||||
protected $config = [
|
||||
'time_format' => ' c ',
|
||||
'single' => false,
|
||||
'file_size' => 2097152,
|
||||
'path' => LOG_PATH,
|
||||
'apart_level' => [],
|
||||
'single' => false,
|
||||
];
|
||||
|
||||
protected $writed = [];
|
||||
@@ -66,7 +67,7 @@ class File
|
||||
if (in_array($type, $this->config['apart_level'])) {
|
||||
// 独立记录的日志级别
|
||||
if ($this->config['single']) {
|
||||
$filename = $path . $type . '.log';
|
||||
$filename = $path . DS . $type . '.log';
|
||||
} else {
|
||||
$filename = $path . DS . date('d') . '_' . $type . $cli . '.log';
|
||||
}
|
||||
@@ -84,7 +85,7 @@ class File
|
||||
protected function write($message, $destination, $apart = false)
|
||||
{
|
||||
//检测日志文件大小,超过配置大小则备份日志文件重新生成
|
||||
if (!$this->config['single'] && is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) {
|
||||
if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) {
|
||||
rename($destination, dirname($destination) . DS . time() . '-' . basename($destination));
|
||||
$this->writed[$destination] = false;
|
||||
}
|
||||
@@ -108,11 +109,10 @@ class File
|
||||
$message = '[ info ] ' . $current_uri . $time_str . $memory_str . $file_load . "\r\n" . $message;
|
||||
}
|
||||
$now = date($this->config['time_format']);
|
||||
$server = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '0.0.0.0';
|
||||
$remote = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0';
|
||||
$ip = Request::instance()->ip();
|
||||
$method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'CLI';
|
||||
$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
|
||||
$message = "---------------------------------------------------------------\r\n[{$now}] {$server} {$remote} {$method} {$uri}\r\n" . $message;
|
||||
$message = "---------------------------------------------------------------\r\n[{$now}] {$ip} {$method} {$uri}\r\n" . $message;
|
||||
|
||||
$this->writed[$destination] = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user