Browse Source

Merge branch 'master' of http://git.huxiukeji.com/zhangxiaobin/ggyuyin

lizhen_gitee 1 year ago
parent
commit
904d282b2a
43 changed files with 1242 additions and 134 deletions
  1. 179 0
      application/admin/controller/UserInvite.php
  2. 82 1
      application/admin/controller/UserPower.php
  3. 186 7
      application/admin/controller/user/User.php
  4. 2 2
      application/admin/lang/zh-cn/user/rechargelog.php
  5. 5 0
      application/admin/lang/zh-cn/user/user.php
  6. 11 0
      application/admin/lang/zh-cn/user_invite.php
  7. 35 0
      application/admin/model/User.php
  8. 49 0
      application/admin/model/UserInvite.php
  9. 1 1
      application/admin/model/UserPower.php
  10. 1 1
      application/admin/model/gift/Log.php
  11. 27 0
      application/admin/validate/UserInvite.php
  12. 1 1
      application/admin/view/gift/back/add.html
  13. 1 1
      application/admin/view/gift/back/edit.html
  14. 2 2
      application/admin/view/gift/back/index.html
  15. 4 4
      application/admin/view/gift/gift/add.html
  16. 73 0
      application/admin/view/user/user/add.html
  17. 41 0
      application/admin/view/user/user/add_jewel.html
  18. 10 0
      application/admin/view/user/user/edit.html
  19. 1 1
      application/admin/view/user/user/index.html
  20. 22 0
      application/admin/view/user_invite/add.html
  21. 22 0
      application/admin/view/user_invite/edit.html
  22. 35 0
      application/admin/view/user_invite/index.html
  23. 14 6
      application/api/controller/Dispatch.php
  24. 33 0
      application/api/controller/Guild.php
  25. 15 7
      application/api/controller/Money.php
  26. 2 2
      application/api/controller/Notify.php
  27. 2 2
      application/api/controller/Party.php
  28. 21 1
      application/api/controller/Tenim.php
  29. 5 3
      application/api/controller/Usercenter.php
  30. 101 73
      application/api/controller/Usersign.php
  31. 2 2
      application/common.php
  32. 5 2
      application/common/library/Auth.php
  33. 3 1
      application/common/model/Wallet.php
  34. 1 1
      application/common/service/RoomService.php
  35. 70 0
      application/common/service/TenimService.php
  36. 44 0
      application/common/service/UserService.php
  37. 8 1
      application/extra/site.php
  38. 3 0
      application/extra/wallet.php
  39. 1 1
      extend/AliPay/AliPay.php
  40. 1 1
      public/assets/js/backend/gift/back.js
  41. 21 9
      public/assets/js/backend/user/user.js
  42. 56 0
      public/assets/js/backend/user_invite.js
  43. 44 1
      public/assets/js/backend/user_power.js

+ 179 - 0
application/admin/controller/UserInvite.php

@@ -0,0 +1,179 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+use think\Db;
+
+/**
+ * 用户邀请管理
+ *
+ * @icon fa fa-circle-o
+ */
+class UserInvite extends Backend
+{
+    
+    /**
+     * UserInvite模型对象
+     * @var \app\admin\model\UserInvite
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\UserInvite;
+
+    }
+
+    public function import()
+    {
+        parent::import();
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+    
+
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //当前是否为关联查询
+        $this->relationSearch = true;
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+
+            $list = $this->model
+                    ->with(['user','inviteuser'])
+                    ->where($where)
+                    ->order($sort, $order)
+                    ->paginate($limit);
+
+            foreach ($list as $row) {
+                
+                $row->getRelation('user')->visible(['nickname']);
+                $row->getRelation('inviteuser')->visible(['nickname']);
+            }
+
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 添加
+     */
+    public function add()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $params = $this->preExcludeFields($params);
+            if (!$params) {
+                $this->error(__('Parameter %s can not be empty', ''));
+            }
+            Db::startTrans();
+            try {
+                //是否采用模型验证
+                if ($this->modelValidate) {
+                    $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                    $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
+                    $this->model->validateFailException(true)->validate($validate);
+                }
+                if ($params['invite_user_id'] == $params['user_id']) {
+                    throw new Exception('不能邀请自己');
+                }
+                if (!empty($params['invite_user_id'])) {
+                    $userWhere['id'] = $params['invite_user_id'];
+                    $user = Db::name('user')->where($userWhere)->find();
+                    if ($user['pre_userid'] != 0) {
+                        throw new Exception('该用户已被邀请');
+                    }
+                    $userRes = Db::name('user_id')->where($userWhere)->update(['pre_userid'=>$params['user_id']]);
+                    if (!$userRes) {
+                        throw new Exception('更新用户邀请信息失败');
+                    }
+                }
+                $result = $this->model->allowField(true)->save($params);
+                if ($result == false) {
+                    throw new Exception(__('No rows were inserted'));
+                }
+                Db::commit();
+                $this->success();
+            } catch (ValidateException|PDOException|Exception $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            }
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 编辑
+     */
+    public function edit($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if (!$params) {
+                $this->error(__('Parameter %s can not be empty', ''));
+            }
+            $params = $this->preExcludeFields($params);
+            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(true)->validate($validate);
+                }
+                if ($params['invite_user_id'] == $params['user_id']) {
+                    throw new Exception('不能邀请自己');
+                }
+                if (!empty($params['invite_user_id'])) {
+                    $userWhere['id'] = $params['invite_user_id'];
+                    $user = Db::name('user')->where($userWhere)->find();
+                    if ($user['pre_userid'] != $params['user_id']) {
+                        $userRes = Db::name('user_id')->where($userWhere)->update(['pre_userid'=>$params['user_id']]);
+                        if (!$userRes) {
+                            throw new Exception('更新用户邀请信息失败');
+                        }
+                    }
+                }
+                $result = $row->allowField(true)->save($params);
+                if ($result == false) {
+                    throw new Exception(__('No rows were inserted'));
+                }
+                Db::commit();
+                $this->success();
+            } catch (ValidateException|PDOException|Exception $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            }
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+}

+ 82 - 1
application/admin/controller/UserPower.php

@@ -3,6 +3,7 @@
 namespace app\admin\controller;
 
 use app\common\controller\Backend;
+use think\Exception;
 
 /**
  * 会员权限管理
@@ -148,9 +149,13 @@ class UserPower extends Backend
                 }
                 if (isset($params['private_messages_time']) && !empty($params['private_messages_time'])) {
                     $params['private_messages_time'] = strtotime($params['private_messages_time']);
+                } else {
+                    $params['private_messages_time'] = 0;
                 }
                 if (isset($params['speak_time']) && !empty($params['speak_time'])) {
                     $params['speak_time'] = strtotime($params['speak_time']);
+                } else {
+                    $params['speak_time'] = 0;
                 }
                 $result = $row->allowField(true)->save($params);
             } catch (ValidateException|PDOException|Exception $e) {
@@ -159,9 +164,85 @@ class UserPower extends Backend
             if ($result == false) {
                 $this->error(__('No rows were updated'));
             }
-            $this->success();
+            $this->success('操作成功');
         }
         $this->view->assign("row", $row);
         return $this->view->fetch();
     }
+
+    /**
+     * 一键禁用
+     */
+    public function powerBan($ids = null)
+    {
+        try {
+            $row = $this->model->get($ids);
+            if (!$row) {
+                throw new Exception(__('No Results were found'));
+            }
+            $adminIds = $this->getDataLimitAdminIds();
+            if (is_array($adminIds)) {
+                if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                    throw new Exception(__('You have no permission'));
+                }
+            }
+            $data = [
+                'private_messages'      => 2,//禁止私聊:0=正常,1=禁止.2=禁止(永久)
+                'private_messages_time' => 0,//禁止私聊时间
+                'speak'                 => 2,//禁言弹幕:0=正常,1=禁止.2=禁止(永久)
+                'speak_time'            => 0,//禁言时间
+                'recharge'              => 1,//充值:0=正常,1=禁止
+                'raffle'                => 1,//抽奖:0=正常,1=禁止
+                'give_gift'             => 1,//赠送礼物:0=正常,1=禁止
+                'transfer'              => 1,//转账:0=正常,1=禁止
+                'payorder'              => 1,//下单:0=正常,1=禁止
+                'attire'                => 1,//购买装扮:0=正常,1=禁止
+                'noble'                 => 1,//开通贵族:0=正常,1=禁止
+                'withdraw'              => 1,//提现:0=允许,1=禁止
+            ];
+            $where['id'] = $ids;
+            $res = $this->model->update($data,$where);
+            $this->success('操作成功');
+        } catch (Exception $e) {
+            $this->error($e->getMessage());
+        }
+    }
+
+    /**
+     * 一键解禁
+     */
+    public function powerUnban($ids = null)
+    {
+        try {
+            $row = $this->model->get($ids);
+            if (!$row) {
+                throw new Exception(__('No Results were found'));
+            }
+            $adminIds = $this->getDataLimitAdminIds();
+            if (is_array($adminIds)) {
+                if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                    throw new Exception(__('You have no permission'));
+                }
+            }
+            $data = [
+                'private_messages'      => 0,//禁止私聊:0=正常,1=禁止.2=禁止(永久)
+                'private_messages_time' => 0,//禁止私聊时间
+                'speak'                 => 0,//禁言弹幕:0=正常,1=禁止.2=禁止(永久)
+                'speak_time'            => 0,//禁言时间
+                'recharge'              => 0,//充值:0=正常,1=禁止
+                'raffle'                => 0,//抽奖:0=正常,1=禁止
+                'give_gift'             => 0,//赠送礼物:0=正常,1=禁止
+                'transfer'              => 0,//转账:0=正常,1=禁止
+                'payorder'              => 0,//下单:0=正常,1=禁止
+                'attire'                => 0,//购买装扮:0=正常,1=禁止
+                'noble'                 => 0,//开通贵族:0=正常,1=禁止
+                'withdraw'              => 0,//提现:0=允许,1=禁止
+            ];
+            $where['id'] = $ids;
+            $res = $this->model->update($data,$where);
+            $this->success('操作成功');
+        } catch (Exception $e) {
+            $this->error($e->getMessage());
+        }
+    }
 }

+ 186 - 7
application/admin/controller/user/User.php

@@ -3,8 +3,15 @@
 namespace app\admin\controller\user;
 
 use app\admin\model\Message;
+use app\admin\model\UserPower;
 use app\common\controller\Backend;
 use app\common\library\Auth;
+use app\common\service\TenimService;
+use fast\Random;
+use think\Db;
+use think\Exception;
+use think\exception\PDOException;
+use think\exception\ValidateException;
 
 /**
  * 会员管理
@@ -27,8 +34,10 @@ class User extends Backend
         parent::_initialize();
         $this->model = model('User');
         $typeList = [
+            'genderList' => $this->model->getGenderList(),
             'isCoolList' => $this->model->getIsCoolList(),
             'isManagerList' => $this->model->getIsManagerList(),
+            'isStealthList' => $this->model->getIsStealthList(),
         ];
         $this->view->assign($typeList);
         $this->assignconfig($typeList);
@@ -68,12 +77,69 @@ class User extends Backend
     /**
      * 添加
      */
+    /**
+     * 添加
+     */
     public function add()
     {
         if ($this->request->isPost()) {
-            $this->token();
+            $params = $this->request->post("row/a");
+            $params = $this->preExcludeFields($params);
+            if (!$params) {
+                $this->error(__('Parameter %s can not be empty', ''));
+            }
+            $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 . '.add' : $name) : $this->modelValidate;
+                    $this->model->validateFailException(true)->validate($validate);
+                }
+                if (empty($params['avatar'])) {
+                    $params['avatar'] = '/assets/img/default_avatar.png';
+                }
+                $ids = $this->model->column("u_id");
+                $invite_no = $this->model->column("invite_no");
+                $params['u_id'] = $this->model->getUinqueId(8, [$ids]);
+                $params['invite_no'] = $this->model->getUinqueNo(8, $invite_no);
+                if (empty($params['nickname'])) {
+                    $params['nickname'] = 'gg_'.$params['u_id'];
+                }
+                $params['image'] = '/assets/img/default_avatar.png';
+                $params['username'] = $params['mobile'];
+                $params['status'] = 'normal';
+                $params['salt'] = Random::alnum();
+                $params['has_info'] = 1;
+                $result = $this->model->allowField(true)->save($params);
+                $userId = $this->model->id;
+                $userPower = new UserPower();
+                $userPowerData['user_id'] = $userId;
+                $userPowerRes = $userPower->insertGetId($userPowerData);
+                if (!$userPowerRes) {
+                    throw new Exception('创建用户权限失败');
+                }
+                //创建IM用户
+                $tenimService = new TenimService();
+                $imParams['user_id'] = $userPowerRes;
+                $imParams['nickname'] = $params['nickname'];
+                $imParams['avatar'] = cdnurl($params['avatar']);
+                $tenimRes = $tenimService->accountImport($imParams);
+                if (!$tenimRes['status']) {
+                    throw new Exception($tenimRes['msg']);
+                }
+            } catch (ValidateException|PDOException|Exception $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            }
+            if ($result == false) {
+               $this->error(__('No rows were inserted'));
+            }
+            Db::commit();
+            $this->success();
         }
-        return parent::add();
+        return $this->view->fetch();
     }
 
     /**
@@ -81,15 +147,56 @@ class User extends Backend
      */
     public function edit($ids = null)
     {
-        if ($this->request->isPost()) {
-            $this->token();
-        }
         $row = $this->model->get($ids);
-        $this->modelValidate = true;
         if (!$row) {
             $this->error(__('No Results were found'));
         }
-        return parent::edit($ids);
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if (!$params) {
+                $this->error(__('Parameter %s can not be empty', ''));
+            }
+            $params = $this->preExcludeFields($params);
+            $result = false;
+            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(true)->validate($validate);
+                }
+                if (!empty($params['u_id'])) {
+                    $userWhere['u_id'] = $params['u_id'];
+                    $userWhere['id'] = ['neq',$ids];
+                    $user = $this->model->where($userWhere)->find();
+                    if (!empty($user)) {
+                        throw new Exception('前端用户ID已存在');
+                    }
+                }
+                if (!empty($params['mobile'])) {
+                    $userWhere['mobile'] = $params['mobile'];
+                    $user = $this->model->where($userWhere)->find();
+                    if (!empty($user)) {
+                        throw new Exception('手机号已存在');
+                    }
+                }
+                $result = $row->allowField(true)->save($params);
+            } catch (ValidateException|PDOException|Exception $e) {
+                $this->error($e->getMessage());
+            }
+            if ($result == false) {
+                $this->error(__('No rows were updated'));
+            }
+            $this->success();
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
     }
 
     /**
@@ -219,4 +326,76 @@ class User extends Backend
         ]);
         return $this->view->fetch();
     }
+
+    /**
+     * 钻石充值
+     * @param null $ids
+     * @return string
+     */
+    public function addJewel($ids=null)
+    {
+        /* 判断数据是否存在*/
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        /* 判断是否有权限访问*/
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if (!$params) {
+                $this->error(__('Parameter %s can not be empty', ''));
+            }
+            $params = $this->preExcludeFields($params);
+            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(true)->validate($validate);
+                }
+                if (!empty($params['jewel_add'])) {//钻石充值
+                    $userWhere['id'] = $row['id'];
+                    $user = Db::name('user')->where($userWhere)->lock(true)->find();
+                    $before = isset($user['jewel']) ? $user['jewel'] : 0;
+                    $jewelRes = model('Wallet')->lockChangeAccountRemain($row['id'],$params['jewel_add'],'+',$before,$remark='钻石充值()',17,'jewel');
+                    if (!$jewelRes['status']) {
+                        throw new Exception($jewelRes['msg']);
+                    }
+                    $params['jewel'] = bcadd($user['jewel'],$params['jewel_add']);
+                    //充值日志记录
+                    //判断是否首充
+                    $jewellogWhere['user_id'] = $row['id'];
+                    $jewellogWhere['type'] = 1;
+                    $userJewelLog = model('UserJewelLog')->where($jewellogWhere)->find();
+                    $isFirst = 1;
+                    if (!empty($userJewelLog)) {
+                        $isFirst = 0;
+                    }
+                    $preUserId = $user['pre_userid'];
+                    $userRechargeLogRes = model('UserRechargeLog')->addRecord($row['id'], $params['jewel_add'], $user['money'], $params['jewel'], $user['money'], 4, 4,$isFirst,$preUserId);
+                    if (!$userRechargeLogRes) {
+                        throw new Exception('充值记录生成失败');
+                    }
+                }
+                $result = $row->allowField(true)->save($params);
+                if ($result == false) {
+                    throw new Exception(__('No rows were updated'));
+                }
+                Db::commit();
+                $this->success();
+            } catch (ValidateException|PDOException|Exception $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            }
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
 }

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

@@ -8,8 +8,8 @@ return [
     'Jewelafter'    => '充值后钻石余额',
     'Moneyafter'    => '充值后账户余额',
     'Away'          => '支付通道',
-    'Away 1'        => '微信APP支付',
-    'Away 2'        => '支付宝WAP支付',
+    'Away 1'        => '微信支付',
+    'Away 2'        => '支付宝支付',
     'Away 3'        => '微信公众号支付',
     'Away 4'        => '苹果支付',
     'Platform'      => '充值平台',

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

@@ -26,6 +26,8 @@ return [
     'Empirical'                                   => '经验值',
     'Money'                                       => '账户余额',
     'Jewel'                                       => '钻石余额',
+    'Money_add'                                   => '余额充值',
+    'Jewel_add'                                   => '钻石充值',
     'Sound_coin'                                  => '声币余额',
     'Noble'                                       => '贵族',
     'NobleDuetime'                                => '贵族到期时间',
@@ -47,6 +49,9 @@ return [
     'Is_manager'                                  => '管理员',
     'Is_manager 0'                                => '否',
     'Is_manager 1'                                => '是',
+    'Is_stealth'                                  => '隐身',
+    'Is_stealth 0'                                => '否',
+    'Is_stealth 1'                                => '是',
     'Status'                                      => '状态',
     'Leave password blank if dont want to change' => '不修改密码请留空',
 ];

+ 11 - 0
application/admin/lang/zh-cn/user_invite.php

@@ -0,0 +1,11 @@
+<?php
+
+return [
+    'Id'             => '主键ID',
+    'User_id'        => '用户ID',
+    'Invite_user_id' => '被邀请的用户ID',
+    'Createtime'     => '创建时间',
+    'Updatetime'     => '更新时间',
+    'User.nickname'  => '邀请用户昵称',
+    'Inviteuser.nickname'  => '被邀请用户昵称',
+];

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

@@ -3,6 +3,7 @@
 namespace app\admin\model;
 
 use app\common\model\ScoreLog;
+use fast\Random;
 use think\Model;
 
 class User extends Model
@@ -20,6 +21,7 @@ class User extends Model
         'logintime_text',
         'is_cool_text',
         'is_manager_text',
+        'is_stealth_text',
     ];
 
     public function getOriginData()
@@ -126,6 +128,18 @@ class User extends Model
         return isset($list[$value]) ? $list[$value] : '';
     }
 
+    public function getIsStealthList()
+    {
+        return ['0' =>__('Is_stealth 0'), '1' =>__('Is_stealth 1')];
+    }
+
+    public function getIsStealthTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['is_stealth']) ? $data['is_stealth'] : '');
+        $list = $this->getIsStealthList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
     public function noble()
     {
         return $this->belongsTo('app\admin\model\noble\Level', 'noble', 'id', [], 'LEFT')->setEagerlyType(0);
@@ -149,4 +163,25 @@ class User extends Model
     {
         return $this->belongsTo('app\admin\model\Constellation', 'constellation_id', 'id', [], 'LEFT')->setEagerlyType(0);
     }
+
+    public function getUinqueId($length = 8, $ids = [])
+    {
+        $newid = Random::build("nozero", $length);
+        if (in_array($newid, $ids)) {
+            $newid = $this->getUinqueId($length, $ids);
+        }
+        return $newid;
+    }
+
+    /**
+     * 生成不重复的随机数字字母组合
+     */
+    function getUinqueNo($length = 8, $nos = [])
+    {
+        $newid = Random::build("alnum", $length);
+        if (in_array($newid, $nos)) {
+            $newid = $this->getUinqueNo($length, $nos);
+        }
+        return $newid;
+    }
 }

+ 49 - 0
application/admin/model/UserInvite.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class UserInvite extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'user_invite';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = 'int';
+
+    // 定义时间戳字段名
+    protected $createTime = 'createtime';
+    protected $updateTime = 'updatetime';
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+
+    ];
+    
+
+    
+
+
+
+
+
+
+
+    public function user()
+    {
+        return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+    public function inviteuser()
+    {
+        return $this->belongsTo('User', 'invite_user_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+}

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

@@ -47,7 +47,7 @@ class UserPower extends Model
 
     public function getSpeakList()
     {
-        return ['0' => __('Speak 0'),'1' => __('Speak 1'),'2' => __('Speak 3')];
+        return ['0' => __('Speak 0'),'1' => __('Speak 1'),'2' => __('Speak 2')];
     }
 
     public function getRechargeList()

+ 1 - 1
application/admin/model/gift/Log.php

@@ -44,7 +44,7 @@ class Log extends Model
 
     public function touser()
     {
-        return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
+        return $this->belongsTo('app\admin\model\User', 'user_to_id', 'id', [], 'LEFT')->setEagerlyType(0);
     }
 
 

+ 27 - 0
application/admin/validate/UserInvite.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\validate;
+
+use think\Validate;
+
+class UserInvite extends Validate
+{
+    /**
+     * 验证规则
+     */
+    protected $rule = [
+    ];
+    /**
+     * 提示消息
+     */
+    protected $message = [
+    ];
+    /**
+     * 验证场景
+     */
+    protected $scene = [
+        'add'  => [],
+        'edit' => [],
+    ];
+    
+}

+ 1 - 1
application/admin/view/gift/back/add.html

@@ -1,7 +1,7 @@
 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
 
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('用户昵称')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
         </div>

+ 1 - 1
application/admin/view/gift/back/edit.html

@@ -1,7 +1,7 @@
 <form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
 
     <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('用户昵称')}:</label>
         <div class="col-xs-12 col-sm-8">
             <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
         </div>

+ 2 - 2
application/admin/view/gift/back/index.html

@@ -7,7 +7,7 @@
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
                         <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
-                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('gift/back/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <!--<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('gift/back/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
                         <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('gift/back/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('gift/back/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
                         <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('gift/back/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
@@ -18,7 +18,7 @@
                                 <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>
+                        </div>-->
 
                         
                     </div>

+ 4 - 4
application/admin/view/gift/gift/add.html

@@ -19,7 +19,7 @@
         </div>
     </div>
     <!--<div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('宝箱类型')}:</label>
+        <label class="control-label col-xs-12 col-sm-2">{:__('Box_type')}:</label>
         <div class="col-xs-12 col-sm-8">
                         
             <select  id="c-box_type" data-rule="required" class="form-control selectpicker" name="row[box_type]">
@@ -105,7 +105,7 @@
                 <span class="msg-box n-right" for="c-special"></span>
             </div>
             <ul class="row list-inline faupload-preview" id="p-special"></ul>
-            <div style="padding:2px 33px;margin-top:10px;width:120px;color:#fff3f6;cursor:pointer;background-color: #00A000;border-radius: 2px;" onclick="play()">播放动画</div>
+            <div style="padding:2px 33px;margin-top:10px;width:120px;color:#fff3f6;cursor:pointer;background-color: #00A000;border-radius: 2px;" onclick="play()">鎾�斁鍔ㄧ敾</div>
         </div>
     </div>
 
@@ -134,7 +134,7 @@
 
 <script src="/assets/js/svga.min.js" ></script>
 <script>
-    // 播放
+    // 鎾�斁
     function play() {
         $("#p-special li a.thumbnail").html("<div id='demoCanvas'></div>");
 
@@ -142,7 +142,7 @@
         player.loops=1;
         player.clearsAfterStop=false;
 
-        var parser = new SVGA.Parser('#demoCanvas'); // 如果你需要支持 IE6+,那么必须把同样的选择器传给 Parser。
+        var parser = new SVGA.Parser('#demoCanvas'); // 濡傛灉浣犻渶瑕佹敮鎸� IE6+锛岄偅涔堝繀椤绘妸鍚屾牱鐨勯€夋嫨鍣ㄤ紶缁� Parser銆�
 
         var svgaUrl = $("#c-special").val();
 

+ 73 - 0
application/admin/view/user/user/add.html

@@ -0,0 +1,73 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+    {:token()}
+    <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="required" class="form-control" name="row[mobile]" type="text" value="">
+        </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="" class="form-control" name="row[nickname]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-avatar" class="control-label col-xs-12 col-sm-2">{:__('Avatar')}:</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="">
+                <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>
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-gender" class="control-label col-xs-12 col-sm-2">{:__('Gender')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <div class="radio">
+                {foreach name="genderList" item="vo"}
+                <label for="row[gender]-{$key}"><input id="row[gender]-{$key}" name="row[gender]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label>
+                {/foreach}
+            </div>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Age_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-age_id" data-rule="required" data-source="age/index" class="form-control selectpage" name="row[age_id]" type="text" value="0">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Is_manager')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select id="c-is_manager" data-rule="required" class="form-control selectpicker" name="row[is_manager]">
+                {foreach name="isManagerList" item="vo"}
+                <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Is_stealth')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select id="c-is_stealth" data-rule="required" class="form-control selectpicker" name="row[is_stealth]">
+                {foreach name="isStealthList" item="vo"}
+                <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+        </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

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

@@ -0,0 +1,41 @@
+<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 for="c-u_id" class="control-label col-xs-12 col-sm-2">{:__('Uid')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-u_id" data-rule="required" disabled class="form-control" name="row[u_id]" type="text" value="{$row.u_id|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" disabled class="form-control" name="row[nickname]" type="text" value="{$row.nickname|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">
+            <input id="c-mobile" data-rule="required" disabled class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-mobile" class="control-label col-xs-12 col-sm-2">{:__('Jewel')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-jewel" data-rule="required" disabled class="form-control" name="row[jewel]" type="number" value="{$row.jewel|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label for="c-mobile" class="control-label col-xs-12 col-sm-2">{:__('Jewel_add')}:</label>
+        <div class="col-xs-12 col-sm-4">
+            <input id="c-jewel_add" data-rule="required" min="1" class="form-control" name="row[jewel_add]" type="number" value="0">
+        </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 10 - 0
application/admin/view/user/user/edit.html

@@ -54,6 +54,16 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Is_stealth')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select id="c-is_stealth" data-rule="required" class="form-control selectpicker" name="row[is_stealth]">
+                {foreach name="isStealthList" item="vo"}
+                <option value="{$key}" {in name="key" value="$row.is_stealth"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+        </div>
+    </div>
+    <div class="form-group">
         <label for="c-gender" class="control-label col-xs-12 col-sm-2">{:__('Gender')}:</label>
         <div class="col-xs-12 col-sm-8">
             {:build_radios('row[gender]', ['1'=>__('Male'), '0'=>__('Female')], $row['gender'])}

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

@@ -6,7 +6,7 @@
             <div class="tab-pane fade active in" id="one">
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
-                        {:build_toolbar('refresh,edit')}
+                        {:build_toolbar('refresh,add,edit')}
                         <div class="dropdown btn-group {:$auth->check('user/user/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">

+ 22 - 0
application/admin/view/user_invite/add.html

@@ -0,0 +1,22 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Invite_user_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-invite_user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[invite_user_id]" type="text" 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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 22 - 0
application/admin/view/user_invite/edit.html

@@ -0,0 +1,22 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Invite_user_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-invite_user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[invite_user_id]" type="text" value="{$row.invite_user_id|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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 35 - 0
application/admin/view/user_invite/index.html

@@ -0,0 +1,35 @@
+<div class="panel panel-default panel-intro">
+    {:build_heading()}
+
+    <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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('user_invite/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('user_invite/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('user_invite/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('user_invite/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
+
+                        <div class="dropdown btn-group {:$auth->check('user_invite/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>
+
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('user_invite/edit')}" 
+                           data-operate-del="{:$auth->check('user_invite/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 14 - 6
application/api/controller/Dispatch.php

@@ -431,6 +431,14 @@ class Dispatch extends Common
             $data["createtime"] = time();
             $res = $orderModel->insertGetId($data);
             if($res) {
+                //冻结用户钻石
+                $userWhere['id'] = $this->auth->id;
+                $money = bcmul($authInfo["price"],$num);
+                $res1 = model('User')->where($userWhere)->setDec("jewel",$money);//用户扣减金额
+                $res2 = model('User')->where($userWhere)->setInc("frozen",$money);//用户冻结金额
+                if (!$res1 || !$res2) {
+                    throw new Exception('用户扣减金额失败');
+                }
                 \app\common\model\Message::addMessage($authInfo["user_id"],"派单通知","您的技能:".$skillInfo["name"]."有人下单啦,请注意查看!");
                 Db::commit();
                 $this->success('订单创建成功!',["order_no"=>$out_trade_no]);
@@ -618,16 +626,16 @@ class Dispatch extends Common
                 $money = $orderInfo["price"] * $orderInfo["num"];
                 // 解冻用户余额
                 $where = [];
-                $where["id"] = $this->auth->id;
+                $where["id"] = $orderInfo["user_id"];
                 $userInfo = $userModel->where($where)->find();
                 if($userInfo["frozen"] - $money < 0) {
                     $this->error(__('账户资金异常,请联系管理员!'),[],105);
                 }
-                $res1 = $userModel->where($where)->setDec("frozen",$money);
-                $res2 = $userModel->where($where)->setInc("jewel",$money);
+                $res1 = $userModel->where($where)->setDec("frozen",$money);//下单用户
+                $res2 = $userModel->where($where)->setInc("jewel",$money);//下单用户
                 // 添加用户余额变动记录
                 $userjewellogModel = new \app\common\model\UserJewelLog();
-                $res3 = $userjewellogModel->addUserJewelLog($orderInfo["recive_id"], $money, "+", $userInfo["jewel"], "拒绝订单返还余额", 7);
+                $res3 = $userjewellogModel->addUserJewelLog($orderInfo["user_id"], $money, "+", $userInfo["jewel"], "拒绝订单返还余额", 7);
                 // 更新订单状态
                 $data = [];
                 $data["status"] = $status;
@@ -643,7 +651,7 @@ class Dispatch extends Common
                     // 系统消息通知
                     \app\common\model\Message::addMessage($orderInfo["user_id"],"派单通知","您的订单,技能:".$orderInfo["skill_name"]."已被拒绝接单,请注意查看!");
 
-                    $this->success('订单完成。');
+                    $this->success('订单已拒绝。');
                 } else {
                     $this->error(__('订单更新失败!请稍后重试'));
                 }
@@ -740,7 +748,7 @@ class Dispatch extends Common
                 $res2 = $userModel->where($where)->setInc("jewel",$money);
                 // 添加用户余额变动记录
                 $userjewellogModel = new \app\common\model\UserJewelLog();
-                $res3 = $userjewellogModel->addUserJewelLog($orderInfo["recive_id"], $money, "+", $userInfo["jewel"], "拒绝订单返还余额", 7);
+                $res3 = $userjewellogModel->addUserJewelLog($orderInfo["user_id"], $money, "+", $userInfo["jewel"], "取消订单返还余额", 7);
                 // 更新订单状态
                 $data = [];
                 $data["status"] = $status;

+ 33 - 0
application/api/controller/Guild.php

@@ -620,6 +620,9 @@ class Guild extends Api
     public function getGuildMemberInfo() {
         $member_id = $this->request->request("member_id",0,"intval"); //公会成员ID
         if($member_id <= 0) $this->error("参数错误!");
+        $memberData = model('GuildMember')->field('id,user_id')->find($member_id);
+        $userService = new UserService();
+        $userService->updateGuildMember(['user_id'=>$memberData['user_id']]);
         $memberInfo = model('GuildMember')
             ->field('id,user_id,wealth,charm,gift_num,role,guild_id,createtime')
             ->with(['user'=>function($uQuery){
@@ -647,6 +650,36 @@ class Guild extends Api
         $memberInfo["logintime"] = !empty($logintime) ? date("Y-m-d", $logintime) : '';
         $myGuildMember = model('GuildMember')->field('role')->where(["user_id"=>$this->auth->id,"guild_id"=>$memberInfo->guild_id])->find();
         $memberInfo["my_role"] = !empty($myGuildMember) ? $myGuildMember['role'] : -1;
+        $fieldArr = ['wealth','charm','gift_num'];
+        foreach ($fieldArr as $fkey => $fval) {
+            if ($memberInfo[$fval] > 10000) {
+                $memberInfo[$fval] = bcdiv($memberInfo[$fval],10000,2).'w';
+            }
+        }
+        /*$userJewelLogWhere["type"] = ["in",[0,2,3,5,6,13]];//查看wallet.php文件
+        $userJewelLogWhere["user_id"] = $userData['id'];
+        $userJewelLogPay = model('UserJewelLog')
+            ->field("sum(value) as total_price")
+            ->where($userJewelLogWhere)
+            ->select();
+        $memberInfo['wealth'] = isset($userJewelLogPay[0]['total_price']) ? (int)$userJewelLogPay[0]['total_price'] : 0;
+        if ($memberInfo['wealth'] > 10000) {
+            $memberInfo['wealth'] = bcdiv($memberInfo['wealth'],10000,2).'w';
+        }
+        $userGiftWhere = [];
+        $userGiftWhere["user_to_id"] = $userData['id'];
+        $userGift = model('GiftUserParty')
+            ->field("sum(value) as total_price,sum(number)as gift_total_num")
+            ->where($userGiftWhere)
+            ->select();
+        $memberInfo['charm'] = isset($userGift[0]['total_price']) ? (int)$userGift[0]['total_price'] : 0;
+        $memberInfo['gift_num'] = isset($userGift[0]['gift_total_num']) ? (int)$userGift[0]['gift_total_num'] : 0;
+        if ($memberInfo['charm'] > 10000) {
+            $memberInfo['charm'] = bcdiv($memberInfo['charm'],10000,2).'w';
+        }
+        if ($memberInfo['gift_num'] > 10000) {
+            $memberInfo['gift_num'] = bcdiv($memberInfo['gift_num'],10000,2).'w';
+        }*/
         $this->success("获取成功!",$memberInfo);
     }
 

+ 15 - 7
application/api/controller/Money.php

@@ -51,16 +51,13 @@ class Money extends Common
         $openid = $this->request->request("openid", "");// 非小程序支付无需传值
         $params_from = $this->request->request("params_from",1);// 平台参数充值平台:1=安卓,2=ios
         $amounts = $this->request->request("amounts",0);// 自定义金额
+        $jewelRate = config('site.money_to_jewel');
         if (!$rechar_id && empty($amounts)) {
             $this->error(__('Invalid parameters'));
         }
         if (!preg_match("/^-?\d+$/",$amounts)) {
             $this->error('金额必须是整数');
         }
-
-        if ($this->auth->is_auth != 2) {//实名后允许充值
-            throw new Exception('请先实名认证');
-        }
         if ($this->auth->power->recharge == 1) {//禁止充值
             throw new Exception('禁止充值');
         }
@@ -70,9 +67,9 @@ class Money extends Common
             $recharMode = new \app\common\model\RecharConfig();
             $recharInfo = $recharMode->where(["id" => $rechar_id])->find();
         } else {
-            $amountsNew = $amounts * 100;
+            $amountsNew = $amounts * $jewelRate;
             $recharInfo = [
-                'money' => $amountsNew,
+                'money' => $amounts,
                 'jewel' => $amountsNew,
                 'jewel_full' => $amountsNew,
             ];
@@ -81,7 +78,18 @@ class Money extends Common
         $out_trade_no = date("YmdHis") . rand(100000, 999999);
         $title = "充值钻石";
         $amount = $recharInfo["money"] / 100;
-
+        if ($this->auth->is_auth != 2) {//实名后允许充值
+            //未实名认证最大可充值金额
+            $maxMoney = config('site.un_authentication_max');
+            $rechargeMoneyWhere['user_id'] = $user_id;
+            $rechargeMoneyWhere['status'] = 1;
+            $rechargeMoney = model('RecharOrder')->where($rechargeMoneyWhere)->sum('money');
+            $userRechargeMoney = !empty($rechargeMoney) ? (int)$rechargeMoney : 0;
+            $userMoney = bcadd($amount,$userRechargeMoney);
+            if ($userMoney > $maxMoney) {
+                $this->error('请先实名认证');
+            }
+        }
         if ($params_from == "ios") {
             $jewel = $recharInfo['jewel'];
         } else {

+ 2 - 2
application/api/controller/Notify.php

@@ -58,7 +58,7 @@ class Notify extends Api
                 $detail = "钻石充值";
                 $res3 = $jewellogModel->addUserJewelLog($userInfo["id"], $orderInfo["jewel"], "+", $userInfo["jewel"], $detail, 1);
                 // 添加充值记录
-                $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], $orderInfo["platform"], 1,$isFirst,$preUserId);
+                $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], 0, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], $orderInfo["platform"], 1,$isFirst,$preUserId);
                 if ($res1 && $res2 && $res3 && $res4) {
                     // 添加统计
                     $userInfo->chargecount = $userInfo->chargecount + $payamount;
@@ -166,7 +166,7 @@ class Notify extends Api
                 $detail = "钻石充值";
                 $res3 = $jewellogModel->addUserJewelLog($userInfo["id"], $orderInfo["jewel"], "+", $userInfo["jewel"], $detail, 1);
                 // 添加充值记录
-                $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], $orderInfo["platform"], 1,$isFirst,$preUserId);
+                $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], $orderInfo["platform"], 2,$isFirst,$preUserId);
                 if ($res1 && $res2 && $res3 && $res4) {
                     // 添加统计
                     $userInfo->chargecount = $userInfo->chargecount + $payamount;

+ 2 - 2
application/api/controller/Party.php

@@ -583,7 +583,7 @@ class Party extends Common
         if($res) $user_ids = array_values($res);
         // 获取用户列表信息
         if($user_ids){
-            $userList = \app\common\model\User::field("id,avatar,nickname,level,gender")->where(["id"=>["in",$user_ids],'is_manager'=>0])->limit($pageStart,$pageNum)->select();
+            $userList = \app\common\model\User::field("id,avatar,nickname,level,gender")->where(["id"=>["in",$user_ids],'is_stealth'=>0])->limit($pageStart,$pageNum)->select();
         }
 
         $this->success("获取成功!",$userList);
@@ -1601,7 +1601,7 @@ class Party extends Common
         $backGiftId = 0;
         $boxgiftInfo = [];
         // 不可以赠送给自己
-        if(in_array($userauthid,$user_id_arr)) $this->error("不可以赠送给自己!");
+        //if(in_array($userauthid,$user_id_arr)) $this->error("不可以赠送给自己!");
         if($is_back == 1) {
             // 获取背包礼物信息
             $giftInfo = \app\common\model\GiftBack::get($gift_id);

+ 21 - 1
application/api/controller/Tenim.php

@@ -16,7 +16,7 @@ use think\Db;
 class Tenim extends Api
 {
     protected $noNeedLogin = ['trtc_callback',"callback",'test','createIMGroup','updateRoomInfo','setImManage','sendMessageToUser','outMemberFromRoom',
-        'autoUserLine','getRoomUser','getGroupList','getGroupInfo'];
+        'autoUserLine','getRoomUser','getGroupList','getGroupInfo','getUserList'];
     protected $noNeedRight = ['*'];
 
 
@@ -1257,4 +1257,24 @@ exit;
         }
         $this->success('操作成功',$imResult['data']);
     }
+
+    /**
+     * 获取用户列表
+     */
+    public function getUserList() {
+        $userId = $this->request->param('user_ids','');
+        if (empty($userId)) {
+            $this->error('参数错误');
+        }
+        $userIdArr = explode(',',$userId);
+        $tenimService = new TenimService();
+        $params = [
+            'user_ids' => $userIdArr,
+        ];
+        $imResult = $tenimService->accountCheck($params);
+        if (!$imResult['status']) {
+            $this->error($imResult['msg']);
+        }
+        $this->success('操作成功',$imResult['data']);
+    }
 }

+ 5 - 3
application/api/controller/Usercenter.php

@@ -47,7 +47,7 @@ class UserCenter extends Common
         $where = [];
         $where["id"] = $user_id;
         $userInfo = $this->userModel->field("id,nickname,pre_nickname,image,mobile,avatar,pre_avatar,gender,money,age,u_id,level,jewel,
-        age_id,constellation_id,province_id,city_id,desc,ipaddress,is_cool,is_manager")->where($where)->find();
+        age_id,constellation_id,province_id,city_id,desc,ipaddress,is_cool,is_manager,is_stealth")->where($where)->find();
         $userInfo['nickname_status'] = $userInfo['avatar_status'] = 0;
         if (!empty($userInfo['pre_nickname']) && $userInfo['pre_nickname'] != $userInfo['nickname']) {
             $userInfo['nickname_status'] = 1;
@@ -605,8 +605,8 @@ class UserCenter extends Common
         $avatar && $data["avatar"] = $avatar;
 
         if($nickname){
-            if (mb_strlen($nickname) > 8) {
-                $this->error('用户昵称最多支持8个汉字或组合');
+            if (mb_strlen($nickname) > 30) {
+                $this->error('用户昵称最多支持30个汉字或组合');
             }
             $data["nickname"] = $nickname;
         }
@@ -1141,6 +1141,7 @@ class UserCenter extends Common
             //全部
             $totalNum = $userInviteModel->where($userInviteWhere)->count();
             $inviteMoney = config('site.invite_money');
+            $inviteRule = config('site.invite_rule');
             $result = [
                 'invite_money' => (int)$inviteMoney,
                 'invite_no' => $inviteNo,//邀请码
@@ -1149,6 +1150,7 @@ class UserCenter extends Common
                 'week_now_num' => $weekNowNum,//本周邀请数
                 'last_week_num' => $lastWeekNum,//上周邀请数
                 'total_num' => $totalNum,//总邀请数
+                'invite_rule' => $inviteRule,//规则说明
             ];
             $this->success('获取成功',$result);
         } catch (Exception $e) {

+ 101 - 73
application/api/controller/Usersign.php

@@ -4,6 +4,7 @@ namespace app\api\controller;
 
 use app\common\controller\Api;
 use think\Db;
+use think\Exception;
 
 /**
  * 签到
@@ -49,72 +50,73 @@ class Usersign extends Api
 
     //签到
     public function signin(){
-        $uid = $this->auth->id;
-
-        //记录日志
-        $data = [
-            'uid' => $uid,
-            'times' => 1,
-            'goldnum' => 0,
-            'createtime' => time(),
-        ];
-
-        $yesterday_time = strtotime('yesterday'); //昨天0点时间戳
-        $today_time = $yesterday_time + 86400; //今日0点时间戳
-        //修正当前次数
-        $check = Db::name('user_sign')->where('uid',$uid)->order('id desc')->find();
-        if($check){
-            //今天只能签一次
-            if($check['createtime'] >= $today_time){
-                $this->error('今天已经签过了');
-            }
-            if ($check['createtime'] >= $yesterday_time) {
-                $data['times'] = $check['times'] + 1; //连续签到次数
+        Db::startTrans();
+        try {
+            $uid = $this->auth->id;
+            //记录日志
+            $data = [
+                'uid' => $uid,
+                'type' => 1,
+                'times' => 1,
+                'goldnum' => 0,
+                'createtime' => time(),
+            ];
+
+            $yesterday_time = strtotime('yesterday'); //昨天0点时间戳
+            $today_time = $yesterday_time + 86400; //今日0点时间戳
+            //修正当前次数
+            $check = Db::name('user_sign')->where('uid',$uid)->order('id desc')->find();
+            if($check){
+                //今天只能签一次
+                if($check['createtime'] >= $today_time){
+                    throw new Exception('今天已经签过了');
+                }
+                if ($check['createtime'] >= $yesterday_time) {
+                    $data['times'] = $check['times'] + 1; //连续签到次数
+                }
             }
-        }
-
-        $signin_id = $data['times'] % 7;
-        if ($signin_id == 0) {
-            $signin_id = 7;
-        }
 
-        //匹配对应金币数
-        $list = Db::name('signin')->order('id asc')->column('id,goldnum');
-        $data['goldnum'] = isset($list[$signin_id]) ? $list[$signin_id] : 0 ;
-        Db::startTrans();
-        //记录日志
-        $log_id = Db::name('user_sign')->insertGetId($data);
-        if(!$log_id){
-            Db::rollback();
-            $this->error('签到失败');
-        }
+            /*$signin_id = $data['times'] % 7;
+            if ($signin_id == 0) {
+                $signin_id = 7;
+            }
 
-        //加经验
-        $userWhere['id'] = $uid;
-        $user = model('User')->where($userWhere)->lock(true)->find();
-        $userNewEmpirical = $user['empirical'] + $data['goldnum'];
-        $userUpdate['empirical'] = $userNewEmpirical;
-        // 获取用户当前经验值对应等级
-        $userconfigModel = new \app\common\model\UserLevelConfig();
-        $where = [];
-        $where["empirical"] = ["elt",$userNewEmpirical];
-        $userexplainstart = $userconfigModel->where($where)->order("empirical","desc")->find();
-        if (!empty($userexplainstart)) {
-            if ($userexplainstart['level'] != $user['level']) {
-                $userUpdate['level'] = $userexplainstart['level'];
+            //匹配对应金币数
+            $list = Db::name('signin')->order('id asc')->column('id,goldnum');
+            $data['goldnum'] = isset($list[$signin_id]) ? $list[$signin_id] : 0 ;
+            Db::startTrans();
+            //记录日志
+            $log_id = Db::name('user_sign')->insertGetId($data);
+            if(!$log_id){
+                Db::rollback();
+                $this->error('签到失败');
+            }*/
+
+            //加经验
+            /*$userWhere['id'] = $uid;
+            $user = model('User')->where($userWhere)->lock(true)->find();
+            $userNewEmpirical = $user['empirical'] + $data['goldnum'];
+            $userUpdate['empirical'] = $userNewEmpirical;
+            // 获取用户当前经验值对应等级
+            $userconfigModel = new \app\common\model\UserLevelConfig();
+            $where = [];
+            $where["empirical"] = ["elt",$userNewEmpirical];
+            $userexplainstart = $userconfigModel->where($where)->order("empirical","desc")->find();
+            if (!empty($userexplainstart)) {
+                if ($userexplainstart['level'] != $user['level']) {
+                    $userUpdate['level'] = $userexplainstart['level'];
+                }
             }
-        }
-        $res = $user->update($userUpdate,$userWhere);
-        if($res === false){
-            Db::rollback();
-            $this->error('经验更新失败');
-        }
-        //第七天赠送礼物
-        $gift = [];
-        $sendGift = config('site.sign_gift');
-        if ($data['times'] == 7 && $sendGift == '1') {
+            $res = $user->update($userUpdate,$userWhere);
+            if($res === false){
+                Db::rollback();
+                $this->error('经验更新失败');
+            }*/
+            //第七天赠送礼物
+            $gift = [];
+            $sendGift = config('site.sign_gift');
             $userSignGift = model('UserSignGift')->with(['gift'])->find();
-            if (!empty($userSignGift)) {
+            if ($data['times'] == 7 && $sendGift == '1' && !empty($userSignGift)) {
                 $giftData = isset($userSignGift['gift']) ? $userSignGift['gift'] : [];
                 if (!empty($giftData)) {
                     $gift = [
@@ -122,20 +124,46 @@ class Usersign extends Api
                         'num' => $userSignGift['num'],
                     ];
                 }
+                $giftName = isset($giftData['name']) ? $giftData['name'] : '';
+                $data['goldnum'] = $gift['num'];
+                $data['type'] = 2;
+                $data['remark'] = '签到奖励'.$giftName.$gift['num'];
+            } else {//随机获取钻石
+                $signJewel = config('site.sign_jewel');
+                $signJewelArr = [];
+                if (!empty($signJewel)) {
+                    $signJewelArr = explode('-', $signJewel);
+                }
+                $min = isset($signJewelArr[0]) ? $signJewelArr[0] : 1;
+                $max = isset($signJewelArr[1]) ? $signJewelArr[1] : 1;
+                $gift['num'] = rand($min,$max);
+                $data['goldnum'] = $gift['num'];
+                $data['remark'] = '签到钻石'.$gift['num'];
+                $user = model('User')->find($uid);
+                $userJewel = isset($user['jewel']) ? $user['jewel'] : 0;
+                $rs_wallet = model('wallet')->lockChangeAccountRemain($uid,$gift['num'],'+',$userJewel,$data['remark'],16,'jewel');
+                if (!$rs_wallet['status']) {
+                    throw new Exception($rs_wallet['msg']);
+                }
             }
+            //记录日志
+            $log_id = Db::name('user_sign')->insertGetId($data);
+            if(!$log_id){
+                throw new Exception('签到失败');
+            }
+            //系统消息
+            $msg_id = \app\common\model\Message::addMessage($this->auth->id,'签到奖励','签到成功,获得奖励');
+            $signImg = config('site.sign_img');
+            $result = [
+                'image' => isset($gift['image']) ? $gift['image'] : cdnurl($signImg),
+                'goldnum' => isset($gift['num']) ? $gift['num'] : $data['goldnum'],
+            ];
+            Db::commit();
+            $this->success('签到成功', $result);
+        } catch (Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage());
         }
-
-        //系统消息
-        $msg_id = \app\common\model\Message::addMessage($this->auth->id,'签到奖励','签到成功,获得奖励');
-
-        Db::commit();
-        $signImg = config('site.sign_img');
-        $signImg = cdnurl($signImg);
-        $result = [
-            'image' => isset($gift['image']) ? $gift['image'] : $signImg,
-            'goldnum' => isset($gift['num']) ? $gift['num'] : $data['goldnum'],
-        ];
-        $this->success('签到成功', $result);
     }
 
     //第七天赠送vip

+ 2 - 2
application/common.php

@@ -736,8 +736,8 @@ if (!function_exists('week_now')) {
     function week_now()
     {
         $arr = [
-            strtotime(date('Y-m-d', strtotime("-1 week Monday", time()))),
-            strtotime(date('Y-m-d', strtotime("+0 week Sunday", time()))) - 1
+            strtotime(date('Y-m-d', strtotime("+0 week Monday", time()))),
+            strtotime(date('Y-m-d', strtotime("+0 week Sunday", time())))
         ];
 
         return $arr;

+ 5 - 2
application/common/library/Auth.php

@@ -181,7 +181,7 @@ class Auth
             'mobile'    => $mobile,
             'level'     => 0,
             'score'     => 0,
-            'avatar'    => isset($extend["avatar"]) ? $extend["avatar"] : cdnurl('/assets/img/default_avatar.png'),
+            'avatar'    => isset($extend["avatar"]) ? $extend["avatar"] : '/assets/img/default_avatar.png',
             'image'     => '/assets/img/default_avatar.png',
         ];
         //https://bansheng-1304213176.cos.ap-guangzhou.myqcloud.com/
@@ -216,6 +216,8 @@ class Auth
                 $powerData = ['user_id' => $user->id];
                 Db::name('user_power')->insertGetId($powerData);
             }
+            $userpower = UserPower::getByUserId($user->id);
+            $this->_user->power = $userpower;
             //注册成功的事件
             Hook::listen("user_register_successed", $this->_user, $data);
             \app\common\model\NewBagHave::insert(["user_id" => $user->id, "createtime" => time()]);
@@ -490,7 +492,7 @@ class Auth
                 $v["type"] == 4 && $userandroidpop = $v["android_image"];
             }
         }
-        $userField = 'id,pay_password,openid,is_cool,is_manager,nickname,pre_nickname,avatar,pre_avatar';
+        $userField = 'id,pay_password,openid,is_cool,is_manager,is_stealth,nickname,pre_nickname,avatar,pre_avatar';
         $user = model('User')->field($userField)->where(["id" => $this->_user->id])->with(['useralipay','userbank'])->find();
         // 获取我的推荐人的邀请码
         $preUserField = 'id,invite_no';
@@ -521,6 +523,7 @@ class Auth
         $userinfo['bind_bank'] = !empty($userBank) ? 1 : 0;
         $userinfo['is_cool'] = isset($user['is_cool']) ? $user['is_cool'] : 0;
         $userinfo['is_manager'] = isset($user['is_manager']) ? $user['is_manager'] : 0;
+        $userinfo['is_stealth'] = isset($user['is_stealth']) ? $user['is_stealth'] : 0;
         //家族信息
         $guildField = 'g.id,g.g_id,g.user_id,g.party_id,g.name,g.image,g.desc,g.member,g.status';
         $guildWhere['gm.user_id'] = $this->_user->id;

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

@@ -1,5 +1,6 @@
 <?php
 namespace app\common\model;
+use app\common\service\UserService;
 use think\Model;
 use think\Db;
 /**
@@ -163,7 +164,8 @@ class Wallet extends Model
                 $result['msg'] = '账户余额已更新!';
                 $result['log_table'] = $accountType.'_log';
                 $result['log_id'] = $rs2_id;
-
+                $userService = new UserService();
+                $userService->updateGuildMember(['user_id'=>$user_id]);
                 return $result;
             }
             else

+ 1 - 1
application/common/service/RoomService.php

@@ -220,7 +220,7 @@ class RoomService
             $userIds = $this->redis->zRange("party_user_".$partyId,0,-1);
             $field = 'id,avatar,nickname';
             $userWhere['id'] = ['in', $userIds];
-            $userWhere['is_manager'] = 0;
+            $userWhere['is_stealth'] = 0;
             $userModel = new \app\common\model\User();
             $userData = $userModel->field($field)->where($userWhere)->select();
             $userDatas = [];

+ 70 - 0
application/common/service/TenimService.php

@@ -238,4 +238,74 @@ class TenimService
         }
         return $result;
     }
+
+    /**
+     * 创建用户账号
+     */
+    public function accountImport($params=[])
+    {
+        $result = [
+            'status' => 1,
+            'msg' => '获取成功',
+            'data' => [],
+        ];
+        try {
+            $userId = isset($params['user_id']) ? $params['user_id'] : 0;
+            $nickname = isset($params['nickname']) ? $params['nickname'] : '';
+            $avatar = isset($params['avatar']) ? $params['avatar'] : '';
+
+            $url = "https://console.tim.qq.com/v4/im_open_login_svc/account_import".$this->url;
+            $tencentObj = new tencentim($url);
+            if(!empty($userId)) {
+                $data["UserID"] = (string)$userId;
+                $data["Nick"] = $nickname;
+                $data["FaceUrl"] = $avatar;
+                $imRes = $tencentObj->toSend($data);
+                if (isset($imRes['ActionStatus']) && $imRes['ActionStatus'] != 'OK') {
+                    $errorInfo = isset($imRes['ErrorInfo']) ? $imRes['ErrorInfo'] : [];
+                    throw new Exception(json_encode($errorInfo));
+                }
+            }
+        } catch (\Exception $e) {
+            $result['status'] = 0;
+            $result['msg'] = $e->getMessage();
+        }
+        return $result;
+    }
+
+    /**
+     * 查询用户账号
+     */
+    public function accountCheck($params=[])
+    {
+        $result = [
+            'status' => 1,
+            'msg' => '获取成功',
+            'data' => [],
+        ];
+        try {
+            $userIds = isset($params['user_ids']) ? $params['user_ids'] : [];
+
+            if(!empty($userIds)) {
+                $url = "https://console.tim.qq.com/v4/im_open_login_svc/account_check".$this->url;
+                $tencentObj = new tencentim($url);
+                foreach ($userIds as $key => $value) {
+                    $userIdArr[] = [
+                        'UserID' => $value,
+                    ];
+                }
+                $data["CheckItem"] = $userIdArr;
+                $imRes = $tencentObj->toSend($data);
+                if (isset($imRes['ActionStatus']) && $imRes['ActionStatus'] != 'OK') {
+                    $errorInfo = isset($imRes['ErrorInfo']) ? $imRes['ErrorInfo'] : [];
+                    throw new Exception(json_encode($errorInfo));
+                }
+                $result['data'] = isset($imRes['ResultItem']) ? $imRes['ResultItem'] : [];
+            }
+        } catch (\Exception $e) {
+            $result['status'] = 0;
+            $result['msg'] = $e->getMessage();
+        }
+        return $result;
+    }
 }

+ 44 - 0
application/common/service/UserService.php

@@ -233,4 +233,48 @@ class UserService
         }
         return $result;
     }
+
+    /**
+     * 更新用户消费/魅力/礼物数据
+     * @return void
+     */
+    public function updateGuildMember($params=[])
+    {
+        $result = [
+            'status' => 1,
+            'msg' => '操作成功',
+            'data' => [],
+        ];
+        try {
+            $userId = isset($params['user_id']) ? $params['user_id'] : 0;
+            if (!empty($userId)) {
+                $guildMemberWhere['user_id'] = $userId;
+                $guildMember = model('GuildMember')->where($guildMemberWhere)->count();
+                if (!empty($guildMember)) {
+                    $wealth = $charm = $gift_num = 0;
+                    $userJewelLogWhere["type"] = ["in",[0,2,3,5,6,13]];//查看wallet.php文件
+                    $userJewelLogWhere["user_id"] = $userId;
+                    $userJewelLogPay = model('UserJewelLog')
+                        ->field("sum(value) as total_price")
+                        ->where($userJewelLogWhere)
+                        ->select();
+                    $wealth = isset($userJewelLogPay[0]['total_price']) ? (int)$userJewelLogPay[0]['total_price'] : 0;
+                    $userGiftWhere = [];
+                    $userGiftWhere["user_to_id"] = $userId;
+                    $userGift = model('GiftUserParty')
+                        ->field("sum(value) as total_price,sum(number)as gift_total_num")
+                        ->where($userGiftWhere)
+                        ->select();
+                    $charm = isset($userGift[0]['total_price']) ? (int)$userGift[0]['total_price'] : 0;
+                    $giftNum = isset($userGift[0]['gift_total_num']) ? (int)$userGift[0]['gift_total_num'] : 0;
+                    $guildMemberData = ['wealth'=>$wealth,'charm'=>$charm,'gift_num'=>$giftNum];
+                    $r = model('GuildMember')->update($guildMemberData,$guildMemberWhere);
+                }
+            }
+        } catch (Exception $e) {
+            $result['status'] = 0;
+            $result['msg'] = $e->getMessage();
+        }
+        return $result;
+    }
 }

+ 8 - 1
application/extra/site.php

@@ -26,6 +26,8 @@ return [
         'currency' => '货币比例配置',
         'other' => '其他配置',
         'egg' => '开箱子和大转盘',
+        'sign' => '签到配置',
+        'invite' => '邀请配置',
     ],
     'mail_type' => '1',
     'mail_smtp_host' => 'smtp.qq.com',
@@ -103,7 +105,7 @@ return [
     'switch' => '1',
     'appShare' => '/uploads/20210422/75744fbe87ee36e52ffffcb82acdc403.png',
     'roomLimit' => '10',
-    'domain_name' => 'http://ggyuyin.huxiukeji.cn',
+    'domain_name' => 'https://ggyuyin.huxiukeji.cn',
     'intro_image' => '/uploads/20230703/35b10db56529aa19086eeb3d1d0bb6b0.png',
     'egggift_content' => '<p>我是奖励概览</p>',
     'sign_gift' => '1',
@@ -113,4 +115,9 @@ return [
     'exchange_define' => '1',
     'withdraw_define' => '1',
     'sign_img' => '/uploads/20230714/f02676a5491e5a88141ce9a9a8c20a77.png',
+    'sign_jewel' => '1-10',
+    'invite_rule' => '邀请规则:'."\r\n"
+        .'1、所有用户都可以参加邀请好友活动'."\r\n"
+        .'2、通过自己分享的活动页面地址下载注册成功,'."\r\n"
+        .'即发放注册奖励,若好友充值即奖励1元。',
 ];

+ 3 - 0
application/extra/wallet.php

@@ -21,6 +21,8 @@ return [
         13 => '抽奖箱子和转盘', //减少
         14 => '余额兑换钻石', //增加
         //15已被占用
+        16 => '签到得钻石',//增加
+        17 => '平台充值',//增加
 
         //money
         101 => '获赠礼物', //增加
@@ -29,6 +31,7 @@ return [
         104 => '申请提现', //减少
         105 => '申请提现驳回', //增加
         106 => '接单收益', //增加
+        107 => '平台充值', //增加
     ],
     'moneyname' => [
         'jewel'    => '钻石',

+ 1 - 1
extend/AliPay/AliPay.php

@@ -266,7 +266,7 @@ class AliPay {
         $responsecode = $responseResult->$responseApiName->code;
         $result = [
             'code' => $responsecode,
-            'sub_msg' => $responseResult->$responseApiName->sub_msg,
+            'sub_msg' => $responseResult->$responseApiName->msg,
         ];
         return $result;
         /*if(!empty($responsecode)&&$responsecode==10000){

+ 1 - 1
public/assets/js/backend/gift/back.js

@@ -34,7 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'use_time', title: __('Use_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'get_way', title: __('Get_way'), searchList: {"1":__('Get_way 1'),"2":__('Get_way 2'),"3":__('Get_way 3')}, formatter: Table.api.formatter.normal},
                         {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                     ]
                 ]
             });

+ 21 - 9
public/assets/js/backend/user/user.js

@@ -6,9 +6,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.init({
                 extend: {
                     index_url: 'user/user/index',
+                    add_url: 'user/user/add',
                     edit_url: 'user/user/edit',
                     multi_url: 'user/user/multi',
                     infocheck_url: 'user/user/infocheck',
+                    addjewel_url: 'user/user/add_jewel',
                     table: 'user',
                 }
             });
@@ -47,12 +49,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         // {field: 'onlinetime', title: __('最近一次上线时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                         // {field: 'chargecount', title: __('总充值金额')},
                         // {field: 'rebatecount', title: __('总获得返利金额')},
-                        //{field: 'gender', title: __('Gender'), searchList: {1: __('Male'), 0: __('Female')}, formatter: Table.api.formatter.normal},
+                        {field: 'gender', title: __('Gender'), searchList: {1: __('Male'), 0: __('Female')}, formatter: Table.api.formatter.normal},
                         // {field: 'age', title: __('Age'), operate: 'LIKE'},
                         // {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
                         // {field: 'empirical', title: __('Empirical'), operate: 'LIKE'},
-                        // {field: 'money', title: __('Money'), operate: 'LIKE'},
-                        // {field: 'jewel', title: __('Jewel'), operate: 'LIKE'},
+                        {field: 'money', title: __('Money'), operate: 'LIKE'},
+                        {field: 'jewel', title: __('Jewel'), operate: 'LIKE'},
                         // {field: 'sound_coin', title: __('Sound_coin'), operate: 'LIKE'},
                         // {field: 'noble.name', title: __('Noble'), operate: 'LIKE'},
                         // {field: 'noble_duetime', title: __('NobleDuetime'), formatter: Table.api.formatter.datetime, operate: 'RANGE'},
@@ -60,6 +62,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'constellation.name', title: __('Constellation_id'), operate: false},
                         {field: 'is_cool', title: __('Is_cool'), searchList:Config.isCoolList, formatter: Table.api.formatter.status},
                         {field: 'is_manager', title: __('Is_manager'), searchList:Config.isManagerList, formatter: Table.api.formatter.status},
+                        {field: 'is_stealth', title: __('Is_stealth'), searchList:Config.isStealthList, formatter: Table.api.formatter.status},
                         {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                         {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
                         {field: 'createtime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
@@ -68,12 +71,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {
                             field: 'operate', title: __('Operate'), buttons: [
                                 {
-                                    name: 'detail',
-                                    title: __('查看详情'),
-                                    classname: 'btn btn-xs btn-primary btn-dialog',
-                                    icon: 'fa fa-list',
-                                    url: 'user/user/detail',
-                                }, {
                                     name: 'infocheck',
                                     title: __('信息审核'),
                                     classname: 'btn btn-xs btn-warning btn-dialog',
@@ -86,6 +83,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                             return false;
                                         }
                                     }
+                                },{
+                                    name: 'detail',
+                                    title: __('查看详情'),
+                                    classname: 'btn btn-xs btn-primary btn-dialog',
+                                    icon: 'fa fa-list',
+                                    url: 'user/user/detail',
+                                }, {
+                                    name: 'addjewel',
+                                    title: __('充值'),
+                                    classname: 'btn btn-xs btn-info btn-dialog',
+                                    icon: 'fa fa-diamond',
+                                    url: 'user/user/addJewel',
                                 },
                             ], table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate
                         }
@@ -109,6 +118,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         infocheck: function () {
             Controller.api.bindevent();
         },
+        addjewel: function () {
+            Controller.api.bindevent();
+        },
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));

+ 56 - 0
public/assets/js/backend/user_invite.js

@@ -0,0 +1,56 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'user_invite/index' + location.search,
+                    add_url: 'user_invite/add',
+                    edit_url: 'user_invite/edit',
+                    del_url: 'user_invite/del',
+                    multi_url: 'user_invite/multi',
+                    import_url: 'user_invite/import',
+                    table: 'user_invite',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'user_id', title: __('User_id')},
+                        {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
+                        {field: 'invite_user_id', title: __('Invite_user_id')},
+                        {field: 'inviteuser.nickname', title: __('Inviteuser.nickname'), operate: 'LIKE'},
+                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'updatetime', title: __('Updatetime'), 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}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});

+ 44 - 1
public/assets/js/backend/user_power.js

@@ -42,7 +42,50 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'attire', title: __('Attire'), searchList: {"0":__('Attire 0'),"1":__('Attire 1')}, formatter: Table.api.formatter.normal},
                         {field: 'noble', title: __('Noble'), searchList: {"0":__('Noble 0'),"1":__('Noble 1')}, formatter: Table.api.formatter.normal},
                         {field: 'withdraw', title: __('Withdraw'), searchList: {"0":__('Withdraw 0'),"1":__('Withdraw 1')}, formatter: Table.api.formatter.normal},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
+                            buttons:[
+                                {
+                                    name: 'ban',
+                                    title: __('一键禁用'),
+                                    classname: 'btn btn-xs btn-warning btn-magic btn-ajax',
+                                    icon: 'fa fa-times-circle',
+                                    confirm: '确认一键禁用?',
+                                    url: 'user_power/powerBan',
+                                    success: function (data, ret) {
+                                        //Layer.alert(ret.msg);
+                                        //如果需要阻止成功提示,则必须使用return false;
+                                        if (ret.code == 0) {
+                                            return false;
+                                        }
+                                        table.bootstrapTable('refresh');
+                                    },
+                                    error: function (data, ret) {
+                                        Layer.alert(ret.msg);
+                                        return false;
+                                    }
+                                },
+                                {
+                                    name: 'unban',
+                                    title: __('一键解禁'),
+                                    classname: 'btn btn-xs btn-info btn-magic btn-ajax',
+                                    icon: 'fa fa-check-circle',
+                                    confirm: '确认一键解禁?',
+                                    url: 'user_power/powerUnban',
+                                    success: function (data, ret) {
+                                        //Layer.alert(ret.msg);
+                                        //如果需要阻止成功提示,则必须使用return false;
+                                        if (ret.code == 0) {
+                                            return false;
+                                        }
+                                        table.bootstrapTable('refresh');
+                                    },
+                                    error: function (data, ret) {
+                                        Layer.alert(ret.msg);
+                                        return false;
+                                    }
+                                },
+                            ]
+                        }
                     ]
                 ]
             });