Просмотр исходного кода

wesmiler ECY 画画交易平台

APPLE 3 лет назад
Родитель
Сommit
3426bfb0d8

+ 41 - 14
application/admin/controller/bonus/Withdrawals.php

@@ -3,6 +3,8 @@
 namespace app\admin\controller\bonus;
 
 use app\common\controller\Backend;
+use app\common\model\User;
+use think\Db;
 
 /**
  * 
@@ -96,21 +98,46 @@ class Withdrawals extends Backend
     		{
     			$this->error("信息不存在");
     		}
+            $user = User::where(['id'=> $info['userid']])->find();
+            if(empty($user)){
+                $this->error("用户信息不存在");
+            }
+
+    		DB::startTrans();
     		$res1=$this->model->where('id',$params['id'])->update(['process_status'=>-1,'remark'=>$params['remark'],'confirm_date'=>time()]);
-    		$changedata=[
-	    		'type'=>5,
-	    		'money'=>$info['amount'],
-	    		'userid'=>$info['userid'],
-	    		'relevant_userid'=>-1,
-	    		'remark'=>'拒绝提现返还',
-    		];
-    		$res=caiwu($changedata, $info['money_type']);
-    		if($res && $res1)
-    		{
-    			$this->success('审核完成');
-    		}else{
-    			$this->error('审核失败');
-    		}
+    		if(!$res1){
+    		    DB::rollback();
+                $this->error('审核失败');
+            }
+
+    		$balance = $user->usdt;
+    		$user->usdt = $user->usdt + $info['amount'];
+    		$user->updatetime = time();
+    		if(!$user->save()){
+                DB::rollback();
+                $this->error('审核失败');
+            }
+
+            // 流水明细
+            $changedata=[
+                'userid'=> $info['userid'],
+                'type'=> 5,
+                'money'=> $info['amount'],
+                'balance'=> $balance,
+                'relevant_userid'=> $info['userid'],
+                'status'=>1,
+                'create_time'=>time(),
+                'remark'=>'USDT余额提现拒绝返还',
+                'user_name'=>$user->username? $user->username : '系统',
+                'relevant_name'=>$user->username? $user->username : '系统',
+            ];
+            if(!Db::name('detailed_bonus')->insertGetId($changedata)){
+                DB::rollback();
+                $this->error('审核失败');
+            }
+
+            DB::commit();
+            $this->success('审核完成');
     	}
     	$ids=input('ids');
     	$this->view->assign('id',$ids);

+ 22 - 10
application/api/controller/User.php

@@ -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 {

+ 2 - 2
application/shop/view/user/withdraw.html

@@ -34,9 +34,9 @@
 			<div class=" sc-bg am-radius10">
 				<form class="am-form am-form-horizontal am-padding-sm invest-form" id="form1">
 					<div class="am-form-group">
-						<label class="am-u-sm-3 am-form-label">可提现{:get_money_name_byident('bonus')}</label>
+						<label class="am-u-sm-3 am-form-label">可提现{$user['usdt']}</label>
 						<div class="am-u-sm-9">
-							<input type="text" value="{$user['bonus']}" class="white " readonly="readonly">
+							<input type="text" value="{$user['usdt']}" class="white " readonly="readonly">
 						</div>
 					</div>
 					<div class="line"></div>

+ 1 - 1
application/shop/view/user/withdrawdetaile.html

@@ -49,7 +49,7 @@
 			var pag = 1, page;  //p当前页,page总页数
 			getList();
 			function getList(){
-				jQuery.post("{:url('api/user/withdrawdetaile')}" ,{p:pag,money_type:'bonus'},function(data) {
+				jQuery.post("{:url('api/user/withdrawdetaile')}" ,{p:pag,money_type:'usdt'},function(data) {
 					console.log(data.data);
 					if(data.data != null && data.data.length != 0){
 						page=data.total;