mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
修复几个notice
This commit is contained in:
@@ -1103,7 +1103,7 @@ class Model
|
|||||||
foreach ($fields as $key => $val) {
|
foreach ($fields as $key => $val) {
|
||||||
// 记录字段类型
|
// 记录字段类型
|
||||||
$type[$key] = $val['type'];
|
$type[$key] = $val['type'];
|
||||||
if ($val['primary']) {
|
if (!empty($val['primary'])) {
|
||||||
// 增加复合主键支持
|
// 增加复合主键支持
|
||||||
if (!empty($this->fields['_pk'])) {
|
if (!empty($this->fields['_pk'])) {
|
||||||
if (is_string($this->fields['_pk'])) {
|
if (is_string($this->fields['_pk'])) {
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class Mongo extends Driver
|
|||||||
}
|
}
|
||||||
$this->model = $options['model'];
|
$this->model = $options['model'];
|
||||||
$this->executeTimes++;
|
$this->executeTimes++;
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.insert(';
|
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.insert(';
|
||||||
$this->queryStr .= $data ? json_encode($data) : '{}';
|
$this->queryStr .= $data ? json_encode($data) : '{}';
|
||||||
$this->queryStr .= ')';
|
$this->queryStr .= ')';
|
||||||
@@ -277,7 +277,7 @@ class Mongo extends Driver
|
|||||||
*/
|
*/
|
||||||
public function getMongoNextId($pk)
|
public function getMongoNextId($pk)
|
||||||
{
|
{
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.find({},{' . $pk . ':1}).sort({' . $pk . ':-1}).limit(1)';
|
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.find({},{' . $pk . ':1}).sort({' . $pk . ':-1}).limit(1)';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -344,7 +344,7 @@ class Mongo extends Driver
|
|||||||
$query = $this->parseWhere($options['where']);
|
$query = $this->parseWhere($options['where']);
|
||||||
$this->model = $options['model'];
|
$this->model = $options['model'];
|
||||||
$this->executeTimes++;
|
$this->executeTimes++;
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.remove(' . json_encode($query) . ')';
|
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.remove(' . json_encode($query) . ')';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -370,7 +370,7 @@ class Mongo extends Driver
|
|||||||
}
|
}
|
||||||
$this->model = $options['model'];
|
$this->model = $options['model'];
|
||||||
$this->executeTimes++;
|
$this->executeTimes++;
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.remove({})';
|
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.remove({})';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -405,10 +405,10 @@ class Mongo extends Driver
|
|||||||
}
|
}
|
||||||
$this->model = $options['model'];
|
$this->model = $options['model'];
|
||||||
$this->queryTimes++;
|
$this->queryTimes++;
|
||||||
$query = $this->parseWhere($options['where']);
|
$query = $this->parseWhere(!empty($options['where']) ? $options['where'] : '');
|
||||||
$field = $this->parseField($options['field']);
|
$field = $this->parseField(!empty($options['field']) ? $options['field'] : '');
|
||||||
try {
|
try {
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.find(';
|
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.find(';
|
||||||
$this->queryStr .= $query ? json_encode($query) : '{}';
|
$this->queryStr .= $query ? json_encode($query) : '{}';
|
||||||
$this->queryStr .= $field ? ',' . json_encode($field) : '';
|
$this->queryStr .= $field ? ',' . json_encode($field) : '';
|
||||||
@@ -418,7 +418,7 @@ class Mongo extends Driver
|
|||||||
$_cursor = $this->_collection->find($query, $field);
|
$_cursor = $this->_collection->find($query, $field);
|
||||||
if ($options['order']) {
|
if ($options['order']) {
|
||||||
$order = $this->parseOrder($options['order']);
|
$order = $this->parseOrder($options['order']);
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr .= '.sort(' . json_encode($order) . ')';
|
$this->queryStr .= '.sort(' . json_encode($order) . ')';
|
||||||
}
|
}
|
||||||
$_cursor = $_cursor->sort($order);
|
$_cursor = $_cursor->sort($order);
|
||||||
@@ -438,12 +438,12 @@ class Mongo extends Driver
|
|||||||
if (isset($options['limit'])) {
|
if (isset($options['limit'])) {
|
||||||
list($offset, $length) = $this->parseLimit($options['limit']);
|
list($offset, $length) = $this->parseLimit($options['limit']);
|
||||||
if (!empty($offset)) {
|
if (!empty($offset)) {
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr .= '.skip(' . intval($offset) . ')';
|
$this->queryStr .= '.skip(' . intval($offset) . ')';
|
||||||
}
|
}
|
||||||
$_cursor = $_cursor->skip(intval($offset));
|
$_cursor = $_cursor->skip(intval($offset));
|
||||||
}
|
}
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr .= '.limit(' . intval($length) . ')';
|
$this->queryStr .= '.limit(' . intval($length) . ')';
|
||||||
}
|
}
|
||||||
$_cursor = $_cursor->limit(intval($length));
|
$_cursor = $_cursor->limit(intval($length));
|
||||||
@@ -550,7 +550,7 @@ class Mongo extends Driver
|
|||||||
$this->switchCollection($collection, '', false);
|
$this->switchCollection($collection, '', false);
|
||||||
}
|
}
|
||||||
$this->queryTimes++;
|
$this->queryTimes++;
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.findOne()';
|
$this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.findOne()';
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -581,7 +581,7 @@ class Mongo extends Driver
|
|||||||
*/
|
*/
|
||||||
public function getTables()
|
public function getTables()
|
||||||
{
|
{
|
||||||
if ($this->config['debug']) {
|
if (!empty($this->config['debug'])) {
|
||||||
$this->queryStr = $this->_dbName . '.getCollenctionNames()';
|
$this->queryStr = $this->_dbName . '.getCollenctionNames()';
|
||||||
}
|
}
|
||||||
$this->queryTimes++;
|
$this->queryTimes++;
|
||||||
@@ -699,7 +699,7 @@ class Mongo extends Driver
|
|||||||
public function parseWhere($where)
|
public function parseWhere($where)
|
||||||
{
|
{
|
||||||
$query = [];
|
$query = [];
|
||||||
foreach ($where as $key => $val) {
|
foreach ((array) $where as $key => $val) {
|
||||||
if ('_id' != $key && 0 === strpos($key, '_')) {
|
if ('_id' != $key && 0 === strpos($key, '_')) {
|
||||||
// 解析特殊条件表达式
|
// 解析特殊条件表达式
|
||||||
$query = $this->parseThinkWhere($key, $val);
|
$query = $this->parseThinkWhere($key, $val);
|
||||||
|
|||||||
Reference in New Issue
Block a user