|
|
@@ -7,6 +7,7 @@ use app\common\library\CoinRate;
|
|
|
use app\common\library\Ems;
|
|
|
use app\common\library\Sms;
|
|
|
use app\common\model\Config;
|
|
|
+use think\Db;
|
|
|
use function EasyWeChat\Payment\get_server_ip;
|
|
|
use fast\Random;
|
|
|
use think\Validate;
|
|
|
@@ -792,10 +793,11 @@ class User extends Api
|
|
|
$this->error(__('请选择提现方式'));
|
|
|
}
|
|
|
$user = get_user_data($this->auth->id);
|
|
|
- $JC = $param['money'] - $user['bonus'];
|
|
|
+ $JC = $param['money'] - $user['usdt'];
|
|
|
if ($JC > 0) {
|
|
|
$this->error("余额不足");
|
|
|
}
|
|
|
+
|
|
|
if($param['type'] == 1)
|
|
|
{
|
|
|
if(empty($user['alipayprc']))
|
|
|
@@ -833,17 +835,27 @@ class User extends Api
|
|
|
$studio=db('studio')->where(['title'=>$this->auth->login_studio])->find();
|
|
|
$fee=$param['money']*$config['withdraw_fee']*0.01;
|
|
|
db()->startTrans();
|
|
|
- $changedata = [
|
|
|
- 'type' => 6,
|
|
|
- 'money' => 0 - $param['money'],
|
|
|
- 'userid' => $this->auth->id,
|
|
|
- 'relevant_userid' => $this->auth->id,
|
|
|
- 'remark' => '提现扣除',
|
|
|
+ $res = db('user')->where("id",$this->auth->id)->update(['usdt'=> $user['usdt']-$param['money'],'updatetime'=>time()]);
|
|
|
+
|
|
|
+ // 流水明细
|
|
|
+ $changedata=[
|
|
|
+ 'userid'=>$this->auth->id,
|
|
|
+ 'type'=> 6,
|
|
|
+ 'money'=> -$param['money'],
|
|
|
+ 'balance'=> $user['usdt'],
|
|
|
+ 'relevant_userid'=>$this->auth->id,
|
|
|
+ 'status'=>1,
|
|
|
+ 'create_time'=>time(),
|
|
|
+ 'remark'=>'提现扣除',
|
|
|
+ 'user_name'=>$user['username']? $user['username'] : '系统',
|
|
|
+ 'relevant_name'=>$user['username']? $user['username'] : '系统',
|
|
|
];
|
|
|
- $res = caiwu($changedata, 'bonus');
|
|
|
+ $res1 = Db::name('detailed_bonus')->insertGetId($changedata);
|
|
|
+
|
|
|
$data = [
|
|
|
'withdraw_date' => time(),
|
|
|
'amount' => $param['money'],
|
|
|
+ 'usdt_num' => $param['money'],
|
|
|
'fack_receive' => $param['money']-$fee,
|
|
|
'fee' => $fee,
|
|
|
'userid' => $this->auth->id,
|
|
|
@@ -852,13 +864,13 @@ class User extends Api
|
|
|
'usdt_address' => isset($user['usdt_address']) && $param['type'] == 4? $user['usdt_address'] : '',
|
|
|
'name'=>$name,
|
|
|
'process_status' => 1,
|
|
|
- 'money_type' => 'bonus',
|
|
|
+ 'money_type' => 'usdt',
|
|
|
'type'=>$type,
|
|
|
'stuid'=>$studio['id'],
|
|
|
];
|
|
|
|
|
|
$ids = db('withdrawals')->insertGetId($data);
|
|
|
- if ($res && $ids) {
|
|
|
+ if ($res && $res1 && $ids) {
|
|
|
db()->commit();
|
|
|
$this->success(__("提现成功"));
|
|
|
} else {
|