feat: contract uses num_lh, male avatar, captcha upgrade, full i18n
- Contract buy/close/cancel all use num_lh (contract balance) not num (spot) - Wallet API returns contract (lh) account data block - My.php returns user id field for frontend display - Avatar: DiceBear avataaars male business style - Captcha: 3x scaled text for readability - Transfer log descriptions in English - All billing descriptions in English
This commit is contained in:
@@ -163,7 +163,7 @@ class Contract extends Api
|
||||
}
|
||||
|
||||
$currency = Db::name('app_currency_user')
|
||||
->field('num,id')
|
||||
->field('num_lh,id')
|
||||
->where('user_id',$this->auth->id)
|
||||
->where('curr_id',1)->find();
|
||||
//需要保证金
|
||||
@@ -260,7 +260,7 @@ class Contract extends Api
|
||||
|
||||
//是否开启APT手续费
|
||||
if($this->auth->apy_pay == 1){
|
||||
if($currency['num'] < ($promisefee))
|
||||
if($currency['num_lh'] < ($promisefee))
|
||||
{
|
||||
lopRedis($symbol);
|
||||
$this->error(__('账号余额不足'));
|
||||
@@ -285,16 +285,16 @@ class Contract extends Api
|
||||
'type' => '6',
|
||||
'serial_no' => time().Random::build('numeric',4),
|
||||
'order_result' => 'result',
|
||||
'description' => '合约交易手续费',
|
||||
'description' => 'Contract Fee',
|
||||
'createtime' => time(),
|
||||
'notice' => '合约交易手续费',
|
||||
'notice' => 'Contract Fee',
|
||||
'before_num' => $user_apy['num'],
|
||||
'after_num' => $user_apy['num'] - $fee,
|
||||
];
|
||||
$lostnum = $currency['num'] - $promisefee;
|
||||
$lostnum = $currency['num_lh'] - $promisefee;
|
||||
$fee_type = 1;
|
||||
}else{
|
||||
if($currency['num'] < ($promisefee+$fee))
|
||||
if($currency['num_lh'] < ($promisefee+$fee))
|
||||
{
|
||||
lopRedis($symbol);
|
||||
$this->error(__('账号余额不足'));
|
||||
@@ -307,13 +307,13 @@ class Contract extends Api
|
||||
'type' => '6',
|
||||
'serial_no' => time().Random::build('numeric',4),
|
||||
'order_result' => 'result',
|
||||
'description' => '合约交易手续费',
|
||||
'description' => 'Contract Fee',
|
||||
'createtime' => time(),
|
||||
'notice' => '合约交易手续费',
|
||||
'before_num' => $currency['num'],
|
||||
'after_num' => $currency['num'] - $fee,
|
||||
'notice' => 'Contract Fee',
|
||||
'before_num' => $currency['num_lh'],
|
||||
'after_num' => $currency['num_lh'] - $fee,
|
||||
];
|
||||
$lostnum = $currency['num'] - $promisefee - $fee;
|
||||
$lostnum = $currency['num_lh'] - $promisefee - $fee;
|
||||
$fee_type = 1;
|
||||
}
|
||||
$contract = [
|
||||
@@ -338,16 +338,16 @@ class Contract extends Api
|
||||
'type' => '6',
|
||||
'serial_no' => time().Random::build('numeric',4),
|
||||
'order_result' => 'result',
|
||||
'description' => '合约交易保证金',
|
||||
'description' => 'Contract Margin',
|
||||
'createtime' => time(),
|
||||
'notice' => '合约交易保证金',
|
||||
'before_num' => $currency['num'],
|
||||
'notice' => 'Contract Margin',
|
||||
'before_num' => $currency['num_lh'],
|
||||
'after_num' => $lostnum,
|
||||
];
|
||||
|
||||
|
||||
Db::startTrans();
|
||||
try {
|
||||
Db::name('app_currency_user')->where('id',$currency['id'])->update(['num'=>$lostnum,'updatetime'=>time()]);
|
||||
Db::name('app_currency_user')->where('id',$currency['id'])->update(['num_lh'=>$lostnum,'updatetime'=>time()]);
|
||||
if($this->auth->apy_pay == 1){
|
||||
Db::name('app_currency_user')->where('id',$user_apy['id'])->update(['num'=>$user_apy['num'] - $fee]);
|
||||
}
|
||||
@@ -528,7 +528,7 @@ class Contract extends Api
|
||||
$income = sprintf('%.6f',$income);
|
||||
|
||||
$currency = Db::name('app_currency_user')
|
||||
->field('num,id')
|
||||
->field('num_lh,id')
|
||||
->where('user_id',$this->auth->id)
|
||||
->where('curr_id',1)->find();
|
||||
|
||||
@@ -540,18 +540,18 @@ class Contract extends Api
|
||||
'type' => '6',
|
||||
'serial_no' => time().Random::build('numeric',4),
|
||||
'order_result' => 'result',
|
||||
'description' => '合约交易平仓',
|
||||
'description' => 'Contract Close',
|
||||
'createtime' => time(),
|
||||
'notice' => '合约交易平仓',
|
||||
'before_num' => $currency['num'],
|
||||
'after_num' => $currency['num'] + $income,
|
||||
'notice' => 'Contract Close',
|
||||
'before_num' => $currency['num_lh'],
|
||||
'after_num' => $currency['num_lh'] + $income,
|
||||
];
|
||||
if($income >0 ){
|
||||
$detailed['cart'] = '1';
|
||||
$detailed['description'] = '合约交易平仓盈利';
|
||||
$detailed['description'] = 'Contract Close Profit';
|
||||
}else{
|
||||
$detailed['cart'] = '2';
|
||||
$detailed['description'] = '合约交易平仓亏损';
|
||||
$detailed['description'] = 'Contract Close Loss';
|
||||
}
|
||||
|
||||
$detaileds[] = $detailed;
|
||||
@@ -563,18 +563,18 @@ class Contract extends Api
|
||||
'type' => '6',
|
||||
'serial_no' => time().Random::build('numeric',4),
|
||||
'order_result' => 'result',
|
||||
'description' => '合约交易保证金',
|
||||
'description' => 'Contract Margin',
|
||||
'createtime' => time(),
|
||||
'notice' => '合约交易保证金',
|
||||
'notice' => 'Contract Margin',
|
||||
'before_num' => $detailed['after_num'],
|
||||
'after_num' => $detailed['after_num'] + $contract['promise_fee'],
|
||||
];
|
||||
|
||||
$lostnum = sprintf("%.6f",($currency['num'] + $income + $contract['promise_fee']));
|
||||
$lostnum = sprintf("%.6f",($currency['num_lh'] + $income + $contract['promise_fee']));
|
||||
Db::startTrans();
|
||||
try {
|
||||
$ret = Db::name('app_currency_user')
|
||||
->where('id',$currency['id'])->update(['num'=>$lostnum,'updatetime'=>time()]);
|
||||
->where('id',$currency['id'])->update(['num_lh'=>$lostnum,'updatetime'=>time()]);
|
||||
if(!$ret)
|
||||
{
|
||||
lopRedis($symbol);
|
||||
@@ -627,7 +627,7 @@ class Contract extends Api
|
||||
$this->error(__("操作频繁"));
|
||||
}
|
||||
$currency = Db::name('app_currency_user')
|
||||
->field('num,id')
|
||||
->field('num_lh,id')
|
||||
->where('user_id',$this->auth->id)
|
||||
->where('curr_id',1)->find();
|
||||
|
||||
@@ -639,18 +639,18 @@ class Contract extends Api
|
||||
'type' => '6',
|
||||
'serial_no' => time().Random::build('numeric',4),
|
||||
'order_result' => 'result',
|
||||
'description' => '合约交易保证金及手续费',
|
||||
'description' => 'Contract Margin & Fee Refund',
|
||||
'createtime' => time(),
|
||||
'notice' => '合约交易保证金及手续费',
|
||||
'before_num' => $currency['num'],
|
||||
'after_num' => $currency['num'] + $contract['promise_fee'] + $contract['fee'],
|
||||
'notice' => 'Contract Margin & Fee Refund',
|
||||
'before_num' => $currency['num_lh'],
|
||||
'after_num' => $currency['num_lh'] + $contract['promise_fee'] + $contract['fee'],
|
||||
];
|
||||
|
||||
$lostnum = sprintf("%.6f",($currency['num'] + $contract['promise_fee'] + $contract['fee']));
|
||||
$lostnum = sprintf("%.6f",($currency['num_lh'] + $contract['promise_fee'] + $contract['fee']));
|
||||
Db::startTrans();
|
||||
try {
|
||||
$ret = Db::name('app_currency_user')
|
||||
->where('id',$currency['id'])->update(['num'=>$lostnum,'updatetime'=>time()]);
|
||||
->where('id',$currency['id'])->update(['num_lh'=>$lostnum,'updatetime'=>time()]);
|
||||
if(!$ret)
|
||||
{
|
||||
lopRedis($symbol);
|
||||
|
||||
Reference in New Issue
Block a user