diff --git a/app/admin/controller/user/Group.php b/app/admin/controller/user/Group.php deleted file mode 100644 index af00ee2..0000000 --- a/app/admin/controller/user/Group.php +++ /dev/null @@ -1,150 +0,0 @@ -model = new UserGroup(); - return null; - } - - public function select(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - list($where, $alias, $limit, $order) = $this->queryBuilder(); - $data = $this->model - ->alias($alias) - ->where($where) - ->order($order) - ->limit(9999) - ->select() - ->toArray(); - - return $this->success('', [ - 'options' => $data, - ]); - } - - public function add(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - if ($request->method() !== 'POST') { - return $this->error(__('Parameter error')); - } - - $data = $request->post(); - if (!$data) { - return $this->error(__('Parameter %s can not be empty', [''])); - } - - $data = $this->excludeFields($data); - $data = $this->handleRules($data); - - $result = false; - $this->model->startTrans(); - try { - if ($this->modelValidate) { - $validateClass = str_replace("\\model\\", "\\validate\\", get_class($this->model)); - if (class_exists($validateClass)) { - $validate = new $validateClass(); - $validate->scene('add')->check($data); - } - } - $result = $this->model->save($data); - $this->model->commit(); - } catch (Throwable $e) { - $this->model->rollback(); - return $this->error($e->getMessage()); - } - return $result !== false ? $this->success(__('Added successfully')) : $this->error(__('No rows were added')); - } - - public function edit(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - $pk = $this->model->getPk(); - $id = $request->post($pk) ?? $request->get($pk); - $row = $this->model->find($id); - if (!$row) { - return $this->error(__('Record not found')); - } - - if ($request->method() === 'POST') { - $data = $request->post(); - if (!$data) { - return $this->error(__('Parameter %s can not be empty', [''])); - } - $data = $this->excludeFields($data); - $data = $this->handleRules($data); - $result = false; - $this->model->startTrans(); - try { - if ($this->modelValidate) { - $validateClass = str_replace("\\model\\", "\\validate\\", get_class($this->model)); - if (class_exists($validateClass)) { - $validate = new $validateClass(); - $validate->scene('edit')->check(array_merge($data, [$pk => $row[$pk]])); - } - } - $result = $row->save($data); - $this->model->commit(); - } catch (Throwable $e) { - $this->model->rollback(); - return $this->error($e->getMessage()); - } - return $result !== false ? $this->success(__('Update successful')) : $this->error(__('No rows updated')); - } - - $pidArr = UserRule::field('pid')->distinct(true)->where('id', 'in', $row->rules)->select()->toArray(); - $rules = $row->rules ? explode(',', $row->rules) : []; - foreach ($pidArr as $item) { - $ruKey = array_search($item['pid'], $rules); - if ($ruKey !== false) { - unset($rules[$ruKey]); - } - } - $rowData = $row->toArray(); - $rowData['rules'] = array_values($rules); - return $this->success('', ['row' => $rowData]); - } - - private function handleRules(array $data): array - { - if (isset($data['rules']) && is_array($data['rules']) && $data['rules']) { - $rules = UserRule::select(); - $super = true; - foreach ($rules as $rule) { - if (!in_array($rule['id'], $data['rules'])) { - $super = false; - break; - } - } - $data['rules'] = $super ? '*' : implode(',', $data['rules']); - } else { - unset($data['rules']); - } - return $data; - } -} diff --git a/app/admin/controller/user/MoneyLog.php b/app/admin/controller/user/MoneyLog.php deleted file mode 100644 index c2d628d..0000000 --- a/app/admin/controller/user/MoneyLog.php +++ /dev/null @@ -1,43 +0,0 @@ -model = new UserMoneyLog(); - return null; - } - - public function add(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - if ($request->method() === 'POST') { - return $this->_add(); - } - - $userId = $request->get('userId', $request->post('userId', 0)); - $user = User::where('id', $userId)->find(); - if (!$user) { - return $this->error(__("The user can't find it")); - } - return $this->success('', ['user' => $user]); - } -} diff --git a/app/admin/controller/user/Rule.php b/app/admin/controller/user/Rule.php deleted file mode 100644 index 5647fcb..0000000 --- a/app/admin/controller/user/Rule.php +++ /dev/null @@ -1,98 +0,0 @@ - 'desc']; - protected array|string $quickSearchField = 'title'; - - protected function initController(Request $request): ?Response - { - $this->model = new UserRule(); - $this->tree = Tree::instance(); - $isTree = filter_var($request->get('isTree', $request->post('isTree', true)), FILTER_VALIDATE_BOOLEAN); - $initValue = $request->get('initValue') ?? $request->post('initValue') ?? []; - $this->initValue = is_array($initValue) ? array_filter($initValue) : []; - $this->keyword = $request->get('quickSearch', $request->post('quickSearch', '')); - $this->assembleTree = $isTree && !$this->initValue; - return null; - } - - public function index(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - if ($request->get('select') || $request->post('select')) { - return $this->select($request); - } - - list($where, , , ) = $this->queryBuilder(); - $list = $this->model->where($where)->order($this->defaultSortField)->select(); - - if ($this->assembleTree) { - $list = $this->tree->assembleChild($list->toArray()); - } else { - $list = $list->toArray(); - } - - return $this->success('', [ - 'list' => $list, - 'remark' => get_route_remark(), - ]); - } - - public function add(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - return $this->_add(); - } - - public function edit(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - return $this->_edit(); - } - - public function del(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - return $this->_del(); - } - - public function select(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - list($where, , , ) = $this->queryBuilder(); - $list = $this->model->where($where)->order($this->defaultSortField)->select(); - - if ($this->assembleTree) { - $list = $this->tree->assembleChild($list->toArray()); - } else { - $list = $list->toArray(); - } - - return $this->success('', ['list' => $list]); - } -} diff --git a/app/admin/controller/user/ScoreLog.php b/app/admin/controller/user/ScoreLog.php deleted file mode 100644 index f065ad8..0000000 --- a/app/admin/controller/user/ScoreLog.php +++ /dev/null @@ -1,43 +0,0 @@ -model = new UserScoreLog(); - return null; - } - - public function add(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - if ($request->method() === 'POST') { - return $this->_add(); - } - - $userId = $request->get('userId', $request->post('userId', 0)); - $user = User::where('id', $userId)->find(); - if (!$user) { - return $this->error(__("The user can't find it")); - } - return $this->success('', ['user' => $user]); - } -} diff --git a/app/admin/controller/user/User.php b/app/admin/controller/user/User.php deleted file mode 100644 index 37909e8..0000000 --- a/app/admin/controller/user/User.php +++ /dev/null @@ -1,161 +0,0 @@ -model = new UserModel(); - return null; - } - - public function index(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - if ($request->get('select') || $request->post('select')) { - return $this->select($request); - } - - list($where, $alias, $limit, $order) = $this->queryBuilder(); - $res = $this->model - ->withoutField('password,salt') - ->withJoin($this->withJoinTable, $this->withJoinType) - ->alias($alias) - ->where($where) - ->order($order) - ->paginate($limit); - - return $this->success('', [ - 'list' => $res->items(), - 'total' => $res->total(), - 'remark' => get_route_remark(), - ]); - } - - public function add(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - if ($request->method() !== 'POST') { - return $this->error(__('Parameter error')); - } - - $data = $request->post(); - if (!$data) { - return $this->error(__('Parameter %s can not be empty', [''])); - } - - $passwd = $data['password'] ?? ''; - $data = $this->excludeFields($data); - - $result = false; - $this->model->startTrans(); - try { - if ($this->modelValidate) { - $validateClass = str_replace("\\model\\", "\\validate\\", get_class($this->model)); - if (class_exists($validateClass)) { - $validate = new $validateClass(); - if ($this->modelSceneValidate) $validate->scene('add'); - $validate->check($data); - } - } - $result = $this->model->save($data); - $this->model->commit(); - if ($passwd) { - $this->model->resetPassword($this->model->id, $passwd); - } - } catch (Throwable $e) { - $this->model->rollback(); - return $this->error($e->getMessage()); - } - return $result !== false ? $this->success(__('Added successfully')) : $this->error(__('No rows were added')); - } - - public function edit(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - $pk = $this->model->getPk(); - $id = $request->post($pk) ?? $request->get($pk); - $row = $this->model->find($id); - if (!$row) { - return $this->error(__('Record not found')); - } - - $dataLimitAdminIds = $this->getDataLimitAdminIds(); - if ($dataLimitAdminIds && !in_array($row[$this->dataLimitField], $dataLimitAdminIds)) { - return $this->error(__('You have no permission')); - } - - if ($request->method() === 'POST') { - $data = $request->post(); - if (!$data) { - return $this->error(__('Parameter %s can not be empty', [''])); - } - if (!empty($data['password'])) { - $this->model->resetPassword($row->id, $data['password']); - } - $data = $this->excludeFields($data); - $result = false; - $this->model->startTrans(); - try { - if ($this->modelValidate) { - $validateClass = str_replace("\\model\\", "\\validate\\", get_class($this->model)); - if (class_exists($validateClass)) { - $validate = new $validateClass(); - $validate->scene('edit')->check(array_merge($data, [$pk => $row[$pk]])); - } - } - $result = $row->save($data); - $this->model->commit(); - } catch (Throwable $e) { - $this->model->rollback(); - return $this->error($e->getMessage()); - } - return $result !== false ? $this->success(__('Update successful')) : $this->error(__('No rows updated')); - } - - unset($row['password'], $row['salt']); - $row['password'] = ''; - return $this->success('', ['row' => $row]); - } - - public function select(Request $request): Response - { - $response = $this->initializeBackend($request); - if ($response !== null) return $response; - - list($where, $alias, $limit, $order) = $this->queryBuilder(); - $res = $this->model - ->withoutField('password,salt') - ->withJoin($this->withJoinTable, $this->withJoinType) - ->alias($alias) - ->where($where) - ->order($order) - ->paginate($limit); - - return $this->success('', [ - 'list' => $res->items(), - 'total' => $res->total(), - ]); - } -} diff --git a/app/admin/model/User.php b/app/admin/model/User.php deleted file mode 100644 index dd623e6..0000000 --- a/app/admin/model/User.php +++ /dev/null @@ -1,48 +0,0 @@ -belongsTo(UserGroup::class, 'group_id'); - } - - public function resetPassword(int|string $uid, string $newPassword): int - { - return $this->where(['id' => $uid])->update(['password' => hash_password($newPassword), 'salt' => '']); - } -} diff --git a/app/admin/model/UserGroup.php b/app/admin/model/UserGroup.php deleted file mode 100644 index ebaf7a2..0000000 --- a/app/admin/model/UserGroup.php +++ /dev/null @@ -1,17 +0,0 @@ -user_id)->lock(true)->find(); - if (!$user) { - throw new \Exception(__("The user can't find it")); - } - if (!$model->memo) { - throw new \Exception(__("Change note cannot be blank")); - } - $model->before = $user->money; - $user->money += $model->money; - $user->save(); - $model->after = $user->money; - } - - public static function onBeforeDelete(): bool - { - return false; - } - - public function getMoneyAttr($value): string - { - return bcdiv((string) $value, '100', 2); - } - - public function setMoneyAttr($value): string - { - return bcmul((string) $value, '100', 2); - } - - public function getBeforeAttr($value): string - { - return bcdiv((string) $value, '100', 2); - } - - public function setBeforeAttr($value): string - { - return bcmul((string) $value, '100', 2); - } - - public function getAfterAttr($value): string - { - return bcdiv((string) $value, '100', 2); - } - - public function setAfterAttr($value): string - { - return bcmul((string) $value, '100', 2); - } - - public function user(): BelongsTo - { - return $this->belongsTo(User::class, 'user_id'); - } -} diff --git a/app/admin/model/UserScoreLog.php b/app/admin/model/UserScoreLog.php deleted file mode 100644 index 64c4490..0000000 --- a/app/admin/model/UserScoreLog.php +++ /dev/null @@ -1,42 +0,0 @@ -user_id)->lock(true)->find(); - if (!$user) { - throw new \Exception(__("The user can't find it")); - } - if (!$model->memo) { - throw new \Exception(__("Change note cannot be blank")); - } - $model->before = $user->score; - $user->score += $model->score; - $user->save(); - $model->after = $user->score; - } - - public static function onBeforeDelete(): bool - { - return false; - } - - public function user(): BelongsTo - { - return $this->belongsTo(User::class, 'user_id'); - } -} diff --git a/app/admin/validate/UserMoneyLog.php b/app/admin/validate/UserMoneyLog.php deleted file mode 100644 index a46cc51..0000000 --- a/app/admin/validate/UserMoneyLog.php +++ /dev/null @@ -1,37 +0,0 @@ - 'require', - 'money' => 'require', - 'memo' => 'require', - ]; - - protected $message = []; - - protected $field = []; - - protected $scene = [ - 'add' => ['user_id', 'money', 'memo'], - 'edit' => ['user_id', 'money', 'memo'], - ]; - - public function __construct() - { - $this->field = [ - 'user_id' => __('user_id'), - 'money' => __('money'), - 'memo' => __('memo'), - ]; - parent::__construct(); - } -} diff --git a/app/admin/validate/UserScoreLog.php b/app/admin/validate/UserScoreLog.php deleted file mode 100644 index 66ab985..0000000 --- a/app/admin/validate/UserScoreLog.php +++ /dev/null @@ -1,37 +0,0 @@ - 'require', - 'score' => 'require', - 'memo' => 'require', - ]; - - protected $message = []; - - protected $field = []; - - protected $scene = [ - 'add' => ['user_id', 'score', 'memo'], - 'edit' => ['user_id', 'score', 'memo'], - ]; - - public function __construct() - { - $this->field = [ - 'user_id' => __('user_id'), - 'score' => __('score'), - 'memo' => __('memo'), - ]; - parent::__construct(); - } -} diff --git a/app/api/controller/Install.php b/app/api/controller/Install.php index a3a2650..d9483fb 100644 --- a/app/api/controller/Install.php +++ b/app/api/controller/Install.php @@ -11,7 +11,6 @@ use ba\Terminal; use ba\Filesystem; use app\common\controller\Api; use app\admin\model\Admin as AdminModel; -use app\admin\model\User as UserModel; use app\process\Monitor; use support\Response; use Webman\Http\Request; @@ -627,10 +626,6 @@ class Install extends Api $adminModel->resetPassword($defaultAdmin->id, $param['adminpassword']); } - // 默认用户密码修改 - $user = new UserModel(); - $user->resetPassword(1, Random::build()); - // 修改站点名称 if (class_exists(\app\admin\model\Config::class)) { \app\admin\model\Config::where('name', 'site_name')->update([ diff --git a/app/api/controller/User.php b/app/api/controller/User.php index 8e27665..66abaa1 100644 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -6,6 +6,7 @@ use ba\Captcha; use ba\ClickCaptcha; use app\common\controller\Frontend; use app\common\facade\Token; +use support\think\Db; use support\validation\Validator; use support\validation\ValidationException; use Webman\Http\Request; @@ -46,6 +47,7 @@ class User extends Frontend 'captchaId' => $params['captchaId'] ?? '', 'captchaInfo' => $params['captchaInfo'] ?? '', 'registerType' => $params['registerType'] ?? '', + 'invite_code' => $params['invite_code'] ?? '', ]); if (!in_array($params['tab'], ['login', 'register'])) { @@ -72,7 +74,20 @@ class User extends Frontend if (!$captchaObj->check($params['captcha'], $params[$params['registerType']] . 'user_register')) { return $this->error(__('Please enter the correct verification code')); } - $res = $this->auth->register($params['username'], $params['password'], $params['mobile'], $params['email']); + $extend = []; + if (!empty($params['invite_code'])) { + $inviterAdmin = Db::name('admin') + ->field(['id', 'channel_id']) + ->where('invite_code', $params['invite_code']) + ->find(); + if (!$inviterAdmin) { + return $this->error(__('Parameter error')); + } + $extend['register_invite_code'] = $params['invite_code']; + $extend['inviter_admin_id'] = $inviterAdmin['id']; + $extend['channel_id'] = $inviterAdmin['channel_id'] ?? null; + } + $res = $this->auth->register($params['username'], $params['password'], $params['mobile'], $params['email'], 1, $extend); } if ($res === true) { @@ -117,6 +132,7 @@ class User extends Frontend 'email' => 'required_if:registerType,email|email|unique:user,email', 'mobile' => 'required_if:registerType,mobile|regex:/^1[3-9]\d{9}$/|unique:user,mobile', 'captcha' => 'required|string', + 'invite_code' => 'nullable|string|max:64', ], [ 'username.regex' => __('Please input correct username'), @@ -129,6 +145,7 @@ class User extends Frontend 'password' => __('Password'), 'captcha' => __('captcha'), 'registerType' => __('Register type'), + 'invite_code' => __('Invite code'), ] ]; } diff --git a/app/functions.php b/app/functions.php index 18b52be..5537463 100644 --- a/app/functions.php +++ b/app/functions.php @@ -170,7 +170,7 @@ if (!function_exists('get_controller_path')) { * 从 Request 或路由获取控制器路径(等价于 ThinkPHP controllerPath) * 优先从 $request->controller(Webman 路由匹配时设置)解析,否则从 path 解析 * @param \Webman\Http\Request|null $request - * @return string|null 如 auth/admin、user/user + * @return string|null 如 auth/admin */ function get_controller_path($request = null): ?string { diff --git a/config/route.php b/config/route.php index 83c54b0..5e9c1c6 100644 --- a/config/route.php +++ b/config/route.php @@ -172,29 +172,6 @@ Route::get('/admin/auth/rule/select', [\app\admin\controller\auth\Rule::class, ' // admin/auth/adminLog Route::get('/admin/auth/adminLog/index', [\app\admin\controller\auth\AdminLog::class, 'index']); -// admin/user/user -Route::get('/admin/user/user/index', [\app\admin\controller\user\User::class, 'index']); -Route::post('/admin/user/user/add', [\app\admin\controller\user\User::class, 'add']); -Route::post('/admin/user/user/edit', [\app\admin\controller\user\User::class, 'edit']); -Route::get('/admin/user/user/select', [\app\admin\controller\user\User::class, 'select']); - -// admin/user/group -Route::post('/admin/user/group/add', [\app\admin\controller\user\Group::class, 'add']); -Route::post('/admin/user/group/edit', [\app\admin\controller\user\Group::class, 'edit']); - -// admin/user/rule -Route::get('/admin/user/rule/index', [\app\admin\controller\user\Rule::class, 'index']); -Route::post('/admin/user/rule/add', [\app\admin\controller\user\Rule::class, 'add']); -Route::post('/admin/user/rule/edit', [\app\admin\controller\user\Rule::class, 'edit']); -Route::post('/admin/user/rule/del', [\app\admin\controller\user\Rule::class, 'del']); -Route::get('/admin/user/rule/select', [\app\admin\controller\user\Rule::class, 'select']); - -// admin/user/scoreLog -Route::post('/admin/user/scoreLog/add', [\app\admin\controller\user\ScoreLog::class, 'add']); - -// admin/user/moneyLog -Route::post('/admin/user/moneyLog/add', [\app\admin\controller\user\MoneyLog::class, 'add']); - // admin/routine/config Route::get('/admin/routine/config/index', [\app\admin\controller\routine\Config::class, 'index']); Route::post('/admin/routine/config/edit', [\app\admin\controller\routine\Config::class, 'edit']); diff --git a/database/migrations/20230620180916_install_data.php b/database/migrations/20230620180916_install_data.php index 6a62627..1043803 100644 --- a/database/migrations/20230620180916_install_data.php +++ b/database/migrations/20230620180916_install_data.php @@ -17,8 +17,6 @@ class InstallData extends AbstractMigration $this->menuRule(); $this->securityDataRecycle(); $this->securitySensitiveData(); - $this->user(); - $this->userGroup(); $this->userRule(); } @@ -456,245 +454,6 @@ class InstallData extends AbstractMigration 'updatetime' => $this->nowTime, 'createtime' => $this->nowTime, ], - [ - 'id' => '21', - 'type' => 'menu_dir', - 'title' => '会员管理', - 'name' => 'user', - 'path' => 'user', - 'icon' => 'fa fa-drivers-license', - 'weigh' => '95', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '22', - 'pid' => '21', - 'type' => 'menu', - 'title' => '会员管理', - 'name' => 'user/user', - 'path' => 'user/user', - 'icon' => 'fa fa-user', - 'menu_type' => 'tab', - 'component' => '/src/views/backend/user/user/index.vue', - 'keepalive' => '1', - 'weigh' => '94', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '23', - 'pid' => '22', - 'type' => 'button', - 'title' => '查看', - 'name' => 'user/user/index', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '24', - 'pid' => '22', - 'type' => 'button', - 'title' => '添加', - 'name' => 'user/user/add', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '25', - 'pid' => '22', - 'type' => 'button', - 'title' => '编辑', - 'name' => 'user/user/edit', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '26', - 'pid' => '22', - 'type' => 'button', - 'title' => '删除', - 'name' => 'user/user/del', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '27', - 'pid' => '21', - 'type' => 'menu', - 'title' => '会员分组管理', - 'name' => 'user/group', - 'path' => 'user/group', - 'icon' => 'fa fa-group', - 'menu_type' => 'tab', - 'component' => '/src/views/backend/user/group/index.vue', - 'keepalive' => '1', - 'weigh' => '93', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '28', - 'pid' => '27', - 'type' => 'button', - 'title' => '查看', - 'name' => 'user/group/index', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '29', - 'pid' => '27', - 'type' => 'button', - 'title' => '添加', - 'name' => 'user/group/add', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '30', - 'pid' => '27', - 'type' => 'button', - 'title' => '编辑', - 'name' => 'user/group/edit', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '31', - 'pid' => '27', - 'type' => 'button', - 'title' => '删除', - 'name' => 'user/group/del', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '32', - 'pid' => '21', - 'type' => 'menu', - 'title' => '会员规则管理', - 'name' => 'user/rule', - 'path' => 'user/rule', - 'icon' => 'fa fa-th-list', - 'menu_type' => 'tab', - 'component' => '/src/views/backend/user/rule/index.vue', - 'keepalive' => '1', - 'weigh' => '92', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '33', - 'pid' => '32', - 'type' => 'button', - 'title' => '查看', - 'name' => 'user/rule/index', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '34', - 'pid' => '32', - 'type' => 'button', - 'title' => '添加', - 'name' => 'user/rule/add', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '35', - 'pid' => '32', - 'type' => 'button', - 'title' => '编辑', - 'name' => 'user/rule/edit', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '36', - 'pid' => '32', - 'type' => 'button', - 'title' => '删除', - 'name' => 'user/rule/del', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '37', - 'pid' => '32', - 'type' => 'button', - 'title' => '快速排序', - 'name' => 'user/rule/sortable', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '38', - 'pid' => '21', - 'type' => 'menu', - 'title' => '会员余额管理', - 'name' => 'user/moneyLog', - 'path' => 'user/moneyLog', - 'icon' => 'el-icon-Money', - 'menu_type' => 'tab', - 'component' => '/src/views/backend/user/moneyLog/index.vue', - 'keepalive' => '1', - 'weigh' => '91', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '39', - 'pid' => '38', - 'type' => 'button', - 'title' => '查看', - 'name' => 'user/moneyLog/index', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '40', - 'pid' => '38', - 'type' => 'button', - 'title' => '添加', - 'name' => 'user/moneyLog/add', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '41', - 'pid' => '21', - 'type' => 'menu', - 'title' => '会员积分管理', - 'name' => 'user/scoreLog', - 'path' => 'user/scoreLog', - 'icon' => 'el-icon-Discount', - 'menu_type' => 'tab', - 'component' => '/src/views/backend/user/scoreLog/index.vue', - 'keepalive' => '1', - 'weigh' => '90', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '42', - 'pid' => '41', - 'type' => 'button', - 'title' => '查看', - 'name' => 'user/scoreLog/index', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], - [ - 'id' => '43', - 'pid' => '41', - 'type' => 'button', - 'title' => '添加', - 'name' => 'user/scoreLog/add', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], [ 'id' => '44', 'type' => 'menu_dir', @@ -1214,16 +973,6 @@ class InstallData extends AbstractMigration 'updatetime' => $this->nowTime, 'createtime' => $this->nowTime, ], - [ - 'id' => 5, - 'name' => '会员', - 'controller' => 'user/User.php', - 'controller_as' => 'user/user', - 'data_table' => 'user', - 'primary_key' => 'id', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], [ 'id' => 6, 'name' => '数据回收规则', @@ -1257,18 +1006,6 @@ class InstallData extends AbstractMigration 'updatetime' => $this->nowTime, 'createtime' => $this->nowTime, ], - [ - 'id' => 2, - 'name' => '会员数据', - 'controller' => 'user/User.php', - 'controller_as' => 'user/user', - 'data_table' => 'user', - 'primary_key' => 'id', - 'data_fields' => '{"username":"用户名","mobile":"手机号","password":"密码","status":"状态","email":"邮箱地址"}', - 'status' => '1', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ], [ 'id' => 3, 'name' => '管理员权限', @@ -1288,49 +1025,6 @@ class InstallData extends AbstractMigration } } - public function user(): void - { - $table = $this->table('user'); - $rows = [ - [ - 'id' => 1, - 'group_id' => 1, - 'username' => 'user', - 'nickname' => 'User', - 'email' => '18888888888@qq.com', - 'mobile' => '18888888888', - 'gender' => '2', - 'birthday' => date('Y-m-d'), - 'status' => 'enable', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ] - ]; - $exist = Db::name('user')->where('id', 1)->value('id'); - if (!$exist) { - $table->insert($rows)->saveData(); - } - } - - public function userGroup(): void - { - $table = $this->table('user_group'); - $rows = [ - [ - 'id' => 1, - 'name' => '默认分组', - 'rules' => '*', - 'status' => '1', - 'updatetime' => $this->nowTime, - 'createtime' => $this->nowTime, - ] - ]; - $exist = Db::name('user_group')->where('id', 1)->value('id'); - if (!$exist) { - $table->insert($rows)->saveData(); - } - } - public function userRule(): void { $table = $this->table('user_rule'); diff --git a/web/src/api/backend/user/group.ts b/web/src/api/backend/user/group.ts deleted file mode 100644 index 010f231..0000000 --- a/web/src/api/backend/user/group.ts +++ /dev/null @@ -1,8 +0,0 @@ -import createAxios from '/@/utils/axios' - -export function getUserRules() { - return createAxios({ - url: '/admin/user.Rule/index', - method: 'get', - }) -} diff --git a/web/src/api/backend/user/moneyLog.ts b/web/src/api/backend/user/moneyLog.ts deleted file mode 100644 index e2078fe..0000000 --- a/web/src/api/backend/user/moneyLog.ts +++ /dev/null @@ -1,13 +0,0 @@ -import createAxios from '/@/utils/axios' - -export const url = '/admin/user.MoneyLog/' - -export function add(userId: string) { - return createAxios({ - url: url + 'add', - method: 'get', - params: { - userId: userId, - }, - }) -} diff --git a/web/src/api/backend/user/scoreLog.ts b/web/src/api/backend/user/scoreLog.ts deleted file mode 100644 index 9262d2a..0000000 --- a/web/src/api/backend/user/scoreLog.ts +++ /dev/null @@ -1,13 +0,0 @@ -import createAxios from '/@/utils/axios' - -export const url = '/admin/user.ScoreLog/' - -export function add(userId: string) { - return createAxios({ - url: url + 'add', - method: 'get', - params: { - userId: userId, - }, - }) -} diff --git a/web/src/lang/autoload.ts b/web/src/lang/autoload.ts index af5d708..f3ba371 100644 --- a/web/src/lang/autoload.ts +++ b/web/src/lang/autoload.ts @@ -8,7 +8,5 @@ import { adminBaseRoutePath } from '/@/router/static/adminBase' export default { '/': ['./frontend/${lang}/index.ts'], [adminBaseRoutePath + '/moduleStore']: ['./backend/${lang}/module.ts'], - [adminBaseRoutePath + '/user/rule']: ['./backend/${lang}/auth/rule.ts'], - [adminBaseRoutePath + '/user/scoreLog']: ['./backend/${lang}/user/moneyLog.ts'], [adminBaseRoutePath + '/crud/crud']: ['./backend/${lang}/crud/log.ts', './backend/${lang}/crud/state.ts'], } diff --git a/web/src/lang/backend/en/user/group.ts b/web/src/lang/backend/en/user/group.ts deleted file mode 100644 index 8f6b6cc..0000000 --- a/web/src/lang/backend/en/user/group.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default { - GroupName: 'Group name', - 'Group name': 'Group name', - jurisdiction: 'Permissions', -} diff --git a/web/src/lang/backend/en/user/moneyLog.ts b/web/src/lang/backend/en/user/moneyLog.ts deleted file mode 100644 index 0714c79..0000000 --- a/web/src/lang/backend/en/user/moneyLog.ts +++ /dev/null @@ -1,16 +0,0 @@ -export default { - 'User name': 'Username', - 'User nickname': 'User nickname', - balance: 'Balance', - 'User ID': 'User ID', - 'Change balance': 'Change balance', - 'Before change': 'Before the change', - 'After change': 'After the change', - remarks: 'Remark', - 'Current balance': 'Current balance', - 'Change amount': 'Change amount', - 'Please enter the balance change amount': 'Please enter the balance change amount.', - 'Balance after change': 'Balance after change', - 'Please enter change remarks / description': 'Please enter change remarks/description', - User: 'User', -} diff --git a/web/src/lang/backend/en/user/rule.ts b/web/src/lang/backend/en/user/rule.ts deleted file mode 100644 index 9d2b92f..0000000 --- a/web/src/lang/backend/en/user/rule.ts +++ /dev/null @@ -1,26 +0,0 @@ -export default { - 'Normal routing': 'Normal routing', - 'Member center menu contents': 'Member center menu directory ', - 'Member center menu items': 'Member Center menu items', - 'Top bar menu items': 'Top bar menu items', - 'Page button': 'Page button', - 'Top bar user dropdown': 'Top bar user dropdown', - 'Type route tips': 'Automatically register as a front-end route', - 'Type menu_dir tips': 'Automatically register routes and serve as menu directory of member center This item cannot jump', - 'Type menu tips': 'Automatically register routes and serve as menu items in member centers', - 'Type nav tips': 'Routes are automatically registered as menu items in the top bar of the site', - 'Type button tips': 'Automatic registration as a permission node, can be quickly verified by v-auth', - 'Type nav_user_menu tips': 'Automatically register routes and serve as a dropdown menu for top bar members', - 'English name': 'English name', - 'Web side routing path': 'Web side routing path', - no_login_valid: 'no login valid', - 'no_login_valid 0': 'no', - 'no_login_valid 1': 'yes', - 'no_login_valid tips': 'Tourists do not have membership groups Use this option to set whether the current rules are valid for tourists (visible)', - 'For example, if you add account/overview as a route only': - 'Please start with /src for web side component paths, such as: /src/views/frontend/index.vue', - 'Web side component path, please start with /src, such as: /src/views/frontend/index': - "For example, if you add 'account/overview' as a route only, then you can additionally add 'account/overview', 'account/overview/:a' and 'account/overview/:b/:C' as menus only.", - 'Component path tips': - 'This item is mandatory within a WEB project; otherwise, it cannot be accessed. However, when it is used as a menu within a Nuxt project, there is no need to fill in this item', -} diff --git a/web/src/lang/backend/en/user/scoreLog.ts b/web/src/lang/backend/en/user/scoreLog.ts deleted file mode 100644 index 54a5ab6..0000000 --- a/web/src/lang/backend/en/user/scoreLog.ts +++ /dev/null @@ -1,8 +0,0 @@ -export default { - integral: 'Integral', - 'Change points': 'Change points', - 'Current points': 'Current points', - 'Please enter the change amount of points': 'Please enter the change amount of points', - 'Points after change': 'Points after change', - 'Please enter change remarks / description': 'Please enter change remarks/description', -} diff --git a/web/src/lang/backend/en/user/user.ts b/web/src/lang/backend/en/user/user.ts deleted file mode 100644 index 4a51286..0000000 --- a/web/src/lang/backend/en/user/user.ts +++ /dev/null @@ -1,22 +0,0 @@ -export default { - 'User name': 'Username', - nickname: 'Nickname', - group: 'Group', - avatar: 'Avatar', - Gender: 'Gender', - male: 'Male', - female: 'Female', - mobile: 'Mobile Number', - 'Last login IP': 'Last login IP', - 'Last login': 'Last login', - email: 'Email', - birthday: 'Birthday', - balance: 'Balance', - 'Adjustment balance': 'Adjust balance', - integral: 'Integral', - 'Adjust integral': 'Adjust integral', - password: 'Password', - 'Please leave blank if not modified': 'Please leave blank if you do not modify', - 'Personal signature': 'Personal signature', - 'Login account': 'Login account name', -} diff --git a/web/src/lang/backend/zh-cn/user/group.ts b/web/src/lang/backend/zh-cn/user/group.ts deleted file mode 100644 index 170fc8c..0000000 --- a/web/src/lang/backend/zh-cn/user/group.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default { - GroupName: '组名', - 'Group name': '组别名称', - jurisdiction: '权限', -} diff --git a/web/src/lang/backend/zh-cn/user/moneyLog.ts b/web/src/lang/backend/zh-cn/user/moneyLog.ts deleted file mode 100644 index 7f40880..0000000 --- a/web/src/lang/backend/zh-cn/user/moneyLog.ts +++ /dev/null @@ -1,16 +0,0 @@ -export default { - 'User name': '用户名', - 'User nickname': '用户昵称', - balance: '余额', - 'User ID': '用户ID', - 'Change balance': '变更余额', - 'Before change': '变更前', - 'After change': '变更后', - remarks: '备注', - 'Current balance': '当前余额', - 'Change amount': '变动数额', - 'Please enter the balance change amount': '请输入余额变更数额', - 'Balance after change': '变更后余额', - 'Please enter change remarks / description': '请输入变更备注/说明', - User: '用户', -} diff --git a/web/src/lang/backend/zh-cn/user/rule.ts b/web/src/lang/backend/zh-cn/user/rule.ts deleted file mode 100644 index d2851ad..0000000 --- a/web/src/lang/backend/zh-cn/user/rule.ts +++ /dev/null @@ -1,24 +0,0 @@ -export default { - 'Normal routing': '普通路由', - 'Member center menu contents': '会员中心菜单目录', - 'Member center menu items': '会员中心菜单项', - 'Top bar menu items': '顶栏菜单项', - 'Page button': '页面按钮', - 'Top bar user dropdown': '顶栏会员菜单下拉项', - 'Type route tips': '自动注册为前端路由', - 'Type menu_dir tips': '自动注册路由,并作为会员中心的菜单目录,此项本身不可跳转', - 'Type menu tips': '自动注册路由,并作为会员中心的菜单项目', - 'Type nav tips': '自动注册路由,并作为站点顶栏的菜单项目', - 'Type button tips': '自动注册为权限节点,可通过 v-auth 快速验权', - 'Type nav_user_menu tips': '自动注册路由,并作为顶栏会员菜单下拉项', - 'English name': '英文名称', - 'Web side routing path': 'WEB 端路由路径(vue-router 的 path)', - no_login_valid: '未登录有效', - 'no_login_valid 0': '游客无效', - 'no_login_valid 1': '游客有效', - 'no_login_valid tips': '游客没有会员分组,通过本选项设置当前规则是否对游客有效(可见)', - 'For example, if you add account/overview as a route only': 'WEB 端组件路径,请以 /src 开头,如:/src/views/frontend/index.vue', - 'Web side component path, please start with /src, such as: /src/views/frontend/index': - '比如将 `account/overview` 只添加为路由,那么可以另外将 `account/overview`、`account/overview/:a`、`account/overview/:b/:c` 只添加为菜单', - 'Component path tips': '组件路径在 WEB 工程内是必填的,否则无法访问,但作为 Nuxt 工程内的菜单时,无需填写此项,请根据菜单使用场景填写', -} diff --git a/web/src/lang/backend/zh-cn/user/scoreLog.ts b/web/src/lang/backend/zh-cn/user/scoreLog.ts deleted file mode 100644 index d6cbb21..0000000 --- a/web/src/lang/backend/zh-cn/user/scoreLog.ts +++ /dev/null @@ -1,8 +0,0 @@ -export default { - integral: '积分', - 'Change points': '变更积分', - 'Current points': '当前积分', - 'Please enter the change amount of points': '请输入积分变更数额', - 'Points after change': '变更后积分', - 'Please enter change remarks / description': '请输入变更备注/说明', -} diff --git a/web/src/lang/backend/zh-cn/user/user.ts b/web/src/lang/backend/zh-cn/user/user.ts deleted file mode 100644 index fc9df85..0000000 --- a/web/src/lang/backend/zh-cn/user/user.ts +++ /dev/null @@ -1,22 +0,0 @@ -export default { - 'User name': '用户名', - nickname: '昵称', - group: '分组', - avatar: '头像', - Gender: '性别', - male: '男', - female: '女', - mobile: '手机号', - 'Last login IP': '最后登录IP', - 'Last login': '最后登录', - email: '电子邮箱', - birthday: '生日', - balance: '余额', - 'Adjustment balance': '调整余额', - integral: '积分', - 'Adjust integral': '调整积分', - password: '密码', - 'Please leave blank if not modified': '不修改请留空', - 'Personal signature': '个性签名', - 'Login account': '登录账户名', -} diff --git a/web/src/views/backend/user/group/index.vue b/web/src/views/backend/user/group/index.vue deleted file mode 100644 index 27110de..0000000 --- a/web/src/views/backend/user/group/index.vue +++ /dev/null @@ -1,155 +0,0 @@ - - - - - diff --git a/web/src/views/backend/user/group/popupForm.vue b/web/src/views/backend/user/group/popupForm.vue deleted file mode 100644 index f60742e..0000000 --- a/web/src/views/backend/user/group/popupForm.vue +++ /dev/null @@ -1,145 +0,0 @@ - - - - - diff --git a/web/src/views/backend/user/moneyLog/index.vue b/web/src/views/backend/user/moneyLog/index.vue deleted file mode 100644 index b620f7f..0000000 --- a/web/src/views/backend/user/moneyLog/index.vue +++ /dev/null @@ -1,147 +0,0 @@ - - - - - diff --git a/web/src/views/backend/user/moneyLog/popupForm.vue b/web/src/views/backend/user/moneyLog/popupForm.vue deleted file mode 100644 index 50570b4..0000000 --- a/web/src/views/backend/user/moneyLog/popupForm.vue +++ /dev/null @@ -1,160 +0,0 @@ - - - - - diff --git a/web/src/views/backend/user/rule/index.vue b/web/src/views/backend/user/rule/index.vue deleted file mode 100644 index f631ff8..0000000 --- a/web/src/views/backend/user/rule/index.vue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - diff --git a/web/src/views/backend/user/rule/popupForm.vue b/web/src/views/backend/user/rule/popupForm.vue deleted file mode 100644 index 9343f12..0000000 --- a/web/src/views/backend/user/rule/popupForm.vue +++ /dev/null @@ -1,237 +0,0 @@ - - - - - diff --git a/web/src/views/backend/user/scoreLog/index.vue b/web/src/views/backend/user/scoreLog/index.vue deleted file mode 100644 index 676eaa8..0000000 --- a/web/src/views/backend/user/scoreLog/index.vue +++ /dev/null @@ -1,126 +0,0 @@ - - - - - diff --git a/web/src/views/backend/user/scoreLog/popupForm.vue b/web/src/views/backend/user/scoreLog/popupForm.vue deleted file mode 100644 index 0f54c04..0000000 --- a/web/src/views/backend/user/scoreLog/popupForm.vue +++ /dev/null @@ -1,160 +0,0 @@ - - - - - diff --git a/web/src/views/backend/user/user/index.vue b/web/src/views/backend/user/user/index.vue deleted file mode 100644 index a55b23b..0000000 --- a/web/src/views/backend/user/user/index.vue +++ /dev/null @@ -1,114 +0,0 @@ - - - - - diff --git a/web/src/views/backend/user/user/popupForm.vue b/web/src/views/backend/user/user/popupForm.vue deleted file mode 100644 index 48850fd..0000000 --- a/web/src/views/backend/user/user/popupForm.vue +++ /dev/null @@ -1,238 +0,0 @@ - - - - -