zac3533 před 1 rokem
rodič
revize
ce088a16e8
29 změnil soubory, kde provedl 591 přidání a 319 odebrání
  1. 26 8
      application/admin/controller/news/Lists.php
  2. 1 1
      application/admin/controller/news/Types.php
  3. 10 1
      application/admin/controller/trade/Moneylog.php
  4. 0 108
      application/admin/controller/user/Rule.php
  5. 49 0
      application/admin/controller/user/Team.php
  6. 208 22
      application/admin/controller/user/User.php
  7. 14 0
      application/admin/lang/vn/news/lists.php
  8. 5 0
      application/admin/lang/vn/news/types.php
  9. 9 5
      application/admin/lang/zh-cn/news/lists.php
  10. 13 0
      application/admin/lang/zh-cn/user/user.php
  11. 5 0
      application/admin/model/User.php
  12. 0 34
      application/admin/model/UserGroup.php
  13. 28 0
      application/admin/model/UserPath.php
  14. 0 67
      application/admin/model/UserRule.php
  15. 17 24
      application/admin/view/news/lists/add.html
  16. 0 0
      application/admin/view/user/team/add.html
  17. 0 0
      application/admin/view/user/team/edit.html
  18. 0 0
      application/admin/view/user/team/index.html
  19. 41 0
      application/admin/view/user/user/balance.html
  20. 40 0
      application/admin/view/user/user/cardslip.html
  21. 42 0
      application/admin/view/user/user/collection.html
  22. 2 24
      application/admin/view/user/user/edit.html
  23. 2 2
      application/admin/view/user/user/index.html
  24. 22 0
      application/common.php
  25. 9 5
      application/common/model/Lists.php
  26. 1 3
      application/common/model/Types.php
  27. 6 3
      public/assets/js/backend/news/lists.js
  28. 1 1
      public/assets/js/backend/trade/moneylog.js
  29. 40 11
      public/assets/js/backend/user/user.js

+ 26 - 8
application/admin/controller/news/Lists.php

@@ -21,17 +21,35 @@ class Lists extends Backend
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\admin\model\news\Lists;
+        $this->model = new \app\common\model\Lists;
 
     }
 
-
-
-    /**
-     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
-     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
-     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     /**
+     * 查看
+     *
+     * @return string|Json
+     * @throws \think\Exception
+     * @throws DbException
      */
-
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if (false === $this->request->isAjax()) {
+            return $this->view->fetch();
+        }
+        //如果发送的来源是 Selectpage,则转发到 Selectpage
+        if ($this->request->request('keyField')) {
+            return $this->selectpage();
+        }
+        [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+        $list = $this->model->with('types')
+            ->where($where)
+            ->order($sort, $order)
+            ->paginate($limit);
+        $result = ['total' => $list->total(), 'rows' => $list->items()];
+        return json($result);
+    }
 
 }

+ 1 - 1
application/admin/controller/news/Types.php

@@ -21,7 +21,7 @@ class Types extends Backend
     public function _initialize()
     {
         parent::_initialize();
-        $this->model = new \app\admin\model\news\Types;
+        $this->model = new \app\common\model\Types;
 
     }
 

+ 10 - 1
application/admin/controller/trade/Moneylog.php

@@ -22,6 +22,7 @@ class Moneylog extends Backend
     {
         parent::_initialize();
         $this->model = new \app\common\model\Moneylog;
+        $this->assignconfig('user_id', $this->request->param('ids/d', 0));
 
     }
 
@@ -45,8 +46,16 @@ class Moneylog extends Backend
             return $this->selectpage();
         }
         [$where, $sort, $order, $offset, $limit] = $this->buildparams();
+
+        $map = [];
+        $user_id = $this->request->param('user_id/d', 0);
+
+
+        if($user_id > 0) $map['user_id'] = $user_id ;
+
+
         $list = $this->model->with('users,fromuser')
-            ->where($where)
+            ->where($where)->where($map)
             ->order($sort, $order)
             ->paginate($limit);
         $result = ['total' => $list->total(), 'rows' => $list->items()];

+ 0 - 108
application/admin/controller/user/Rule.php

@@ -1,108 +0,0 @@
-<?php
-
-namespace app\admin\controller\user;
-
-use app\common\controller\Backend;
-use fast\Tree;
-
-/**
- * 会员规则管理
- *
- * @icon fa fa-circle-o
- */
-class Rule extends Backend
-{
-
-    /**
-     * @var \app\admin\model\UserRule
-     */
-    protected $model = null;
-    protected $rulelist = [];
-    protected $multiFields = 'ismenu,status';
-
-    public function _initialize()
-    {
-        parent::_initialize();
-        $this->model = model('UserRule');
-        $this->view->assign("statusList", $this->model->getStatusList());
-        // 必须将结果集转换为数组
-        $ruleList = collection($this->model->order('weigh', 'desc')->select())->toArray();
-        foreach ($ruleList as $k => &$v) {
-            $v['title'] = __($v['title']);
-            $v['remark'] = __($v['remark']);
-        }
-        unset($v);
-        Tree::instance()->init($ruleList)->icon = ['&nbsp;&nbsp;&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;', '&nbsp;&nbsp;&nbsp;&nbsp;'];
-        $this->rulelist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'title');
-        $ruledata = [0 => __('None')];
-        foreach ($this->rulelist as $k => &$v) {
-            if (!$v['ismenu']) {
-                continue;
-            }
-            $ruledata[$v['id']] = $v['title'];
-        }
-        $this->view->assign('ruledata', $ruledata);
-    }
-
-    /**
-     * 查看
-     */
-    public function index()
-    {
-        if ($this->request->isAjax()) {
-            $list = $this->rulelist;
-            $total = count($this->rulelist);
-
-            $result = array("total" => $total, "rows" => $list);
-
-            return json($result);
-        }
-        return $this->view->fetch();
-    }
-
-    /**
-     * 添加
-     */
-    public function add()
-    {
-        if ($this->request->isPost()) {
-            $this->token();
-        }
-        return parent::add();
-    }
-
-    /**
-     * 编辑
-     */
-    public function edit($ids = null)
-    {
-        if ($this->request->isPost()) {
-            $this->token();
-        }
-        return parent::edit($ids);
-    }
-
-    /**
-     * 删除
-     */
-    public function del($ids = "")
-    {
-        if (!$this->request->isPost()) {
-            $this->error(__("Invalid parameters"));
-        }
-        $ids = $ids ? $ids : $this->request->post("ids");
-        if ($ids) {
-            $delIds = [];
-            foreach (explode(',', $ids) as $k => $v) {
-                $delIds = array_merge($delIds, Tree::instance()->getChildrenIds($v, true));
-            }
-            $delIds = array_unique($delIds);
-            $count = $this->model->where('id', 'in', $delIds)->delete();
-            if ($count) {
-                $this->success();
-            }
-        }
-        $this->error();
-    }
-
-}

+ 49 - 0
application/admin/controller/user/Team.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace app\admin\controller\user;
+
+use app\common\controller\Backend;
+use fast\Tree;
+
+/**
+ * 会员团队
+ *
+ * @icon fa fa-circle-o
+ */
+class Team extends Backend
+{
+
+    /**
+     * @var \app\admin\model\UserRule
+     */
+    protected $model = null;
+ 
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = model('UserRule');
+ 
+    }
+
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        if ($this->request->isAjax()) {
+            $list = $this->rulelist;
+            $total = count($this->rulelist);
+
+            $result = array("total" => $total, "rows" => $list);
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+ 
+
+
+
+
+}

+ 208 - 22
application/admin/controller/user/User.php

@@ -2,9 +2,13 @@
 
 namespace app\admin\controller\user;
 
+use think\Db;
+use Exception;
+use app\common\model\Moneylog;
+use think\exception\DbException;
+use think\exception\PDOException;
 use app\common\controller\Backend;
-use app\common\library\Auth;
-
+use think\exception\ValidateException;
 /**
  * 会员管理
  *
@@ -14,7 +18,7 @@ class User extends Backend
 {
 
     protected $relationSearch = true;
-    protected $searchFields = 'id,username,nickname';
+    protected $searchFields = 'id,mobile';
 
     /**
      * @var \app\admin\model\User
@@ -26,6 +30,7 @@ class User extends Backend
         parent::_initialize();
         $this->model = model('User');
         $this->assign('statusList', $this->model->getStatusList());
+        $this->assign('typeList', $this->model->getTypeList());
         
     }
 
@@ -58,50 +63,231 @@ class User extends Backend
         return $this->view->fetch();
     }
 
+
     /**
-     * 添加
+     * 余额     public function balance($ids = null)
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
      */
-    public function add()
+    public function balance($ids = null)
     {
-        if ($this->request->isPost()) {
-            $this->token();
+        $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'));
+        }
+        if (false === $this->request->isPost()) {
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
         }
-        return parent::add();
+        $params = $this->preExcludeFields($params);
+        $result = false;
+        Db::startTrans();
+        try {
+            $balance = build_amount_compute($params['type'], $params['amount'], $row->balance);
+            //操作记录
+            Moneylog::create(['user_id'=> $params['id'], 
+                'from_id'=> $this->auth->id,
+                'amount'=> $params['amount'],
+                'balance'=> $balance
+            ]);
+            $result = $row->allowField(true)->save(['balance'=>$balance]);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $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 edit($ids = null)
+    public function cardslip($ids = null)
     {
-        if ($this->request->isPost()) {
-            $this->token();
+        $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'));
+        }
+        if (false === $this->request->isPost()) {
+
+            $task = json_decode($row->linit_task, true);
+            $row->which_start   = $task['which_start']??'';
+            $row->min_amount    = $task['min_amount']??'';
+            $row->max_amount    = $task['max_amount']??'';
+            $row->income_multiple= $task['income_multiple']??'';
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
         }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+        $result = false;
+        Db::startTrans();
+        try {
+      
+            unset($params['id']);
+            $result = $row->allowField(true)->save(['linit_task'=>json_encode($params)]);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $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 collection($ids = null)
+    {
         $row = $this->model->get($ids);
-        $this->modelValidate = true;
         if (!$row) {
             $this->error(__('No Results were found'));
         }
-        $this->view->assign('groupList', build_select('row[group_id]', \app\admin\model\UserGroup::column('id,name'), $row['group_id'], ['class' => 'form-control selectpicker']));
-        return parent::edit($ids);
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+        if (false === $this->request->isPost()) {
+            $bank = json_decode($row->bank_info, true);
+            $row->real_name = $bank['real_name']??'';
+            $row->bank_name = $bank['bank_name']??'';
+            $row->bank_card = $bank['bank_card']??'';
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+        $result = false;
+        Db::startTrans();
+        try {
+
+            $addr = $params['usdt_address'];
+            unset($params['id'],$params['usdt_address']);
+            $result = $row->allowField(true)->save(['usdt_address'=> $addr, 'bank_info'=>json_encode($params)]);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
+        $this->success();
     }
 
+
     /**
-     * 删除
+     * 清0
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
      */
-    public function del($ids = "")
+    public function clear($ids = null)
     {
-        if (!$this->request->isPost()) {
-            $this->error(__("Invalid parameters"));
+        $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(['task_num'=>0]);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
         }
-        $ids = $ids ? $ids : $this->request->post("ids");
+        $this->success();
+    }
+
+
+    /**
+     * 编辑
+     *
+     * @param $ids
+     * @return string
+     * @throws DbException
+     * @throws \think\Exception
+     */
+    public function edit($ids = null)
+    {
         $row = $this->model->get($ids);
-        $this->modelValidate = true;
         if (!$row) {
             $this->error(__('No Results were found'));
         }
-        Auth::instance()->delete($row['id']);
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+            $this->error(__('You have no permission'));
+        }
+        if (false === $this->request->isPost()) {
+            $this->view->assign('row', $row);
+            return $this->view->fetch();
+        }
+        $params = $this->request->post('row/a');
+        if (empty($params)) {
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $params = $this->preExcludeFields($params);
+        $result = false;
+        Db::startTrans();
+        try {
+            //是否采用模型验证
+            if ($this->modelValidate) {
+                $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+                $row->validateFailException()->validate($validate);
+            }
+            $result = $row->allowField(true)->save($params);
+            Db::commit();
+        } catch (ValidateException|PDOException|Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
+        }
+        if (false === $result) {
+            $this->error(__('No rows were updated'));
+        }
         $this->success();
     }
 
+
+
 }

+ 14 - 0
application/admin/lang/vn/news/lists.php

@@ -0,0 +1,14 @@
+<?php
+
+return [
+    'Title'         => 'tiêu đề',
+    'Type_id'       => 'Phân loại',
+    'Img_url'       => 'Hình ảnh được đề xuất',
+    'Content'       => 'nội dung',
+    'Status'        => 'Trạng thái đã bật',
+    'Enable'        => 'cho phép',
+    'Off shelf'     => 'Đã xóa khỏi kệ',
+    'Create_time'     => 'thêm thời gian',
+    'Update_time'     => 'Cập nhật thời gian',
+
+];

+ 5 - 0
application/admin/lang/vn/news/types.php

@@ -0,0 +1,5 @@
+<?php
+
+return [
+    'Title' => 'tên danh mục'
+];

+ 9 - 5
application/admin/lang/zh-cn/news/lists.php

@@ -1,9 +1,13 @@
 <?php
 
 return [
-    'Title'   => '标题',
-    'Type_id' => '分类ID',
-    'Img_url' => '推荐图片',
-    'Content' => '内容',
-    'Status'  => '启用状态:0下架 1启用'
+    'Title'         => '标题',
+    'Type_id'       => '分类',
+    'Img_url'       => '推荐图片',
+    'Content'       => '内容',
+    'Status'        => '启用状态',
+    'Enable'        => '启用',
+    'Off shelf'     => '下架',
+    'Create_time'   => '添加时间',
+    'Update_time'   => '更新时间',
 ];

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

@@ -25,7 +25,20 @@ return [
     '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'       => '收益倍数',
 
 
 

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

@@ -63,6 +63,11 @@ class User extends Model
         return ['1' => __('Open'), '0' => __('Close')];
     }
 
+    
+    public function getTypeList()
+    {
+        return [0 => __('New'), 1 => __('Reduce')];
+    }
 
 
     public function getPrevtimeTextAttr($value, $data)

+ 0 - 34
application/admin/model/UserGroup.php

@@ -1,34 +0,0 @@
-<?php
-
-namespace app\admin\model;
-
-use think\Model;
-
-class UserGroup extends Model
-{
-
-    // 表名
-    protected $name = 'user_group';
-    // 自动写入时间戳字段
-    protected $autoWriteTimestamp = 'int';
-    // 定义时间戳字段名
-    protected $createTime = 'createtime';
-    protected $updateTime = 'updatetime';
-    // 追加属性
-    protected $append = [
-        'status_text'
-    ];
-
-    public function getStatusList()
-    {
-        return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
-    }
-
-    public function getStatusTextAttr($value, $data)
-    {
-        $value = $value ? $value : $data['status'];
-        $list = $this->getStatusList();
-        return isset($list[$value]) ? $list[$value] : '';
-    }
-
-}

+ 28 - 0
application/admin/model/UserPath.php

@@ -0,0 +1,28 @@
+<?php
+
+namespace app\admin\model;
+
+use fast\Tree;
+use think\Model;
+
+class UserPath extends Model
+{
+
+    // 表名
+    protected $name = 'user_path';
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = false;
+    // 定义时间戳字段名
+    protected $createTime = false;
+    protected $updateTime = false;
+    // 追加属性
+    protected $append = [
+
+    ];
+
+
+
+
+  
+
+}

+ 0 - 67
application/admin/model/UserRule.php

@@ -1,67 +0,0 @@
-<?php
-
-namespace app\admin\model;
-
-use fast\Tree;
-use think\Model;
-
-class UserRule extends Model
-{
-
-    // 表名
-    protected $name = 'user_rule';
-    // 自动写入时间戳字段
-    protected $autoWriteTimestamp = 'int';
-    // 定义时间戳字段名
-    protected $createTime = 'createtime';
-    protected $updateTime = 'updatetime';
-    // 追加属性
-    protected $append = [
-        'status_text'
-    ];
-
-    protected static function init()
-    {
-        self::afterInsert(function ($row) {
-            $pk = $row->getPk();
-            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
-        });
-    }
-
-    public function getTitleAttr($value, $data)
-    {
-        return __($value);
-    }
-
-    public function getStatusList()
-    {
-        return ['normal' => __('Normal'), 'hidden' => __('Hidden')];
-    }
-
-    public function getStatusTextAttr($value, $data)
-    {
-        $value = $value ? $value : $data['status'];
-        $list = $this->getStatusList();
-        return isset($list[$value]) ? $list[$value] : '';
-    }
-
-    public static function getTreeList($selected = [])
-    {
-        $ruleList = collection(self::where('status', 'normal')->order('weigh desc,id desc')->select())->toArray();
-        $nodeList = [];
-        Tree::instance()->init($ruleList);
-        $ruleList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
-        $hasChildrens = [];
-        foreach ($ruleList as $k => $v)
-        {
-            if ($v['haschild'])
-                $hasChildrens[] = $v['id'];
-        }
-        foreach ($ruleList as $k => $v) {
-            $state = array('selected' => in_array($v['id'], $selected) && !in_array($v['id'], $hasChildrens));
-            $nodeList[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => 'menu', 'state' => $state);
-        }
-        return $nodeList;
-    }
-
-}

+ 17 - 24
application/admin/view/news/lists/add.html

@@ -1,5 +1,5 @@
-<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
-
+<form id="add-form" role="form" data-toggle="validator" method="POST" action="">
+    <div class="form-horizontal">
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
         <div class="col-xs-12 col-sm-8">
@@ -9,13 +9,22 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Type_id')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-type_id" data-rule="required" data-source="type/index" class="form-control selectpage" name="row[type_id]" type="text" value="">
+            <input id="c-type_id" data-rule="required" data-field="title" data-source="news/types/index" class="form-control selectpage" name="row[type_id]" type="text" value="">
         </div>
     </div>
+  
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Img_url')}:</label>
+        <label for="c-img_url" class="control-label col-xs-12 col-sm-2">{:__('Img_url')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <input id="c-img_url" class="form-control" name="row[img_url]" type="text">
+            <div class="input-group">
+                <input id="c-img_url" data-rule="" class="form-control" size="50" name="row[img_url]" type="text" value="">
+                <div class="input-group-addon no-border no-padding">
+                    <span><button type="button" id="faupload-img_url" class="btn btn-danger faupload" data-input-id="c-img_url" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-img_url"><i class="fa fa-upload"></i> 上传</button></span>
+                    <span><button type="button" id="fachoose-img_url" class="btn btn-primary fachoose" data-input-id="c-img_url" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> 选择</button></span>
+                </div>
+                <span class="msg-box n-right" for="c-img_url"></span>
+            </div>
+            <ul class="row list-inline faupload-preview" id="p-img_url"></ul>
         </div>
     </div>
     <div class="form-group">
@@ -24,28 +33,12 @@
             <textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
         </div>
     </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-status" class="form-control" name="row[status]" type="number" value="0">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Create_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-create_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create_time]" type="text" value="{:date('Y-m-d H:i:s')}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Update_time')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-update_time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update_time]" type="text" value="{:date('Y-m-d H:i:s')}">
-        </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>
         </div>
-    </div>
+    </div></div>
 </form>

+ 0 - 0
application/admin/view/user/rule/add.html → application/admin/view/user/team/add.html


+ 0 - 0
application/admin/view/user/rule/edit.html → application/admin/view/user/team/edit.html


+ 0 - 0
application/admin/view/user/rule/index.html → application/admin/view/user/team/index.html


+ 41 - 0
application/admin/view/user/user/balance.html

@@ -0,0 +1,41 @@
+<form id="edit-form" role="form" data-toggle="validator" method="POST" action="">
+    {:token()}
+    <div class="form-horizontal">
+    <input type="hidden" name="row[id]" value="{$row.id}">
+    <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-8">
+            <input id="c-mobile" data-rule="mobile" disabled class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label for="c-balance" class="control-label col-xs-12 col-sm-2">{:__('Balance')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-balance" disabled class="form-control" name="row[balance]" type="number" value="{$row.balance}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-agent_in_usdt" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:Form::radios('row[type]', $typeList, 0, ['data-rule'=>'required'])}
+        </div>
+    </div>
+    
+    <div class="form-group">
+        <label for="c-balance" class="control-label col-xs-12 col-sm-2">{:__('Amount')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-amount" data-rule="required" class="form-control" name="row[amount]" type="number" value="">
+        </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>
+</form>

+ 40 - 0
application/admin/view/user/user/cardslip.html

@@ -0,0 +1,40 @@
+<form id="edit-form" role="form" data-toggle="validator" method="POST" action="">
+    {:token()}
+    <div class="form-horizontal">
+    <input type="hidden" name="row[id]" value="{$row.id}">
+    <div class="form-group">
+        <label for="c-which_start" class="control-label col-xs-12 col-sm-2">{:__('Which start')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-which_start" data-rule="required" class="form-control" name="row[which_start]" type="number" value="{$row.which_start|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-min_amount" class="control-label col-xs-12 col-sm-2">{:__('Min amount')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-min_amount" data-rule="required" class="form-control" name="row[min_amount]" type="text" value="{$row.min_amount|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-max_amount" class="control-label col-xs-12 col-sm-2">{:__('Max amount')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-max_amount" data-rule="required" class="form-control" name="row[max_amount]" type="number" value="{$row.max_amount|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label for="c-income_multiple" class="control-label col-xs-12 col-sm-2">{:__('Income multiple')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-income_multiple" data-rule="required" class="form-control" name="row[income_multiple]" type="number" value="{$row.income_multiple|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 ">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+    </div>
+</form>

+ 42 - 0
application/admin/view/user/user/collection.html

@@ -0,0 +1,42 @@
+<form id="edit-form" role="form" data-toggle="validator" method="POST" action="">
+    {:token()}
+    <div class="form-horizontal">
+    <input type="hidden" name="row[id]" value="{$row.id}">
+    
+    <div class="form-group">
+        <label for="c-usdt_address" class="control-label col-xs-12 col-sm-2">{:__('USDT address')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-usdt_address" data-rule="required" class="form-control" name="row[usdt_address]" type="text" value="{$row.usdt_address|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label for="c-real_name" class="control-label col-xs-12 col-sm-2">{:__('Real name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-real_name" data-rule="required" class="form-control" name="row[real_name]" type="text" value="{$row.real_name|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-bank_name" class="control-label col-xs-12 col-sm-2">{:__('Bank name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-bank_name" data-rule="required" class="form-control" name="row[bank_name]" type="number" value="{$row.bank_name|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label for="c-bank_card" class="control-label col-xs-12 col-sm-2">{:__('Bank card')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-bank_card" data-rule="required" class="form-control" name="row[bank_card]" type="number" value="{$row.bank_card|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 ">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+    </div>
+</form>

+ 2 - 24
application/admin/view/user/user/edit.html

@@ -1,36 +1,13 @@
 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
     {:token()}
     <input type="hidden" name="row[id]" value="{$row.id}">
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            {$groupList}
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-username" class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-username" data-rule="required" class="form-control" name="row[username]" type="text" value="{$row.username|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label for="c-nickname" class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-nickname" data-rule="required" class="form-control" name="row[nickname]" type="text" value="{$row.nickname|htmlentities}">
-        </div>
-    </div>
     <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-email" class="control-label col-xs-12 col-sm-2">{:__('Email')}:</label>
-        <div class="col-xs-12 col-sm-4">
-            <input id="c-email" data-rule="email" class="form-control" name="row[email]" type="text" value="{$row.email|htmlentities}">
-        </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">
@@ -51,6 +28,7 @@
             <ul class="row list-inline faupload-preview" id="p-avatar"></ul>
         </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">

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

@@ -10,7 +10,7 @@
                         <a href="javascript:;" class="btn btn-success btn-balance btn-disabled disabled {:$auth->check('user/user/balance')?'':'hide'}" title="{:__('Balance')}" >
                             {:__('Balance')}
                         </a>
-                        <a href="javascript:;" class="btn btn-info btn-cardSlip btn-disabled disabled {:$auth->check('user/user/cardSlip')?'':'hide'}" title="{:__('Card slip')}" >
+                        <a href="javascript:;" class="btn btn-info btn-cardslip btn-disabled disabled {:$auth->check('user/user/cardslip')?'':'hide'}" title="{:__('Card slip')}" >
                             {:__('Card slip')}
                         </a>
                         <a href="javascript:;" class="btn btn-primary btn-collection btn-disabled disabled {:$auth->check('user/user/collection')?'':'hide'}" title="{:__('Collection')}" >
@@ -20,7 +20,7 @@
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
                            data-operate-balance="{:$auth->check('user/user/balance')}"
                            data-operate-cardSlip="{:$auth->check('user/user/cardSlip')}"
-                           data-operate-collection="{:$auth->check('user/user/del')}"
+                           data-operate-collection="{:$auth->check('user/user/collection')}"
                            width="100%">
                     </table>
                 </div>

+ 22 - 0
application/common.php

@@ -560,3 +560,25 @@ EOT;
         return $icon;
     }
 }
+
+
+
+/**
+ * 生成文件后缀图片
+ * @param string $unit +-
+ * @param float   $amount  调整金额
+ * @param float   $balance 余额
+ * @return float
+ */
+function build_amount_compute($unit, $amount, $balance): float
+{   $res = 0;
+    switch ($unit) {
+        case 0:
+            $res =bcadd($amount, $balance, 6);
+            break;
+        default:
+            // 如果没有匹配的值
+            if($balance > $amount) $res = bcsub($balance, $amount, 6);     
+    }
+    return $res;
+}

+ 9 - 5
application/common/model/Lists.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace app\admin\model\news;
+namespace app\common\model;
 
 use think\Model;
 
@@ -16,11 +16,11 @@ class Lists extends Model
     protected $name = 'news';
     
     // 自动写入时间戳字段
-    protected $autoWriteTimestamp = false;
+    protected $autoWriteTimestamp = 'int';
 
     // 定义时间戳字段名
-    protected $createTime = false;
-    protected $updateTime = false;
+    protected $createTime = 'create_time';
+    protected $updateTime = 'update_time';
     protected $deleteTime = false;
 
     // 追加属性
@@ -30,7 +30,11 @@ class Lists extends Model
     ];
     
 
-    
+    public function types()
+    {
+        return $this->hasOne('Types','id','type_id',[],'LEFT')->setEagerlyType(0);
+    }
+
 
 
 

+ 1 - 3
application/common/model/Types.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace app\admin\model\news;
+namespace app\common\model;
 
 use think\Model;
 
@@ -10,8 +10,6 @@ class Types extends Model
 
     
 
-    
-
     // 表名
     protected $name = 'news_type';
     

+ 6 - 3
public/assets/js/backend/news/lists.js

@@ -27,9 +27,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
                         {field: 'title', title: __('Title'), operate: 'LIKE'},
-                        {field: 'type_id', title: __('Type_id')},
-                        {field: 'img_url', title: __('Img_url'), operate: 'LIKE', formatter: Table.api.formatter.url},
-                        {field: 'status', title: __('Status')},
+                        {field: 'types.title', title: __('Type_id')},
+                        {field: 'img_url', title: __('Img_url'), events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'status', title: __('Status'), 
+                            searchList: {"1":__('Enable'),"0":__('Off shelf')}, 
+                            formatter: Table.api.formatter.toggle
+                        },
                         {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}

+ 1 - 1
public/assets/js/backend/trade/moneylog.js

@@ -5,7 +5,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 初始化表格参数配置
             Table.api.init({
                 extend: {
-                    index_url: 'trade/moneylog/index' + location.search,
+                    index_url: 'trade/moneylog/index' + location.search +'&user_id='+Config.user_id,
                     table: 'money_log',
                 }
             });

+ 40 - 11
public/assets/js/backend/user/user.js

@@ -8,6 +8,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     index_url: 'user/user/index',
                     edit_url: 'user/user/edit',
                     del_url: 'user/user/del',
+                    balance_url: 'user/user/balance',
+                    cardslip_url: 'user/user/cardslip',
+                    collection_url: 'user/user/collection',
                     table: 'user',
                 }
             });
@@ -50,25 +53,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                     name: "account",
                                     text:  __('Account change'),
                                     classname: 'btn btn-xs btn-info btn-magic btn-dialog',
-                                    url: 'user/group/edit',
+                                    url: 'trade/moneylog/index',
                                     refresh: true
                                 },
                                 {
                                 name: "clear",
                                 text:  __('Clear'),
-                                classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
-                                url: 'user/group/edit',
+                                classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
+                                url: 'user/user/clear',
+                                visible: function (row) {
+                                    if(row.task_num > 0)  return true;
+                                    return false;
+                                },
                                 refresh: true
                             },{
                                 name: "team",
                                 text:  __('Team'),
-                                classname: 'btn btn-xs btn-success btn-magic btn-ajax',
+                                classname: 'btn btn-xs btn-success btn-magic btn-dialog',
                                 confirm: __('Confirm review'),
-                                url: 'user/group/disable/is_lock/1',
-                                visible: function (row) {
-                                    if(row.is_lock == 0)  return true;
-                                    return false;
-                                },
+                                url: 'user/group/Team',
+                
                                 refresh: true
                             },{
                                 name: "edit",
@@ -82,7 +86,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                 classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
                                 confirm: __('Confirm review'),
                                 url: 'user/user/del',
-                       
                                 refresh: true
                             }],
                             events: Table.api.events.operate, formatter: Table.api.formatter.operate
@@ -93,8 +96,34 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
             // 为表格绑定事件
             Table.api.bindevent(table);
+
+            //余额           
+            $(document).on('click','.btn-balance',function () {
+                var ids = Table.api.selectedids(table);
+                Fast.api.open($.fn.bootstrapTable.defaults.extend.balance_url + "?ids=" + ids, __('Balance'))
+            });
+            //卡单  
+            $(document).on('click','.btn-cardslip',function () {
+                var ids = Table.api.selectedids(table);
+                Fast.api.open($.fn.bootstrapTable.defaults.extend.cardslip_url + "?ids=" + ids, __('Card slip'))
+            });
+            //收款  
+            $(document).on('click','.btn-collection',function () {
+                var ids = Table.api.selectedids(table);
+                Fast.api.open($.fn.bootstrapTable.defaults.extend.collection_url + "?ids=" + ids, __('Collection'))
+            });
+
+        },
+        balance: function () {
+            //余额
+            Controller.api.bindevent();
+        },
+        cardslip: function () {
+            //卡单
+            Controller.api.bindevent();
         },
-        add: function () {
+        collection: function () {
+            //收款
             Controller.api.bindevent();
         },
         edit: function () {