12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace common\helpers;
- /**
- * Created by PhpStorm.
- * Author: libingke
- * Date: 2018/2/1
- */
- class KeyHelper
- {
- /**
- * [生成唯一Id]
- * @author: libingke
- * @return string
- */
- public static function getUniqueId($addStr = '')
- {
- $sugar = is_string($addStr) && $addStr != '' ? $addStr : '';
- return md5(uniqid(md5(microtime(true)),true) . $sugar);
- }
- public static function getMessageStatusKey($id, $queue)
- {
- if (is_string($queue) && is_string($id)) {
- return "queue:{$queue}:message:{$id}:status";
- }
- return null;
- }
- public static function getMessageResultKey($id, $queue)
- {
- if (is_string($queue) && is_string($id)) {
- return "queue:{$queue}:message:{$id}:result";
- }
- return null;
- }
- }
|