فهرست منبع

修复了bug,增加波场

这小子有点二 3 سال پیش
والد
کامیت
5013ecba80
44فایلهای تغییر یافته به همراه1067 افزوده شده و 125 حذف شده
  1. 10 4
      application/admin/controller/Dashboard.php
  2. 32 7
      application/admin/controller/auth/Admin.php
  3. 5 1
      application/admin/controller/house/Fruitorder.php
  4. 4 2
      application/admin/controller/house/Setup.php
  5. 18 10
      application/admin/controller/mail/Mail.php
  6. 76 5
      application/admin/controller/reports/Business.php
  7. 4 1
      application/admin/controller/reports/Fruit.php
  8. 50 0
      application/admin/controller/reports/User.php
  9. 1 1
      application/admin/controller/system/Notice.php
  10. 10 2
      application/admin/controller/user/Helplog.php
  11. 3 0
      application/admin/controller/user/Loginlog.php
  12. 93 2
      application/admin/controller/user/Operatelog.php
  13. 131 6
      application/admin/controller/user/User.php
  14. 8 0
      application/admin/controller/withdraw/Rebate.php
  15. 9 0
      application/admin/controller/withdraw/Rebatelist.php
  16. 26 8
      application/admin/controller/withdraw/Withdraw.php
  17. 1 0
      application/admin/lang/zh-cn/user/user.php
  18. 10 4
      application/admin/library/Pweb3.php
  19. 67 0
      application/admin/library/Tweb3.php
  20. 6 0
      application/admin/model/StatisticsBusiness.php
  21. 41 0
      application/admin/validate/Rebate.php
  22. 6 0
      application/admin/view/auth/admin/add.html
  23. 2 2
      application/admin/view/auth/admin/edit.html
  24. 43 24
      application/admin/view/house/setup/chain.html
  25. 19 0
      application/admin/view/reports/business/user.html
  26. 19 0
      application/admin/view/reports/user/user.html
  27. 1 1
      application/admin/view/system/notice/add.html
  28. 1 1
      application/admin/view/system/notice/edit.html
  29. 38 0
      application/admin/view/user/user/fee.html
  30. 9 8
      application/admin/view/user/user/look.html
  31. 5 0
      application/admin/view/user/user/usergivegold.html
  32. 2 0
      application/admin/view/withdraw/rebate/index.html
  33. 2 0
      application/admin/view/withdraw/withdraw/index.html
  34. 1 1
      application/common.php
  35. 2 1
      composer.json
  36. 1 1
      public/assets/js/backend/auth/admin.js
  37. 47 3
      public/assets/js/backend/reports/business.js
  38. 43 0
      public/assets/js/backend/reports/user.js
  39. 1 0
      public/assets/js/backend/user/helplog.js
  40. 1 0
      public/assets/js/backend/user/loginlog.js
  41. 3 1
      public/assets/js/backend/user/operatelog.js
  42. 197 28
      public/assets/js/backend/user/user.js
  43. 17 0
      public/assets/js/backend/withdraw/fee.js
  44. 2 1
      public/assets/js/backend/withdraw/withdraw.js

+ 10 - 4
application/admin/controller/Dashboard.php

@@ -32,17 +32,22 @@ class Dashboard extends Backend
         } catch (\Exception $e) {
 
         }
-        $where_user = [];
+        $where_user['user_type'] = 0;
         $where_withdraw = [];
         $where_fruit = [];
         $where_shop = [];
+        $user_a = new \app\admin\controller\user\User();
         if ($this->auth->__get('role') > 0) {
-            $user_a = new \app\admin\controller\user\User();
             $user_list = $user_a->userrule();
             $where_user['user_id'] = ['in', $user_list];
             $where_withdraw['withdraw_user_id'] = ['in', $user_list];
             $where_fruit['fsl_user_id'] = ['in', $user_list];
             $where_shop['ssl_user_id'] = ['in', $user_list];
+        } else {
+            $user_list = $user_a->userrule(1);
+            $where_withdraw['withdraw_user_id'] = ['not in', $user_list];
+            $where_fruit['fsl_user_id'] = ['not in', $user_list];
+            $where_shop['ssl_user_id'] = ['not in', $user_list];
         }
 
         $column = [];
@@ -95,14 +100,15 @@ class Dashboard extends Backend
         //$this->assignconfig('column', array_keys($userlist));
         //$this->assignconfig('userdata', array_values($userlist));
 
-        if ($this->auth->__get('role')>0) {
+        if ($this->auth->__get('role')>1) {
             if ($this->auth->__get('host')) {
                 $host = $this->auth->__get('host');
             } else {
                 $admin_info = Admin::get(intval($this->auth->__get('agent_id')));
                 $host = $admin_info->host;
             }
-            $promote_url = 'http://'.$host.Config::get('promote_url').'?agent='.$this->auth->__get('id');
+            //$promote_url = 'http://'.$host.Config::get('promote_url').'?agent='.$this->auth->__get('id');
+            $promote_url = 'http://'.$host.Config::get('promote_url');
         } else {
             $promote_url = '';
         }

+ 32 - 7
application/admin/controller/auth/Admin.php

@@ -83,6 +83,7 @@ class Admin extends Backend
             $this->where['agent_id'] = $this->auth->__get('agent_id');
         }
 
+
         $this->view->assign('groupdata', $groupdata);
         $this->assignconfig("admin", ['id' => $this->auth->id]);
 
@@ -121,13 +122,17 @@ class Admin extends Backend
                 $adminGroupName[$this->auth->id][$n['id']] = $n['name'];
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
-
+            if ($this->auth->__get('role') > 0) {
+                $this->where['id'] = ['in', model('Admin')->admin_list($this->auth->__get('id'))];
+            }
             $list = $this->model
                 ->with(['acting'=>function($query){
                     $query->field('id,superior,nickname');
                 }])
+                
                 ->where($this->where)
                 ->where($where)
+                ->whereOr(['id'=> $this->auth->__get('id')])
                 ->where('id', 'in', $this->childrenAdminIds)
                 ->field(['password', 'salt', 'token'], true)
                 ->order($sort, $order)
@@ -137,9 +142,20 @@ class Admin extends Backend
                 $groups = isset($adminGroupName[$v['id']]) ? $adminGroupName[$v['id']] : [];
                 $v['groups'] = implode(',', array_keys($groups));
                 $v['groups_text'] = implode(',', array_values($groups));
-                $v['user_count'] = model('user')->where(['user_acting'=>$v['id']])->count();
-                $v['role2_count'] = $this->model->where(['superior'=>$v['id'], 'role'=>2])->count();
-                $v['role3_count'] = $this->model->where(['superior'=>$v['id'], 'role'=>3])->count();
+                if ($v->role==3) {
+                    $v['user_count'] = model('user')->where(['user_acting'=>$v['id']])->count();
+                } else  {
+                    $where_user['user_acting'] = ['in', model('Admin')->admin_list($v['id'])];
+                    $v['user_count'] = model('user')->where($where_user)->count();
+                }
+                
+                if ($v->role==1) {
+                    $v['role2_count'] = $this->model->where(['agent_id'=>$v['id'], 'role'=>2])->count();
+                    $v['role3_count'] = $this->model->where(['agent_id'=>$v['id'], 'role'=>3])->count();    
+                } else {
+                    $v['role2_count'] = $this->model->where(['superior'=>$v['id'], 'role'=>2])->count();
+                    $v['role3_count'] = $this->model->where(['superior'=>$v['id'], 'role'=>3])->count();    
+                }
             }
             unset($v);
             $result = array("total" => $list->total(), "rows" => $list->items());
@@ -184,7 +200,11 @@ class Admin extends Backend
             if (!$superior || !$role) {
                 $this->error(__('No Results were found'));
             }
-            $where_superior['superior'] = $superior;
+            if ($role==3) {
+                $where_superior['superior'] = ['in', model('Admin')->admin_list($superior)];
+            } else {
+                $where_superior['superior'] = $superior;
+            }
             $where_superior['role'] = $role;
             $list = $this->model
                 ->where($this->where)
@@ -286,6 +306,7 @@ class Admin extends Backend
             }
             $this->view->assign("admin_list", $admin_list);
             $this->view->assign("admin_roles", $this->adminRoles);
+            $this->view->assign("role", $this->auth->__get('role'));
         }
         return $this->view->fetch();
     }
@@ -297,6 +318,10 @@ class Admin extends Backend
     {
         $role = $this->request->post("role/d");
         $where = [];
+        if ($role == 1)  {
+            $result = array("code"=>1, "msg"=>"", "rows" => []);
+            return json($result);
+        }
         if ($this->auth->__get('role')==0) {
             if ($role==2) {
                 $where['role'] = 1;
@@ -319,7 +344,7 @@ class Admin extends Backend
         $user_id = $this->request->get("user_id");
         if ($this->request->isAjax()) {
             $where = [];
-            $where['role'] = ['>', 0];
+            $where['role'] = ['>', 1];
             if ($this->auth->__get('role')>0) {
                 $where['superior'] = $this->auth->__get('id');
             }
@@ -343,7 +368,7 @@ class Admin extends Backend
         $user_id = $this->request->get("user_id");
         if ($this->request->isAjax()) {
             $where = [];
-            $where['role'] = ['>', 0];
+            $where['role'] = ['>', 1];
             if ($this->auth->__get('role')>0) {
                 $where['superior'] = $this->auth->__get('id');
             }

+ 5 - 1
application/admin/controller/house/Fruitorder.php

@@ -48,7 +48,11 @@ class Fruitorder extends Backend
                 ->paginate($limit);
             foreach ($list as &$item) {
                 $item->status = '已完成';
-                $item->fsl_info = $item->userfruit->fruit->fruit_name.'*'.$item->fsl_amount;
+                if (isset($item->userfruit->fruit) && $item->userfruit->fruit) {
+                    $item->fsl_info = $item->userfruit->fruit->fruit_name.'*'.$item->fsl_amount;
+                } else {
+                    $item->fsl_info = '';
+                }
             }
             $result = array("total" => $list->total(), "rows" => $list->items());
             return json($result);

+ 4 - 2
application/admin/controller/house/Setup.php

@@ -75,11 +75,13 @@ class Setup extends Backend
             $params = $this->request->post("row/a");
             try {
                 $row = $this->model->where(['id'=>1])->find();
-                $row->chain_key                     = encrypt($this->key, trim($params['chain_key']));
-                $row->chain_withdraw_address        = trim($params['chain_withdraw_address']);
+                //$row->chain_key                     = encrypt($this->key, trim($params['chain_key']));
+                //$row->chain_withdraw_address        = trim($params['chain_withdraw_address']);
                 $row->chain_contract_address        = trim($params['chain_contract_address']);
                 $row->chain_url                     = trim($params['chain_url']);
                 $row->chain_id                      = trim($params['chain_id']);
+                $row->chain_tron_contract_address   = trim($params['chain_tron_contract_address']);
+                $row->chain_tron_url                = trim($params['chain_tron_url']);
                 $row->save();
                 $this->setCaches();
             } catch (Exception $e) {

+ 18 - 10
application/admin/controller/mail/Mail.php

@@ -66,18 +66,24 @@ class Mail extends Backend
     public function useradd()
     {
         $id = $this->request->post("id/a");
-        $user_id = Cache::get('mail_usre_id');
         if ($id) {
-            if ($user_id) {
-                $user_id_arr = json_decode($user_id, true);
-                $user_list = array_unique(array_merge($user_id_arr, $id));
-                Cache::set('mail_usre_id', json_encode($user_list), 7200);
-            } else {
-                Cache::set('mail_usre_id', json_encode($id), 7200);
-            }
+            Cache::set('mail_usre_id', json_encode($id), 7200);
             $this->success(__('Add_success'));
         }
         return ;
+
+        // $user_id = Cache::get('mail_usre_id');
+        // if ($id) {
+        //     if ($user_id) {
+        //         $user_id_arr = json_decode($user_id, true);
+        //         $user_list = array_unique(array_merge($user_id_arr, $id));
+        //         Cache::set('mail_usre_id', json_encode($user_list), 7200);
+        //     } else {
+        //         Cache::set('mail_usre_id', json_encode($id), 7200);
+        //     }
+        //     $this->success(__('Add_success'));
+        // }
+        // return ;
     }
     
     /**
@@ -92,6 +98,7 @@ class Mail extends Backend
                 Db::startTrans();
                 try {
                     $user_id = Cache::get('mail_usre_id');
+                    
                     $data['mail_sender'] = 0;
                     if ($user_id) {
                         $user_list = json_decode($user_id,  true);
@@ -99,11 +106,10 @@ class Mail extends Backend
                             $data['mail_sender'] = '|'.implode('|', $user_list).'|';
                         }
                     }
-
                     if ($row['mail_limit'] == 0) {
                         if ($this->auth->__get('role') > 0) {
                             $user_a = new \app\admin\controller\user\User();
-                            $user_list = $user_a->userrule();
+                            $user_list = $user_a->userrule(2);
                             $data['mail_sender'] = '|'.implode('|', $user_list).'|';
                         }
                     }
@@ -113,6 +119,7 @@ class Mail extends Backend
                     $data['mail_attachment'] = $row['mail_attachment'];
                     $data['mail_send_num'] = 1;
                     $data['mail_admin_id'] = (int)session('admin.id');
+                    
                     $res = $this->model->save($data);
                     if (!$res) {
                         exception(__('Error'));
@@ -135,6 +142,7 @@ class Mail extends Backend
                     if (isset($row['props'])) {
                         $props = $row['props'];
                         $i = 0;
+                        $props_data = [];
                         foreach ($props as &$item) {
                             if ($item['ma_amount']>0) {
                                 $props_data[$i]['ma_mail_id'] = $ma_mail_id;

+ 76 - 5
application/admin/controller/reports/Business.php

@@ -25,6 +25,7 @@ class Business extends Backend
     {
         parent::_initialize();
         $this->model = model('Admin');
+        $this->model_business = model('StatisticsBusiness');
     }
 
 
@@ -37,6 +38,7 @@ class Business extends Backend
         $this->request->filter(['strip_tags', 'trim']);
         $id = $this->request->get("id/d");
         $type = $this->request->get("type/d");
+        $agent_id = $this->request->get("agent_id/d");
         if ($this->request->isAjax()) {
             //如果发送的来源是Selectpage,则转发到Selectpage
             if ($this->request->request('keyField')) {
@@ -48,6 +50,9 @@ class Business extends Backend
                     $where_1['role'] = 2;
                 } elseif ($type==2 && ($this->auth->__get('role')==2 || $this->auth->__get('role')==1)) {
                     $where_1['role'] = 3;
+                    if ($this->auth->__get('role')==2) {
+                        $where_1['superior'] = $this->auth->__get('id');
+                    }
                 } else {
                     $where_1['id'] = intval($this->auth->__get('id'));
                 }
@@ -62,8 +67,10 @@ class Business extends Backend
             } else {
                 if ($type==1) {
                     $where_1['role'] = 2;
+                    $where_1['superior'] = $id;
                 } elseif ($type==2) {
                     $where_1['role'] = 3;
+                    $where_1['superior'] = $id;
                 } else {
                     $where_1['role'] = 1;
                 }
@@ -76,12 +83,31 @@ class Business extends Backend
                 ->paginate($limit);
             $where_s = [];
             foreach ($list as $k => &$v) {
-                if ($type==1) {
-                    $where_s['su_leader_id'] = $v->id;
-                } elseif ($type==2) {
-                    $where_s['su_members_id'] = $v->id;
+                if ($this->auth->__get('role') > 1) {
+                    if (empty($type)) {
+                        if ($this->auth->__get('role')==2) {
+                            $where_s['su_leader_id'] = $v->id;
+                        } else if ($this->auth->__get('role')==3) {
+                            $where_s['su_members_id'] = $v->id;
+                        }
+                    } else {
+                        if ($type==1) {
+                            $where_s['su_leader_id'] = $v->id;
+                        } elseif ($type==2) {
+                            $where_s['su_members_id'] = $v->id;
+                        } else {
+                            $where_s['su_agent_id'] = $v->id;
+                        }
+                    }
+                    
                 } else {
-                    $where_s['su_agent_id'] = $v->id;
+                    if ($type==1) {
+                        $where_s['su_leader_id'] = $v->id;
+                    } elseif ($type==2) {
+                        $where_s['su_members_id'] = $v->id;
+                    } else {
+                        $where_s['su_agent_id'] = $v->id;
+                    }
                 }
                 $v->statistics = model('StatisticsBusiness')->field('sum(su_give_gold) as su_give_gold, sum(su_use_gold) as su_use_gold, sum(su_fruit_sell) as su_fruit_sell, sum(su_withdraw_amount) as su_withdraw_amount, sum(su_withdraw_fee) as su_withdraw_fee')->where($where_s)->find();
             }
@@ -94,5 +120,50 @@ class Business extends Backend
         return $this->view->fetch();
     }
 
+    /**
+     * 查看 业务报表统计 会员明细
+     */
+    public function user()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        $id = $this->request->get("id/d");
+        $type = $this->request->get("type/d");
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            if ($this->auth->__get('role') == 1) {
+                $where_1['su_agent_id'] = $this->auth->__get('id');
+            } elseif ($this->auth->__get('role') == 2) {
+                $where_1['su_leader_id'] = $this->auth->__get('id');
+            } elseif ($this->auth->__get('role') == 3) {
+                $where_1['su_members_id'] = $this->auth->__get('id');
+            }
+
+            $where_1['su_user_id'] = $id;
+            $user = Model('User')->get($id);
+            $admin = Model('Admin')->get($user->user_acting);
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $list = $this->model_business
+                ->with(['user' => function($query){
+                    $query->field('user_id,user_nickname');
+                }])
+                ->where($where_1)
+                ->where($where)
+                ->order($sort, $order)
+                ->paginate($limit);
+            foreach ($list as $k => &$v) {
+                $v->admin_name = $admin->nickname;
+            }
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        $this->view->assign('id', $id);
+        $this->view->assign('type', $type);
+        return $this->view->fetch();
+    }
 
 }

+ 4 - 1
application/admin/controller/reports/Fruit.php

@@ -40,10 +40,13 @@ class Fruit extends Backend
                 return $this->selectpage();
             }
             $where_user = [];
+            $user_a = new \app\admin\controller\user\User();
             if ($this->auth->__get('role') > 0) {
-                $user_a = new \app\admin\controller\user\User();
                 $user_list = $user_a->userrule();
                 $where_user['fsl_user_id'] = ['in', $user_list];
+            } else {
+                $user_list = $user_a->userrule(1);
+                $where_user['fsl_user_id'] = ['not in', $user_list];
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             $list = $this->model

+ 50 - 0
application/admin/controller/reports/User.php

@@ -63,5 +63,55 @@ class User extends Backend
         return $this->view->fetch();
     }
 
+    /**
+     * 查看 指定上级会员每日统计
+     */
+    public function user()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        $id = $this->request->get("id/d");
+        $type = $this->request->get("type/d");
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            $where_user = [];
+            if ($type==3) {
+                $where_user['su_leader_id'] = $id;
+                $where_user['su_members_id'] = 0;
+            } else {
+                $where_user['su_members_id'] = $id;
+            }
+            if ($this->auth->__get('role') == 1) {
+                $where_user['su_agent_id'] = $this->auth->__get('id');
+            } elseif ($this->auth->__get('role') == 2) {
+                $where_user['su_leader_id'] = $this->auth->__get('id');
+            } elseif ($this->auth->__get('role') == 3) {
+                $where_user['su_members_id'] = $this->auth->__get('id');
+            }
+            $admin = Model('Admin')->get($id);
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $list = $this->model
+                ->with(['user' => function($query){
+                    $query->field('user_id,user_nickname');
+                }])
+                ->where($where_user)
+                ->where($where)
+                ->order($sort, $order)
+                ->paginate($limit);
+            foreach ($list as $k => &$v) {
+                $v->admin_name = $admin->nickname;
+            }
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        $this->view->assign('id', $id);
+        $this->view->assign('type', $type);
+        return $this->view->fetch();
+    }
+
 
 }

+ 1 - 1
application/admin/controller/system/Notice.php

@@ -218,7 +218,7 @@ class Notice extends Backend
                     } else {
                         if ($this->auth->__get('role') > 0) {
                             $user_a = new \app\admin\controller\user\User();
-                            $user_list = $user_a->userrule();
+                            $user_list = $user_a->userrule(2);
                             $row->notice_user_list = '|'.implode('|', $user_list).'|';
                         } else {
                             $row->notice_user_list  = 0;

+ 10 - 2
application/admin/controller/user/Helplog.php

@@ -40,7 +40,7 @@ class Helplog extends Backend
                 return $this->selectpage();
             }
             $user_a = new \app\admin\controller\user\User();
-            $user_list = $user_a->userrule();
+            $user_list = $user_a->userrule(2);
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             $list = $this->model
                 ->with('user,userfriend')
@@ -48,7 +48,15 @@ class Helplog extends Backend
                 ->where($where)
                 ->order($sort, $order)
                 ->paginate($limit);
-
+            foreach($list as &$item) {
+                if ($item->fhl_type==1) {
+                    $item->fhl_memo = '浇水';
+                } elseif ($item->fhl_type==2) {
+                    $item->fhl_memo = '施肥';
+                } else {
+                    $item->fhl_memo = '';
+                }
+            }
             $result = array("total" => $list->total(), "rows" => $list->items());
 
             return json($result);

+ 3 - 0
application/admin/controller/user/Loginlog.php

@@ -40,8 +40,11 @@ class Loginlog extends Backend
                 return $this->selectpage();
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $user_a = new \app\admin\controller\user\User();
+            $user_list = $user_a->userrule(2);
             $list = $this->model
                 ->with('user')
+                ->where(['ull_user_id'=>['in', $user_list]])
                 ->where($where)
                 ->order($sort, $order)
                 ->paginate($limit);

+ 93 - 2
application/admin/controller/user/Operatelog.php

@@ -40,7 +40,7 @@ class Operatelog extends Backend
                 return $this->selectpage();
             }
             $user_a = new \app\admin\controller\user\User();
-            $user_list = $user_a->userrule();
+            $user_list = $user_a->userrule(2);
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             $list = $this->model
                 ->with('user')
@@ -48,12 +48,103 @@ class Operatelog extends Backend
                 ->where($where)
                 ->order($sort, $order)
                 ->paginate($limit);
-            $result = array("total" => $list->total(), "rows" => $list->items());
+            foreach ($list as $item) {
+                $data = $this->action($item->uol_action);
+                if ($data) {
+                    $item->uol_memo = $data['action_name'];
 
+                    $data_arr = explode('|||', $item->uol_data);
+                    $data_1 = [];
+                    foreach($data_arr as $k=>$v) {
+                        $data_2 = explode('=>', $v);
+                        $data_1[$data_2[0]] = $data_2[1];
+                    }
+                    $memo_info = $data['action_info'];
+                    foreach ($data_1 as $k=>$v) {
+                        $memo_info = str_ireplace('{{'.$k.'}}', $v, $memo_info);
+                    }
+                    $item->uol_memo_info = $memo_info;
+                }
+            }
+            $result = array("total" => $list->total(), "rows" => $list->items());
             return json($result);
         }
         return $this->view->fetch();
     }
 
+    private function action($id) 
+    {
+        $data= [
+            '1'   => [
+                'action_name' => '升级房屋',
+                'action_info' => 'House upgrade to {{level}}',
+            ],
+            '2'   => [
+                'action_name' => '购买商品',
+                'action_info' => 'Buy {{shop_name}} x{{shop_amount}} Consume gold x{{price}}',
+            ],
+            '3'   => [
+                'action_name' => '售卖果实',
+                'action_info' => 'Sell {{fruit_name}} x{{amount}} to get USDT x{{price}}',
+            ],
+            '4'   => [
+                'action_name' => '播种',
+                'action_info' => 'Land planted {{seed_name}} x1',
+            ],
+            '5'   => [
+                'action_name' => '收割',
+                'action_info' => 'Harvest Fruit {{fruit_name}} x{{nums}}',
+            ],
+            '6'   => [
+                'action_name' => '施肥',
+                'action_info' => 'Fertilizer consumption {{props_name}} x1',
+            ],
+            '7'   => [
+                'action_name' => '浇水',
+                'action_info' => 'Watering Consumption {{props_name}} x1',
+            ],
+            '8'   => [
+                'action_name' => '除虫',
+                'action_info' => 'Exterminator consumes {{props_name}} x1',
+            ],
+            '9'   => [
+                'action_name' => '除草',
+                'action_info' => 'Herbicide consumption {{props_name}} x1',
+            ],
+            '10'  => [
+                'action_name' => '',
+                'action_info' => '',
+            ],
+            '11'  => [
+                'action_name' => '打开邮箱附件',
+                'action_info' => '',
+            ],
+            '12'  => [
+                'action_name' => '系统赠送金币',
+                'action_info' => 'The system gives gold coins x{{amount}}',
+            ],
+            '13'  => [
+                'action_name' => '提现',
+                'action_info' => 'Withdraw USDT x{{usdt}}',
+            ],
+            '14'  => [
+                'action_name' => '修改头像',
+                'action_info' => 'Modify the avatar successfully',
+            ],
+            '15'  => [
+                'action_name' => '修改昵称',
+                'action_info' => 'Modify nickname successfully',
+            ],
+            '16'  => [
+                'action_name' => '获得返佣',
+                'action_info' => 'Rebate to get USDT x{{rebatePrice}}',
+            ],
+            '17'  => [
+                'action_name' => '消耗材料',
+                'action_info' => 'Consume wood x{{wood}} stone x{{stone}} steel x{{steel}} gold x{{gold}}',
+            ],
+        ];
+        return $data[$id];
+    }
 
 }

+ 131 - 6
application/admin/controller/user/User.php

@@ -4,6 +4,8 @@ namespace app\admin\controller\user;
 
 use app\common\controller\Backend;
 use app\common\library\Auth;
+use app\admin\library\Pweb3;
+use app\admin\library\Tweb3;
 
 /**
  * 会员管理
@@ -29,14 +31,18 @@ class User extends Backend
         if ($this->auth->__get('role') > 0) {
             $this->where['user_acting'] = ['in', model('Admin')->admin_list($this->auth->__get('id'))];
         }
+        $this->assignconfig('role', $this->auth->__get('role'));
     }
 
     /**
      * 不同代理返回用户
      */
-    public function userrule()
+    public function userrule($type=0)
     {
+        $where = ['user_type'=>$type];
+        if ($type==2) $where = [];
         $list = $this->model
+                ->where($where)
                 ->where($this->where)
                 ->column('user_id');
         return $list;
@@ -90,7 +96,8 @@ class User extends Backend
             if (!$acting) {
                 $this->error(__('No Results were found'));
             }
-            $where_acting['user_acting'] = $acting;
+            //$where_acting['user_acting'] = $acting;
+            $where_acting['user_acting'] = ['in', model('Admin')->admin_list($acting)];
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             $list = $this->model
                 ->with(['useracting'=>function($query){
@@ -100,7 +107,7 @@ class User extends Backend
                 }])
                 ->where($where_acting)
                 ->where($where)
-                ->where($this->where)
+                //->where($this->where)
                 ->order($sort, $order)
                 ->paginate($limit);
             foreach ($list as $k => $v) {
@@ -167,6 +174,7 @@ class User extends Backend
                 $where['user_id'] = ['in', $user_id];
                 $res = $this->model->update(['user_acting' => $id], $where);
                 if ($res) {
+                    $this->statistics_user($user_id, $id);
                     $this->success(__('Operation completed'));
                 } else {
                     $this->error(__('Operation failed'));
@@ -176,6 +184,27 @@ class User extends Backend
         }
     }
 
+    /**
+     * 会员分配 更改统计用户数据
+     */
+    private function statistics_user($user_id, $user_acting)
+    {
+        $admin = model('Admin')->get($user_acting);
+        if ($admin) {
+            $data['su_agent_id'] = $admin->agent_id;
+            if ($admin->role==2) {
+                $data['su_leader_id'] = $admin->id;
+                $data['su_members_id'] = 0;
+            } else {
+                $data['su_leader_id'] = $admin->superior;
+                $data['su_members_id'] = $admin->id;
+            }
+            $where['su_user_id'] = ['in', $user_id];
+            model('StatisticsBusiness')->update($data, $where);
+            model('StatisticsUser')->update($data, $where);
+        }
+    }
+
 
     /**
      * 设置-赠送、USDT余额、链上余额、启用状态
@@ -191,6 +220,7 @@ class User extends Backend
             $user_usdt_amount = $this->request->post("user_usdt_amount");
             $user_erc20_usdt = $this->request->post("user_erc20_usdt");
             $user_enable = $this->request->post("user_enable");
+            $user_memo = $this->request->post("user_memo");
             
             if ($user_id) {
                 $row = $this->model->get($user_id);
@@ -205,6 +235,7 @@ class User extends Backend
                     }
                     if ($user_erc20_usdt) $row->user_erc20_usdt = $user_erc20_usdt;
                     if ($user_enable) $row->user_enable = $user_enable;
+                    if ($user_memo) $row->user_memo = $user_memo;
                     $row->save();
                     if ($user_usdt_amount) $this->model->checkCheckSumFromInfo($user_id);
                     $this->success();
@@ -253,6 +284,13 @@ class User extends Backend
         return $this->view->fetch();
     }
 
+    public function test()
+    {
+        $web3 = new Tweb3();
+        $user_erc20_usdt = $web3->balanceof('TB4q8UWPpnTRZ6ShLg3a274iGFXKXaZ7MW');
+        print_r($user_erc20_usdt);
+    }
+
     /**
      * 查看
      */
@@ -265,7 +303,38 @@ class User extends Backend
                 $row->user_avatar = $row->user_avatar ? avatarurl($row->user_avatar, true) : letter_avatar($row->user_nickname);
             }
             $withdraw_fee_sum = model('withdraw')->where(['withdraw_user_id'=>$user_id, 'withdraw_status'=>1])->sum('withdraw_fee');
+            $withdraw_sum = model('withdraw')->where(['withdraw_user_id'=>$user_id, 'withdraw_status'=>1])->sum('withdraw_amount');
+            $row->user_withdraw = $withdraw_sum;
+            try {
+                if ($row->user_chain==2) {
+                    $web3 = new Tweb3();
+                } else {
+                    $web3 = new Pweb3();
+                }
+                $user_erc20_usdt = $web3->balanceof($row->user_wallet_address);
+            } catch (\Exception $e) {
+                $user_erc20_usdt = 0;
+            }
+            if ($row->user_type==0) $row->user_erc20_usdt = $user_erc20_usdt;
+            $inviter_id = 0;
+            if ($row->user_inviter) {
+                $row_inviter = $this->model->where(['user_invitation'=>$row->user_inviter])->find();
+                if ($row_inviter) {
+                    $inviter_id = $row_inviter->user_id;
+                }
+            }
+
+            $admin_name = '';
+            if ($row->user_acting) {
+                $row_admin = model('Admin')->field('id, nickname')->where(['id'=>$row->user_acting])->find();
+                if ($row_admin) {
+                    $admin_name = $row_admin->nickname;
+                }
+            }
+
             $this->view->assign("row", $row);
+            $this->view->assign("inviter_id", $inviter_id);
+            $this->view->assign("admin_name", $admin_name);
             $this->view->assign("withdraw_fee_sum", $withdraw_fee_sum);
             return $this->view->fetch();
         }
@@ -300,10 +369,13 @@ class User extends Backend
             if ($user_id) {
                 $row = $this->model->get($user_id);
                 if ($row) {
-                    if ($user_withdraw_nums) $row->user_withdraw_nums = $user_withdraw_nums;
-                    if ($user_enable) $row->user_enable = $user_enable;
-                    if ($user_acting) $row->user_acting = $user_acting;
+                    $row->user_withdraw_nums = $user_withdraw_nums;
+                    $row->user_enable = $user_enable;
+                    $row->user_acting = $user_acting;
                     $row->save();
+                    if ($user_acting) {
+                        $this->statistics_user($user_id, $user_acting);
+                    }
                     $this->success();
                 }
             }
@@ -388,6 +460,59 @@ class User extends Backend
         $this->error(__('Operation failed'));
     }
 
+    /**
+     * 查看-提现规则 
+     */
+    public function fee()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        $fee_id = $this->request->get("fee_id/d");
+        $search = $this->request->get("search/trim");
+        $fee = model('Fee')->order('fee_isdefault', 'desc')->select();
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            $where['user_fee_id'] = $fee_id;
+            if ($search) {
+                $where['user_nickname'] = ['like', '%'.$search.'%'];
+            }
+            $list = $this->model
+                ->field('user_id, user_fee_id, user_nickname')
+                ->where($where)
+                ->where($this->where)
+                ->order('user_id', 'desc')
+                ->select();
+            foreach ($list as &$item) {
+                $item['fee'] = $fee;
+            }
+
+            $result = array("total" => 0, "rows" => $list);
+
+            return json($result);
+        } else {
+            $this->view->assign("fee_id", $fee_id);
+            $this->view->assign("fee", $fee);
+        }
+        return $this->view->fetch();
+    }
+
+    //修改提现规则
+    public function feeedit()
+    {
+        $user_id = $this->request->post("id");
+        $user_fee_id = $this->request->post("fee_id/d");
+        if ($user_id ) {
+            $res = $this->model->update(['user_fee_id'=>$user_fee_id], ['user_id'=>['in', $user_id]]);
+            if ($res) {
+                $this->success(__('Operation completed'));
+            }
+        }
+        $this->error(__('Operation failed'));
+    }
+
     /**
      * 查看-下级会员 
      */

+ 8 - 0
application/admin/controller/withdraw/Rebate.php

@@ -39,10 +39,17 @@ class Rebate extends Backend
                 return $this->selectpage();
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $where_rule = [];
+            if ($this->auth->__get('role') > 0) {
+                $user_a = new \app\admin\controller\user\User();
+                $user_list = $user_a->userrule(2);
+                $where_rule['user_id'] = ['in', $user_list];
+            }
             $list = model('User')
                 ->with(['useracting'=>function($query) {
                     $query->field('role,username,id');
                 }])
+                ->where($where_rule)
                 ->where($where)
                 ->order($sort, $order)
                 ->paginate($limit);
@@ -52,6 +59,7 @@ class Rebate extends Backend
             $result = array("total" => $list->total(), "rows" => $list->items());
             return json($result);
         }
+        $this->assign('role', $this->auth->__get('role'));
         return $this->view->fetch();
     }
 

+ 9 - 0
application/admin/controller/withdraw/Rebatelist.php

@@ -38,9 +38,18 @@ class Rebatelist extends Backend
             if ($this->request->request('keyField')) {
                 return $this->selectpage();
             }
+
+            $where_rule = [];
+            if ($this->auth->__get('role') > 0) {
+                $user_a = new \app\admin\controller\user\User();
+                $user_list = $user_a->userrule(2);
+                $where_rule['rl_user_id'] = ['in', $user_list];
+            }
+
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             $list = $this->model
                 ->with(['user', 'rebate'])
+                ->where($where_rule)
                 ->where($where)
                 ->order($sort, $order)
                 ->paginate($limit);

+ 26 - 8
application/admin/controller/withdraw/Withdraw.php

@@ -25,6 +25,7 @@ class Withdraw extends Backend
     {
         parent::_initialize();
         $this->model = model('Withdraw');
+        
     }
 
     /**
@@ -40,21 +41,36 @@ class Withdraw extends Backend
                 return $this->selectpage();
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $where_rule = [];
+            if ($this->auth->__get('role') > 0) {
+                $user_a = new \app\admin\controller\user\User();
+                $user_list = $user_a->userrule(2);
+                $where_rule['withdraw_user_id'] = ['in', $user_list];
+            }
             $list = $this->model
                 ->with(['user', 'fee'=> function($query){
                     $query->with(['rule']);
                 }])
+                ->where($where_rule)
                 ->where($where)
                 ->order($sort, $order)
                 ->paginate($limit);
             foreach ($list as $item) {
-                $item->withdraw_audit_name = ($item->withdraw_audit==1) ? '已处理' : '待处理';
-                $item->withdraw_amount_actual = $item->withdraw_amount - $item->withdraw_fee;
+                if ($item->withdraw_audit==1) {
+                    $item->withdraw_audit_name = '审核通过';
+                } elseif ($item->withdraw_audit==2) {
+                    $item->withdraw_audit_name = '审核拒绝';
+                } else {
+                    $item->withdraw_audit_name = '审核中';
+                }
+                //$item->withdraw_audit_name = ($item->withdraw_audit==1) ? '已处理' : '待处理';
+                $item->withdraw_amount_actual = bcsub($item->withdraw_amount , $item->withdraw_fee, 2);
              }
 
             $result = array("total" => $list->total(), "rows" => $list->items());
             return json($result);
         }
+        $this->assign('role', $this->auth->__get('role'));
         return $this->view->fetch();
     }
 
@@ -98,7 +114,6 @@ class Withdraw extends Backend
                     Db::commit();
                     $result = array("code" => 1, "msg" => '');
                     return json($result);
-                    //$this->success();
                 } catch (\Exception $e) {
                     Db::rollback();
                     $this->error($e->getMessage());
@@ -161,9 +176,9 @@ class Withdraw extends Backend
                     if ($amount<=0) {
                         exception('您的提现金额扣除手续费后,金额小于等于0');
                     }
-                    $res = $this->transfer($user->user_wallet_address, $amount);
-                    if ($res) {
-                        $withdraw->withdraw_hash = $res;
+                    //$res = $this->transfer($user->user_wallet_address, $amount);
+                    //if ($res) {
+                        //$withdraw->withdraw_hash = $res;
                         $withdraw->withdraw_status = 1;
                         if (!$withdraw->save()) {
                             exception('提现转帐成功,状态和交易哈希保存失败');
@@ -173,10 +188,13 @@ class Withdraw extends Backend
                             exception('提现转帐成功,用户冻结金额修改失败');
                         }
                         model('User')->checkCheckSumFromInfo($user->user_id);
-                    }
+                    //}
                 }
                 Db::commit();
-                $this->statistics($user->user_id, $user->user_acting, $withdraw->withdraw_amount, $withdraw->withdraw_fee); //提现后保存统计日志
+                if ($user->user_type == 0) {
+                    $this->statistics($user->user_id, $user->user_acting, $withdraw->withdraw_amount, $withdraw->withdraw_fee); //提现后保存统计日志
+                }
+                
             } catch (\Exception $e) {
                 Db::rollback();
                 $this->error($e->getMessage());

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

@@ -33,4 +33,5 @@ return [
     'Admin_nickname'            => '用户分配',
     'Allocation'                => '分配',
     'User_inviter'              => '邀请人',
+    'User_memo'                 => '备注',
 ];

+ 10 - 4
application/admin/library/Pweb3.php

@@ -15,14 +15,20 @@ class Pweb3
     private $wallet;
     private $abi;
     private $contract;
-    public function __construct()
+    public function __construct($type=1)
     {
         $url = 'https://rinkeby.infura.io/v3/fe4299f9c4264d159c1041d68b542127';
         $row = model('Setup')->where(['id'=>1])->find();
         if ($row) {
-            if ($row->chain_key) $this->key =  encrypt('q09pEFRo1RNyTJ6qPqCjTKhmrme7iS1J', $row->chain_key, 'D');
-            if ($row->chain_withdraw_address) $this->contractAddress = $row->chain_withdraw_address;
-            if ($row->chain_url) $url = $row->chain_url;
+            if ($type==1) {
+                if ($row->chain_key) $this->key =  encrypt('q09pEFRo1RNyTJ6qPqCjTKhmrme7iS1J', $row->chain_key, 'D');
+                //if ($row->chain_withdraw_address) $this->contractAddress = $row->chain_withdraw_address;
+                if ($row->chain_contract_address) $this->contractAddress = $row->chain_contract_address;
+                if ($row->chain_url) $url = $row->chain_url;
+            } else {
+                if ($row->chain_tron_contract_address) $this->contractAddress = $row->chain_tron_contract_address;
+                if ($row->chain_tron_url) $url = $row->chain_tron_url;
+            }
         }
         $this->wallet = Wallet::createByPrivate($this->key);
         $this->abi = file_get_contents('./abi/erc20.abi');

+ 67 - 0
application/admin/library/Tweb3.php

@@ -0,0 +1,67 @@
+<?php
+
+namespace app\admin\library;
+
+use app\admin\model\Admin;
+use GuzzleHttp\Client;
+use Tron\Address;
+
+class Tweb3
+{
+    private $key = '';
+    private $contractAddress = 'TXLAQ63Xg1NAzckPwKHvzw7CSEmLMEqcdj';
+    private $web3;
+    private $wallet;
+    private $abi;
+    private $contract;
+    public function __construct()
+    {
+        $uri = 'https://nile.trongrid.io/walletsolidity/';
+        // $row = model('Setup')->where(['id'=>1])->find();
+        // if ($row) {
+        //     if ($row->chain_tron_contract_address) $this->contractAddress = $row->chain_tron_contract_address;
+        //     if ($row->chain_tron_url) $url = $row->chain_tron_url;
+        // }
+
+        $api = new \Tron\Api(new Client(['base_uri' => $uri]));
+        
+        //$trxWallet = new \Tron\TRX($api);
+        //$addressData = $trxWallet->generateAddress();
+        // $addressData->privateKey
+        // $addressData->address
+        
+        $config = [
+            'contract_address' => $this->contractAddress,// USDT TRC20
+            'decimals' => 6,
+        ];
+        $this->contract = new \Tron\TRC20($api, $config);
+    }
+
+    /**
+     * 合约转帐
+     *
+     * @param string $address 转入地址
+     * @return string
+     */
+    public function transfer($address, $amount)
+    {
+    }
+
+    /**
+     * 合约查询余额
+     *
+     * @param string $address 查询地址
+     * @return int
+     */
+    public function balanceof($address)
+    {
+        $address = new Address(
+            $address,
+            '',
+            $this->contract->tron->address2HexString($address)
+        );
+        $balanceData = $this->contract->balance($address);
+        return $balanceData;
+    }
+
+}

+ 6 - 0
application/admin/model/StatisticsBusiness.php

@@ -35,5 +35,11 @@ class StatisticsBusiness extends Model
     {
         return $this->belongsTo('Admin', 'su_members_id', 'id', [], 'LEFT')->setEagerlyType(0);
     }
+    
+    public function user()
+    {
+        return $this->belongsTo('User', 'su_user_id', 'user_id', [], 'LEFT')->setEagerlyType(0);
+    }
+
 
 }

+ 41 - 0
application/admin/validate/Rebate.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class Rebate extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+        'rebate_name' => 'require',
+        'rebate_value' => 'number|require',
+        'rebate_prop' => 'number|require',
+    ];
+
+    /**
+     * 字段描述
+     */
+    protected $field = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => ['rebate_name', 'rebate_value', 'rebate_prop'],
+    ];
+
+    public function __construct(array $rules = [], $message = [], $field = [])
+    {
+        parent::__construct($rules, $message, $field);
+    }
+
+}

+ 6 - 0
application/admin/view/auth/admin/add.html

@@ -64,6 +64,12 @@
             {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])}
         </div>
     </div>
+    <div class="form-group">
+        <label for="mobile" class="control-label col-xs-12 col-sm-2">二级域名前缀:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input type="text" class="form-control" id="mobile" name="row[host]" value=""  />
+        </div>
+    </div>
     <div class="form-group hidden layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">

+ 2 - 2
application/admin/view/auth/admin/edit.html

@@ -69,11 +69,11 @@
             {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['status'])}
         </div>
     </div>
-    {if $row.role==1}
+    {if $row.role>1}
     <div class="form-group">
         <label for="mobile" class="control-label col-xs-12 col-sm-2">二级域名前缀:</label>
         <div class="col-xs-12 col-sm-8">
-            <input type="text" class="form-control" id="mobile" name="row[host]" value="{$row.host|default=''|htmlentities}" data-rule="required" />
+            <input type="text" class="form-control" id="mobile" name="row[host]" value="{$row.host|default=''|htmlentities}" />
         </div>
     </div>
     {/if}

+ 43 - 24
application/admin/view/house/setup/chain.html

@@ -1,37 +1,56 @@
 <form id="chain-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
     {:token()}
-
-    <div class="form-group">
-        <label for="c-name" class="control-label col-xs-12 col-sm-2">提现转帐钱包私钥:</label>
-        <div class="col-xs-12 col-sm-6">
-            <input id="c-name" data-rule="required" class="form-control" name="row[chain_key]" type="text" value="{$row.chain_key}" >
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">
+                ETH 配制
+            </h3>
         </div>
-    </div>
-    <div class="form-group">
-        <label for="c-name" class="control-label col-xs-12 col-sm-2">提现合约地址:</label>
-        <div class="col-xs-12 col-sm-6">
-            <input id="c-name"  class="form-control" name="row[chain_withdraw_address]" type="text" value="{$row.chain_withdraw_address}" >
+        <div class="panel-body">
+        <div class="form-group">
+            <label for="c-name" class="control-label col-xs-12 col-sm-2">链上USDT地址:</label>
+            <div class="col-xs-12 col-sm-6">
+                <input id="c-name" data-rule="required" class="form-control" name="row[chain_contract_address]" type="text" value="{$row.chain_contract_address}" >
+            </div>
         </div>
-    </div>
-    <div class="form-group">
-        <label for="c-name" class="control-label col-xs-12 col-sm-2">链上USDT地址:</label>
-        <div class="col-xs-12 col-sm-6">
-            <input id="c-name" data-rule="required" class="form-control" name="row[chain_contract_address]" type="text" value="{$row.chain_contract_address}" >
+        <div class="form-group">
+            <label for="c-name" class="control-label col-xs-12 col-sm-2">区块链RPC URL:</label>
+            <div class="col-xs-12 col-sm-6">
+                <input id="c-name" data-rule="required" class="form-control" name="row[chain_url]" type="text" value="{$row.chain_url}" >
+            </div>
+        </div>
+        <div class="form-group">
+            <label for="c-name" class="control-label col-xs-12 col-sm-2">区块链ID:</label>
+            <div class="col-xs-12 col-sm-6">
+                <input id="c-name"  class="form-control" name="row[chain_id]" type="text" value="{$row.chain_id}" >
+            </div>
         </div>
-    </div>
-    <div class="form-group">
-        <label for="c-name" class="control-label col-xs-12 col-sm-2">区块链RPC URL:</label>
-        <div class="col-xs-12 col-sm-6">
-            <input id="c-name" data-rule="required" class="form-control" name="row[chain_url]" type="text" value="{$row.chain_url}" >
         </div>
     </div>
-    <div class="form-group">
-        <label for="c-name" class="control-label col-xs-12 col-sm-2">区块链ID:</label>
-        <div class="col-xs-12 col-sm-6">
-            <input id="c-name"  class="form-control" name="row[chain_id]" type="text" value="{$row.chain_id}" >
+
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">
+                TRON 配制
+            </h3>
+        </div>
+        <div class="panel-body">
+        <div class="form-group">
+            <label for="c-name" class="control-label col-xs-12 col-sm-2">链上USDT地址:</label>
+            <div class="col-xs-12 col-sm-6">
+                <input id="c-name" data-rule="required" class="form-control" name="row[chain_tron_contract_address]" type="text" value="{$row.chain_tron_contract_address}" >
+            </div>
+        </div>
+        <div class="form-group">
+            <label for="c-name" class="control-label col-xs-12 col-sm-2">区块链RPC URL:</label>
+            <div class="col-xs-12 col-sm-6">
+                <input id="c-name" data-rule="required" class="form-control" name="row[chain_tron_url]" type="text" value="{$row.chain_tron_url}" >
+            </div>
+        </div>
         </div>
     </div>
 
+
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-6">

+ 19 - 0
application/admin/view/reports/business/user.html

@@ -0,0 +1,19 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+    <input type="hidden" id="id" value="{$id}">
+    <input type="hidden" id="type" value="{$type}">
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <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"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 19 - 0
application/admin/view/reports/user/user.html

@@ -0,0 +1,19 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+    <input type="hidden" id="id" value="{$id}">
+    <input type="hidden" id="type" value="{$type}">
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        <div><span>代理 > 组长 > 组员 > 会员 </span><a class="btn  btn-addtabs btn-notice" href="#" onclick="javascript:history.go(-1)" data-name="" ><<返回</a></div>
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 1 - 1
application/admin/view/system/notice/add.html

@@ -28,7 +28,7 @@
     <div class="form-group">
         <label for="c-time" class="control-label col-xs-12 col-sm-2">{:__('Notice_time')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-time" class="form-control datetimerange" name="row[time]" type="text" >
+            <input id="c-time" class="form-control datetimerange" data-date-format="YYYY-MM-DD HH:mm:ss" data-time-picker="true" data-use-current="true" name="row[time]" type="text" >
 
         </div>
     </div>

+ 1 - 1
application/admin/view/system/notice/edit.html

@@ -28,7 +28,7 @@
     <div class="form-group">
         <label for="c-time" class="control-label col-xs-12 col-sm-2">{:__('Notice_time')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-time"  class="form-control datetimerange" name="row[time]" type="text" value="{$row.notice_starttime|datetime} - {$row.notice_endtime|datetime}">
+            <input id="c-time"  class="form-control datetimerange" data-date-format="YYYY-MM-DD HH:mm:ss" data-time-picker="true" data-use-current="true" name="row[time]" type="text" value="{$row.notice_starttime|datetime} - {$row.notice_endtime|datetime}">
 
         </div>
     </div>

+ 38 - 0
application/admin/view/user/user/fee.html

@@ -0,0 +1,38 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+    <input type="hidden" id="fee_id" value="{$fee_id}" />
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="widget-body no-padding">
+                    <div id="toolbar" class="toolbar">
+                        {:build_toolbar('refresh')}
+                        <div class="dropdown btn-group ">
+                            <a href="javascript:;" class="btn btn-default" >
+                                移动到
+                                <select name="fee" data-rule="required" id="fee" >
+                                    {foreach name="fee" id="item"}
+                                    {if ($item['fee_isdefault']==1)}
+                                    <option value="0" >{$item['fee_name']}</option>
+                                    {else /}
+                                    <option value="{$item['fee_id']}" >{$item['fee_name']}</option>
+                                    {/if}
+                                    {/foreach}
+                                </select>
+                            </a>
+                            <a class="btn btn-info btn-fee btn-disabled disabled {:$auth->check('user/user/feeedit')?'':'hide'}"  data-name="save" title="保存">
+                                保 存
+                            </a>
+
+                        </div>
+
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 9 - 8
application/admin/view/user/user/look.html

@@ -4,6 +4,7 @@
 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
     {:token()}
     <input type="hidden" name="row[user_id]" id='user_id' value="{$row.user_id}">
+    <input type="hidden" id='user_type' value="{$row.user_type}">
     <div  style="text-align:center">
     <table style="BORDER-COLLAPSE: collapse;" width="90%">
         <tr style="height: 40px;text-align: left;">
@@ -20,7 +21,7 @@
         </tr>
         <tr style="height: 40px;text-align: left;">
             <td>ChainAddress</td>
-            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_house_level]" type="text" value="{$row['user_house_level']}" disabled></td>
+            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_wallet_address]" type="text" value="{$row['user_wallet_address']}" disabled></td>
             <td>USDT余额</td>
             <td><input id="c-user_usdt_amount" data-rule="" class="" name="row[user_usdt_amount]" type="number" value="{$row['user_usdt_amount']}" ></td>
         </tr>
@@ -38,15 +39,15 @@
         </tr>
         <tr style="height: 40px;text-align: left;">
             <td>用户划分</td>
-            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_type]" type="text" value="{$row['user_type']}" disabled></td>
+            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_type]" type="text" value="{$row['user_type']==0 ? '普通用户' : '测试用户' }" disabled></td>
             <td>上级代理</td>
-            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_acting]" type="number" value="{$row['user_acting']}" disabled></td>
+            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="admin_name" type="text" value="{$admin_name}" disabled></td>
         </tr>
         <tr style="height: 40px;text-align: left;">
             <td>注册时间</td>
-            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_reg_time]" type="text" value="{$row['user_reg_time']}" disabled></td>
+            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_reg_time]" type="text" value="{$row['user_reg_time']|date='Y-m-d H:i:s',###}" disabled></td>
             <td>注册IP</td>
-            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_reg_ip]" type="number" value="{$row['user_reg_ip']}" disabled></td>
+            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_reg_ip]" type="text" value="{$row['user_reg_ip']}" disabled></td>
         </tr>
         <tr style="height: 40px;text-align: left;">
             <td>累计消费金币</td>
@@ -58,17 +59,17 @@
             <td>链上余额</td>
             <td><input id="c-user_erc20_usdt" data-rule="" class="" name="row[user_erc20_usdt]" type="text" value="{$row['user_erc20_usdt']}"></td>
             <td>邀请人ID</td>
-            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="row[user_inviter]" type="number" value="{$row['user_inviter']}" disabled></td>
+            <td><input id="c-nums" data-rule="required" class="" style="border:none;" name="inviter_id" type="number" value="{$inviter_id}" disabled></td>
         </tr>
         <tr style="height: 40px;text-align: left;">
             <td>登录次数</td>
             <td><input id="c-nums" data-rule="required" class="" style="border:none;" style="border:none;" name="row[user_login_nums]" type="text" value="{$row['user_login_nums']}" disabled></td>
             <td>启用状态</td>
-            <td><input id="c-user_enable" data-rule="" class="" name="row[user_enable]" type="number" value="{$row['user_enable']}" ></td>
+            <td><input id="c-user_enable" data-rule="" class="" name="row[user_enable]" type="text" value="{$row['user_enable']==1 ? '启用' : '禁用'}" ></td>
         </tr>
         <tr style="height: 40px;text-align: left;">
             <td>备注</td>
-            <td>{$row['user_memo']}</td>
+            <td><input id="c-user_memo" data-rule="" class="" name="row[user_memo]" type="text" value="{$row['user_memo']}"></td>
             <td></td>
             <td></td>
         </tr>

+ 5 - 0
application/admin/view/user/user/usergivegold.html

@@ -24,6 +24,11 @@
                 <div align="center" class="form-group" style="padding-top: 20px;">
                     {:build_radios('user_enable', [1=>__('Open'), '0'=>__('Close')], $row['user_enable'])}
                 </div>
+                {elseif $type == 'user_memo' /}
+                <div align="center" >备注:</div>
+                <div align="center" class="form-group" style="padding-top: 20px;">
+                    <input id="c-nums" data-rule="required" class="" name="user_memo" type="text" value="{$row['user_memo']}" >
+                </div>
                 {else /}
                 <div align="center" >将该会员移动至:</div>
                 <div align="center" class="form-group" style="padding-top: 20px;">

+ 2 - 0
application/admin/view/withdraw/rebate/index.html

@@ -7,9 +7,11 @@
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
                         {:build_toolbar('refresh')}
+                        {if ($role==0)}
                         <div class="dropdown btn-group ">
                             <a class="btn btn-primary dropdown-toggle btn-addtabs" href="withdraw/rebate/list" data-name="" title="{:__('Set')}" ><i class="fa fa-cog"></i> {:__('Set')}</a>
                         </div>
+                        {/if}
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                            width="100%">

+ 2 - 0
application/admin/view/withdraw/withdraw/index.html

@@ -7,9 +7,11 @@
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
                         {:build_toolbar('refresh')}
+                        {if ($role==0)}
                         <div class="dropdown btn-group ">
                             <a class="btn btn-primary dropdown-toggle btn-min-limit" data-name="" title="最低提现设置" ><i class="fa fa-cog"></i> 最低提现设置</a>
                         </div>
+                        {/if}
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                            data-operate-audit="{:$auth->check('withdraw/withdraw/audit')}"

+ 1 - 1
application/common.php

@@ -558,7 +558,7 @@ EOT;
                 $a=($a+1)%256;  
                 $j=($j+$box[$a])%256;  
                 $tmp=$box[$a];  
-                $box[$a]=$box[$j];  
+                $box[$a]=$box[$j];
                 $box[$j]=$tmp;  
                 $result.=chr(ord($string[$i])^($box[($box[$a]+$box[$j])%256]));  
             }  

+ 2 - 1
composer.json

@@ -31,7 +31,8 @@
         "ext-pdo": "*",
         "ext-bcmath": "*",
         "txthinking/mailer": "^2.0",
-        "kgs/web3": "dev-master"
+        "kgs/web3": "dev-master",
+        "fenguoz/tron-php": "^1.3"
     },
     "config": {
         "preferred-install": "dist",

+ 1 - 1
public/assets/js/backend/auth/admin.js

@@ -251,7 +251,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {field: 'id', title: __('Id'), sortable: true, operate:false},
                         {field: 'nickname', title: __('Nickname')},
-                        {field: 'role', title: __('Role'), searchList: {2:'组长',3:'组员'}, formatter: Table.api.formatter.status},
+                        {field: 'role', title: __('Role'), searchList: {2:'组长', 3:'组员'}, formatter: Table.api.formatter.status},
                         {field: 'usernum', title: __('Usernum'), operate: false},
                         {field: 'select', title: __('Operate'), operate: false, events: operateEvents, formatter: function (value, row, index) {
                                 return '<a class="btn  btn-addtabs btn-select" data-name="" >选择</a>'

+ 47 - 3
public/assets/js/backend/reports/business.js

@@ -29,15 +29,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'username', title: __('Username'), operate: 'LIKE'},
                         {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
                         {field: 'role', title: __('Role'), searchList: {1:'代理',2:'组长',3:'组员'}, formatter: Table.api.formatter.status},
+                        {field: 'statistics.su_give_gold', title: '赠送金币', operate: false},
                         {field: 'statistics.su_use_gold', title: __('Su_use_gold'), operate: false},
                         {field: 'statistics.su_fruit_sell', title: __('Su_fruit_sell'), operate: false},
                         {field: 'statistics.su_withdraw_amount', title: __('Su_withdraw_amount'), operate: false},
                         {field: 'statistics.su_withdraw_fee', title: __('Su_withdraw_fee'), operate: false},
                         {field: 'look', title: __('Look'), operate: false, formatter: function (value, row, index) {
-                            if (row.role==3) {
-                                return '';
+                            if (row.role==2) {
+                                return '<a class="btn  btn-addtabs btn-notice" href="reports.user/user?type=3&id='+row.id+'&agent_id='+row.agent_id+'" data-name="" ><i class="fa fa-circle-o"></i>查看会员</a> ' + 
+                                '<a class="btn  btn-addtabs btn-notice" href="reports.business/index?type='+row.role+'&id='+row.id+'&agent_id='+row.agent_id+'" data-name="" ><i class="fa fa-circle-o"></i>查看</a>'
+                            } else if (row.role==3) {
+                                return '<a class="btn  btn-addtabs btn-notice" href="reports.user/user?type=4&id='+row.id+'&agent_id='+row.agent_id+'" data-name="" ><i class="fa fa-circle-o"></i>查看</a>'
                             } else {
-                                return '<a class="btn  btn-addtabs btn-notice" href="reports.business/index?type='+row.role+'&id='+row.id+'" data-name="" ><i class="fa fa-circle-o"></i>查看</a>'
+                                return '<a class="btn  btn-addtabs btn-notice" href="reports.business/index?type='+row.role+'&id='+row.id+'&agent_id='+row.agent_id+'" data-name="" ><i class="fa fa-circle-o"></i>查看</a>'
                             }
                         }},
                     ]
@@ -47,6 +51,46 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 为表格绑定事件
             Table.api.bindevent(table);
         },
+        user: function () {
+
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'reports/business/user?type='+$('#type').val()+'&id='+$('#id').val(),
+                    add_url: '',
+                    edit_url: '',
+                    del_url: '',
+                    multi_url: "",
+                    table: 'business',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'su_id',
+                sortName: 'statistics_business.su_id',
+                sortOrder: 'desc',
+                columns: [
+                    [
+                        {field: 'su_id', title: __('Id'), sortable: true, operate: false},
+                        {field: 'user.user_nickname', title: '昵称', operate: false},
+                        {field: 'admin_name', title: '上级代理', operate: false},
+                        {field: 'su_give_gold', title: __('Su_give_gold'), operate: false},
+                        {field: 'su_use_gold', title: __('Su_use_gold'), operate: false},
+                        {field: 'su_fruit_sell', title: __('Su_fruit_sell'), operate: false},
+                        {field: 'su_withdraw_amount', title: __('Su_withdraw_amount'), operate: false},
+                        {field: 'su_withdraw_fee', title: '提现手续费', operate: false},
+                        {field: 'su_updatetime', title: '统计时间', formatter: Table.api.formatter.datetime},
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
         add: function () {
             Controller.api.bindevent();
 

+ 43 - 0
public/assets/js/backend/reports/user.js

@@ -41,6 +41,49 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 为表格绑定事件
             Table.api.bindevent(table);
         },
+        user: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'reports/user/user?type='+$('#type').val()+'&id='+$('#id').val(),
+                    add_url: '',
+                    edit_url: '',
+                    del_url: '',
+                    multi_url: "",
+                    table: 'user',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'su_id',
+                sortName: 'statistics_user.su_time',
+                sortOrder: 'desc',
+                columns: [
+                    [
+                        {field: 'su_id', title: __('Id'), sortable: true, operate: false},
+                        {field: 'su_user_id', title: __('User_id')},
+                        {field: 'user.user_nickname', title: __('User_nickname'), operate: false},
+                        {field: 'admin_name', title: '上级代理', operate: false},
+                        {field: 'su_give_gold', title: __('Su_give_gold'), operate: false},
+                        {field: 'su_use_gold', title: __('Su_use_gold'), operate: false},
+                        {field: 'su_fruit_sell', title: __('Su_fruit_sell'), operate: false},
+                        {field: 'su_withdraw_amount', title: __('Su_withdraw_amount'), operate: false},
+                        {field: 'su_withdraw_fee', title: __('Su_withdraw_fee'), operate: false},
+                        //{field: 'su_time', title: __('Su_time')},
+                        {field: 'look', title: '查看明细', operate: false, formatter: function (value, row, index) {
+                            return '<a class="btn  btn-addtabs btn-notice" href="reports.business/user?type=5&id='+row.su_user_id+'" data-name="" ><i class="fa fa-circle-o"></i>查看</a>'
+                        }},
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
         add: function () {
             Controller.api.bindevent();
 

+ 1 - 0
public/assets/js/backend/user/helplog.js

@@ -26,6 +26,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'userfriend.user_nickname', title: __('Fhl_friend_user_nickname'), operate: false},
                         {field: 'fhl_memo', title: __('Fhl_memo'), operate: false},
                         {field: 'fhl_time', title: __('Fhl_time'), formatter: Table.api.formatter.datetime, operate: false},
+                        {field: 'fhl_ipaddr', title: 'IP', operate: false},
                     ]
                 ]
             });

+ 1 - 0
public/assets/js/backend/user/loginlog.js

@@ -24,6 +24,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'user.user_nickname', title: __('User_nickname')},
                         {field: 'operation', title: __('Operation'), operate: false},
                         {field: 'ull_login_time', title: __('Ull_login_time'), formatter: Table.api.formatter.datetime, operate: false},
+                        {field: 'ull_ipaddr', title: 'IP', operate: false},
                     ]
                 ]
             });

+ 3 - 1
public/assets/js/backend/user/operatelog.js

@@ -23,7 +23,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'uol_user_id', title: __('Uol_user_id')},
                         {field: 'user.user_nickname', title: __('User_nickname')},
                         {field: 'uol_memo', title: __('Operation'), operate: false},
-                        {field: 'uol_login_time', title: __('Uol_login_time'), formatter: Table.api.formatter.datetime, operate: false},
+                        {field: 'uol_memo_info', title: '操作详情', operate: false},
+                        {field: 'uol_time', title: __('Uol_login_time'), formatter: Table.api.formatter.datetime, operate: false},
+                        {field: 'uol_ipaddr', title: 'IP', operate: false},
                     ]
                 ]
             });

+ 197 - 28
public/assets/js/backend/user/user.js

@@ -57,7 +57,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {field: 'user_id', title: __('User_id'), sortable: true},
                         {field: 'user_wallet_address', title: __('User_wallet_address'), operate: 'LIKE'},
-                        {field: 'user_chain', title: __('User_chain'), operate: false},
+                        {field: 'user_chain', title: __('User_chain'), formatter: Table.api.formatter.status, searchList: {1: 'ETH', 2: 'TRON'}, operate: false},
                         {field: 'avatar', title: __('User_avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
                         {field: 'user_nickname', title: __('User_nickname'), operate: 'LIKE'},
                         {field: 'user_house_level', title: __('User_house_level'), operate: false},
@@ -65,16 +65,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'user_usdt_amount', title: __('User_usdt_amount'), operate: false},
                         {field: 'user_withdraw', title: __('User_withdraw'), operate: false},
                         {field: 'user_invitation', title: __('User_invitation'), operate: false},
-                        {field: 'user_type', title: __('User_type'), formatter: Table.api.formatter.status, searchList: {1: __('User_type_1'), 2: __('User_type_2')}},
+                        {field: 'user_type', title: __('User_type'), formatter: Table.api.formatter.status, searchList: {1: __('User_type_1'), 0: __('User_type_2')}},
                         {field: 'useracting.nickname', title: __('User_acting'), operate: false},
-
+                        {field: 'user_memo', title: __('User_memo')},
                         {field: 'gold_coin', title: __('Gold_coin'), operate: false, events: operateEvents, formatter:function(value, row, index) {
-                                if (row.givegold) {
-                                    return row.givegold.gg_name + ' <button type="button" class="btn btn-embossed btn-goldcoin" >编辑</button>';
+                                if (Config.role==0) {
+                                    if (row.givegold) {
+                                        return row.givegold.gg_name + ' <button type="button" class="btn btn-embossed btn-goldcoin" >编辑</button>';
+                                    } else {
+                                        return '<button type="button" class="btn btn-embossed btn-goldcoin" >编辑</button>';
+                                    }
                                 } else {
-                                    return '<button type="button" class="btn btn-embossed btn-goldcoin" >编辑</button>';
+                                    table.data("gold_coin", null);
+                                    //return;
                                 }
-                                
                             }
                         },
 
@@ -83,9 +87,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     return '<a class="btn  btn-addtabs btn-notice" href="user.user/look?user_id='+row.user_id+'" data-name="" ><i class="fa fa-circle-o"></i>查看</a>' + 
                                 '<a class="btn  btn-addtabs btn-notice" href="user.user/edituser?user_id='+row.user_id+'" data-name="" ><i class="fa fa-pencil"></i>修改</a>';
                                 } else {
-                                    return '<a class="btn  btn-addtabs btn-notice" href="user.user/look?user_id='+row.user_id+'" data-name="" ><i class="fa fa-circle-o"></i>查看</a>' + 
-                                '<a class="btn  btn-addtabs btn-notice" href="user.user/edituser?user_id='+row.user_id+'" data-name="" ><i class="fa fa-pencil"></i>修改</a>' + 
-                                '<button type="button" class="btn btn-embossed btn-totype btn-primary" >转为测试号</button>';
+                                    if (Config.role==0) {
+                                        return '<a class="btn  btn-addtabs btn-notice" href="user.user/look?user_id='+row.user_id+'" data-name="" ><i class="fa fa-circle-o"></i>查看</a>' + 
+                                        '<a class="btn  btn-addtabs btn-notice" href="user.user/edituser?user_id='+row.user_id+'" data-name="" ><i class="fa fa-pencil"></i>修改</a>' + 
+                                        '<button type="button" class="btn btn-embossed btn-totype btn-primary" >转为测试号</button>';
+                                    } else {
+                                        return '<a class="btn  btn-addtabs btn-notice" href="user.user/look?user_id='+row.user_id+'" data-name="" ><i class="fa fa-circle-o"></i>查看</a>' + 
+                                        '<a class="btn  btn-addtabs btn-notice" href="user.user/edituser?user_id='+row.user_id+'" data-name="" ><i class="fa fa-pencil"></i>修改</a>';
+                                    }
+                                    
                                 }
                                 
                             }
@@ -299,6 +309,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 this.layerIndex = index;
             });
             $(document).on('click', '#c-user_erc20_usdt', function () {
+                if ($('#user_type').val() == 0) {
+                    alert('普通用户不能修改');
+                    return;
+                }
                 var _params = {
                     type: 'user_erc20_usdt',
                     user_id: $('#user_id').val(),
@@ -324,6 +338,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 });
                 this.layerIndex = index;
             });
+            $(document).on('click', '#c-user_memo', function () {
+                var _params = {
+                    type: 'user_memo',
+                    user_id: $('#user_id').val(),
+                };
+                var index = layer.open({
+                    type: 2,
+                    title: __('User_memo'),
+                    area: ["400px", "300px"],
+                    content: Fast.api.fixurl('user/user/usergivegold?user_id=' + _params.user_id + '&type=' + _params.type)
+                });
+                this.layerIndex = index;
+            });
         },
         givegold: function () {
             function getAbcClass(value, row, index) {
@@ -354,6 +381,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         data: _params,
                         success: function (ret) {
                             alert(ret.msg);
+                            window.location.reload();
                         },
                         error: function (e) {
                         }
@@ -411,6 +439,109 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     data: _params,
                     success: function (ret) {
                         alert(ret.msg);
+                        window.location.reload();
+                    },
+                    error: function (e) {
+                    }
+                });
+                
+            });
+            
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        fee: function () {
+            function getAbcClass(value, row, index) {
+                var contentObj = $("<select class='abcClass'></select>");
+                $.each(row.fee, function(index, obj){
+                    var optionObj = contentObj.append("<option></option>").children("option").last();
+                    var fee_id = obj.fee_id;
+                    if (obj.fee_isdefault==1) {
+                        fee_id = 0;
+                    }
+                    optionObj.attr("value", fee_id).text(obj.fee_name);
+                    if (obj.fee_id == row.user_fee_id) {
+                        optionObj.attr("selected", "selected");
+                        $("#abcClass").children().eq(index).attr("selected", "selected");
+                    }
+                })
+                return "移至 <select class='abcClass' index="+index+">"+contentObj.html()+"</select>";
+            }
+            window.actionEvents = {
+                'change .abcClass':function(e,value,row,index){
+                    if(!value){
+                        value = e.currentTarget.value;
+                    }
+                    var _params = {
+                        id: row.user_id,
+                        fee_id: value,
+                    };
+                    $.ajax({
+                        dataType: 'json',
+                        type: 'POST',
+                        url: 'user/user/feeedit',
+                        data: _params,
+                        success: function (ret) {
+                            alert(ret.msg);
+                            window.location.reload();
+                        },
+                        error: function (e) {
+                        }
+                    });
+                },
+            }
+            
+
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'user/user/fee?fee_id=' + $('#fee_id').val(),
+                    add_url: '',
+                    edit_url: '',
+                    del_url: '',
+                    multi_url: '',
+                    table: 'fee',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'user_id',
+                sortName: 'user.user_reg_time',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'user_id', title: __('User_id'), sortable: true, operate:false},
+                        {field: 'user_nickname', title: __('User_nickname'), operate: 'LIKE'},
+
+                        {field: 'abcClass', title: '操作',  events:actionEvents, formatter: getAbcClass},
+                    ]
+                ],
+                commonSearch: false,
+                pagination: false,
+                showToggle: false,
+                showColumns: false,
+                showExport: false,
+            });
+
+            // 移动
+            $(document).on('click', '.btn-fee', function () {
+                var ids = Table.api.selectedids(table);
+                var _params = {
+                    id: ids.join(','),
+                    fee_id: $('#fee').val(),
+                };
+                $.ajax({
+                    dataType: 'json',
+                    type: 'POST',
+                    url: 'user/user/feeedit',
+                    data: _params,
+                    success: function (ret) {
+                        alert(ret.msg);
+                        window.location.reload();
                     },
                     error: function (e) {
                     }
@@ -458,10 +589,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.bindevent(table);
         },
         notice: function () {
+            let userList = [];
+            window.actionEvents = {
+                'click .btn-user':function(e,value,row,index){
+                    if($('#user_id'+row.user_id).is(':checked')) {
+                        userList.push(row.user_id);
+                    }else {
+                        let index = userList.indexOf(row.user_id);
+                        userList.splice(index, 1);
+                    }
+                    //console.log(userList);
+                },
+            }
             // 初始化表格参数配置
             Table.api.init({
                 extend: {
-                    index_url: 'user/user/mail?mail_id=' + $('#mail_id').val(),
+                    index_url: 'user/user/mail',
                     add_url: '',
                     edit_url: '',
                     del_url: '',
@@ -480,7 +623,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 pageSize: 30,
                 columns: [
                     [
-                        {checkbox: true},
+                        {field: 'check', title: '选择', operate: false, events:actionEvents, formatter: function (value, row, index) {
+                            if (userList.indexOf(row.user_id) == -1) {
+                                return '<input name="user_id" class="btn-user" id="user_id'+row.user_id+'"  value="'+row.user_id+'" type="checkbox" />';
+                            } else {
+                                return '<input name="user_id" class="btn-user" id="user_id'+row.user_id+'"  value="'+row.user_id+'" type="checkbox" checked />';
+                            }
+                            
+                        }},
                         {field: 'user_id', title: __('User_id'), sortable: true, operate:false},
                         {field: 'user_nickname', title: __('User_nickname'), operate: 'LIKE'},
                     ]
@@ -492,25 +642,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 showExport: false,
             });
             // 选择范围
-            $(document).on('change', '#type', function () {
-                var type =  $('#type').val();
-                if (type==1) {
-                    $('.btn-send').addClass('btn-disabled');
-                } else {
-                    $('.btn-send').removeClass('btn-disabled');
-                }
-            });
+            // $(document).on('change', '#type', function () {
+            //     var type =  $('#type').val();
+            //     if (type==1) {
+            //         $('.btn-send').addClass('btn-disabled');
+            //     } else {
+            //         $('.btn-send').removeClass('btn-disabled');
+            //     }
+            // });
             // 发送
             $(document).on('click', '.btn-send', function () {
-                var ids = Table.api.selectedids(table);
+                //var ids = Table.api.selectedids(table);
                 var type =  $('#type').val();
-                if (type == 1 && ids=='') {
+                if (type == 1 && userList==[]) {
                     alert(__('Error_info1'));
                     return;
                 }
                 var _params = {
                     //id: ids.join(','),
-                    id: ids,
+                    id: userList,
                     notice_id: $('#notice_id').val(),
                     type: type,
                 };
@@ -531,6 +681,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.bindevent(table);
         },
         mail: function () {
+            let userList = [];
+            window.actionEvents = {
+                'click .btn-user':function(e,value,row,index){
+                    if($('#user_id'+row.user_id).is(':checked')) {
+                        userList.push(row.user_id);
+                    }else {
+                        let index = userList.indexOf(row.user_id);
+                        userList.splice(index, 1);
+                    }
+                    //console.log(userList);
+                },
+            }
             // 初始化表格参数配置
             Table.api.init({
                 extend: {
@@ -553,7 +715,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 pageSize: 30,
                 columns: [
                     [
-                        {checkbox: true},
+                        {field: 'check', title: '选择', operate: false, events:actionEvents, formatter: function (value, row, index) {
+                            if (userList.indexOf(row.user_id) == -1) {
+                                return '<input name="user_id" class="btn-user" id="user_id'+row.user_id+'"  value="'+row.user_id+'" type="checkbox" />';
+                            } else {
+                                return '<input name="user_id" class="btn-user" id="user_id'+row.user_id+'"  value="'+row.user_id+'" type="checkbox" checked />';
+                            }
+                            
+                        }},
                         {field: 'user_id', title: __('User_id'), sortable: true, operate:false},
                         {field: 'user_nickname', title: __('User_nickname'), operate: 'LIKE'},
                     ]
@@ -567,10 +736,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
             // 发送
             $(document).on('click', '.btn-mail', function () {
-                var ids = Table.api.selectedids(table);
+                //var ids = Table.api.selectedids(table);
                 var _params = {
                     //id: ids.join(','),
-                    id: ids,
+                    id: userList,
                     mail_id: $('#mail_id').val(),
                 };
                 $.ajax({
@@ -598,7 +767,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     edit_url: '',
                     del_url: '',
                     multi_url: '',
-                    table: 'mail',
+                    table: 'noticeuser',
                 }
             });
 
@@ -639,4 +808,4 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         }
     };
     return Controller;
-});
+});

+ 17 - 0
public/assets/js/backend/withdraw/fee.js

@@ -12,6 +12,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     });
                     this.layerIndex = index;
                 },
+                'click #bind_user': function (e, value, row, index) {
+                    var fee_id;
+                    fee_id = row.fee_id;
+                    if (row.fee_isdefault == 1) {
+                        fee_id = 0;
+                    }
+                    var index = layer.open({
+                        type: 2,
+                        title: '会员设置',
+                        area: ["600px", "800px"],
+                        content: Fast.api.fixurl('user/user/fee?fee_id=' + fee_id)
+                    });
+                    this.layerIndex = index;
+                },
             };
             // 初始化表格参数配置
             Table.api.init({
@@ -54,6 +68,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                 return Table.api.formatter.toggle.call(this, value, row, index);
                             }
                         },
+                        {field: 'userinfo', title: '会员明细', events: operateEvents, formatter: function (value, row, index) {
+                            return '<button id="bind_user" type="button" class="btn">查看</button>';
+                        }},
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: function (value, row, index) {
                             var table = this.table;
                             // 操作配置

+ 2 - 1
public/assets/js/backend/withdraw/withdraw.js

@@ -63,7 +63,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'withdraw_amount_actual', title: __('Withdraw_amount_actual')},
                         {field: 'operate', title: __('Operate'), events: operateEvents, formatter: function (value, row, index) {
                             if (row.withdraw_audit==1) {
-                                return '审核通过 <a href="https://etherscan.io/tx/'+row.withdraw_hash+'" target="_blank" >链上查看</a>';
+                                //return '审核通过 <a href="https://etherscan.io/tx/'+row.withdraw_hash+'" target="_blank" >链上查看</a>';
+                                return '审核通过';
                             } else if (row.withdraw_audit==2) {
                                 return '审核失败';
                             } else {