多语言-收集busiResult返回结果

This commit is contained in:
liaozetao
2024-04-11 11:05:56 +08:00
committed by khalil
parent 983fb3cfed
commit 1e0d33227e
5 changed files with 875 additions and 338 deletions

View File

@@ -76,7 +76,7 @@ public class SmsController extends BaseController {
}
logger.info("sendSmsCode2, mobile:{}, type:{}, uid:{}, phoneAreaCode:{} ", mobile, type, uid,phoneAreaCode);
if (phoneBlackService.checkIsNeedInterceptWithPhoneAreaCode(phoneAreaCode,mobile)) {
throw new ServiceException(BusiStatus.PHONE_BE_INTERCEPTED);
throw new ServiceException(BusiStatus.PHONE_NUMBER_BE_INTERCEPTED);
}
if (!CommonUtil.checkPhoneFormat(phoneAreaCode,mobile)) {
return SmsTypeEnum.REGISTER.getValue() == type ? new BusiResult<>(BusiStatus.SMS_SEND_SUCCESS) :
@@ -96,7 +96,7 @@ public class SmsController extends BaseController {
}
boolean verify = smsService.verifySmsCode(mobile, code);
if (!verify) {
return new BusiResult(BusiStatus.VERIFY_CODE_ERROR);
return new BusiResult(BusiStatus.SMS_VERIFY_CODE_ERROR);
}
return new BusiResult(BusiStatus.SUCCESS);
}

View File

@@ -861,7 +861,7 @@ public class UsersController extends BaseController {
HttpServletRequest request) throws Exception {
phone = decryptSensitiveInfo(request, phone);
if (phoneBlackService.checkIsNeedInterceptWithPhoneAreaCode(phoneAreaCode, phone)) {
throw new ServiceException(BusiStatus.PHONE_BE_INTERCEPTED);
throw new ServiceException(BusiStatus.PHONE_NUMBER_BE_INTERCEPTED);
}
return new BusiResult(usersService.boundPhone(getUid(request), phone, code, phoneAreaCode));
}

View File

@@ -50,7 +50,7 @@ public class SmsWithdrawController extends BaseController {
HttpServletRequest request) {
phone = decryptSensitiveInfo(request, phone);
if (phoneBlackService.checkIsNeedIntercept(phone)) {
throw new ServiceException(BusiStatus.PHONE_BE_INTERCEPTED);
throw new ServiceException(BusiStatus.PHONE_NUMBER_BE_INTERCEPTED);
}
return BusiResult.success(withdrawService.boundPhone(getUid(), phone, code, phoneAreaCode));
}

View File

@@ -2,6 +2,7 @@ import random
import hashlib
import requests
import time
import os
def baidu_translate(word):
@@ -29,6 +30,7 @@ def baidu_translate(word):
req_get = requests.get(api_url, api_data)
# 结果的位置可能不同
result_json = req_get.json()
print(result_json)
result: str = ''
if 'trans_result' in result_json:
result = result_json['trans_result'][0]['dst']
@@ -36,7 +38,6 @@ def baidu_translate(word):
def spider(filepath, suffix):
import os
code_files = []
for root, dirs, files in os.walk(filepath, topdown=False):
for f in files:
@@ -60,7 +61,7 @@ def message(code_files):
if __name__ == '__main__':
code_files = spider('/Users/liaozetao/Downloads/message', '.txt')
code_files = spider('/Users/liaozetao/Downloads/', '.txt')
msgs = message(code_files)
for m in msgs:
while True:
@@ -80,7 +81,9 @@ if __name__ == '__main__':
str2 = str2.split(')')[0]
str2 = str2.replace('"', '')
content = baidu_translate(str2)
print(str1, ', "', content, '"),')
if len(str1) > 0 and '(' in str1:
str1 = str1.split('(')[0]
print('BusiStatus.', str1, '=', content)
time.sleep(1)
break
except Exception as e: