Skip to content

Commit

Permalink
改进一处PHP7.4兼容性问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Nov 17, 2019
1 parent 536d4b2 commit ee44a14
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/think/db/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,12 @@ public function getPartitionTableName($data, $field, $rule = [])
default:
if (function_exists($type)) {
// 支持指定函数哈希
$seq = (ord(substr($type($value), 0, 1)) % $rule['num']) + 1;
} else {
// 按照字段的首字母的值分表
$seq = (ord($value{0}) % $rule['num']) + 1;
$value = $type($value);
}

$seq = (ord(substr($value, 0, 1)) % $rule['num']) + 1;
}

return $this->getTable() . '_' . $seq;
}
// 当设置的分表字段不在查询条件或者数据中
Expand Down

0 comments on commit ee44a14

Please # to comment.