Browse Source

修改匹配规则

lex-xin 1 month ago
parent
commit
5615d6fb90
1 changed files with 2 additions and 6 deletions
  1. 2 6
      src/libs/instruments.ts

+ 2 - 6
src/libs/instruments.ts

@@ -214,11 +214,7 @@
  * @returns
  */
 export const getInstrumentName = (instruments: any, instrumentName: string) => {
-   const _instrumentName = instrumentName
-      .replace(/ /g, "")
-      .replace(/\d+|\d+/g, "")
-      .trim()
-      .toLocaleLowerCase()
+   const _instrumentName = instrumentName.replace(/ /g, "").trim().toLocaleLowerCase()
    const _instrument = Object.keys(instruments)
    for (let i = 0; i < _instrument.length; i++) {
       const _name = _instrument[i].replace(/ /g, "").toLocaleLowerCase()
@@ -228,7 +224,7 @@ export const getInstrumentName = (instruments: any, instrumentName: string) => {
    }
    for (let i = 0; i < _instrument.length; i++) {
       const _name = _instrument[i].replace(/ /g, "").toLocaleLowerCase()
-      if (_name.includes(_instrumentName)) {
+      if (_instrumentName.includes(_name)) {
          return instruments[_instrument[i]] || ""
       }
    }