generated from tailored/router-db-template
update
This commit is contained in:
32
packages/xhs/src/libs/utils/helper.js
Normal file
32
packages/xhs/src/libs/utils/helper.js
Normal file
@@ -0,0 +1,32 @@
|
||||
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,
|
||||
};
|
||||
Reference in New Issue
Block a user