|
|
@@ -173,54 +173,25 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
- * 获取smh出款信息
|
|
|
+ * 获取操作信息 购买、赠送、提货、转让
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function smhInfo()
|
|
|
+ public function getOperateLog(ProductOrder $productOrder)
|
|
|
{
|
|
|
- $user = $this->auth->getUser();
|
|
|
- if (empty($user)) {
|
|
|
- $this->error('用户信息不存在');
|
|
|
- }
|
|
|
+ $list['data'] = $productOrder->alias('a')
|
|
|
+ ->join("product_list b", "b.id = a.product_id", "left")
|
|
|
+ ->field('a.id as order_id,a.product_id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,a.price,a.status,a.type_id')
|
|
|
+ ->where('a.user_id', $this->auth->id)
|
|
|
+ ->order('a.id DESC')
|
|
|
+ ->paginate($this->pageSize);
|
|
|
+ $list['statusList'] = $productOrder::getStatusAll();
|
|
|
+ $this->success('', $list);
|
|
|
+ }
|
|
|
|
|
|
- $resp = [
|
|
|
- 'smh' => '0', // 平台币余额
|
|
|
- 'smh_min_amount' => 0, // 最低提现U数量
|
|
|
- 'tips' => "", //提现提示信息
|
|
|
- 'address' => "", // 出款地址,此地址有值时,前台不允许重新输入
|
|
|
- 'smh_price' => (new SmhWithdrawRecordModel())->getEtcPrice(), //smh价格
|
|
|
- 'smh_exchange_ratio' => (new ParametersModel())->getValue('smhExchangeRatio'), // smh兑换USDT手续费
|
|
|
- 'smh_fee_rate' => (new ParametersModel())->getValue('smhFeeRate'), // smh提现手续费
|
|
|
- ];
|
|
|
|
|
|
- $wallet = (new LedgerWalletModel())->getWallet($user['id']);
|
|
|
- if (!empty($wallet)) {
|
|
|
- $resp['smh'] = $wallet['smh'];
|
|
|
- }
|
|
|
|
|
|
- $config = (new ParametersModel)
|
|
|
- ->where('name', '=', 'smhMinAmount')
|
|
|
- ->find();
|
|
|
- if(empty($config)){
|
|
|
- $this->error('未配置SMH出款参数');
|
|
|
- }
|
|
|
- $resp['smh_min_amount'] = $config['value'];
|
|
|
- $resp['tips'] = $config['tip'];
|
|
|
|
|
|
- $wallet = (new OfflineWithdrawRecordModel())
|
|
|
- ->where('user_id', $user['id'])
|
|
|
- ->where('symbol', 'smh')
|
|
|
- ->where('status', OfflineWithdrawRecordModel::StatusSuccess)
|
|
|
- ->find();
|
|
|
- if (!empty($wallet)) {
|
|
|
- $resp['address'] = $wallet['to_address'];
|
|
|
- }
|
|
|
-
|
|
|
- $this->success('', $resp);
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 提交出款信息
|
|
|
@@ -231,11 +202,9 @@ class User extends Api
|
|
|
$amount = $this->request->post('amount'); // 金额
|
|
|
$sign = $this->request->post('sign'); // 签名信
|
|
|
$address = $this->request->post('address'); // 提现地址
|
|
|
-// $sign = 'test';
|
|
|
if(empty($sign)){
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
-
|
|
|
$real = $amount; // 实际到账
|
|
|
$min = (new ParametersModel)->getValue('smhMinAmount') ?? '0';
|
|
|
if ($amount <= 0) {
|
|
|
@@ -243,9 +212,7 @@ class User extends Api
|
|
|
} else if ($amount < $min) {
|
|
|
$this->error('提现金额不能小于' . $min);
|
|
|
}
|
|
|
-
|
|
|
$uid = $this->auth->getTokenUserID();
|
|
|
-
|
|
|
// 用户信息
|
|
|
$user = (new UserModel())->getById($uid);
|
|
|
if (empty($user)) {
|
|
|
@@ -256,20 +223,16 @@ class User extends Api
|
|
|
if (empty($wallet)) {
|
|
|
$this->error('用户不存在');
|
|
|
}
|
|
|
-
|
|
|
if($amount > $wallet['smh']){
|
|
|
$this->error('SMH余额不足');
|
|
|
}
|
|
|
-
|
|
|
$rate = (new ParametersModel)->getValue('smhFeeRate') ?? '0';
|
|
|
-
|
|
|
// 扣除手续费后
|
|
|
if ($rate >= 0 && $rate < 1) { // 比例范围只在0-1之间
|
|
|
$real = bcmul($amount, bcsub(1, $rate, 6), 6);
|
|
|
}else{
|
|
|
$this->error('手续费设置错误:' . $rate);
|
|
|
}
|
|
|
-
|
|
|
// 验签
|
|
|
$signMsg = "EtcWithdraw"; // 与前端约定的固定值
|
|
|
if (!checkSign($signMsg, $sign, $user['address'])) {
|