sdfaga
This commit is contained in:
24
main.py
24
main.py
@@ -35,18 +35,20 @@ models.Base.metadata.create_all(bind=engine)
|
|||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
oldEmoji = "异度世界🤖"
|
# 转换emoji字符串为[]
|
||||||
original_string = WXBotService.emoji_to_unicode(oldEmoji)
|
def transOldemoji(oldEmoji=None):
|
||||||
print("original_string", original_string)
|
# oldEmoji = "异度世界🤖"
|
||||||
# 全局替换 \\u 为 @emoji=
|
original_string = WXBotService.emoji_to_unicode(oldEmoji)
|
||||||
converted_string = original_string.replace('\\u', '[@emoji=')
|
print("original_string", original_string)
|
||||||
|
# 全局替换 \\u 为 @emoji=
|
||||||
|
converted_string = original_string.replace('\\u', '@emoji=')
|
||||||
|
# 在 Unicode 编码后添加 ']'
|
||||||
|
converted_string = converted_string[:-1] + ']'
|
||||||
|
# 输出转换后的字符串
|
||||||
|
print(converted_string)
|
||||||
|
return converted_string
|
||||||
|
|
||||||
# 在 Unicode 编码后添加 ']'
|
|
||||||
converted_string = converted_string[:-1] + ']'
|
|
||||||
|
|
||||||
# 输出转换后的字符串
|
|
||||||
print(converted_string)
|
|
||||||
print("original_string", converted_string)
|
|
||||||
# Dependency
|
# Dependency
|
||||||
def get_db():
|
def get_db():
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
@@ -151,6 +153,8 @@ def h5group(nickname, db: Session = Depends(get_db)):
|
|||||||
newtext = unquote(nickname, 'utf-8')
|
newtext = unquote(nickname, 'utf-8')
|
||||||
pattern = r'收到(\w+)的在看'
|
pattern = r'收到(\w+)的在看'
|
||||||
print(newtext)
|
print(newtext)
|
||||||
|
# 处理emoji转为[@emoji=1f916] 格式
|
||||||
|
newtext=transOldemoji(newtext)
|
||||||
matches = re.findall(pattern, newtext)
|
matches = re.findall(pattern, newtext)
|
||||||
print("matches", matches)
|
print("matches", matches)
|
||||||
matchesString = None
|
matchesString = None
|
||||||
|
|||||||
Reference in New Issue
Block a user