增加对不同帖子类型的工具函数
Change-Id: I725923ef606d0f2b434da3f5f4ab6927a5fe3e9a
diff --git a/src/utils/common.ts b/src/utils/common.ts
new file mode 100644
index 0000000..cc20522
--- /dev/null
+++ b/src/utils/common.ts
@@ -0,0 +1,13 @@
+import { MainPostTag, MainPostTagParent, MainPostTagName } from '@/types/common';
+
+export const getTagsByMainTag:(main:string)=>Map<string, number> = (main:string)=>{
+ const ans = new Map<string, number>()
+ const mainTagId = MainPostTag[main as keyof typeof MainPostTag];
+ for(const key in MainPostTagParent){
+ if(MainPostTagParent[key] === mainTagId)
+ {
+ ans.set(MainPostTagName[key], Number(key));
+ }
+ }
+ return ans;
+}
\ No newline at end of file