diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..3b664107 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "git.ignoreLimitWarning": true +} \ No newline at end of file diff --git a/Backend/.env b/Backend/.env old mode 100755 new mode 100644 diff --git a/Backend/.env.development b/Backend/.env.development deleted file mode 100755 index b64122f3..00000000 --- a/Backend/.env.development +++ /dev/null @@ -1,14 +0,0 @@ -# 环境标识 -NODE_ENV=development -VUE_APP_PREVIEW=false -# 应用名称 -VUE_APP_WEBSITE_NAME=艺施管理系统 - -# API基础URL -VUE_APP_API_BASE_URL=http://yishi.com - -# 前端网站 -VUE_APP_WWW_BASE_URL=http://yishi.com - -# WebSocket URL -VUE_APP_WEB_SOCKET_URL=wss://api.yishi.com/ws \ No newline at end of file diff --git a/Backend/.gitignore b/Backend/.gitignore old mode 100755 new mode 100644 index 403adbc1..bd4a9766 --- a/Backend/.gitignore +++ b/Backend/.gitignore @@ -5,6 +5,7 @@ node_modules # local env files .env.local +.env.development .env.*.local # Log files diff --git a/Backend/LICENSE b/Backend/LICENSE old mode 100755 new mode 100644 diff --git a/Backend/README.md b/Backend/README.md old mode 100755 new mode 100644 diff --git a/Backend/babel.config.js b/Backend/babel.config.js old mode 100755 new mode 100644 diff --git a/Backend/jsconfig.json b/Backend/jsconfig.json old mode 100755 new mode 100644 diff --git a/Backend/package.json b/Backend/package.json old mode 100755 new mode 100644 diff --git a/Backend/public/favicon.ico b/Backend/public/favicon.ico old mode 100755 new mode 100644 diff --git a/Backend/public/index.html b/Backend/public/index.html old mode 100755 new mode 100644 diff --git a/Backend/src/$ws.js b/Backend/src/$ws.js old mode 100755 new mode 100644 diff --git a/Backend/src/App.vue b/Backend/src/App.vue old mode 100755 new mode 100644 diff --git a/Backend/src/api/article.js b/Backend/src/api/article.js old mode 100755 new mode 100644 diff --git a/Backend/src/api/emoticon.js b/Backend/src/api/emoticon.js old mode 100755 new mode 100644 diff --git a/Backend/src/api/role.js b/Backend/src/api/role.js old mode 100755 new mode 100644 diff --git a/Backend/src/api/user.js b/Backend/src/api/user.js old mode 100755 new mode 100644 diff --git a/Backend/src/assets/css/global.less b/Backend/src/assets/css/global.less old mode 100755 new mode 100644 diff --git a/Backend/src/assets/css/markdown.css b/Backend/src/assets/css/markdown.css old mode 100755 new mode 100644 diff --git a/Backend/src/assets/css/page/contacts.less b/Backend/src/assets/css/page/contacts.less old mode 100755 new mode 100644 diff --git a/Backend/src/assets/css/page/login-auth.less b/Backend/src/assets/css/page/login-auth.less old mode 100755 new mode 100644 diff --git a/Backend/src/assets/css/page/note-page.less b/Backend/src/assets/css/page/note-page.less old mode 100755 new mode 100644 diff --git a/Backend/src/assets/css/reset.css b/Backend/src/assets/css/reset.css old mode 100755 new mode 100644 diff --git a/Backend/src/assets/css/talk/talk-records.less b/Backend/src/assets/css/talk/talk-records.less old mode 100755 new mode 100644 diff --git a/Backend/src/assets/css/variable.less b/Backend/src/assets/css/variable.less old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/1701.mp3 b/Backend/src/assets/image/1701.mp3 old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/59y888piCn92.mp3 b/Backend/src/assets/image/59y888piCn92.mp3 old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/RaJik9TWDi.png b/Backend/src/assets/image/RaJik9TWDi.png old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/aliyun-abs.jpg b/Backend/src/assets/image/aliyun-abs.jpg old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/background/001.jpg b/Backend/src/assets/image/background/001.jpg old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/background/002.jpg b/Backend/src/assets/image/background/002.jpg old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/background/003.jpg b/Backend/src/assets/image/background/003.jpg old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/background/004.jpg b/Backend/src/assets/image/background/004.jpg old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/background/005.png b/Backend/src/assets/image/background/005.png old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/chat-search-no-message.png b/Backend/src/assets/image/chat-search-no-message.png old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/chat.png b/Backend/src/assets/image/chat.png old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/default-user-banner.png b/Backend/src/assets/image/default-user-banner.png old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/detault-avatar.jpg b/Backend/src/assets/image/detault-avatar.jpg old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/gitee-avatar.jpg b/Backend/src/assets/image/gitee-avatar.jpg old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/github-avatar.jpg b/Backend/src/assets/image/github-avatar.jpg old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/icon_face.png b/Backend/src/assets/image/icon_face.png old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/icon_heart.png b/Backend/src/assets/image/icon_heart.png old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/no-oncall.6b776fcf.png b/Backend/src/assets/image/no-oncall.6b776fcf.png old mode 100755 new mode 100644 diff --git a/Backend/src/assets/image/obj_w5zD.mp3 b/Backend/src/assets/image/obj_w5zD.mp3 old mode 100755 new mode 100644 diff --git a/Backend/src/components/editor/MeEditor.vue b/Backend/src/components/editor/MeEditor.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/editor/MeEditorEmoticon.vue b/Backend/src/components/editor/MeEditorEmoticon.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/editor/MeEditorFileManage.vue b/Backend/src/components/editor/MeEditorFileManage.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/editor/MeEditorImageView.vue b/Backend/src/components/editor/MeEditorImageView.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/editor/MeEditorRecorder.vue b/Backend/src/components/editor/MeEditorRecorder.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/editor/MeEditorSystemEmoticon.vue b/Backend/src/components/editor/MeEditorSystemEmoticon.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/global/Empty.vue b/Backend/src/components/global/Empty.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/global/Loading.vue b/Backend/src/components/global/Loading.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/group/GroupLaunch.vue b/Backend/src/components/group/GroupLaunch.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/group/GroupManage.vue b/Backend/src/components/group/GroupManage.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/group/GroupNotice.vue b/Backend/src/components/group/GroupNotice.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/group/GroupPanel.vue b/Backend/src/components/group/GroupPanel.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/layout/AbsModule.vue b/Backend/src/components/layout/AbsModule.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/layout/AvatarCropper.vue b/Backend/src/components/layout/AvatarCropper.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/layout/RewardModule.vue b/Backend/src/components/layout/RewardModule.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/layout/SkinModule.vue b/Backend/src/components/layout/SkinModule.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/layout/WelcomeModule.vue b/Backend/src/components/layout/WelcomeModule.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/note/NoteAnnexBox.vue b/Backend/src/components/note/NoteAnnexBox.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/note/NoteAnnexRecycle.vue b/Backend/src/components/note/NoteAnnexRecycle.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/note/NoteTagBox.vue b/Backend/src/components/note/NoteTagBox.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/svg-icon/index.vue b/Backend/src/components/svg-icon/index.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/user/UserBusinessCard.vue b/Backend/src/components/user/UserBusinessCard.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/user/UserCard.vue b/Backend/src/components/user/UserCard.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/user/UserEditEmail.vue b/Backend/src/components/user/UserEditEmail.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/user/UserEditMobile.vue b/Backend/src/components/user/UserEditMobile.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/user/UserEditPassword.vue b/Backend/src/components/user/UserEditPassword.vue old mode 100755 new mode 100644 diff --git a/Backend/src/components/user/UserSearch.vue b/Backend/src/components/user/UserSearch.vue old mode 100755 new mode 100644 diff --git a/Backend/src/config/config.js b/Backend/src/config/config.js old mode 100755 new mode 100644 diff --git a/Backend/src/core/directives.js b/Backend/src/core/directives.js old mode 100755 new mode 100644 diff --git a/Backend/src/core/filter.js b/Backend/src/core/filter.js old mode 100755 new mode 100644 diff --git a/Backend/src/core/global-component.js b/Backend/src/core/global-component.js old mode 100755 new mode 100644 diff --git a/Backend/src/core/icons.js b/Backend/src/core/icons.js old mode 100755 new mode 100644 diff --git a/Backend/src/core/lazy-use.js b/Backend/src/core/lazy-use.js old mode 100755 new mode 100644 diff --git a/Backend/src/directive/PreCode.js b/Backend/src/directive/PreCode.js old mode 100755 new mode 100644 diff --git a/Backend/src/icons/avatar-default.png b/Backend/src/icons/avatar-default.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/avatar-room.png b/Backend/src/icons/avatar-room.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/check.png b/Backend/src/icons/check.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/image-default.png b/Backend/src/icons/image-default.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/index.js b/Backend/src/icons/index.js old mode 100755 new mode 100644 diff --git a/Backend/src/icons/link.png b/Backend/src/icons/link.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/logo.png b/Backend/src/icons/logo.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/main-client-down.png b/Backend/src/icons/main-client-down.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/main-client-total.png b/Backend/src/icons/main-client-total.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/main-client-up.png b/Backend/src/icons/main-client-up.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/main-room-total.png b/Backend/src/icons/main-room-total.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/main-room-up.png b/Backend/src/icons/main-room-up.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/map.png b/Backend/src/icons/map.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/play.png b/Backend/src/icons/play.png old mode 100755 new mode 100644 diff --git a/Backend/src/icons/svg/mention-down.svg b/Backend/src/icons/svg/mention-down.svg old mode 100755 new mode 100644 diff --git a/Backend/src/icons/svg/not-data.svg b/Backend/src/icons/svg/not-data.svg old mode 100755 new mode 100644 diff --git a/Backend/src/icons/svg/not-fount.svg b/Backend/src/icons/svg/not-fount.svg old mode 100755 new mode 100644 diff --git a/Backend/src/icons/svg/note-book.svg b/Backend/src/icons/svg/note-book.svg old mode 100755 new mode 100644 diff --git a/Backend/src/icons/svg/note.svg b/Backend/src/icons/svg/note.svg old mode 100755 new mode 100644 diff --git a/Backend/src/icons/svg/zhuangfa.svg b/Backend/src/icons/svg/zhuangfa.svg old mode 100755 new mode 100644 diff --git a/Backend/src/icons/user-avatar.png b/Backend/src/icons/user-avatar.png old mode 100755 new mode 100644 diff --git a/Backend/src/main.js b/Backend/src/main.js old mode 100755 new mode 100644 diff --git a/Backend/src/mixins/main-mixin.js b/Backend/src/mixins/main-mixin.js old mode 100755 new mode 100644 diff --git a/Backend/src/permission.js b/Backend/src/permission.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/recorder/record-sdk.js b/Backend/src/plugins/recorder/record-sdk.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/recorder/recorder.js b/Backend/src/plugins/recorder/recorder.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/sms-lock.js b/Backend/src/plugins/sms-lock.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/socket/event/app-message-event.js b/Backend/src/plugins/socket/event/app-message-event.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/socket/event/friend-apply-event.js b/Backend/src/plugins/socket/event/friend-apply-event.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/socket/event/group-join-event.js b/Backend/src/plugins/socket/event/group-join-event.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/socket/event/keyboard-event.js b/Backend/src/plugins/socket/event/keyboard-event.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/socket/event/login-event.js b/Backend/src/plugins/socket/event/login-event.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/socket/event/revoke-event.js b/Backend/src/plugins/socket/event/revoke-event.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/socket/event/talk-event.js b/Backend/src/plugins/socket/event/talk-event.js old mode 100755 new mode 100644 diff --git a/Backend/src/plugins/socket/ws-socket.js b/Backend/src/plugins/socket/ws-socket.js old mode 100755 new mode 100644 diff --git a/Backend/src/router/auth.js b/Backend/src/router/auth.js old mode 100755 new mode 100644 diff --git a/Backend/src/router/home.js b/Backend/src/router/home.js old mode 100755 new mode 100644 diff --git a/Backend/src/router/index.js b/Backend/src/router/index.js old mode 100755 new mode 100644 diff --git a/Backend/src/router/system.js b/Backend/src/router/system.js old mode 100755 new mode 100644 diff --git a/Backend/src/socket-instance.js b/Backend/src/socket-instance.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/getters.js b/Backend/src/store/getters.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/index.js b/Backend/src/store/index.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/modules/dialogue.js b/Backend/src/store/modules/dialogue.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/modules/emoticon.js b/Backend/src/store/modules/emoticon.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/modules/note.js b/Backend/src/store/modules/note.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/modules/notify.js b/Backend/src/store/modules/notify.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/modules/settings.js b/Backend/src/store/modules/settings.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/modules/user.js b/Backend/src/store/modules/user.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/mutations.js b/Backend/src/store/mutations.js old mode 100755 new mode 100644 diff --git a/Backend/src/store/state.js b/Backend/src/store/state.js old mode 100755 new mode 100644 diff --git a/Backend/src/utils/auth.js b/Backend/src/utils/auth.js old mode 100755 new mode 100644 diff --git a/Backend/src/utils/date.js b/Backend/src/utils/date.js old mode 100755 new mode 100644 diff --git a/Backend/src/utils/editor.js b/Backend/src/utils/editor.js old mode 100755 new mode 100644 diff --git a/Backend/src/utils/emojis.js b/Backend/src/utils/emojis.js old mode 100755 new mode 100644 diff --git a/Backend/src/utils/functions.js b/Backend/src/utils/functions.js old mode 100755 new mode 100644 diff --git a/Backend/src/utils/request.js b/Backend/src/utils/request.js old mode 100755 new mode 100644 diff --git a/Backend/src/utils/talk.js b/Backend/src/utils/talk.js old mode 100755 new mode 100644 diff --git a/Backend/src/utils/validate.js b/Backend/src/utils/validate.js old mode 100755 new mode 100644 diff --git a/Backend/src/views/auth/layout.vue b/Backend/src/views/auth/layout.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/auth/login.vue b/Backend/src/views/auth/login.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/device/layout.vue b/Backend/src/views/device/layout.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/home/index.vue b/Backend/src/views/home/index.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/home/layout.vue b/Backend/src/views/home/layout.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/layout/MainLayout.vue b/Backend/src/views/layout/MainLayout.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/layout/MainLayout_back.vue b/Backend/src/views/layout/MainLayout_back.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/other/404.vue b/Backend/src/views/other/404.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/product/layout.vue b/Backend/src/views/product/layout.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/system/index.vue b/Backend/src/views/system/index.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/system/layout.vue b/Backend/src/views/system/layout.vue old mode 100755 new mode 100644 diff --git a/Backend/src/views/task/layout.vue b/Backend/src/views/task/layout.vue old mode 100755 new mode 100644 diff --git a/Backend/vue.config.js b/Backend/vue.config.js old mode 100755 new mode 100644 diff --git a/Server/.env b/Server/.env deleted file mode 100644 index 17cc44b4..00000000 --- a/Server/.env +++ /dev/null @@ -1,15 +0,0 @@ -[app] -debug = true -trace = true - -[database] -type = mysql -hostname = 127.0.0.1 -database = yi_54iis_com -username = yi_54iis_com -password = c1RbMwrZCCyxF1bC -hostport = 3306 -prefix = tk_ - -[api] -wechat_url = https://s2.siyuguanli.com:9991/ \ No newline at end of file diff --git a/Server/.gitignore b/Server/.gitignore index f48aabd3..aeb9cd4b 100644 --- a/Server/.gitignore +++ b/Server/.gitignore @@ -1,4 +1,5 @@ .idea +.env .vscode .DS_Store composer.lock diff --git a/Server/.htaccess b/Server/.htaccess old mode 100755 new mode 100644 diff --git a/Server/CHANGELOG.md b/Server/CHANGELOG.md old mode 100755 new mode 100644 diff --git a/Server/LICENSE.txt b/Server/LICENSE.txt old mode 100755 new mode 100644 diff --git a/Server/README.md b/Server/README.md old mode 100755 new mode 100644 diff --git a/Server/application/.htaccess b/Server/application/.htaccess old mode 100755 new mode 100644 diff --git a/Server/application/backend/controller/BaseController.php b/Server/application/backend/controller/BaseController.php old mode 100755 new mode 100644 diff --git a/Server/application/command.php b/Server/application/command.php old mode 100755 new mode 100644 diff --git a/Server/application/common.php b/Server/application/common.php old mode 100755 new mode 100644 diff --git a/Server/application/common/AliyunSMS.php b/Server/application/common/AliyunSMS.php old mode 100755 new mode 100644 diff --git a/Server/application/common/command/BaseCommand.php b/Server/application/common/command/BaseCommand.php old mode 100755 new mode 100644 diff --git a/Server/application/common/command/TestCommand.php b/Server/application/common/command/TestCommand.php old mode 100755 new mode 100644 diff --git a/Server/application/common/config/route.php b/Server/application/common/config/route.php index 60cf4d95..e8bb5000 100644 --- a/Server/application/common/config/route.php +++ b/Server/application/common/config/route.php @@ -3,27 +3,8 @@ use think\facade\Route; -// 添加测试路由 -Route::get('api/test', function() { - return json([ - 'code' => 200, - 'msg' => '路由测试成功', - 'data' => [ - 'time' => date('Y-m-d H:i:s'), - 'module' => 'common' - ] - ]); -}); - -// 数据库初始化路由 -Route::get('api/database/init', 'app\\common\\controller\\Database@init'); -Route::get('api/database/test', 'app\\common\\controller\\Database@test'); -Route::get('api/database/update-password', 'app\\common\\controller\\Database@updatePassword'); -Route::get('api/database/debug-password', 'app\\common\\controller\\Database@debugPassword'); -Route::get('api/database/reset-password', 'app\\common\\controller\\Database@resetPassword'); - // 定义RESTful风格的API路由 - 认证相关 -Route::group('api/auth', function () { +Route::group('v1/auth', function () { // 无需认证的接口 Route::post('login', 'app\\common\\controller\\Auth@login'); // 账号密码登录 Route::post('mobile-login', 'app\\common\\controller\\Auth@mobileLogin'); // 手机号验证码登录 @@ -32,6 +13,4 @@ Route::group('api/auth', function () { // 需要JWT认证的接口 Route::get('info', 'app\\common\\controller\\Auth@info')->middleware(['jwt']); // 获取用户信息 Route::post('refresh', 'app\\common\\controller\\Auth@refresh')->middleware(['jwt']); // 刷新令牌 -}); - -return []; \ No newline at end of file +}); \ No newline at end of file diff --git a/Server/application/common/controller/Auth.php b/Server/application/common/controller/Auth.php index 196c8e16..3c73b5e1 100644 --- a/Server/application/common/controller/Auth.php +++ b/Server/application/common/controller/Auth.php @@ -92,7 +92,7 @@ class Auth extends Controller if (!$validate->scene('mobile_login')->check($params)) { return ResponseHelper::error($validate->getError()); } - + try { // 判断验证码是否已加密 $isEncrypted = isset($params['is_encrypted']) && $params['is_encrypted'] === true; @@ -104,6 +104,7 @@ class Auth extends Controller Request::ip(), $isEncrypted ); + return ResponseHelper::success($result, '登录成功'); } catch (\Exception $e) { return ResponseHelper::error($e->getMessage()); diff --git a/Server/application/common/controller/Database.php b/Server/application/common/controller/Database.php deleted file mode 100644 index ab7db78d..00000000 --- a/Server/application/common/controller/Database.php +++ /dev/null @@ -1,196 +0,0 @@ -where('username', 'admin')->find(); - - if (!$adminExists) { - // 生成密码的加密值 - $hashedPassword = password_hash('123456', PASSWORD_BCRYPT); - - // 插入测试数据 - $insertDataSql = " - INSERT INTO `tk_users` (`username`, `password`, `mobile`, `identity_id`, `auth_id`) VALUES - ('admin', '{$hashedPassword}', '13800138000', 1, 1); - "; - - Db::execute($insertDataSql); - } - - return ResponseHelper::success(null, '数据库初始化完成'); - } catch (\Exception $e) { - return ResponseHelper::error('数据库初始化失败: ' . $e->getMessage()); - } - } - - /** - * 测试数据库连接和查询 - * @return \think\response\Json - */ - public function test() - { - try { - // 查询用户表中的数据 - $users = Db::table('tk_users')->select(); - - return ResponseHelper::success([ - 'count' => count($users), - 'users' => $users - ], '数据库查询成功'); - } catch (\Exception $e) { - return ResponseHelper::error('数据库查询失败: ' . $e->getMessage()); - } - } - - /** - * 更新用户密码 - * @param string $username 用户名 - * @param string $password 新密码 - * @return \think\response\Json - */ - public function updatePassword($username = 'admin', $password = '123456') - { - try { - // 生成密码的加密值 - $hashedPassword = password_hash($password, PASSWORD_BCRYPT); - - // 更新数据库中的用户密码 - $result = Db::table('tk_users') - ->where('username', $username) - ->update(['password' => $hashedPassword]); - - if ($result) { - return ResponseHelper::success([ - 'username' => $username, - 'password' => $password, - 'hashed_password' => $hashedPassword - ], '密码更新成功'); - } else { - return ResponseHelper::error('用户不存在或密码未更改'); - } - } catch (\Exception $e) { - return ResponseHelper::error('密码更新失败: ' . $e->getMessage()); - } - } - - /** - * 调试密码验证 - * @param string $username 用户名 - * @param string $password 密码 - * @return \think\response\Json - */ - public function debugPassword($username = 'admin', $password = '123456') - { - try { - // 查询用户 - $user = Db::table('tk_users')->where('username', $username)->find(); - - if (!$user) { - return ResponseHelper::error('用户不存在'); - } - - // 生成新的密码哈希 - $newHash = password_hash($password, PASSWORD_BCRYPT); - - // 验证密码 - $isValid = password_verify($password, $user['password']); - - // 更新密码(确保使用正确的哈希算法) - if (!$isValid) { - Db::table('tk_users') - ->where('username', $username) - ->update(['password' => $newHash]); - } - - return ResponseHelper::success([ - 'username' => $username, - 'stored_hash' => $user['password'], - 'new_hash' => $newHash, - 'is_valid' => $isValid, - 'password_info' => password_get_info($user['password']) - ], '密码验证调试信息'); - } catch (\Exception $e) { - return ResponseHelper::error('密码验证调试失败: ' . $e->getMessage()); - } - } - - /** - * 重置用户密码 - * @param string $username 用户名 - * @param string $password 新密码 - * @return \think\response\Json - */ - public function resetPassword($username = 'admin', $password = '123456') - { - try { - // 查询用户 - $user = Db::table('tk_users')->where('username', $username)->find(); - - if (!$user) { - return ResponseHelper::error('用户不存在'); - } - - // 使用正确的哈希算法生成密码 - $hashedPassword = password_hash($password, PASSWORD_BCRYPT, ['cost' => 10]); - - // 更新数据库中的用户密码 - $result = Db::table('tk_users') - ->where('username', $username) - ->update(['password' => $hashedPassword]); - - if ($result) { - // 验证密码是否正确 - $isValid = password_verify($password, $hashedPassword); - - return ResponseHelper::success([ - 'username' => $username, - 'password' => $password, - 'hashed_password' => $hashedPassword, - 'is_valid' => $isValid - ], '密码重置成功'); - } else { - return ResponseHelper::error('密码重置失败'); - } - } catch (\Exception $e) { - return ResponseHelper::error('密码重置失败: ' . $e->getMessage()); - } - } -} \ No newline at end of file diff --git a/Server/application/common/database/migrations/20240316_create_users_table.php b/Server/application/common/database/migrations/20240316_create_users_table.php deleted file mode 100644 index 7e5f0d76..00000000 --- a/Server/application/common/database/migrations/20240316_create_users_table.php +++ /dev/null @@ -1,79 +0,0 @@ -table('users', [ - 'engine' => 'InnoDB', - 'comment' => '用户表', - 'id' => 'id', - 'signed' => false, - ]); - - $table->addColumn('username', 'string', [ - 'limit' => 50, - 'null' => false, - 'comment' => '用户名', - ]) - ->addColumn('password', 'string', [ - 'limit' => 60, - 'null' => false, - 'comment' => '密码', - ]) - ->addColumn('mobile', 'string', [ - 'limit' => 11, - 'null' => true, - 'comment' => '登录手机号', - ]) - ->addColumn('identity_id', 'integer', [ - 'limit' => 10, - 'null' => true, - 'comment' => '身份信息', - ]) - ->addColumn('auth_id', 'integer', [ - 'limit' => 10, - 'null' => true, - 'comment' => '权限id', - ]) - ->addColumn('create_at', 'timestamp', [ - 'null' => false, - 'default' => 'CURRENT_TIMESTAMP', - 'comment' => '创建时间', - ]) - ->addColumn('update_at', 'timestamp', [ - 'null' => false, - 'default' => 'CURRENT_TIMESTAMP', - 'update' => 'CURRENT_TIMESTAMP', - 'comment' => '修改时间', - ]) - ->addColumn('delete_at', 'timestamp', [ - 'null' => true, - 'default' => null, - 'comment' => '删除时间', - ]) - ->addIndex(['username'], [ - 'unique' => true, - 'name' => 'idx_username', - ]) - ->addIndex(['mobile'], [ - 'unique' => true, - 'name' => 'idx_mobile', - ]) - ->create(); - } - - /** - * 删除用户表 - */ - public function down() - { - $this->dropTable('users'); - } -} \ No newline at end of file diff --git a/Server/application/common/database/tk_users.sql b/Server/application/common/database/tk_users.sql deleted file mode 100644 index ab142514..00000000 --- a/Server/application/common/database/tk_users.sql +++ /dev/null @@ -1,19 +0,0 @@ --- 创建用户表 -CREATE TABLE IF NOT EXISTS `tk_users` ( - `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID', - `username` varchar(50) NOT NULL COMMENT '用户名', - `password` varchar(60) NOT NULL COMMENT '密码', - `mobile` varchar(11) DEFAULT NULL COMMENT '登录手机号', - `identity_id` int(10) DEFAULT NULL COMMENT '身份信息', - `auth_id` int(10) DEFAULT NULL COMMENT '权限id', - `create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `delete_at` timestamp NULL DEFAULT NULL COMMENT '删除时间', - PRIMARY KEY (`id`), - UNIQUE KEY `idx_username` (`username`), - UNIQUE KEY `idx_mobile` (`mobile`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表'; - --- 插入测试数据 -INSERT INTO `tk_users` (`username`, `password`, `mobile`, `identity_id`, `auth_id`) VALUES -('admin', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', '13800138000', 1, 1); -- 密码为:password \ No newline at end of file diff --git a/Server/application/common/model/CompanyAccountModel.php b/Server/application/common/model/CompanyAccountModel.php deleted file mode 100644 index 5f8395c0..00000000 --- a/Server/application/common/model/CompanyAccountModel.php +++ /dev/null @@ -1,11 +0,0 @@ -order('id', 'DESC') - ->select() as $model) { - $assoc[$model->getAttr('id')] = $model->getAttr('number') - . ($model->isOnline() ? '[在线]' : '[离线]'); - } - } - return $assoc; - } - - /** - * 是否在线 - * - * @return string[] - */ - static public function isOnlineAssoc() { - return [ - static::IS_ONLINE_YES => '在线', - static::IS_ONLINE_NO => '离线', - ]; - } - - /** - * 获取状态 - * - * @return string[] - */ - static public function statusAssoc() { - return [ - static::STATUS_ACTIVE => '正常', - static::STATUS_DISABLE => '停用', - ]; - } - - /** - * 设备是否在线 - * - * @return bool - */ - public function isOnline() { - return $this->getAttr('is_online') == static::IS_ONLINE_YES - AND time() - $this->getAttr('active_time') <= static::ACTIVE_TIME; - } -} \ No newline at end of file diff --git a/Server/application/common/model/ProductGroupModel.php b/Server/application/common/model/ProductGroupModel.php deleted file mode 100644 index 165ec510..00000000 --- a/Server/application/common/model/ProductGroupModel.php +++ /dev/null @@ -1,37 +0,0 @@ -order('id', 'DESC') - ->select() as $model) { - $assoc[$model->getAttr('id')] = $model->getAttr('name'); - } - } - return $assoc; - } - - /** - * 商品数量 - * - * @return ProductModel - */ - public function productNum() { - return ProductModel::where(1) - ->where('group_id', $this->getAttr('id')) - ->count(); - } -} \ No newline at end of file diff --git a/Server/application/common/model/ProductModel.php b/Server/application/common/model/ProductModel.php deleted file mode 100644 index 66b7f9b3..00000000 --- a/Server/application/common/model/ProductModel.php +++ /dev/null @@ -1,26 +0,0 @@ - '未使用', - static::IS_USED_YES => '已使用', - ]; - } -} \ No newline at end of file diff --git a/Server/application/common/model/TaskDetailModel.php b/Server/application/common/model/TaskDetailModel.php deleted file mode 100644 index 7174fba8..00000000 --- a/Server/application/common/model/TaskDetailModel.php +++ /dev/null @@ -1,16 +0,0 @@ - '[闲鱼]发布商品', - static::TYPE_PRODUCT_POLISH => '[闲鱼]擦亮商品', - static::TYPE_PRODUCT_ON => '[闲鱼]上架商品', - static::TYPE_PRODUCT_OFF => '[闲鱼]下架商品', - static::TYPE_COIN_SIGN => '[闲鱼]签到鱼币', - static::TYPE_COIN_DEDUCT => '[闲鱼]鱼币抵扣', - static::TYPE_PRICE_CUT => '[闲鱼]一键降价', - static::TYPE_COMMENT_REMOVE => '[闲鱼]删除留言', - static::TYPE_PRODUCT_RE_RELEASE => '[闲鱼]编辑重复', - static::TYPE_RAISE_XY => '[闲鱼]养号', - static::TYPE_RAISE_XY_UNITY => '[闲鱼]互助养号', - static::TYPE_RAISE_XY_TZ => '[闲鱼]会玩养号', - static::TYPE_SYNC_USER => '[闲鱼]采集账号信息', - static::TYPE_SYNC_SHOP => '[闲鱼]采集店铺信息', - static::TYPE_UPDATE_USER => '[闲鱼]修改账号信息', - static::TYPE_PRODUCT_WELFARE => '[闲鱼]公益宝贝', - static::TYPE_MESSAGE_REPLY => '[闲鱼]消息回复', - ]; - } - - /** - * 获取状态 - * - * @return string[] - */ - static public function statusAssoc() { - return [ - static::STATUS_AWAIT => '加入队列', - static::STATUS_ALLOC => '准备运行', - static::STATUS_COMPLETE => '运行成功', - ]; - } - - /** - * 获取执行方式 - * - * @return string[] - */ - static public function runTypeAssoc() { - return [ - static::RUN_TYPE_ONCE => '立刻执行', - static::RUN_TYPE_TIMER => '定时执行', - static::RUN_TYPE_DAILY => '每天执行', - ]; - } - - /** - * 平台 - * - * @return string[] - */ - static public function platformAssoc() { - return [ - static::PLATFORM_XIANYU => '闲鱼', - ]; - } - - /** - * 任务类 - * - * @return string[] - */ - static public function taskClasses() { - return [ - static::TYPE_PRODUCT_RELEASE => '\app\common\task\ProductReleaseTask', - static::TYPE_PRODUCT_POLISH => '\app\common\task\ProductPolishTask', - static::TYPE_PRODUCT_ON => '\app\common\task\ProductOnTask', - static::TYPE_PRODUCT_OFF => '\app\common\task\ProductOffTask', - static::TYPE_COIN_SIGN => '\app\common\task\CoinSignTask', - static::TYPE_COIN_DEDUCT => '\app\common\task\CoinDeductTask', - static::TYPE_PRICE_CUT => '\app\common\task\PriceCutTask', - static::TYPE_COMMENT_REMOVE => '\app\common\task\CommentRemoveTask', - static::TYPE_PRODUCT_RE_RELEASE => '\app\common\task\ProductReReleaseTask', - static::TYPE_RAISE_XY => '\app\common\task\RaiseXyTask', - static::TYPE_RAISE_XY_UNITY => '\app\common\task\RaiseXyUnityTask', - static::TYPE_RAISE_XY_TZ => '\app\common\task\RaiseXyTzTask', - static::TYPE_SYNC_USER => '\app\common\task\SyncUserTask', - static::TYPE_SYNC_SHOP => '\app\common\task\SyncShopTask', - static::TYPE_UPDATE_USER => '\app\common\task\UpdateUserTask', - static::TYPE_PRODUCT_WELFARE => '\app\common\task\ProductWelfareTask', - static::TYPE_MESSAGE_REPLY => '\app\common\task\MessageReplyTask', - ]; - } - - /** - * 分配到详情 - * - * @param TaskModel $model - * @return bool - */ - static public function toDetail(TaskModel $model) { - $detail = new TaskDetailModel(); - $detail->setAttr('task_id', $model->getAttr('id')); - $detail->setAttr('device_id', $model->getAttr('device_id')); - $detail->setAttr('platform', $model->getAttr('platform')); - $detail->setAttr('type', $model->getAttr('type')); - $detail->setAttr('params', $model->getAttr('params')); - $detail->setAttr('info', new \stdClass()); - return $detail->save(); - } - - /** - * 获取设备 - * - * @return DeviceModel - */ - public function device() { - return DeviceModel::get($this->getAttr('device_id')); - } -} \ No newline at end of file diff --git a/Server/application/common/model/UserModel.php b/Server/application/common/model/UserModel.php deleted file mode 100644 index f27b7d6c..00000000 --- a/Server/application/common/model/UserModel.php +++ /dev/null @@ -1,39 +0,0 @@ - '正常', - static::STATUS_DISABLE => '禁用', - ]; - } - - /** - * 只读 - * - * @var array - */ - protected $readonly = ['username']; - - /** - * JSON 字段 - * - * @var array - */ - protected $json = ['roles']; - - protected $jsonAssoc = TRUE; -} \ No newline at end of file diff --git a/Server/application/common/model/UserTokenModel.php b/Server/application/common/model/UserTokenModel.php deleted file mode 100644 index 81401149..00000000 --- a/Server/application/common/model/UserTokenModel.php +++ /dev/null @@ -1,9 +0,0 @@ - 'devices/index/count', // 获取设备总数 - 'devices/list' => 'devices/index/index', // 获取设备列表 - 'devices/info/:id' => 'devices/index/read', // 获取设备详情 - 'devices/add' => ['devices/index/save', ['method' => 'post']], // 添加设备 - 'devices/update/:id' => ['devices/index/update', ['method' => 'put']], // 更新设备 - 'devices/delete/:id' => ['devices/index/delete', ['method' => 'delete']], // 删除设备 - 'devices/count_by_brand' => 'devices/index/countByBrand', // 按设备品牌统计数量 - 'devices/count_by_status' => 'devices/index/countByStatus', // 按设备在线状态统计数量 -]; \ No newline at end of file +use think\facade\Route; + +// 定义RESTful风格的API路由 - 设备管理相关 +Route::group('v1/devices', function () { + // 设备列表和查询 + Route::get('', 'app\\devices\\controller\\Device@index'); // 获取设备列表 + Route::get('count', 'app\\devices\\controller\\Device@count'); // 获取设备总数 + Route::get(':id', 'app\\devices\\controller\\Device@read'); // 获取设备详情 + + // 设备管理 + Route::post('', 'app\\devices\\controller\\Device@save'); // 添加设备 + Route::put('refresh', 'app\\devices\\controller\\Device@refresh'); // 刷新设备状态 + Route::delete(':id', 'app\\devices\\controller\\Device@delete'); // 删除设备 +})->middleware(['jwt']); \ No newline at end of file diff --git a/Server/application/devices/controller/Index.php b/Server/application/devices/controller/Device.php similarity index 55% rename from Server/application/devices/controller/Index.php rename to Server/application/devices/controller/Device.php index 030f9f03..e4b2c50c 100644 --- a/Server/application/devices/controller/Index.php +++ b/Server/application/devices/controller/Device.php @@ -2,14 +2,32 @@ namespace app\devices\controller; use think\Controller; -use app\devices\model\Device; +use app\devices\model\Device as DeviceModel; use think\facade\Request; +use app\common\util\JwtUtil; /** * 设备管理控制器 */ -class Index extends Controller +class Device extends Controller { + /** + * 用户信息 + * @var object + */ + protected $user; + + /** + * 初始化 + */ + protected function initialize() + { + parent::initialize(); + + // 设置时区 + date_default_timezone_set('Asia/Shanghai'); + } + /** * 获取设备总数 * @return \think\response\Json @@ -20,38 +38,20 @@ class Index extends Controller // 获取查询条件 $where = []; - // 设备品牌 - $brand = Request::param('brand'); - if (!empty($brand)) { - $where['brand'] = $brand; + // 租户ID + $tenantId = Request::param('tenant_id'); + if (is_numeric($tenantId)) { + $where['tenantId'] = $tenantId; } - - // 设备型号 - $model = Request::param('model'); - if (!empty($model)) { - $where['model'] = $model; - } - + // 设备在线状态 $alive = Request::param('alive'); if (is_numeric($alive)) { $where['alive'] = $alive; } - // 租户ID - $tenantId = Request::param('tenant_id'); - if (is_numeric($tenantId)) { - $where['tenantId'] = $tenantId; - } - - // 分组ID - $groupId = Request::param('group_id'); - if (is_numeric($groupId)) { - $where['groupId'] = $groupId; - } - // 获取设备总数 - $count = Device::getDeviceCount($where); + $count = DeviceModel::getDeviceCount($where); return json([ 'code' => 200, @@ -78,58 +78,34 @@ class Index extends Controller // 获取查询条件 $where = []; - // 设备名称 - $userName = Request::param('user_name'); - if (!empty($userName)) { - $where['userName'] = ['like', "%{$userName}%"]; - } - // 设备IMEI $imei = Request::param('imei'); if (!empty($imei)) { $where['imei'] = ['like', "%{$imei}%"]; } - // 设备品牌 - $brand = Request::param('brand'); - if (!empty($brand)) { - $where['brand'] = $brand; + // 设备备注 + $memo = Request::param('memo'); + if (!empty($memo)) { + $where['memo'] = ['like', "%{$memo}%"]; } - - // 设备型号 - $model = Request::param('model'); - if (!empty($model)) { - $where['model'] = $model; - } - + // 设备在线状态 $alive = Request::param('alive'); if (is_numeric($alive)) { $where['alive'] = $alive; } - // 租户ID - $tenantId = Request::param('tenant_id'); - if (is_numeric($tenantId)) { - $where['tenantId'] = $tenantId; - } - - // 分组ID - $groupId = Request::param('group_id'); - if (is_numeric($groupId)) { - $where['groupId'] = $groupId; - } - // 获取分页参数 - $page = Request::param('page/d', 1); - $limit = Request::param('limit/d', 10); + $page = (int)Request::param('page', 1); + $limit = (int)Request::param('limit', 10); // 获取排序参数 $sort = Request::param('sort', 'id'); $order = Request::param('order', 'desc'); // 获取设备列表 - $list = Device::getDeviceList($where, "{$sort} {$order}", $page, $limit); + $list = DeviceModel::getDeviceList($where, "{$sort} {$order}", $page, $limit); return json([ 'code' => 200, @@ -164,7 +140,7 @@ class Index extends Controller } // 获取设备详情 - $info = Device::getDeviceInfo($id); + $info = DeviceModel::getDeviceInfo($id); if (empty($info)) { return json([ 'code' => 404, @@ -184,6 +160,27 @@ class Index extends Controller ]); } } + + /** + * 刷新设备 + * @return \think\response\Json + */ + public function refresh() + { + try { + + return json([ + 'code' => 200, + 'msg' => '刷新成功', + 'data' => [] + ]); + } catch (\Exception $e) { + return json([ + 'code' => 500, + 'msg' => '获取失败:' . $e->getMessage() + ]); + } + } /** * 添加设备 @@ -204,7 +201,7 @@ class Index extends Controller } // 验证IMEI是否已存在 - $exists = Device::where('imei', $data['imei'])->where('isDeleted', 0)->find(); + $exists = DeviceModel::where('imei', $data['imei'])->where('isDeleted', 0)->find(); if ($exists) { return json([ 'code' => 400, @@ -213,7 +210,7 @@ class Index extends Controller } // 添加设备 - $id = Device::addDevice($data); + $id = DeviceModel::addDevice($data); return json([ 'code' => 200, @@ -229,64 +226,7 @@ class Index extends Controller ]); } } - - /** - * 更新设备 - * @return \think\response\Json - */ - public function update() - { - try { - // 获取设备ID - $id = Request::param('id/d'); - if (empty($id)) { - return json([ - 'code' => 400, - 'msg' => '参数错误' - ]); - } - - // 获取设备数据 - $data = Request::put(); - - // 验证设备是否存在 - $exists = Device::where('id', $id)->where('isDeleted', 0)->find(); - if (!$exists) { - return json([ - 'code' => 404, - 'msg' => '设备不存在' - ]); - } - - // 如果更新IMEI,验证IMEI是否已存在 - if (!empty($data['imei']) && $data['imei'] != $exists['imei']) { - $imeiExists = Device::where('imei', $data['imei'])->where('isDeleted', 0)->where('id', '<>', $id)->find(); - if ($imeiExists) { - return json([ - 'code' => 400, - 'msg' => '设备IMEI已存在' - ]); - } - } - - // 更新设备 - $result = Device::updateDevice($id, $data); - - return json([ - 'code' => 200, - 'msg' => '更新成功', - 'data' => [ - 'result' => $result - ] - ]); - } catch (\Exception $e) { - return json([ - 'code' => 500, - 'msg' => '更新失败:' . $e->getMessage() - ]); - } - } - + /** * 删除设备 * @return \think\response\Json @@ -304,7 +244,7 @@ class Index extends Controller } // 验证设备是否存在 - $exists = Device::where('id', $id)->where('isDeleted', 0)->find(); + $exists = DeviceModel::where('id', $id)->where('isDeleted', 0)->find(); if (!$exists) { return json([ 'code' => 404, @@ -313,7 +253,7 @@ class Index extends Controller } // 删除设备 - $result = Device::deleteDevice($id); + $result = DeviceModel::deleteDevice($id); return json([ 'code' => 200, @@ -329,50 +269,4 @@ class Index extends Controller ]); } } - - /** - * 按设备品牌统计数量 - * @return \think\response\Json - */ - public function countByBrand() - { - try { - // 获取统计数据 - $data = Device::countByBrand(); - - return json([ - 'code' => 200, - 'msg' => '获取成功', - 'data' => $data - ]); - } catch (\Exception $e) { - return json([ - 'code' => 500, - 'msg' => '获取失败:' . $e->getMessage() - ]); - } - } - - /** - * 按设备在线状态统计数量 - * @return \think\response\Json - */ - public function countByStatus() - { - try { - // 获取统计数据 - $data = Device::countByStatus(); - - return json([ - 'code' => 200, - 'msg' => '获取成功', - 'data' => $data - ]); - } catch (\Exception $e) { - return json([ - 'code' => 500, - 'msg' => '获取失败:' . $e->getMessage() - ]); - } - } } \ No newline at end of file diff --git a/Server/application/devices/model/Device.php b/Server/application/devices/model/Device.php index 0550bbaf..26cd7f1c 100644 --- a/Server/application/devices/model/Device.php +++ b/Server/application/devices/model/Device.php @@ -10,19 +10,31 @@ use think\Db; class Device extends Model { // 设置表名 - protected $name = 'tk_device'; + protected $name = 'device'; // 设置主键 protected $pk = 'id'; // 自动写入时间戳 - protected $autoWriteTimestamp = true; + protected $autoWriteTimestamp = 'int'; // 定义时间戳字段名 protected $createTime = 'createTime'; protected $updateTime = 'updateTime'; protected $deleteTime = 'deleteTime'; + // 定义字段类型 + protected $type = [ + 'id' => 'integer', + 'createTime' => 'integer', + 'updateTime' => 'integer', + 'deleteTime' => 'integer', + 'alive' => 'integer', + 'isDeleted' => 'integer', + 'tenantId' => 'integer', + 'groupId' => 'integer' + ]; + /** * 获取设备总数 * @param array $where 查询条件 @@ -105,7 +117,7 @@ class Device extends Model return self::where('id', $id) ->update([ 'isDeleted' => 1, - 'deleteTime' => date('Y-m-d H:i:s') + 'deleteTime' => date('Y-m-d H:i:s', time()) ]); } diff --git a/Server/application/http/middleware/jwt.php b/Server/application/http/middleware/jwt.php new file mode 100644 index 00000000..0be8c589 --- /dev/null +++ b/Server/application/http/middleware/jwt.php @@ -0,0 +1,11 @@ +