|
|
@@ -48,17 +48,16 @@ class Offline extends Api
|
|
|
$sign = $this->request->post('sign'); // 签名信
|
|
|
$address = $this->request->post('to_address'); // 地址
|
|
|
if(empty($sign) || empty($address)){
|
|
|
- $this->error('参数错误');
|
|
|
+ $this->error(__('Invalid parameters'));
|
|
|
}
|
|
|
$real = bcdiv($amount, getConfig('convert_rate'), 6); // 折合转换 U = 1
|
|
|
$min = getConfig('withdraw_min_amount');
|
|
|
$rate = getConfig('withdrawal_fee');
|
|
|
if ($amount <= 0) {
|
|
|
- $this->error('提现金额必须大于0');
|
|
|
+ $this->error(__('The withdrawal amount must be greater than 0'));
|
|
|
} else if ($amount < $min) {
|
|
|
- $this->error('提现金额不能小于' . $min);
|
|
|
+ $this->error(__('The withdrawal amount cannot be less than') . $min);
|
|
|
}
|
|
|
-
|
|
|
// 扣除手续费后
|
|
|
if ($rate > 0 && $rate < 1) { // 比例范围只在0-1之间
|
|
|
$real = bcmul($real, bcsub(1, $rate, 6), 6);
|
|
|
@@ -67,20 +66,15 @@ class Offline extends Api
|
|
|
|
|
|
// 用户信息
|
|
|
$user = (new UserModel())->getById($uid);
|
|
|
- if (empty($user)) {
|
|
|
- $this->error('用户不存在');
|
|
|
- }
|
|
|
-
|
|
|
if($user['is_withdraw']){
|
|
|
- $this->error('提现失败,请联系客服。');
|
|
|
+ $this->error(__('Withdrawal failed, please contact customer service.'));
|
|
|
}
|
|
|
|
|
|
// 验签
|
|
|
$signMsg = "withdraw"; // 与前端约定的固定值
|
|
|
if (!checkSign($signMsg, $sign, $address)) {
|
|
|
- $this->error('签名校验失败');
|
|
|
+ $this->error(__('Signature verification failed'));
|
|
|
}
|
|
|
-
|
|
|
// 启动事务
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
@@ -96,10 +90,10 @@ class Offline extends Api
|
|
|
} catch (Exception $e) {
|
|
|
// 回滚事务
|
|
|
Db::rollback();
|
|
|
- $this->error('提交失败:' . $e->getMessage());
|
|
|
+ $this->error( $e->getMessage());
|
|
|
}
|
|
|
|
|
|
- $this->success('提现申请已提交');
|
|
|
+ $this->success('ok');
|
|
|
}
|
|
|
|
|
|
/**
|