perf: 优化已读标记

This commit is contained in:
kuaifan
2023-02-21 16:16:12 +08:00
parent efd25bc787
commit 71a9b8f6ce
3 changed files with 61 additions and 2 deletions

View File

@@ -1311,6 +1311,27 @@ class Base
return $setting;
}
/**
* 时间转毫秒时间戳
* @param $time
* @return float|int
*/
public static function strtotimeM($time)
{
if (str_contains($time, '.')) {
list($t, $m) = explode(".", $time);
if (is_string($t)) {
$t = strtotime($t);
}
$time = $t . str_pad($m, 3, "0", STR_PAD_LEFT);
}
if (is_numeric($time)) {
return (int) str_pad($time, 13, "0");
} else {
return strtotime($time) * 1000;
}
}
/**
* 获取设置值
* @param $setname