Sfoglia il codice sorgente

Merge branch 'main' of https://jihulab.com/tou-biao/api-system

Jason 1 anno fa
parent
commit
f84b6f6461

+ 18 - 3
application/admin/controller/Ajax.php

@@ -13,6 +13,9 @@ use think\Db;
 use think\Lang;
 use think\Response;
 use think\Validate;
+use think\Env;
+use OSS\OssClient;
+
 
 /**
  * Ajax异步请求接口
@@ -73,6 +76,9 @@ class Ajax extends Backend
             $chunkcount = $this->request->post("chunkcount/d");
             $filename = $this->request->post("filename");
             $method = $this->request->method(true);
+
+         
+
             if ($action == 'merge') {
                 $attachment = null;
                 //合并分片文件
@@ -109,13 +115,22 @@ class Ajax extends Backend
             //默认普通上传文件
             $file = $this->request->file('file');
             try {
-                $upload = new Upload($file);
-                $attachment = $upload->upload();
+
+                // $upload = new Upload($file);
+                // $attachment = $upload->upload();
+           
+                $filename = $file->getInfo();
+                //获取oss实例
+                $ossClient = new OssClient(Env::get('oss.key_id'), Env::get('oss.key_secret'), Env::get('oss.endpoint'));
+                $bucket    = Env::get('oss.dbucket'); 
+                $uploadpath = "tou-biao/" . date("Ymd") . "/" . $filename['name'];
+                $rs = $ossClient->uploadFile($bucket, $uploadpath, $file->getRealPath());
+  
             } catch (UploadException $e) {
                 $this->error($e->getMessage());
             }
 
-            $this->success(__('Uploaded successful'), '', ['url' => $attachment->url, 'fullurl' => cdnurl($attachment->url, true)]);
+            $this->success(__('Uploaded successful'), '', ['url' => $rs['info']['url'], 'fullurl' => $rs['info']['url']]);
         }
     }
 

+ 1 - 1
application/admin/controller/user/Group.php

@@ -44,7 +44,7 @@ class Group extends Backend
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
             $list = $this->model
-                ->where($where)->where('is_agent', 1)
+                ->where($where)->where('is_agent', 1)->where('is_delete', 0)
                 ->order($sort, $order)
                 ->paginate($limit);
 

+ 115 - 11
application/admin/controller/user/Team.php

@@ -2,8 +2,13 @@
 
 namespace app\admin\controller\user;
 
+use think\Db;
+use Exception;
+use app\admin\model\UserPath;
+use think\exception\DbException;
+use think\exception\PDOException;
 use app\common\controller\Backend;
-use fast\Tree;
+use think\exception\ValidateException;
 
 /**
  * 会员团队
@@ -14,36 +19,135 @@ class Team extends Backend
 {
 
     /**
-     * @var \app\admin\model\UserRule
+     * @var \app\admin\model\UserPath
      */
     protected $model = null;
  
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = model('UserRule');
- 
+        $this->model = model('User');
+        $user_id = $this->request->param('ids/d', 0);
+        $this->assignconfig('user_id', $user_id);
+        $this->view->assign("typeList", UserPath::where('parent_id', $user_id)->order('distance', 'asc')->column('distance'));
+
     }
 
+
     /**
      * 查看
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
      */
     public function index()
     {
-        if ($this->request->isAjax()) {
-            $list = $this->rulelist;
-            $total = count($this->rulelist);
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+       
+        [, $sort, $order, $offset, $limit] = $this->buildparams();
+
+        $where = self::_where(json_decode($this->request->get("filter"), true));
 
-            $result = array("total" => $total, "rows" => $list);
+        $mapType = []; 
+        $type = $this->request->param('distance/d');
+        if($type > 0) $mapType['distance'] = $type;
+        $user_id = $this->request->param('user_id/d');
 
-            return json($result);
+        $list = $this->model->alias('a')
+            ->join('users b','a.parent_id = b.id', 'LEFT')
+            ->join('users_path c','a.id = c.user_id and c.parent_id ='. $user_id, 'LEFT')
+            ->where('a.id','IN',function($query) use($user_id){
+                $query->table('ta_users_path')->where('parent_id', $user_id)->order('distance', 'desc')->field('user_id');
+            })
+            ->where($where)->where($mapType)->where('a.is_delete', 0)
+            ->field('a.id,a.is_lock,a.mobile,a.balance,a.bonus_sum,a.create_time,b.mobile as parent_name,c.distance')
+            ->order($sort, $order)
+            ->paginate($limit);
+        if($list->total() > 0){
+            $in  = model('Mongyin');
+            $out = model('Mongyout');
+            foreach ($list as &$item) {
+                $item->recharge = $in::where('status', 1)->where('user_id', $item->id)->sum('amount');
+                $item->withdraw = $out::where('status', 1)->where('user_id', $item->id)->sum('amount');
+            }  
         }
-        return $this->view->fetch();
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
     }
 
- 
+    /**
+     * 封禁
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
+     */
+    public function lock($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+        $result = false;
+        try {
+            $result = $row->allowField(true)->save(['is_lock'=>1]);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
 
+    /**
+     * 封禁团队
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
+     */
+    public function lockAll($ids = null)
+    {
+        $rows = UserPath::where('parent_id', $ids)->column('distance');
+        if (!$rows) {
+            $this->error(__('No Results were found'));
+        }
+        $result = false;
+        try {
+            $result = $this->model->where('id', 'in', $rows)->update(['is_lock'=>1]);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
 
 
+    //搜索条件
+    private static function _where($filter = array()): array
+    {
+        $where = [];
+        if(isset($filter['mobile'])) $where['a.mobile'] = $filter['mobile'];
+        if(isset($filter['create_time'])) {
+            $arr = explode(' - ', $filter['create_time']);
+            $where['a.create_time']= ['between', [strtotime($arr[0]), strtotime($arr[1])]];
+        }
+        return $where;
+    }
 
 }

+ 64 - 9
application/admin/controller/user/User.php

@@ -4,6 +4,8 @@ namespace app\admin\controller\user;
 
 use think\Db;
 use Exception;
+use fast\Random;
+use app\admin\model\UserPath;
 use app\common\model\Moneylog;
 use think\exception\DbException;
 use think\exception\PDOException;
@@ -47,15 +49,25 @@ class User extends Backend
                 return $this->selectpage();
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
-            $list = $this->model
-                //->with('group')
-                ->where($where)
+
+            $list = $this->model->alias('a')
+                ->join('users b','a.parent_id = b.id', 'LEFT')
+                ->where($where)->where('a.is_delete', 0)
                 ->order($sort, $order)
+                ->field('a.*,b.mobile as parent_name')
                 ->paginate($limit);
-            // foreach ($list as $k => $v) {
-            //     $v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
-            //     $v->hidden(['password', 'salt']);
-            // }
+
+   
+            $in  = model('Mongyin');
+            $out = model('Mongyout');
+            $path= model('UserPath');
+            foreach ($list as &$item) {
+                $item->agent = $this->model->where('id', '=',  
+                                $path->where('user_id', $item->id)->where('is_agent', 1)->order('distance', 'desc')->value('parent_id'))
+                             ->value('mobile');
+                $item->recharge = $in::where('status', 1)->where('user_id', $item->id)->sum('amount');
+                $item->withdraw = $out::where('status', 1)->where('user_id', $item->id)->sum('amount');
+            }  
             $result = array("total" => $list->total(), "rows" => $list->items());
 
             return json($result);
@@ -65,7 +77,7 @@ class User extends Backend
 
 
     /**
-     * 余额     public function balance($ids = null)
+     * 余额
      * @param $ids
      * @return string
      * @throws DbException
@@ -211,7 +223,7 @@ class User extends Backend
 
 
     /**
-     * 清0
+     * 清
      * @param $ids
      * @return string
      * @throws DbException
@@ -276,6 +288,17 @@ class User extends Backend
                 $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
                 $row->validateFailException()->validate($validate);
             }
+            if(!empty($params['login_pwd'])){
+                $params['salt'] = Random::alnum();
+                $params['fund_pwd'] = $this->auth->getEncryptPassword($params['fund_pwd'], $params['salt']);
+            }else{
+                unset($params['login_pwd']);
+            }
+            if(!empty($params['fund_pwd'])){
+                $params['fund_pwd'] = md5($params['fund_pwd']);
+            }else{
+                unset($params['fund_pwd']);
+            }
             $result = $row->allowField(true)->save($params);
             Db::commit();
         } catch (ValidateException|PDOException|Exception $e) {
@@ -288,6 +311,38 @@ class User extends Backend
         $this->success();
     }
 
+    
+    /**
+     * 删除
+     *
+     * @param $ids
+     * @return void
+     * @throws DbException
+     * @throws DataNotFoundException
+     * @throws ModelNotFoundException
+     */
+    public function del($ids = null)
+    {
 
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+        $result = false;
+        try {
+            $result = $row->allowField(true)->save(['is_delete'=>1]);
+        } catch (ValidateException|PDOException|Exception $e) {
+
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
+    }
 
 }

+ 0 - 19
application/admin/lang/vn/user/rule.php

@@ -1,19 +0,0 @@
-<?php
-
-return [
-    'Pid'             => '父ID',
-    'Name'            => '规则',
-    'Title'           => '标题',
-    'Remark'          => '备注',
-    'Ismenu'          => '是否菜单',
-    'Change password' => '修改密码',
-    'Createtime'      => '创建时间',
-    'Updatetime'      => '更新时间',
-    'Menu tips'       => '规则任意,请不可重复,仅做层级显示,无需匹配控制器和方法',
-    'Node tips'       => '模块/控制器/方法名',
-    'Weigh'           => '权重',
-    'Status'          => '状态',
-    'Toggle all'      => '显示全部',
-    'Toggle menu visible' => '点击切换菜单显示',
-    'Toggle sub menu'     => '点击切换子菜单',
-];

+ 18 - 0
application/admin/lang/vn/user/team.php

@@ -0,0 +1,18 @@
+<?php
+
+return [
+    'Pid'             => '父ID',
+    'Name'            => '规则',
+    'Balance'         => '余额',
+    'Bonus sum'       => '累计佣金',
+    'Parent id'       => '上级用户',
+    'Recharge'        => '充值',
+    'Withdraw'        => '提现',
+    'Level'           => 'mức độ',
+    'Grade'           => 'lớp học',  
+    'Account'         => 'Thay đổi tài khoản', 
+    'Ban team'        => 'đội cấm',
+    'Ban'             => 'lệnh cấm', 
+    'Createtime'      => '注册时间',
+    'Updatetime'      => '更新时间',
+];

+ 43 - 29
application/admin/lang/vn/user/user.php

@@ -1,33 +1,47 @@
 <?php
 
 return [
-    'Id'             => 'ID',
-    'Group_id'       => '组别ID',
-    'Username'       => '用户名',
-    'Nickname'       => '昵称',
-    'Password'       => '密码',
-    'Salt'           => '密码盐',
-    'Email'          => '电子邮箱',
-    'Mobile'         => '手机号',
-    'Avatar'         => '头像',
-    'Level'          => '等级',
-    'Gender'         => '性别',
-    'Male'           => '男',
-    'FeMale'         => '女',
-    'Birthday'       => '生日',
-    'Bio'            => '格言',
-    'Score'          => '积分',
-    'Successions'    => '连续登录天数',
-    'Maxsuccessions' => '最大连续登录天数',
-    'Prevtime'       => '上次登录时间',
-    'Logintime'      => '登录时间',
-    'Loginip'        => '登录IP',
-    'Loginfailure'   => '失败次数',
-    'Joinip'         => '加入IP',
-    'Jointime'       => '加入时间',
-    'Createtime'     => '创建时间',
-    'Updatetime'     => '更新时间',
-    'Token'          => 'Token',
-    'Status'         => '状态',
-    'Leave password blank if dont want to change' => '不修改密码请留空',
+    'Id'                    => 'ID',
+    'Group_id'              => '所属代理',
+    'Mobile'                => '手机号',
+    'Parent_id'             => '上级',
+    'Balance'               => '余额',
+    'Freeze'                => '冻结金额',
+    'Task'                  => '本轮已做任务量',
+    'Invitation_code'       => '邀请码',
+    'Is_agent'              => '代理',
+    'User_type'             => '用户类型(真人/假人)',
+    'Status'                => '状态(是/否)',
+    'Recharge'              => '充值',
+    'Withdrawal'            => '提现',
+    'Income'                => '收益',
+    'Account change'        => '帐变',
+    'Clear'                 => '清零',
+    'Team'                  => '团队',
+    'Card slip'             => '卡单',
+    'Collection'            => '收款', 
+    'Yes'                   => '是',
+    'No'                    => '否',
+    'Dummy'                 => '假人',
+    'Real person'           => '真人',
+    'Locking'               => '锁定',
+    'New'                   => '新增',
+    'Reduce'                => '减少',
+    'Type'                  => '类型',
+    'Amount'                => '金额',
+    'USDT address'          => 'USDT钱包地址',
+    'Real name'             => '姓名',
+    'Bank name'             => '开户行',
+    'Bank card'             => '卡号',
+    'Which start'           => '第几单开始',
+    'Min amount'            => '最小金额',
+    'Max amount'            => '最大金额',
+    'Income multiple'       => '收益倍数',
+    'Agent ID'              => '代理ID',
+    'Code'                  => '区号',
+    'Nickname'              => '昵称',
+    'Login pwd'             => '登录密码',
+    'Fund pwd'              => '资金密码',
+    'Task num'              => 'Số lượng nhiệm vụ hiện tại',
+    'Pwd title'             => 'Để trống để không thực hiện thay đổi',
 ];

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

@@ -1,19 +0,0 @@
-<?php
-
-return [
-    'Pid'             => '父ID',
-    'Name'            => '规则',
-    'Title'           => '标题',
-    'Remark'          => '备注',
-    'Ismenu'          => '是否菜单',
-    'Change password' => '修改密码',
-    'Createtime'      => '创建时间',
-    'Updatetime'      => '更新时间',
-    'Menu tips'       => '规则任意,请不可重复,仅做层级显示,无需匹配控制器和方法',
-    'Node tips'       => '模块/控制器/方法名',
-    'Weigh'           => '权重',
-    'Status'          => '状态',
-    'Toggle all'      => '显示全部',
-    'Toggle menu visible' => '点击切换菜单显示',
-    'Toggle sub menu'     => '点击切换子菜单',
-];

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

@@ -0,0 +1,20 @@
+<?php
+
+return [
+
+    'Pid'             => '父ID',
+    'Name'            => '规则',
+    'Balance'         => '余额',
+    'Bonus sum'       => '累计佣金',
+    'Parent id'       => '上级用户',
+    'Recharge'        => '充值',
+    'Withdraw'        => '提现',
+    'Level'           => '级别',
+    'Grade'           => '级',  
+    'Ban'             => '封禁',
+    'Ban team'        => '封禁团队',  
+    'Account'         => '帐变', 
+    'Createtime'      => '注册时间',
+    'Updatetime'      => '更新时间',
+
+];

+ 7 - 5
application/admin/lang/zh-cn/user/user.php

@@ -29,8 +29,6 @@ return [
     'Reduce'                => '减少',
     'Type'                  => '类型',
     'Amount'                => '金额',
-
-    
     'USDT address'          => 'USDT钱包地址',
     'Real name'             => '姓名',
     'Bank name'             => '开户行',
@@ -39,8 +37,12 @@ return [
     'Min amount'            => '最小金额',
     'Max amount'            => '最大金额',
     'Income multiple'       => '收益倍数',
-
-
-
+    'Agent ID'              => '代理ID',
+    'Code'                  => '区号',
+    'Nickname'              => '昵称',
+    'Login pwd'             => '登录密码',
+    'Fund pwd'              => '资金密码',
+    'Task num'              => '当前任务数',
+    'Pwd title'             => '留空则不修改',
 
 ];

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

@@ -70,6 +70,12 @@ class User extends Model
     }
 
 
+    public function parent()
+    {
+        return $this->hasOne('User','id','parent_id',[],'LEFT')->setEagerlyType(0);
+    }
+
+
     public function getPrevtimeTextAttr($value, $data)
     {
         $value = $value ? $value : ($data['prevtime'] ?? "");

+ 1 - 1
application/admin/model/UserPath.php

@@ -9,7 +9,7 @@ class UserPath extends Model
 {
 
     // 表名
-    protected $name = 'user_path';
+    protected $name = 'users_path';
     // 自动写入时间戳字段
     protected $autoWriteTimestamp = false;
     // 定义时间戳字段名

+ 11 - 12
application/admin/view/user/team/index.html

@@ -1,24 +1,23 @@
 <div class="panel panel-default panel-intro">
-    {:build_heading()}
+    <div class="panel-heading">
+        {:build_heading(null,FALSE)}
+        <ul class="nav nav-tabs">
+            <li class="active"><a href="#all" data-toggle="tab">{:__('All')}</a></li>
+            {foreach name="typeList" item="vo"}
+                <li><a href="#{$vo}" data-toggle="tab">{$vo} {:__('Grade')}</a></li>
+            {/foreach}
+        </ul>
+    </div>
 
     <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,add,edit,del')}
-                        <div class="dropdown btn-group {:$auth->check('user/rule/multi')?'':'hide'}">
-                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
-                            <ul class="dropdown-menu text-left" role="menu">
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
-                            </ul>
-                        </div>
-                        <a href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('Toggle all')}</a>
+                        {:build_toolbar('refresh')}
+
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('user/rule/edit')}"
-                           data-operate-del="{:$auth->check('user/rule/del')}"
                            width="100%">
                     </table>
                 </div>

+ 27 - 95
application/admin/view/user/user/edit.html

@@ -1,129 +1,61 @@
-<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+<form id="edit-form" role="form" data-toggle="validator" method="POST" action="">
     {:token()}
-    <input type="hidden" name="row[id]" value="{$row.id}">
+  
+    <div class="form-horizontal">
     <div class="form-group">
-        <label for="c-password" class="control-label col-xs-12 col-sm-2">{:__('Password')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-password" data-rule="password" class="form-control" name="row[password]" type="password" value="" placeholder="{:__('Leave password blank if dont want to change')}" autocomplete="new-password" />
-        </div>
-    </div>
-
-    <div class="form-group">
-        <label for="c-mobile" class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-mobile" data-rule="mobile" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
+        <label for="c-agent_id" class="control-label col-xs-12 col-sm-2">{:__('Agent ID')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-agent_id" data-rule="agent_id" class="form-control" name="row[agent_id]" type="agent_id" value="{$row.agent_id|htmlentities}" />
         </div>
     </div>
     <div class="form-group">
-        <label for="c-avatar" class="control-label col-xs-12 col-sm-2">{:__('Avatar')}:</label>
+        <label for="c-code" class="control-label col-xs-12 col-sm-2">{:__('Code')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <div class="input-group">
-                <input id="c-avatar" data-rule="" class="form-control" size="50" name="row[avatar]" type="text" value="{$row.avatar}">
-                <div class="input-group-addon no-border no-padding">
-                    <span><button type="button" id="faupload-avatar" class="btn btn-danger faupload" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-avatar"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
-                    <span><button type="button" id="fachoose-avatar" class="btn btn-primary fachoose" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
-                </div>
-                <span class="msg-box n-right" for="c-avatar"></span>
-            </div>
-            <ul class="row list-inline faupload-preview" id="p-avatar"></ul>
+            <input id="c-code" data-rule="required" class="form-control" name="row[code]" type="number" value="{$row.code|htmlentities}">
         </div>
     </div>
 
     <div class="form-group">
-        <label for="c-level" class="control-label col-xs-12 col-sm-2">{:__('Level')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-level" data-rule="required" class="form-control" name="row[level]" type="number" value="{$row.level}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Gender')}:</label>
+        <label for="c-mobile" class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
         <div class="col-xs-12 col-sm-8">
-            {:build_radios('row[gender]', ['1'=>__('Male'), '0'=>__('Female')], $row['gender'])}
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-birthday" class="control-label col-xs-12 col-sm-2">{:__('Birthday')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-birthday" data-rule="" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[birthday]" type="text" value="{$row.birthday}">
+            <input id="c-mobile" data-rule="mobile" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
         </div>
     </div>
     <div class="form-group">
-        <label for="c-bio" class="control-label col-xs-12 col-sm-2">{:__('Bio')}:</label>
+        <label for="c-nickname" class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-bio" data-rule="" class="form-control" name="row[bio]" type="text" value="{$row.bio|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-money" data-rule="required" class="form-control" name="row[money]" type="number" value="{$row.money}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-score" class="control-label col-xs-12 col-sm-2">{:__('Score')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-score" data-rule="required" class="form-control" name="row[score]" type="number" value="{$row.score}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-successions" class="control-label col-xs-12 col-sm-2">{:__('Successions')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-successions" data-rule="required" class="form-control" name="row[successions]" type="number" value="{$row.successions}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-maxsuccessions" class="control-label col-xs-12 col-sm-2">{:__('Maxsuccessions')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-maxsuccessions" data-rule="required" class="form-control" name="row[maxsuccessions]" type="number" value="{$row.maxsuccessions}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-prevtime" class="control-label col-xs-12 col-sm-2">{:__('Prevtime')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-prevtime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[prevtime]" type="text" value="{$row.prevtime|datetime}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-logintime" class="control-label col-xs-12 col-sm-2">{:__('Logintime')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-logintime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[logintime]" type="text" value="{$row.logintime|datetime}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-loginip" class="control-label col-xs-12 col-sm-2">{:__('Loginip')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-loginip" data-rule="required" class="form-control" name="row[loginip]" type="text" value="{$row.loginip}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-loginfailure" class="control-label col-xs-12 col-sm-2">{:__('Loginfailure')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-loginfailure" data-rule="required" class="form-control" name="row[loginfailure]" type="number" value="{$row.loginfailure}">
+            <input id="c-nickname" data-rule="nickname" class="form-control" name="row[nickname]" type="text" value="{$row.nickname|htmlentities}">
         </div>
     </div>
+
     <div class="form-group">
-        <label for="c-joinip" class="control-label col-xs-12 col-sm-2">{:__('Joinip')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-joinip" data-rule="required" class="form-control" name="row[joinip]" type="text" value="{$row.joinip}">
+        <label for="c-login_pwd" class="control-label col-xs-12 col-sm-2">{:__('Login pwd')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-login_pwd" class="form-control" name="row[login_pwd]" type="text" value="">
+            <a>{:__('Pwd title')}</a>
         </div>
     </div>
     <div class="form-group">
-        <label for="c-jointime" class="control-label col-xs-12 col-sm-2">{:__('Jointime')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-jointime" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[jointime]" type="text" value="{$row.jointime|datetime}">
+        <label for="c-fund_pwd" class="control-label col-xs-12 col-sm-2">{:__('Fund pwd')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-fund_pwd"  class="form-control" name="row[fund_pwd]" type="text" value="">
+            <a>{:__('Pwd title')}</a>
         </div>
     </div>
+
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
+        <label for="c-task_num" class="control-label col-xs-12 col-sm-2">{:__('Task num')}:</label>
         <div class="col-xs-12 col-sm-8">
-            {:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['status'])}
+            <input id="c-task_num" data-rule="required" class="form-control" name="row[task_num]" type="number" value="{$row.task_num|htmlentities}">
         </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-8">
             <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
             <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
         </div>
-    </div>
+    </div></div>
 </form>

+ 54 - 0
application/common/library/Oss.php

@@ -0,0 +1,54 @@
+<?php
+
+namespace app\common\library;
+
+use Psr\Log\AbstractLogger;
+use think\Hook;
+
+/**
+ * Oss文件上传
+ */
+class Oss extends AbstractLogger
+{
+
+       /**
+     * phpmailer对象
+     */
+    protected $mail = null;
+
+    /**
+     * 错误内容
+     */
+    protected $error = '';
+
+
+
+    /**
+     * 构造函数
+     * @param array $options
+     */
+    public function __construct($options = [])
+    {
+ 
+
+        //设置发件人
+        $this->from($this->options['mail_from'], $this->options['mail_smtp_user']);
+    }
+
+
+    /**
+     * Logs with an arbitrary level.
+     *
+     * @param mixed  $level
+     * @param string $message
+     * @param array  $context
+     *
+     * @return void
+     *
+     * @throws \Psr\Log\InvalidArgumentException
+     */
+    public function Init($level, $message, array $context = array())
+    {
+        \think\Log::write($message);
+    }
+}

+ 0 - 3
application/common/model/Lists.php

@@ -35,9 +35,6 @@ class Lists extends Model
         return $this->hasOne('Types','id','type_id',[],'LEFT')->setEagerlyType(0);
     }
 
-
-
-
     public function getCreateTimeTextAttr($value, $data)
     {
         $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : '');

+ 2 - 1
composer.json

@@ -30,7 +30,8 @@
         "ext-curl": "*",
         "ext-pdo": "*",
         "ext-bcmath": "*",
-        "txthinking/mailer": "^2.0"
+        "txthinking/mailer": "^2.0",
+        "aliyuncs/oss-sdk-php": "^2.7"
     },
     "config": {
         "preferred-install": "dist",

+ 1 - 0
public/assets/js/backend/news/lists.js

@@ -35,6 +35,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         },
                         {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        
                         {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]

+ 0 - 130
public/assets/js/backend/user/rule.js

@@ -1,130 +0,0 @@
-define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
-
-    var Controller = {
-        index: function () {
-            // 初始化表格参数配置
-            Table.api.init({
-                extend: {
-                    index_url: 'user/rule/index',
-                    add_url: 'user/rule/add',
-                    edit_url: 'user/rule/edit',
-                    del_url: 'user/rule/del',
-                    multi_url: 'user/rule/multi',
-                    table: 'user_rule',
-                }
-            });
-
-            var table = $("#table");
-
-            // 初始化表格
-            table.bootstrapTable({
-                url: $.fn.bootstrapTable.defaults.extend.index_url,
-                pk: 'id',
-                sortName: 'weigh',
-                escape: false,
-                columns: [
-                    [
-                        {checkbox: true},
-                        {field: 'id', title: __('Id')},
-                        {field: 'pid', title: __('Pid'), visible: false},
-                        {field: 'title', title: __('Title'), align: 'left', formatter: Controller.api.formatter.title},
-                        {field: 'name', title: __('Name'), align: 'left', formatter: Controller.api.formatter.name},
-                        {field: 'remark', title: __('Remark')},
-                        // {field: 'ismenu', title: __('Ismenu'), formatter: Table.api.formatter.toggle},
-                        {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true, visible: false},
-                        {field: 'updatetime', title: __('Updatetime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true, visible: false},
-                        {field: 'weigh', title: __('Weigh')},
-                        {field: 'status', title: __('Status'), formatter: Table.api.formatter.status},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
-                    ]
-                ],
-                pagination: false,
-                search: false,
-                commonSearch: false,
-                rowAttributes: function (row, index) {
-                    return row.pid == 0 ? {} : {style: "display:none"};
-                }
-            });
-
-            // 为表格绑定事件
-            Table.api.bindevent(table);
-
-            table.on('post-body.bs.table', function (e, settings, json, xhr) {
-                //显示隐藏子节点
-                $(">tbody>tr[data-index] > td", this).on('click', "a.btn-node-sub", function () {
-                    var status = $(this).data("shown") ? true : false;
-                    $("a[data-pid='" + $(this).data("id") + "']").each(function () {
-                        $(this).closest("tr").toggle(!status);
-                    });
-                    if (status) {
-                        $("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");
-                    }
-                    $(this).data("shown", !status);
-                    $("i", this).toggleClass("fa-caret-down").toggleClass("fa-caret-right");
-                    return false;
-                });
-            });
-
-            //隐藏子节点
-            $(document).on("collapse", ".btn-node-sub", function () {
-                if ($("i", this).length > 0) {
-                    $("a[data-pid='" + $(this).data("id") + "']").trigger("collapse");
-                }
-                $("i", this).removeClass("fa-caret-down").addClass("fa-caret-right");
-                $(this).data("shown", false);
-                $(this).closest("tr").toggle(false);
-            });
-
-            //展开隐藏一级
-            $(document.body).on("click", ".btn-toggle", function (e) {
-                $("a[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();
-                var that = this;
-                var show = $("i", that).hasClass("fa-chevron-down");
-                $("i", that).toggleClass("fa-chevron-down", !show).toggleClass("fa-chevron-up", show);
-                $("a[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);
-                $(".btn-node-sub[data-pid=0]").data("shown", show);
-            });
-
-            //展开隐藏全部
-            $(document.body).on("click", ".btn-toggle-all", function (e) {
-                var that = this;
-                var show = $("i", that).hasClass("fa-plus");
-                $("i", that).toggleClass("fa-plus", !show).toggleClass("fa-minus", show);
-                $(".btn-node-sub:not([data-pid=0])").closest("tr").toggle(show);
-                $(".btn-node-sub").data("shown", show);
-                $(".btn-node-sub > i").toggleClass("fa-caret-down", show).toggleClass("fa-caret-right", !show);
-            });
-        },
-        add: function () {
-            Controller.api.bindevent();
-        },
-        edit: function () {
-            Controller.api.bindevent();
-        },
-        api: {
-            formatter: {
-                title: function (value, row, index) {
-                    value = value.toString().replace(/(&|&amp;)nbsp;/g, '&nbsp;');
-                    var caret = row.haschild == 1 || row.ismenu == 1 ? '<i class="fa fa-caret-right"></i>' : '';
-                    value = value.indexOf("&nbsp;") > -1 ? value.replace(/(.*)&nbsp;/, "$1" + caret) : caret + value;
-
-                    value = !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
-                    return '<a href="javascript:;" data-id="' + row.id + '" data-pid="' + row.pid + '" class="'
-                        + (row.haschild == 1 || row.ismenu == 1 ? 'text-primary' : 'disabled') + ' btn-node-sub">' + value + '</a>';
-                },
-                name: function (value, row, index) {
-                    return !row.ismenu || row.status == 'hidden' ? "<span class='text-muted'>" + value + "</span>" : value;
-                },
-            },
-            bindevent: function () {
-                $(document).on('click', "input[name='row[ismenu]']", function () {
-                    var name = $("input[name='row[name]']");
-                    name.prop("placeholder", $(this).val() == 1 ? name.data("placeholder-menu") : name.data("placeholder-node"));
-                });
-                $("input[name='row[ismenu]']:checked").trigger("click");
-                Form.api.bindevent($("form[role=form]"));
-            }
-        }
-    };
-    return Controller;
-});

+ 99 - 0
public/assets/js/backend/user/team.js

@@ -0,0 +1,99 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'user/team/index'+ location.search +'&user_id='+Config.user_id,
+                    table: 'user_team',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'a.id',
+                sortName: 'a.id',
+                searchFormVisible: true,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id'), operate: false},
+                        {field: 'mobile', title: __('Mobile'), operate: 'Like'},
+                        {field: 'balance', title: __('Balance'), operate: false},
+                        {field: 'bonus_sum', title: __('Bonus sum'), operate: false},
+                        {field: 'parent_name', title: __('Parent id'),operate: false},
+                        {field: 'recharge', title: __('Recharge'), operate: false},
+                        {field: 'withdraw', title: __('Withdraw'), operate: false},
+
+                        {field: 'distance', title: __('Level'), formatter: function(value, row, index) {
+                            return value + __('Grade');
+                        }, operate: false,cellStyle: function () {
+                            return {css: {"color":"#18bc9c", 'font-weight':'550'}}}
+                        },
+                        {field: 'create_time', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'operate', title: __('Operate'), table: table,
+                            buttons: [
+                                {
+                                    name: "account",
+                                    text:  __('Account'),
+                                    classname: 'btn btn-xs btn-info btn-magic btn-dialog',
+                                    url: function(row){ return 'trade/moneylog/index/ids/'+row.id},
+                                    refresh: true
+                            },{
+                                name: "ban",
+                                text:  __('Ban'),
+                                classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
+                                url: function(row){ return 'user/team/lock/ids/'+row.id},
+                                visible: function (row) {
+                                    if(row.is_lock == 0)  return true;
+                                    return false;
+                                },
+                                refresh: true
+                            },{
+                                name: "banteam",
+                                text:  __('Ban team'),
+                                classname: 'btn btn-xs btn-warning btn-magic btn-ajax',
+                                url: function(row){ return 'user/team/lockAll/ids/'+row.id},
+                                refresh: true
+                            }],
+                            events: Table.api.events.operate, formatter: Table.api.formatter.operate
+                        }]
+                ],
+       
+           
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+            $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
+                var typeStr = $(this).attr("href").replace('#', '');
+                var options = table.bootstrapTable('getOptions');
+                options.pageNumber = 1;
+                options.queryParams = function (params) {
+                    params.distance = typeStr;
+                    return params;
+                };
+                table.bootstrapTable('refresh', {});
+                return false;
+            });
+   
+        },
+        account: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+ 
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});

+ 15 - 17
public/assets/js/backend/user/user.js

@@ -20,25 +20,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 初始化表格
             table.bootstrapTable({
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
-                pk: 'id',
-                sortName: 'user.id',
+                pk: 'a.id',
+                sortName: 'a.id',
                 columns: [
                     [
                         {checkbox: true},
-                        {field: 'id', title: __('Id'), sortable: true},
+                        {field: 'id', title: __('Id'), operate: false},
 
-                        {field: 'id', title: __('Group_id')},
+                        {field: 'agent', title: __('Group_id'), operate: false},
                         {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
-                        {field: 'parent_id', title: __('Parent_id'), operate: 'BETWEEN', sortable: true},
-                        {field: 'balance', title: __('Balance'), operate: 'BETWEEN', sortable: true},
-                        {field: 'freeze', title: __('Freeze'), operate: 'BETWEEN', sortable: true},
-                        {field: 'task_num', title: __('Task'), formatter: Table.api.formatter.search},
+                        {field: 'parent_name', title: __('Parent_id'), operate: false},
+                        {field: 'balance', title: __('Balance'), operate: false},
+                        {field: 'freeze', title: __('Freeze'), operate: false},
+                        {field: 'task_num', title: __('Task'), operate: false},
 
-                        {field: 'id', title: __('Recharge'), operate: 'BETWEEN', sortable: true},
-                        {field: 'id', title: __('Withdrawal'), operate: 'BETWEEN', sortable: true},
-                        {field: 'id', title: __('Income'), operate: 'BETWEEN', sortable: true},
+                        {field: 'id', title: __('Recharge'), operate: false},
+                        {field: 'id', title: __('Withdrawal'), operate: false},
+                        {field: 'id', title: __('Income'), operate: false},
 
-                        {field: 'invitation_code', title: __('Invitation_code'), formatter: Table.api.formatter.search},
+                        {field: 'invitation_code', title: __('Invitation_code'), operate: false},
                         {field: 'is_agent', title: __('Is_agent'), searchList: {1: __('Yes'), 0: __('No')}, formatter: Table.api.formatter.status},
                         
                         {field: 'user_type', title: __('User_type'), formatter: Table.api.formatter.toggle, 
@@ -55,8 +55,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     classname: 'btn btn-xs btn-info btn-magic btn-dialog',
                                     url: 'trade/moneylog/index',
                                     refresh: true
-                                },
-                                {
+                            },{
                                 name: "clear",
                                 text:  __('Clear'),
                                 classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
@@ -70,9 +69,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                 name: "team",
                                 text:  __('Team'),
                                 classname: 'btn btn-xs btn-success btn-magic btn-dialog',
-                                confirm: __('Confirm review'),
-                                url: 'user/group/Team',
-                
+                                url: 'user/team/index',
+                                extend: 'data-area=\'["80%","80%"]\'',
                                 refresh: true
                             },{
                                 name: "edit",