enhance run core - add the logic to save the start chat logic to db; modify some entity with wrong type.

This commit is contained in:
geekgeekrun
2024-03-17 21:57:05 +08:00
parent 883e443e61
commit 3c3d8f2bf2
8 changed files with 171 additions and 28 deletions

View File

@@ -0,0 +1,67 @@
export const parseCompanyScale = (str: string): [number| null, number | null] => {
if (!str) {
return [null, null]
}
const betweenRangeMatchResult = str.match(
/(\d+)-(\d+)人/
);
if (betweenRangeMatchResult) {
const arr = [...betweenRangeMatchResult];
arr.shift();
return arr.map(Number) as [number, number]
}
const gtRangeMatchResult = str.match(
/(\d+)人以上/
);
if (gtRangeMatchResult) {
const arr = [...gtRangeMatchResult];
arr.shift();
return [Number(arr[0]), null]
}
return [null, null]
}
export const parseSalary = (str: string): { low: null | number, heigh: null | number, month: null | number } => {
const result = {
heigh: null,
low: null,
month: null
}
if (!str) {
return result
}
const baseMatchResult = str.match(
/([\.\d]+)-([\.\d]+)k/i
);
if (baseMatchResult) {
const arr = [...baseMatchResult];
arr.shift();
Object.assign(
result,
{
low: Number(arr[0]),
heigh: Number(arr[1]),
}
)
}
const month = str.match(
/([\.\d]+)薪/
)
if (month) {
const arr = [...month];
arr.shift();
Object.assign(
result,
{
month: Number(arr[0])
}
)
}
return result
}