Files
social-router/packages/xhs/src/libs/utils/helper.js
2025-12-25 11:10:33 +08:00

33 lines
660 B
JavaScript

function getSearchId() {
const e = BigInt(Date.now()) << 64n;
const t = Math.floor(Math.random() * 2147483647);
return base36encode(e + BigInt(t));
}
function base36encode(num) {
return num.toString(36).toUpperCase();
}
const SearchSortType = Object.freeze({
// default
GENERAL: { value: 'general' },
// most popular
MOST_POPULAR: { value: 'popularity_descending' },
// Latest
LATEST: { value: 'time_descending' },
});
const SearchNoteType = Object.freeze({
// default
ALL: { value: 0 },
// only video
VIDEO: { value: 1 },
// only image
IMAGE: { value: 2 },
});
export {
getSearchId,
SearchSortType,
SearchNoteType,
};