afa hai 10 meses
pai
achega
446b27d0d1

+ 4 - 7
application/admin/controller/ledger/LedgerWallet.php

@@ -25,7 +25,7 @@ class LedgerWallet extends Backend
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\admin\model\LedgerWallet;
+        $this->model = new \app\common\model\LedgerWalletModel();
 
     }
 
@@ -56,15 +56,12 @@ class LedgerWallet extends Backend
             return $this->selectpage();
         }
         [$where, $sort, $order, $offset, $limit] = $this->buildparams();
-        $list     = $this->model->alias('r')
-            ->join('user u','r.user_id=u.id','LEFT')
+        $list = $this->model->with('users')
             ->where($where)
-            ->field('r.*,u.address')
             ->order($sort, $order)
             ->paginate($limit);
-        foreach ($list as $k => $v) {
-            $list[$k]['address'] = (new UserModel())->getById($v['user_id'])['address'];
-        }
+ 
+  
         $result = ['total' => $list->total(), 'rows' => $list->items()];
         return json($result);
     }

+ 28 - 2
application/admin/controller/offline/OfflineRecharge.php

@@ -21,7 +21,7 @@ class OfflineRecharge extends Backend
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\common\model\OfflineWithdrawRecordModel;
+        $this->model = new \app\common\model\OfflineRechargeRecordModel();
     }
 
 
@@ -31,6 +31,32 @@ class OfflineRecharge extends Backend
      * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
      * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
      */
-
+       /**
+     * 查看
+     *
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $list     = $this->model
+            ->where($where)
+            ->order($sort, $order)
+            ->paginate($limit);
+  
+        $result = ['total' => $list->total(), 'rows' => $list->items(), 'total_revenue'=> 669];
+        return json($result);
+    }
 
 }

+ 6 - 20
application/admin/controller/offline/OfflineWithdraw.php

@@ -19,6 +19,7 @@ use think\Env;
 use think\exception\DbException;
 use think\Model;
 use app\api\controller\Offline as OfflineApi;
+use think\Lang;
 use think\response\Json;
 
 /**
@@ -129,37 +130,22 @@ class OfflineWithdraw extends Backend
                 $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
                 $row->validateFailException()->validate($validate);
             }
-         
+            
             $approved = in_array($params['status'], [WithdrawStatus::StatusApprove, WithdrawStatus::StatusManual]); // true:通过 false:拒绝 $params['status'] == 
+       
             $update = [
                 'status'      => $params['status'],
                 'tx_hash'     => $approved ? $params['tx_hash'] : $row['tx_hash'],
                 'update_time' => time(),
             ];
 
-            //自动动打款调用接口
-            if ($params['status'] == WithdrawStatus::StatusApprove) {
-                if($row['symbol'] != 'usdt'){
-                    throw new Exception("自动打款只支持USDT提现订单");
-                }
-                //(new OfflineWithdrawRecordModel())->where('id', $row->id)->update(['status' => 1]);
-                $req = (new MyBscApi())->createWithdraw($row->id);
-                //$req = (new KangApi())->createWithdraw($row->id);
-                if ($req['code'] == 0){
-                    throw new Exception("打款失败:" . $req['msg']);
-                }
-                $update['status'] =  OfflineWithdrawRecordModel::StatusConfirm;
-            }
-
             // 仅处理"待处理"状态的订单,"已抢单"的暂不处理
             $result = (new OfflineWithdrawRecordModel())->where('id', $row['id'])->where('status', OfflineWithdrawRecordModel::StatusDefault)->update($update);
-            if (empty($result)) {
-                throw new Exception("修改订单状态失败");
-            }
-
+            if (empty($result)) throw new Exception("修改订单状态失败");
+            
             // 拒绝时,将提交的金额退回到用户余额里
             if ($params['status'] == OfflineWithdrawRecordModel::StatusReturn) {
-                (new LedgerWalletModel())->changeWalletAccount($row['user_id'], Asset::USDT, $row['amount'], Action::UsdtWithdrawReturn);
+                (new LedgerWalletModel())->changeWalletAccount($row['user_id'], Asset::TOKEN, $row['amount'], LedgerWalletModel::Return);
             }
             Db::commit();
         } catch (\Exception $e) {

+ 0 - 8
application/admin/model/LedgerWallet.php

@@ -8,10 +8,6 @@ use think\Model;
 class LedgerWallet extends Model
 {
 
-    
-
-    
-
     // 表名
     protected $table = 'ledger_wallet';
     
@@ -29,10 +25,6 @@ class LedgerWallet extends Model
     ];
     
 
-    
-
-
-
     public function getUpdateTimeTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : '');

+ 1 - 2
application/admin/view/offline/offline_recharge/index.html

@@ -11,8 +11,7 @@
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
                         <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
-                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('offline/offline_recharge/add')?'':'hide'}" title="{:__('Declaration')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
-
+                     
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                            data-operate-edit=""

+ 1 - 2
application/admin/view/offline/offline_withdraw/approve.html

@@ -32,8 +32,7 @@
         <label class="control-label col-xs-12 col-sm-2">审核结果:</label>
         <div class="col-xs-12 col-sm-8">
             <div class="radio">
-                <label for="row[status]-200"><input id="row[status]-200" checked="checked" name="row[status]" type="radio" value="200">通过-自动打款</label>
-                <label for="row[status]-201"><input id="row[status]-201" name="row[status]" type="radio" value="201">通过-手动打款</label>
+                <label for="row[status]-200"><input id="row[status]-200" checked="checked" name="row[status]" type="radio" value="200">通过-打款</label>
                 <label for="row[status]-300"><input id="row[status]-300" name="row[status]" type="radio" value="300">退款并驳回</label>
                 <label for="row[status]-400"><input id="row[status]-400" name="row[status]" type="radio" value="400">不退款不提现</label>
             </div>

+ 1 - 0
application/api/lang/en/user.php

@@ -42,4 +42,5 @@ return [
     '充值'                                   => 'Recharge',
     '提现'                                   => 'Withdraw',
     '分享'                                   => 'Share',
+    '退回'                                   => 'Return',
 ];

+ 1 - 0
application/api/lang/zh-cn/user.php

@@ -42,4 +42,5 @@ return [
     '充值'                                  => '充值',
     '提现'                                  => '提现',
     '分享'                                  => '分享',
+    '退回'                                  => '退回',
 ];

+ 9 - 1
application/common/model/LedgerWalletModel.php

@@ -31,6 +31,7 @@ class LedgerWalletModel extends Model
     const Recharge          = 3;
     const Withdraw          = 4;
     const Share             = 5;
+    const Return            = 6;
 
     /*
      * 支付状态
@@ -44,6 +45,7 @@ class LedgerWalletModel extends Model
         self::Recharge          => '充值',
         self::Withdraw          => '提现',
         self::Share             => '分享',
+        self::Return            => '退回',
     ];
 
 
@@ -72,7 +74,8 @@ class LedgerWalletModel extends Model
        
     public static function getStatusList()
     {
-        return [self::Popular => __('热销支付'), self::Payment  => __('转让支付'), self::Receive => __('转让收款'), self::Recharge => __('充值'), self::Withdraw  => __('提现'), self::Share => __('分享')];
+        return [self::Popular => __('热销支付'), self::Payment  => __('转让支付'), self::Receive => __('转让收款'), self::Recharge => __('充值'), 
+        self::Withdraw  => __('提现'), self::Share => __('分享'), self::Return => __('退回')];
     }
 
     /**
@@ -378,6 +381,11 @@ class LedgerWalletModel extends Model
         }
     }
 
+    public function users()
+    {
+        return $this->hasOne(UserModel::class, 'id', 'user_id');
+    }
+
     public function getCreateTimeTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');

+ 2 - 0
application/common/model/OfflineRechargeRecordModel.php

@@ -52,6 +52,8 @@ class OfflineRechargeRecordModel extends Model
         return $this->hasOne(UserModel::class, 'id', 'user_id');
     }
 
+
+
     /**
      * 创建购买(充值)记录
      * @param string $txHash

+ 2 - 6
application/common/model/OfflineWithdrawRecordModel.php

@@ -13,11 +13,9 @@ class OfflineWithdrawRecordModel extends Model
     protected $name = "offline_withdraw_record";
     const StatusDefault     = 0;
     const StatusConfirm     = 100;
-    const StatusSuccessAuto = 200;
-    const StatusSuccessHand = 201;
+    const StatusSuccess     = 200;
     const StatusReturn      = 300;
     const StatusFail        = 400;
-    const StatusCancel      = 500;
 
     /*
      * 客户端订单状态筛选
@@ -26,10 +24,8 @@ class OfflineWithdrawRecordModel extends Model
         '-1'                    => '全部',
         self::StatusDefault     => '待处理',
         self::StatusConfirm     => '待确认',
-        self::StatusSuccessAuto => '自动打款成功',
-        self::StatusSuccessHand => '手动打款成功',
+        self::StatusSuccess     => '打款成功',
         self::StatusReturn      => '驳回',
-        self::StatusCancel      => '取消',
         self::StatusFail        => '失败'
     ];
     public function createWithdraw(string $txHash, int $uid, string $amount, string $real, string $to_address, string $symbol)

+ 5 - 5
extend/fast/WithdrawStatus.php

@@ -15,27 +15,27 @@ class WithdrawStatus
     /**
      * 已抢单
      */
-    const StatusLocked = 1;
+    const StatusLocked = 100;
 
     /**
      * 通过-自动
      */
-    const StatusApprove = 2;
+    const StatusApprove = 200;
 
     /**
      * 拒绝
      */
-    const StatusRefuse = 3;
+    const StatusRefuse = 300;
 
     /**
      * 通过-手动打款
      */
-    const StatusManual = 4;
+    const StatusManual = 400;
 
     /**
      * 提现中
      */
-    const StatusConduct = 5;
+    const StatusConduct = 500;
 
 
     private static array $actions = [

+ 3 - 3
public/assets/js/backend/ledger/ledger_wallet.js

@@ -26,12 +26,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'user_id', title: __('User_id')},
-                        {field: 'address', title: '用户地址'},
+                        {field: 'users.address', title: '用户地址'},
                         {field: 'power', title: '总算力', operate:'BETWEEN'},
                         {field: 'server_power', title: '服务器算力', operate:'BETWEEN'},
                         {field: 'usdt', title: __('Usdt'), operate:'BETWEEN'},
-                        {field: 'token', title: 'ALEO', operate:'BETWEEN'},
-                        {field: 'smh', title: 'SMH', operate:'BETWEEN'},
+                        {field: 'token', title: '茶宝', operate:'BETWEEN'},
+                        {field: 'teac', title: 'Teac', operate:'BETWEEN'},
                         {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                     ]
                 ]

+ 1 - 2
public/assets/js/backend/offline/offline_recharge.js

@@ -23,14 +23,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 pk: 'id',
                 sortName: 'id',
                 fixedColumns: true,
-                fixedRightNumber: 1,
                 columns: [
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'tx_hash', title: __('Tx_hash'), operate: 'LIKE'},
                         {field: 'user_id', title: __('User_id')},
-                        {field: 'symbol', title: __('Symbol'), operate: 'LIKE'},
+                        //{field: 'symbol', title: __('Symbol'), operate: 'LIKE'}, 
                         {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
                         {field: 'to_address', title: __('To_address'), operate: false},
                         {field: 'from_address', title: __('From_address'), operate: false},