zac3533 1 жил өмнө
parent
commit
5ce08a58d1

+ 1 - 1
application/admin/controller/trade/Mongyin.php

@@ -23,8 +23,8 @@ class Mongyin extends Backend
     public function _initialize()
     {
         parent::_initialize();
-        $this->model    = new \app\common\model\Mongyin;
         $this->mapType  = array();
+        $this->model    = new \app\common\model\Mongyin;
         $this->assign('typeList', $this->model->getTypeList());
     }
 

+ 63 - 4
application/admin/controller/trade/Mongyout.php

@@ -2,7 +2,12 @@
 
 namespace app\admin\controller\trade;
 
+use think\Db;
+use Exception;
+use think\exception\DbException;
+use think\exception\PDOException;
 use app\common\controller\Backend;
+use think\exception\ValidateException;
 
 /**
  * 提现记录管理
@@ -18,20 +23,74 @@ class Mongyout extends Backend
      */
     protected $model = null;
 
+    protected $mapType = null;
+
     public function _initialize()
     {
         parent::_initialize();
+        $this->mapType  = array();
         $this->model = new \app\common\model\Mongyout;
         $this->assign('typeList', $this->model->getTypeList());
     }
 
 
 
-    /**
-     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
-     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
-     * 需要将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();
+
+        //tab
+        $type = $this->request->param('order_type/d');
+        if($type > 0) $this->mapType['order_type'] = $type;
+        
+        $list = $this->model->with('users,admins')
+            ->where($where)
+            ->where($this->mapType)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
 
 
+    
+    /**
+     * 审核
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
+     */
+    public function review($ids = null, $status= 0)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $result = false;
+        try {
+            $result = $row->allowField(true)->save(['status'=>$status]);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
 }

+ 27 - 23
application/admin/controller/user/Group.php

@@ -2,7 +2,13 @@
 
 namespace app\admin\controller\user;
 
+
+use think\Db;
+use Exception;
+use think\exception\DbException;
+use think\exception\PDOException;
 use app\common\controller\Backend;
+use think\exception\ValidateException;
 
 /**
  * 会员组管理
@@ -38,14 +44,10 @@ class Group extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             $list = $this->model
-           
                 ->where($where)->where('is_agent', 1)
                 ->order($sort, $order)
                 ->paginate($limit);
-            // foreach ($list as $k => $v) {
-            //     $v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
-            //     $v->hidden(['password', 'salt']);
-            // }
+
             $result = array("total" => $list->total(), "rows" => $list->items());
 
             return json($result);
@@ -55,29 +57,31 @@ class Group extends Backend
 
     
 
-    public function add()
-    {
-        if ($this->request->isPost()) {
-            $this->token();
-        }
-        $nodeList = \app\admin\model\UserRule::getTreeList();
-        $this->assign("nodeList", $nodeList);
-        return parent::add();
-    }
-
-    public function edit($ids = null)
+    /**
+     * 禁用
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
+     */
+    public function disable($ids = null, $is_lock=0)
     {
-        if ($this->request->isPost()) {
-            $this->token();
-        }
         $row = $this->model->get($ids);
         if (!$row) {
             $this->error(__('No Results were found'));
         }
-        $rules = explode(',', $row['rules']);
-        $nodeList = \app\admin\model\UserRule::getTreeList($rules);
-        $this->assign("nodeList", $nodeList);
-        return parent::edit($ids);
+        $result = false;
+        try {
+            $result = $row->allowField(true)->save(['is_lock'=>$is_lock]);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
     }
 
+
+
 }

+ 2 - 0
application/admin/controller/user/User.php

@@ -25,6 +25,8 @@ class User extends Backend
     {
         parent::_initialize();
         $this->model = model('User');
+        $this->assign('statusList', $this->model->getStatusList());
+        
     }
 
     /**

+ 14 - 6
application/admin/lang/vn/user/group.php

@@ -1,10 +1,18 @@
 <?php
 
 return [
-    'Name'            => '组名',
-    'Rules'           => '权限节点',
-    'Change password' => '修改密码',
-    'Createtime'      => '添加时间',
-    'Updatetime'      => '更新时间',
-    'Status'          => '状态'
+    'Mobile'                    => 'Điện thoại di động',
+    'Invitation_code'           => 'Mã mời',
+    'Agent_in_usdt'             => 'Chuyển đổi tiền gửi USDT',
+    'Agent_in_bank'             => 'Công tắc nạp tiền thẻ ngân hàng',
+    'Agent_out_usdt'            => 'Công tắc rút USDT',
+    'Agent_out_bank'            => 'Công tắc rút tiền mặt thẻ ngân hàng',
+    'Service_link'              => 'Liên kết dịch vụ khách hàng',
+    'Team'                      => 'Kích thước nhóm',
+    'Createtime'                => 'thêm thời gian',
+    'Updatetime'                => 'Cập nhật thời gian',
+    'Status'                    => 'tình trạng',
+    'Open'                      => 'bật',
+    'Close'                     => 'Khép kín',
+    'Disable'                   => 'Vô hiệu hóa',
 ];

+ 4 - 0
application/admin/lang/zh-cn/trade/mongyin.php

@@ -16,4 +16,8 @@ return [
     'Create_time'  => '创建时间',
     'Update_time'  => '更新时间',
     'Confirm review'=> '确定执行该操作吗?',
+
+    'Pending'       => '待处理',
+    'Success'       => '成功',
+    'Fail'          => '失败',
 ];

+ 10 - 3
application/admin/lang/zh-cn/trade/mongyout.php

@@ -2,7 +2,7 @@
 
 return [
     'Order_type'   => '订单类型',
-    'User_id'      => '用户ID',
+    'User_id'      => '用户',
     'Address'      => '提币地址',
     'Bank_name'    => '银行卡名称',
     'Bank_card'    => '卡号',
@@ -11,7 +11,14 @@ return [
     'Fee'          => '手续费比例',
     'Real_amount'  => '实际打款',
     'Status'       => '状态',
-    'Admin_id'     => '操作员ID',
+    'Admin_id'     => '操作员',
+    'Review'       => '审核', 
     'Create_time'  => '创建时间',
-    'Update_time'  => '更新时间'
+    'Update_time'  => '更新时间',
+    'Confirm review'=> '确定执行该操作吗?',
+    'Usdt'         => 'USDT',
+    'Bank'         => '银行卡',
+    'Pending'       => '待处理',
+    'Success'       => '成功',
+    'Fail'          => '失败',
 ];

+ 2 - 1
application/admin/lang/zh-cn/user/group.php

@@ -13,5 +13,6 @@ return [
     'Updatetime'                => '更新时间',
     'Status'                    => '状态',
     'Open'                      => '开启',
-    'Close'                     => '关闭'
+    'Close'                     => '关闭',
+    'Disable'                   => '禁用',
 ];

+ 2 - 2
application/admin/lang/zh-cn/user/user.php

@@ -10,8 +10,8 @@ return [
     'Task'                  => '本轮已做任务量',
     'Invitation_code'       => '邀请码',
     'Is_agent'              => '代理',
-    'User_type'             => '用户类型',
-    'Status'                => '状态',
+    'User_type'             => '用户类型(真人/假人)',
+    'Status'                => '状态(是/否)',
     'Recharge'              => '充值',
     'Withdrawal'            => '提现',
     'Income'                => '收益',

+ 3 - 6
application/admin/model/User.php

@@ -57,17 +57,14 @@ class User extends Model
         });
     }
 
-    public function getGenderList()
-    {
-        return ['1' => __('Male'), '0' => __('Female')];
-    }
-
+    
     public function getStatusList()
     {
-        return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
+        return ['1' => __('Open'), '0' => __('Close')];
     }
 
 
+
     public function getPrevtimeTextAttr($value, $data)
     {
         $value = $value ? $value : ($data['prevtime'] ?? "");

+ 29 - 21
application/admin/view/user/group/edit.html

@@ -1,41 +1,49 @@
-<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
-    {:token()}
-    <input type="hidden" name="row[rules]" value="{$row.rules}" />
+
+
+<form id="edit-form" class=" form-ajax" role="form" data-toggle="validator" method="POST" action="">
+
+
+    <div class="form-horizontal">
+       
     <div class="form-group">
-        <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
+        <label for="c-agent_in_usdt" class="control-label col-xs-12 col-sm-2">{:__('Agent_in_usdt')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
+            {:Form::radios('row[agent_in_usdt]', $statusList, $row.agent_in_usdt, ['data-rule'=>'required'])}
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Permission')}:</label>
+        <label for="c-agent_in_bank" class="control-label col-xs-12 col-sm-2">{:__('Agent_in_bank')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <span class="text-muted"><input type="checkbox" name="" id="checkall" /> <label for="checkall"><small>{:__('Check all')}</small></label></span>
-            <span class="text-muted"><input type="checkbox" name="" id="expandall" /> <label for="expandall"><small>{:__('Expand all')}</small></label></span>
+            {:Form::radios('row[agent_in_bank]', $statusList, $row.agent_in_bank, ['data-rule'=>'required'])}
+        </div>
+    </div>
 
-            <div id="treeview"></div>
+    <div class="form-group">
+        <label for="c-agent_out_usdt" class="control-label col-xs-12 col-sm-2">{:__('Agent_out_usdt')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:Form::radios('row[agent_out_usdt]', $statusList, $row.agent_out_usdt, ['data-rule'=>'required'])}
         </div>
     </div>
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <label for="c-agent_out_bank" class="control-label col-xs-12 col-sm-2">{:__('Agent_out_bank')}:</label>
         <div class="col-xs-12 col-sm-8">
-
-            <div class="radio">
-            {foreach name="statusList" item="vo"}
-            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
-            {/foreach}
-            </div>
-
+            {:Form::radios('row[agent_out_bank]', $statusList, $row.agent_out_bank, ['data-rule'=>'required'])}
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-service_link" class="control-label col-xs-12 col-sm-2">{:__('Service_link')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input type="text" name="row[service_link]" value="{$row.service_link|htmlentities}"  id="c-service_link" class="form-control" />
         </div>
     </div>
-    <div class="form-group layer-footer">
+
+
+    <div class="form-group hide layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">
             <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
             <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
         </div>
     </div>
+    </div>
 </form>
-<script>
-    var nodeData = {:json_encode($nodeList); };
-</script>

+ 2 - 4
application/admin/view/user/group/index.html

@@ -6,12 +6,10 @@
             <div class="tab-pane fade active in" id="one">
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
-                 
-              
+                        {:build_toolbar('refresh')}
+
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('user/group/edit')}"
-                           data-operate-del="{:$auth->check('user/group/del')}"
                            width="100%">
                     </table>
                 </div>

+ 9 - 0
application/common/model/Mongyout.php

@@ -37,7 +37,16 @@ class Mongyout extends Model
         return [1 => __('Usdt'), 2 => __('Bank')];
     }
 
+    public function users()
+    {
+        return $this->hasOne('User','id','user_id',[],'LEFT')->setEagerlyType(0);
+    }
 
+    public function admins()
+    {
+        return $this->hasOne('\app\admin\model\Admin','id','admin_id',[],'LEFT')->setEagerlyType(0);
+    }
+    
     public function getCreateTimeTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');

+ 3 - 4
public/assets/js/backend/trade/mongyin.js

@@ -34,7 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'account_name', title: __('Account_name'), operate: 'LIKE'},
                         {field: 'amount', title: __('Amount'), operate:'BETWEEN'},
                         {field: 'status', title: __("Status"), 
-                            searchList: {1:__('Usdt'), 2:__('Bank')}, 
+                            searchList: {0:__('Pending'), 1:__('Success'), 2:__('Fail')}, 
                             formatter: Table.api.formatter.status
                         },
                         {field: 'admins.nickname', title: __('Admin_id')},
@@ -52,7 +52,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     //if(row.status == 0 && parseFloat(row.users.balance) >= parseFloat(row.amount)){
                                         return true;
                            
-                                }
+                                },
+                                refresh: true
                             }],
                             events: Table.api.events.operate, formatter: Table.api.formatter.operate
                         }
@@ -73,10 +74,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 };
                 table.bootstrapTable('refresh', {});
                 return false;
-
             });
 
-
         },
         add: function () {
             Controller.api.bindevent();

+ 53 - 4
public/assets/js/backend/trade/mongyout.js

@@ -23,8 +23,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
-                        {field: 'order_type', title: __('Order_type')},
-                        {field: 'user_id', title: __('User_id')},
+                        {field: 'order_type', title: __("Order_type"), 
+                            searchList: {1:__('Usdt'), 2:__('Bank')}, 
+                            formatter: Table.api.formatter.status
+                        },
+                        {field: 'users.mobile', title: __('User_id')},
                         {field: 'address', title: __('Address'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'bank_name', title: __('Bank_name'), operate: 'LIKE'},
                         {field: 'bank_card', title: __('Bank_card'), operate: 'LIKE'},
@@ -33,16 +36,62 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'fee', title: __('Fee'), operate:'BETWEEN'},
                         {field: 'real_amount', title: __('Real_amount'), operate:'BETWEEN'},
                         {field: 'status', title: __('Status')},
-                        {field: 'admin_id', title: __('Admin_id')},
+                        {field: 'status', title: __("Status"), 
+                            searchList: {0:__('Pending'), 1:__('Success'), 2:__('Fail')}, 
+                            formatter: Table.api.formatter.status
+                        },
+                        {field: 'admins.nickname', title: __('Admin_id')},
                         {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'operate', title: __('Operate'),
+                            table: table,
+                            buttons: [{
+                                name: "operate",
+                                text:  __('Success'),
+                                classname: 'btn btn-xs btn-success btn-magic btn-ajax',
+                                confirm: __('Confirm review'),
+                                url: 'trade/mongyout/review/status/1',
+                                visible: function (row) {
+                                    if(row.status == 0) return true;
+                                    return false;
+                                },
+                                refresh: true
+                            },
+                            {
+                                name: "operate",
+                                text:  __('Fail'),
+                                classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
+                                confirm: __('Confirm review'),
+                                url: 'trade/mongyout/review/status/2',
+                                visible: function (row) {
+                                    if(row.status == 0) return true;
+                                    return false;
+                                },
+                                refresh: true
+                            }],
+
+
+                            events: Table.api.events.operate, formatter: Table.api.formatter.operate
+                        }
                     ]
                 ]
             });
 
             // 为表格绑定事件
             Table.api.bindevent(table);
+            //绑定TAB事件
+            $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
+                var typeStr = $(this).attr("href").replace('#', '');
+                var options = table.bootstrapTable('getOptions');
+                options.pageNumber = 1;
+                options.queryParams = function (params) {
+                    params.order_type = typeStr;
+                    return params;
+                };
+                table.bootstrapTable('refresh', {});
+                return false;
+            });
+
         },
         add: function () {
             Controller.api.bindevent();

+ 23 - 4
public/assets/js/backend/user/group.js

@@ -21,6 +21,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function (
             Table.api.init({
                 extend: {
                     index_url: 'user/group/index',
+                    edit_url: 'user/group/edit',
                     table: 'user_group',
                 }
             });
@@ -44,7 +45,27 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function (
                         {field: 'agent_out_bank', title: __('Agent_out_bank'), searchList: {0: __('Close'), 1: __('Open')}, formatter: Table.api.formatter.status},
                         {field: 'service_link', title: __('Service_link')},
                         {field: 'team_num', title: __('Team')},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'operate', title: __('Operate'), table: table,
+                            buttons: [{
+                                name: "edit",
+                                text:  __('Edit'),
+                                classname: 'btn btn-xs btn-success btn-magic btn-dialog',
+                                url: 'user/group/edit',
+                                refresh: true
+                            },{
+                                name: "disable",
+                                text:  __('Disable'),
+                                classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
+                                confirm: __('Confirm review'),
+                                url: 'user/group/disable/is_lock/1',
+                                visible: function (row) {
+                                    if(row.is_lock == 0)  return true;
+                                    return false;
+                                },
+                                refresh: true
+                            }],
+                            events: Table.api.events.operate, formatter: Table.api.formatter.operate
+                        }
                     ]
                 ]
             });
@@ -52,9 +73,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function (
             // 为表格绑定事件
             Table.api.bindevent(table);
         },
-        add: function () {
-            Controller.api.bindevent();
-        },
+
         edit: function () {
             Controller.api.bindevent();
         },

+ 7 - 2
public/assets/js/backend/user/user.js

@@ -39,9 +39,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
                         {field: 'invitation_code', title: __('Invitation_code'), formatter: Table.api.formatter.search},
                         {field: 'is_agent', title: __('Is_agent'), searchList: {1: __('Yes'), 0: __('No')}, formatter: Table.api.formatter.status},
-                        {field: 'user_type', title: __('User_type'), formatter: Table.api.formatter.status, searchList: {0: __('Dummy'), 1: __('Real person')}},
-                        {field: 'is_lock', title: __('Status'), formatter: Table.api.formatter.status, searchList: {0: __('Normal'), 1: __('Locking')}},
                         
+                        {field: 'user_type', title: __('User_type'), formatter: Table.api.formatter.toggle, 
+                            searchList: {0: __('Dummy'), 1: __('Real person')}
+                        },
+                        {field: 'is_lock', title: __('Status'), formatter: Table.api.formatter.toggle, 
+                            searchList: {0: __('Normal'), 1: __('Locking')}
+                        },
+                            
                         
                      
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}