+ 8 months ago
parent
commit
6f849c1746

+ 24 - 1
application/admin/controller/greenroom/Withdrawal.php

@@ -9,6 +9,7 @@ use think\Env;
 use think\exception\DbException;
 use think\exception\PDOException;
 use think\exception\ValidateException;
+use think\response\Json;
 use Udun\Dispatch\UdunDispatch;
 
 /**
@@ -151,5 +152,27 @@ class Withdrawal extends Backend
         }
         $this->success();
     }
-
+    // 驳回
+    public function reject($ids = null)
+    {
+        Db::startTrans();
+        try {
+            if(!$ids) throw new \Exception('参数错误');
+            $withdraw = $this->model->find($ids);
+            if (!$withdraw) throw new \Exception('提现记录不存在');
+            if ($withdraw->status != 1) throw new \Exception('状态错误');
+            $withdraw->status = -1;
+            $withdraw->save();
+            \app\admin\model\Admin::update([
+                'money' => bcadd($withdraw->amount, 3, 4)
+            ], [
+                'id' => $withdraw->uid
+            ]);
+            Db::commit();
+            return \json(['code' => 1, 'msg' => '驳回成功']);
+        } catch (\Exception $e) {
+            Db::rollback();
+            return \json(['code' => 0, 'msg' => $e->getMessage()]);
+        }
+    }
 }

+ 3 - 3
public/assets/js/backend/greenroom/withdrawal.js

@@ -30,7 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'uid', title: __('Uid')},
                         {field: 'account', title: __('Account'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
-                        {field: 'status', title: __('状态'), searchList: {"0":__('已驳回'),"1":__('申请中'),"2":__('审核通过'),"3":__('已完成')}, formatter: Table.api.formatter.status},
+                        {field: 'status', title: __('状态'), searchList: {"-1":__('已驳回'),"0":__('未知'),"1":__('申请中'),"2":__('审核通过'),"3":__('已完成')}, formatter: Table.api.formatter.status},
                         {field: 'admin.username', title: __('Admin.username'), operate: 'LIKE'},
                         {field: 'admin.nickname', title: __('Admin.nickname'), operate: 'LIKE'},
                         {field: 'admin.appname', title: __('Admin.appname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
@@ -67,10 +67,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     title: __('拒绝'),
                                     classname: 'btn btn-xs btn-success btn-magic btn-ajax',
                                     icon: 'fa fa-magic',
-                                    url: 'customer/customer/freecustomer',
+                                    url: 'greenroom/withdrawal/reject',
                                     confirm: '确定拒绝这次提现申请?',
                                     success: function (data, ret) {
-                                        Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
+                                        Layer.alert(ret.msg);
                                         //如果需要阻止成功提示,则必须使用return false;
                                         //return false;
                                     },