const fs = require('fs');
|
const path = require('path');
|
|
const API_ROOT = path.join(__dirname, '../trading-order-admin/src/main/java/com/yami/trading/api');
|
|
const replacements = [
|
['accessToken 已过期', 'Access token has expired'],
|
['请输入正确的货币数量', 'Please enter a valid amount'],
|
['请输入正确的兑换数量', 'Please enter a valid exchange amount'],
|
['请选择正确的币种', 'Please select a valid currency'],
|
['系统错误,请稍后重试', 'System error, please try again later'],
|
['用户已禁用!', 'User account is disabled'],
|
['用户已禁用', 'User account is disabled'],
|
['请求第三方失败', 'Third-party request failed'],
|
['生成实时数据失败', 'Failed to generate market data'],
|
['代理层级错误', 'Invalid agent level'],
|
['k线图获取失败', 'Failed to load chart data'],
|
['系统参数错误', 'System parameter error'],
|
['资金密码必须6-12位', 'Fund password must be 6-12 characters'],
|
['资金密码错误', 'Incorrect fund password'],
|
['不支持的提现币种', 'Unsupported withdrawal currency'],
|
['订单不存在!', 'Order does not exist'],
|
['订单不存在', 'Order does not exist'],
|
['页码不能小于等于0', 'Page number must be greater than 0'],
|
['页码不是整数', 'Page number must be an integer'],
|
['用户名不能为空', 'Username is required'],
|
['登录密码不能为空', 'Login password is required'],
|
['登录密码必须6-12位', 'Login password must be 6-12 characters'],
|
['校验IP不合法', 'Invalid IP address'],
|
['当前用户在黑名单中', 'The current user is on the blacklist.'],
|
['资金密码不能为空', 'Fund password is required'],
|
['资金密码不符合设定', 'Fund password does not meet requirements'],
|
['请先登录', 'Please log in first'],
|
['密码不能为空', 'Password is required'],
|
['密码必须6-12位', 'Password must be 6-12 characters'],
|
['验证类型不能为空', 'Verification type is required'],
|
['验证码不能为空', 'Verification code is required'],
|
['用户名不存在', 'Username does not exist'],
|
['验证码不正确', 'Incorrect verification code'],
|
['用户名参数为空', 'Username is required'],
|
['请填写正确的电话号码', 'Please enter a valid phone number'],
|
['电话号码已绑定其他用户', 'Phone number is bound to another user'],
|
['电话号码已绑定', 'Phone number is already bound'],
|
['请填写正确的验证码', 'Please enter a valid verification code'],
|
['请输入推荐码', 'Please enter referral code'],
|
['推荐人无权限推荐', 'Referrer is not authorized to refer'],
|
['请填写正确的邮箱地址', 'Please enter a valid email address'],
|
['邮箱已绑定其他用户', 'Email is bound to another user'],
|
['邮箱已绑定', 'Email is already bound'],
|
['操作失败,请稍后再试', 'Operation failed, please try again later'],
|
['旧密码不能为空', 'Old password is required'],
|
['新密码不能为空', 'New password is required'],
|
['旧资金密码不能为空', 'Old fund password is required'],
|
['新资金密码不能为空', 'New fund password is required'],
|
['新密码确认不能为空', 'Password confirmation is required'],
|
['旧密码不正确!', 'Incorrect old password'],
|
['新密码不一致', 'New passwords do not match'],
|
['旧资金密码不能为空', 'Old fund password is required'],
|
['新资金密码不能为空', 'New fund password is required'],
|
['新资金密码确认不能为空', 'Fund password confirmation is required'],
|
['操作类型为空', 'Operation type is required'],
|
['操作类型不是整数', 'Operation type must be an integer'],
|
['操作类型不能小于0', 'Operation type cannot be negative'],
|
['备注长度超过250', 'Remark exceeds 250 characters'],
|
['未绑定谷歌验证器', 'Google Authenticator is not bound'],
|
['未绑定手机号', 'Phone number is not bound'],
|
['未绑定邮箱', 'Email is not bound'],
|
['状态不能小于0', 'Status cannot be negative'],
|
['状态不是整数', 'Status must be an integer'],
|
['参数错误', 'Invalid parameters'],
|
['支付方式模板不正确', 'Invalid payment method template'],
|
['真实姓名必填', 'Real name is required'],
|
['参数值1必填', 'Parameter value 1 is required'],
|
['真实姓名长度大于20', 'Real name exceeds 20 characters'],
|
['备注长度大于100', 'Remark exceeds 100 characters'],
|
['支付方式模板不存在', 'Payment method template does not exist'],
|
['长度大于25', ' exceeds 25 characters'],
|
['请重新登录', 'Please log in again'],
|
['支付方式数量已达上限', 'Payment method limit reached'],
|
['支付方式不匹配该用户', 'Payment method does not match this user'],
|
['支付方式不存在', 'Payment method does not exist'],
|
['证件号码长度超过50', 'ID number exceeds 50 characters'],
|
['实名姓名长度超过50', 'Real name exceeds 50 characters'],
|
['已经提交申请,请等待审核', 'Application submitted, please wait for review'],
|
['审核状态异常请联系客服', 'Abnormal review status, please contact support'],
|
['审核已通过', 'Already approved'],
|
['审核中', 'Under review'],
|
['请上传图片', 'Please upload an image'],
|
['请稍后再试', 'Please try again later'],
|
['无权限', 'Permission denied'],
|
['提交失败,当前有未处理银行卡订单', 'Submission failed, pending bank order exists'],
|
['图片大小不能超过4M', 'Image size cannot exceed 4MB'],
|
['文件上传失败', 'File upload failed'],
|
['订单号不能未空', 'Order number is required'],
|
['当前支付方式有未处理完成的订单!', 'Pending orders exist for this payment method'],
|
['广告id不正确', 'Invalid advert ID'],
|
['广告不存在', 'Advert does not exist'],
|
['承兑商支付方式未配置', 'Merchant payment method not configured'],
|
['承兑商广告支付方式未配置', 'Merchant advert payment method not configured'],
|
['承兑商不存在', 'Merchant does not exist'],
|
['承兑商的用户信息不存在', 'Merchant user info does not exist'],
|
['当前已经加入过自选', 'Already added to favorites'],
|
['保存自选失败:', 'Failed to save favorites:'],
|
['删除失败', 'Delete failed'],
|
['账号或密码不正确', 'Incorrect username or password'],
|
['操作失败,请稍后再试', 'Operation failed, please try again later'],
|
['追加保证金异常', 'Failed to add margin'],
|
['当前币对不存在', 'Trading pair does not exist'],
|
['未开放合约交易', 'Futures trading is not available'],
|
['停牌禁止交易', 'Trading suspended'],
|
['当前已经休市', 'Market is closed'],
|
['实名认证未通过,无法进行高级认证', 'Real-name verification required before advanced verification'],
|
['工作地址长度超过245', 'Work address exceeds 245 characters'],
|
['家庭地址长度超过245', 'Home address exceeds 245 characters'],
|
['亲属电话长度超过32', 'Relative phone exceeds 32 characters'],
|
['亲属名称长度超过32', 'Relative name exceeds 32 characters'],
|
['亲属地址长度超过245', 'Relative address exceeds 245 characters'],
|
['请登录!', 'Please log in'],
|
['最低下单金额:', 'Minimum order amount: '],
|
['委托单不存在', 'Order does not exist'],
|
['执行撤单异常', 'Failed to cancel order'],
|
['无网络', 'Network unavailable'],
|
['谷歌验证码已绑定', 'Google Authenticator is already bound'],
|
['谷歌验证码错误', 'Incorrect Google Authenticator code'],
|
['支付币种不正确', 'Invalid payment currency'],
|
['提交失败,当前有未处理订单', 'Submission failed, pending order exists'],
|
['用户未结束订单数量已达上限', 'Too many open orders'],
|
['今日取消订单次数太多了,请明日再试', 'Too many cancellations today, try again tomorrow'],
|
['订单类型不正确', 'Invalid order type'],
|
['支付金额不正确', 'Invalid payment amount'],
|
['币种数量不正确', 'Invalid currency amount'],
|
['用户不存在', 'User does not exist'],
|
['C2C广告id不正确', 'Invalid C2C advert ID'],
|
['申诉订单号不正确', 'Invalid appeal order number'],
|
['请输入申诉原因', 'Appeal reason is required'],
|
['请上传申诉凭证', 'Please upload appeal evidence'],
|
['该订单已提交申诉', 'Appeal already submitted for this order'],
|
['申诉不存在', 'Appeal does not exist'],
|
['请先通过高级认证', 'Advanced verification required'],
|
['流水小于限额', 'Turnover below minimum limit'],
|
['用户不能取消提现', 'User cannot cancel this withdrawal'],
|
['充值或提现不正确', 'Invalid recharge or withdrawal type'],
|
['订单状态不正确', 'Invalid order status'],
|
[' 不存在', ' does not exist'],
|
];
|
|
function walk(dir, files = []) {
|
for (const name of fs.readdirSync(dir)) {
|
const p = path.join(dir, name);
|
if (fs.statSync(p).isDirectory()) walk(p, files);
|
else if (name.endsWith('.java')) files.push(p);
|
}
|
return files;
|
}
|
|
let changed = 0;
|
for (const file of walk(API_ROOT)) {
|
let content = fs.readFileSync(file, 'utf8');
|
const original = content;
|
for (const [from, to] of replacements) {
|
if (content.includes(from)) content = content.split(from).join(to);
|
}
|
if (content !== original) {
|
fs.writeFileSync(file, content, 'utf8');
|
changed++;
|
console.log('updated:', path.relative(API_ROOT, file));
|
}
|
}
|
console.log('done, files changed:', changed);
|