├── project_xiaoxueqi ├── users │ ├── __init__.py │ ├── saveDir1.avi │ ├── migrations │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-38.pyc │ │ │ ├── 0001_initial.cpython-38.pyc │ │ │ └── 0002_auto_20220704_1538.cpython-38.pyc │ │ ├── 0002_auto_20220704_1538.py │ │ └── 0001_initial.py │ ├── admin.py │ ├── tests.py │ ├── __pycache__ │ │ ├── apps.cpython-38.pyc │ │ ├── urls.cpython-38.pyc │ │ ├── admin.cpython-38.pyc │ │ ├── models.cpython-38.pyc │ │ ├── views.cpython-38.pyc │ │ └── __init__.cpython-38.pyc │ ├── apps.py │ ├── models.py │ └── urls.py ├── video │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ └── __pycache__ │ │ │ └── __init__.cpython-38.pyc │ ├── models.py │ ├── admin.py │ ├── tests.py │ ├── __pycache__ │ │ ├── apps.cpython-38.pyc │ │ ├── urls.cpython-38.pyc │ │ ├── admin.cpython-38.pyc │ │ ├── models.cpython-38.pyc │ │ ├── views.cpython-38.pyc │ │ └── __init__.cpython-38.pyc │ ├── apps.py │ ├── urls.py │ └── views.py ├── .idea │ ├── .gitignore │ ├── inspectionProfiles │ │ ├── profiles_settings.xml │ │ └── Project_Default.xml │ ├── misc.xml │ ├── modules.xml │ └── project_xiaoxueqi.iml ├── project_xiaoxueqi │ ├── __init__.py │ ├── __pycache__ │ │ ├── urls.cpython-38.pyc │ │ ├── wsgi.cpython-38.pyc │ │ ├── __init__.cpython-38.pyc │ │ └── settings.cpython-38.pyc │ ├── asgi.py │ ├── wsgi.py │ ├── urls.py │ └── settings.py ├── static │ ├── smile0.jpg │ ├── smile1.jpg │ ├── smile2.jpg │ ├── smile3.jpg │ ├── smile4.jpg │ ├── smile5.jpg │ ├── smile6.jpg │ ├── smile7.jpg │ ├── smile8.jpg │ ├── smile9.jpg │ ├── look_left0.jpg │ ├── look_left1.jpg │ ├── look_left2.jpg │ ├── look_left3.jpg │ ├── look_left4.jpg │ ├── look_left5.jpg │ ├── look_left6.jpg │ ├── look_left7.jpg │ ├── look_left8.jpg │ ├── look_left9.jpg │ ├── look_right0.jpg │ ├── look_right1.jpg │ ├── look_right2.jpg │ ├── look_right3.jpg │ ├── look_right4.jpg │ ├── look_right5.jpg │ ├── look_right6.jpg │ ├── look_right7.jpg │ ├── look_right8.jpg │ ├── look_right9.jpg │ ├── open_mouth0.jpg │ ├── open_mouth1.jpg │ ├── open_mouth2.jpg │ ├── open_mouth3.jpg │ ├── open_mouth4.jpg │ ├── open_mouth5.jpg │ ├── open_mouth6.jpg │ ├── open_mouth7.jpg │ ├── open_mouth8.jpg │ ├── open_mouth9.jpg │ ├── rise_head0.jpg │ ├── rise_head1.jpg │ ├── rise_head2.jpg │ ├── rise_head3.jpg │ ├── rise_head4.jpg │ ├── rise_head5.jpg │ ├── rise_head6.jpg │ ├── rise_head7.jpg │ ├── rise_head8.jpg │ └── rise_head9.jpg ├── music │ └── baojing1.mp3 ├── .vscode │ └── settings.json ├── test.py └── manage.py ├── web-api ├── api │ ├── robots.txt │ ├── favicon.ico │ └── index-test.php ├── app │ ├── common │ │ ├── components │ │ │ ├── Ucpaas.php │ │ │ ├── EmailJob.php │ │ │ ├── ApiRequest.php │ │ │ ├── Pdf.php │ │ │ ├── SmsJob.php │ │ │ ├── Redis.php │ │ │ ├── Gaode.php │ │ │ ├── Curl.php │ │ │ ├── ApiResponse.php │ │ │ ├── ApiValidator.php │ │ │ ├── AssignTeacherRoleJob.php │ │ │ ├── DataSync.php │ │ │ ├── Qiniu.php │ │ │ ├── Jwt.php │ │ │ └── Encryption.php │ │ ├── utils │ │ │ ├── ArrayUtil.php │ │ │ ├── Apcu.php │ │ │ └── StringMatch.php │ │ ├── commands │ │ │ └── HelloController.php │ │ ├── base │ │ │ └── ApiController.php │ │ └── behaviors │ │ │ ├── ApiCommonBehavior.php │ │ │ ├── ApiResponseBehavior.php │ │ │ └── ApiControllerBehavior.php │ ├── config │ │ ├── params.php.sample │ │ ├── params.php.bak │ │ ├── db.php.sample │ │ ├── redis.php.sample │ │ ├── api_test.php.sample │ │ ├── redis_keySource.php │ │ ├── console.php.sample │ │ ├── api_main.php.sample │ │ └── api_dev.php.sample │ ├── modules │ │ └── user │ │ │ ├── service │ │ │ ├── NotifyService.php │ │ │ ├── XiaoHuaService.php │ │ │ ├── CarStudyService.php │ │ │ ├── UserInfoService.php │ │ │ ├── EmployeeService.php │ │ │ ├── VolunterService.php │ │ │ ├── OldpersonService.php │ │ │ ├── RecordService.php │ │ │ └── AccountService.php │ │ │ ├── models │ │ │ ├── Account.php │ │ │ ├── CarStudy.php │ │ │ ├── Notify.php │ │ │ ├── Employee.php │ │ │ ├── Volunter.php │ │ │ ├── Oldperson.php │ │ │ ├── XiaoHua.php │ │ │ ├── UserInfo.php │ │ │ └── Record.php │ │ │ └── behaviors │ │ │ └── TeacherBehavior.php │ ├── helpers │ │ ├── ArrayValidator.php │ │ ├── DataHelper.php │ │ └── DatetimeHelper.php │ ├── yii.php │ ├── yii │ ├── assets │ │ └── AppAsset.php │ ├── controllers │ │ └── user │ │ │ ├── RecordController.php │ │ │ └── XiaoHuaController.php │ └── composer.json ├── setup.sh ├── .gitignore └── README.MD ├── .idea ├── .gitignore ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml ├── modules.xml ├── misc.xml └── xiaoxueqi.iml ├── web ├── .browserslistrc ├── babel.config.js ├── postcss.config.js ├── screenshots │ ├── wms1.png │ ├── wms2.png │ └── wms3.png ├── src │ ├── assets │ │ ├── logo.png │ │ ├── img │ │ │ ├── img.jpg │ │ │ ├── logo.png │ │ │ └── login-bg.jpg │ │ └── css │ │ │ ├── icon.css │ │ │ ├── theme-green │ │ │ ├── fonts │ │ │ │ ├── element-icons.ttf │ │ │ │ └── element-icons.woff │ │ │ └── color-green.css │ │ │ ├── color-dark.css │ │ │ └── main.css │ ├── components │ │ ├── common │ │ │ ├── bus.js │ │ │ ├── i18n.js │ │ │ ├── Home.vue │ │ │ ├── directives.js │ │ │ ├── Sidebar.vue │ │ │ ├── Tags.vue │ │ │ └── Header.vue │ │ └── page │ │ │ ├── About.vue │ │ │ ├── 403.vue │ │ │ ├── 404.vue │ │ │ ├── Login.vue │ │ │ ├── Register.vue │ │ │ ├── ChangePassword.vue │ │ │ └── ChangInfo.vue │ ├── App.vue │ ├── utils │ │ ├── toformdata.js │ │ └── request.js │ ├── main.js │ ├── router │ │ └── index.js │ └── api │ │ └── index.js ├── .prettierrc ├── .gitignore ├── vue.config.js ├── public │ ├── index.html │ └── table.json └── package.json └── README.md /project_xiaoxueqi/users/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/saveDir1.avi: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project_xiaoxueqi/video/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /project_xiaoxueqi/video/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-api/api/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # 默认忽略的文件 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /web/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not ie <= 8 4 | -------------------------------------------------------------------------------- /project_xiaoxueqi/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # 默认忽略的文件 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /web/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /project_xiaoxueqi/project_xiaoxueqi/__init__.py: -------------------------------------------------------------------------------- 1 | import pymysql 2 | pymysql.install_as_MySQLdb() -------------------------------------------------------------------------------- /project_xiaoxueqi/video/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | -------------------------------------------------------------------------------- /web/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /project_xiaoxueqi/video/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /project_xiaoxueqi/video/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /web-api/api/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web-api/api/favicon.ico -------------------------------------------------------------------------------- /web/screenshots/wms1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web/screenshots/wms1.png -------------------------------------------------------------------------------- /web/screenshots/wms2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web/screenshots/wms2.png -------------------------------------------------------------------------------- /web/screenshots/wms3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web/screenshots/wms3.png -------------------------------------------------------------------------------- /web/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web/src/assets/logo.png -------------------------------------------------------------------------------- /web/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "tabWidth": 4, 3 | "singleQuote": true, 4 | "trailingComma": "none", 5 | "printWidth": 140 6 | } -------------------------------------------------------------------------------- /web/src/assets/img/img.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web/src/assets/img/img.jpg -------------------------------------------------------------------------------- /web/src/assets/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web/src/assets/img/logo.png -------------------------------------------------------------------------------- /web/src/assets/img/login-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web/src/assets/img/login-bg.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile0.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile1.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile2.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile3.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile4.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile5.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile6.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile7.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile8.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/smile9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/smile9.jpg -------------------------------------------------------------------------------- /web/src/components/common/bus.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | 3 | // 使用 Event Bus 4 | const bus = new Vue(); 5 | 6 | export default bus; -------------------------------------------------------------------------------- /project_xiaoxueqi/music/baojing1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/music/baojing1.mp3 -------------------------------------------------------------------------------- /web/src/assets/css/icon.css: -------------------------------------------------------------------------------- 1 | 2 | [class*=" el-icon-lx"], [class^=el-icon-lx] { 3 | font-family: lx-iconfont!important; 4 | } -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left0.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left1.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left2.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left3.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left4.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left5.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left6.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left7.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left8.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_left9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_left9.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right0.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right1.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right2.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right3.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right4.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right5.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right6.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right7.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right8.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/look_right9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/look_right9.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth0.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth1.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth2.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth3.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth4.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth5.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth6.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth7.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth8.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/open_mouth9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/open_mouth9.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head0.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head1.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head2.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head3.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head4.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head5.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head6.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head7.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head8.jpg -------------------------------------------------------------------------------- /project_xiaoxueqi/static/rise_head9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/static/rise_head9.jpg -------------------------------------------------------------------------------- /web-api/app/common/components/Ucpaas.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web-api/app/common/components/Ucpaas.php -------------------------------------------------------------------------------- /web-api/app/config/params.php.sample: -------------------------------------------------------------------------------- 1 | '1.0.0', 5 | 'timeNow' => time(), 6 | 'downloadTmpPath' => '', 7 | ]; 8 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/__pycache__/apps.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/users/__pycache__/apps.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/users/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/users/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/video/__pycache__/apps.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/video/__pycache__/apps.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/video/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/video/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /web/src/assets/css/theme-green/fonts/element-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web/src/assets/css/theme-green/fonts/element-icons.ttf -------------------------------------------------------------------------------- /web/src/assets/css/theme-green/fonts/element-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/web/src/assets/css/theme-green/fonts/element-icons.woff -------------------------------------------------------------------------------- /project_xiaoxueqi/users/__pycache__/admin.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/users/__pycache__/admin.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/users/__pycache__/models.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/users/__pycache__/models.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/users/__pycache__/views.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/users/__pycache__/views.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/video/__pycache__/admin.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/video/__pycache__/admin.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/video/__pycache__/models.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/video/__pycache__/models.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/video/__pycache__/views.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/video/__pycache__/views.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/users/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/users/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/video/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/video/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /web-api/app/config/params.php.bak: -------------------------------------------------------------------------------- 1 | '1.0.0', 5 | 'timeNow' => time(), 6 | 'downloadTmpPath' => 'C:\\Users\\86135\\Desktop\\', 7 | ]; 8 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class AppConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'users' 7 | -------------------------------------------------------------------------------- /project_xiaoxueqi/video/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class VideoConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'video' 7 | -------------------------------------------------------------------------------- /project_xiaoxueqi/project_xiaoxueqi/__pycache__/urls.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/project_xiaoxueqi/__pycache__/urls.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/project_xiaoxueqi/__pycache__/wsgi.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/project_xiaoxueqi/__pycache__/wsgi.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/users/migrations/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/users/migrations/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/video/migrations/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/video/migrations/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/project_xiaoxueqi/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/project_xiaoxueqi/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/project_xiaoxueqi/__pycache__/settings.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/project_xiaoxueqi/__pycache__/settings.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/users/migrations/__pycache__/0001_initial.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/users/migrations/__pycache__/0001_initial.cpython-38.pyc -------------------------------------------------------------------------------- /project_xiaoxueqi/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.testing.pytestArgs": [ 3 | "project_xiaoxueqi" 4 | ], 5 | "python.testing.unittestEnabled": false, 6 | "python.testing.pytestEnabled": true 7 | } -------------------------------------------------------------------------------- /project_xiaoxueqi/users/migrations/__pycache__/0002_auto_20220704_1538.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/q451/Implement-monitoring-system/HEAD/project_xiaoxueqi/users/migrations/__pycache__/0002_auto_20220704_1538.cpython-38.pyc -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /project_xiaoxueqi/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | class account(models.Model): 5 | userid = models.CharField(max_length=128) 6 | password = models.CharField(max_length=128) 7 | email = models.EmailField(unique=True) 8 | 9 | -------------------------------------------------------------------------------- /web-api/app/config/db.php.sample: -------------------------------------------------------------------------------- 1 | 'yii\db\Connection', 5 | 'dsn' => 'mysql:host=;dbname=', 6 | 'username' => '', 7 | 'password' => '', 8 | 'charset' => 'utf8mb4', 9 | 'tablePrefix' => '', 10 | ]; 11 | -------------------------------------------------------------------------------- /web-api/app/config/redis.php.sample: -------------------------------------------------------------------------------- 1 | 'app\common\components\Redis', 5 | 'servers' => [ 6 | ['hostname' => 'localhost', 'port' => 6379, 'database' => 0], 7 | ], 8 | 'keySource' => require(__DIR__ . '/redis_keySource.php'), 9 | ]; 10 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /web-api/app/common/utils/ArrayUtil.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2021-12-19 23:08 7 | */ 8 | 9 | namespace app\common\utils; 10 | 11 | use Yii; 12 | use yii\base\Component; 13 | 14 | class ArrayUtil extends Component 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /web/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | -------------------------------------------------------------------------------- /project_xiaoxueqi/video/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from django.contrib import admin 3 | from django.urls import path, include 4 | from . import views 5 | 6 | urlpatterns = [ 7 | #静态页面URL 8 | path('', views.index), 9 | # path('send/', views.sends), 10 | path('data/', views.data), 11 | ] 12 | -------------------------------------------------------------------------------- /project_xiaoxueqi/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | -------------------------------------------------------------------------------- /project_xiaoxueqi/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | example.html 5 | favicon.ico 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw* 23 | -------------------------------------------------------------------------------- /web/src/utils/toformdata.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This function si to transform data to http formdata 3 | * @param {*} data 4 | * @returns data 5 | */ 6 | export function ToFormData(data) { 7 | // Do whatever you want to transform the data 8 | let ret = '' 9 | for (const it in data) { 10 | ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&' 11 | } 12 | return ret 13 | } 14 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/urls.py: -------------------------------------------------------------------------------- 1 | from django.conf.urls import url 2 | from django.contrib import admin 3 | from django.urls import path, include 4 | from . import views 5 | 6 | urlpatterns = [ 7 | #静态页面URL 8 | # path('', views.video), 9 | path('chack/', views.facecheck), 10 | path('webchack/', views.Onlinefacecheck), 11 | path('quyu/', views.quyucheck), 12 | path('shouji/', views.shouji), 13 | ] 14 | -------------------------------------------------------------------------------- /project_xiaoxueqi/test.py: -------------------------------------------------------------------------------- 1 | import time 2 | import cv2 3 | cap = cv2.VideoCapture(0) 4 | while (1): 5 | ret, img = cap.read() 6 | start = "吃核查" 7 | 8 | # 图片 添加的文字 位置 字体 字体大小 字体颜色 字体粗细 9 | cv2.putText(img, start, (5,50 ), cv2.FONT_HERSHEY_SIMPLEX, 0.75, (0, 0, 255), 2) 10 | cv2.imshow("image", img) 11 | if cv2.waitKey(1) & 0xFF == ord('q'): 12 | break 13 | cap.release() 14 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /web-api/app/modules/user/service/NotifyService.php: -------------------------------------------------------------------------------- 1 | model = new Notify(); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /web-api/app/modules/user/service/XiaoHuaService.php: -------------------------------------------------------------------------------- 1 | model = new XiaoHua(); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /web-api/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | curenv="dev" 4 | 5 | if [ -n "$1" ]; then 6 | curenv="$1" 7 | fi 8 | 9 | cp api/index.php.sample api/index.php 10 | 11 | cp app/config/db.php.sample app/config/db.php 12 | cp app/config/params.php.sample app/config/params.php 13 | cp app/config/api_"$curenv".php.sample app/config/api_"$curenv".php 14 | 15 | 16 | if [ ! -d "./app/runtime" ]; then 17 | mkdir app/runtime 18 | chmod a+w app/runtime 19 | fi 20 | -------------------------------------------------------------------------------- /web-api/app/modules/user/service/CarStudyService.php: -------------------------------------------------------------------------------- 1 | model = new CarStudy(); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /web-api/app/modules/user/service/UserInfoService.php: -------------------------------------------------------------------------------- 1 | model = new UserInfo(); 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /web/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | baseUrl: './', 3 | assetsDir: 'static', 4 | productionSourceMap: false, 5 | // devServer: { 6 | // proxy: { 7 | // '/api':{ 8 | // target:'http://jsonplaceholder.typicode.com', 9 | // changeOrigin:true, 10 | // pathRewrite:{ 11 | // '/api':'' 12 | // } 13 | // } 14 | // } 15 | // } 16 | } -------------------------------------------------------------------------------- /web-api/app/helpers/ArrayValidator.php: -------------------------------------------------------------------------------- 1 | $attribute)) { 17 | $this->addError($model, $attribute, $attribute . '必须是一个数组'); 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /web-api/app/modules/user/service/EmployeeService.php: -------------------------------------------------------------------------------- 1 | model = new Employee(); 18 | } 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /web-api/app/modules/user/service/VolunterService.php: -------------------------------------------------------------------------------- 1 | model = new Volunter(); 18 | } 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /web-api/app/modules/user/service/OldpersonService.php: -------------------------------------------------------------------------------- 1 | model = new Oldperson(); 18 | } 19 | 20 | } 21 | 22 | -------------------------------------------------------------------------------- /project_xiaoxueqi/project_xiaoxueqi/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for project_xiaoxueqi project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_xiaoxueqi.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /project_xiaoxueqi/project_xiaoxueqi/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for project_xiaoxueqi project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_xiaoxueqi.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /web/src/components/page/About.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | -------------------------------------------------------------------------------- /project_xiaoxueqi/.idea/project_xiaoxueqi.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/migrations/0002_auto_20220704_1538.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.5 on 2022-07-04 07:38 2 | 3 | from django.db import migrations 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('users', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterModelOptions( 14 | name='account', 15 | options={}, 16 | ), 17 | migrations.RemoveField( 18 | model_name='account', 19 | name='time_created', 20 | ), 21 | ] 22 | -------------------------------------------------------------------------------- /web/src/assets/css/color-dark.css: -------------------------------------------------------------------------------- 1 | .header{ 2 | background-color: #242f42; 3 | } 4 | .login-wrap{ 5 | background: #324157; 6 | } 7 | .plugins-tips{ 8 | background: #eef1f6; 9 | } 10 | .plugins-tips a{ 11 | color: #20a0ff; 12 | } 13 | .el-upload--text em { 14 | color: #20a0ff; 15 | } 16 | .pure-button{ 17 | background: #20a0ff; 18 | } 19 | .tags-li.active { 20 | border: 1px solid #409EFF; 21 | background-color: #409EFF; 22 | } 23 | .message-title{ 24 | color: #20a0ff; 25 | } 26 | .collapse-btn:hover{ 27 | background: rgb(40,52,70); 28 | } -------------------------------------------------------------------------------- /web-api/api/index-test.php: -------------------------------------------------------------------------------- 1 | run(); 17 | -------------------------------------------------------------------------------- /.idea/xiaoxueqi.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 15 | -------------------------------------------------------------------------------- /web-api/app/config/api_test.php.sample: -------------------------------------------------------------------------------- 1 | ['debug', 'gii'], 5 | 'modules' => [ 6 | 'debug' => [ 7 | 'class' => 'yii\debug\Module', 8 | // uncomment the following to add your IP if you are not connecting from localhost. 9 | //'allowedIPs' => ['127.0.0.1', '::1'], 10 | ], 11 | 'gii' => [ 12 | 'class' => 'yii\gii\Module', 13 | // uncomment the following to add your IP if you are not connecting from localhost. 14 | //'allowedIPs' => ['127.0.0.1', '::1'], 15 | ], 16 | ], 17 | ]; 18 | -------------------------------------------------------------------------------- /web-api/app/yii.php: -------------------------------------------------------------------------------- 1 | run(); 20 | exit($exitCode); 21 | -------------------------------------------------------------------------------- /web-api/app/helpers/DataHelper.php: -------------------------------------------------------------------------------- 1 | run(); 21 | exit($exitCode); 22 | -------------------------------------------------------------------------------- /web-api/app/assets/AppAsset.php: -------------------------------------------------------------------------------- 1 | 14 | * @since 2.0 15 | */ 16 | class AppAsset extends AssetBundle 17 | { 18 | public $basePath = '@webroot'; 19 | public $baseUrl = '@web'; 20 | public $css = [ 21 | 'css/site.css', 22 | ]; 23 | public $js = [ 24 | ]; 25 | public $depends = [ 26 | 'yii\web\YiiAsset', 27 | 'yii\bootstrap\BootstrapAsset', 28 | ]; 29 | } 30 | -------------------------------------------------------------------------------- /web/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 老人监护系统 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /web-api/app/modules/user/models/Account.php: -------------------------------------------------------------------------------- 1 | email_address); 18 | print($this->template_subject); 19 | print($this->template_message); 20 | // (new SendEmailService)->send($this->email_address, $this->template_subject, $this->template_message); 21 | print("end"); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /project_xiaoxueqi/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_xiaoxueqi.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /web-api/app/config/redis_keySource.php: -------------------------------------------------------------------------------- 1 | [ 20 | 'key' => 'zhihuixuegong_counseling_record_batch_downlod_task', // 批量下载任务 21 | 'expire' => false, 22 | ], 23 | // 征集模块 24 | // 批量下载消息触发 25 | 'ZHIHUISIZHENG_SURVEY_BATCH_DOWNLOD' => [ 26 | 'key' => 'zhihuixuegong_survey_answer_batch_downlod_task', // 批量下载任务 27 | 'expire' => false, 28 | ], 29 | ]; 30 | -------------------------------------------------------------------------------- /web-api/.gitignore: -------------------------------------------------------------------------------- 1 | # vim swap files 2 | *.swp 3 | nouhp.out 4 | 5 | # phpstorm project files 6 | .idea 7 | 8 | # netbeans project files 9 | nbproject 10 | 11 | # zend studio for eclipse project files 12 | .buildpath 13 | .project 14 | .settings 15 | 16 | # windows thumbnail cache 17 | Thumbs.db 18 | 19 | # composer vendor dir 20 | app/vendor 21 | app/runtime 22 | 23 | # composer itself is not needed 24 | composer.phar 25 | 26 | # Mac DS_Store Files 27 | .DS_Store 28 | 29 | # phpunit itself is not needed 30 | app/phpunit.phar 31 | # local phpunit config 32 | app/phpunit.xml 33 | 34 | app/tests 35 | 36 | # custom 37 | api/index.php 38 | app/config/api_*.php 39 | app/config/db.php 40 | app/config/params.php 41 | app/config/redis.php 42 | app/config/console.php 43 | 44 | # 特定脚本 45 | getStudent.py 46 | getClassAndGrade.py -------------------------------------------------------------------------------- /web/src/assets/css/theme-green/color-green.css: -------------------------------------------------------------------------------- 1 | .header{ 2 | background-color: #07c4a8; 3 | } 4 | .login-wrap{ 5 | background: rgba(56, 157, 170, 0.82);; 6 | } 7 | .plugins-tips{ 8 | background: #f2f2f2; 9 | } 10 | .plugins-tips a{ 11 | color: #00d1b2; 12 | } 13 | .el-upload--text em { 14 | color: #00d1b2; 15 | } 16 | .pure-button{ 17 | background: #00d1b2; 18 | } 19 | .pagination > .active > a, .pagination > .active > a:hover, .pagination > .active > a:focus, .pagination > .active > span, .pagination > .active > span:hover, .pagination > .active > span:focus { 20 | background-color: #00d1b2 !important; 21 | border-color: #00d1b2 !important; 22 | } 23 | .tags-li.active { 24 | border: 1px solid #00d1b2; 25 | background-color: #00d1b2; 26 | } 27 | .collapse-btn:hover{ 28 | background: #00d1b2; 29 | } -------------------------------------------------------------------------------- /web-api/app/modules/user/models/Notify.php: -------------------------------------------------------------------------------- 1 | { 12 | return config; 13 | }, 14 | error => { 15 | console.log(error); 16 | return Promise.reject(); 17 | } 18 | ); 19 | 20 | service.interceptors.response.use( 21 | response => { 22 | if (response.status === 200) { 23 | return response.data; 24 | } else { 25 | Promise.reject(); 26 | } 27 | }, 28 | error => { 29 | console.log(error); 30 | return Promise.reject(); 31 | } 32 | ); 33 | 34 | export default service; 35 | -------------------------------------------------------------------------------- /web-api/app/common/commands/HelloController.php: -------------------------------------------------------------------------------- 1 | 18 | * @since 2.0 19 | */ 20 | class HelloController extends Controller 21 | { 22 | /** 23 | * This command echoes what you have entered as the message. 24 | * @param string $message the message to be echoed. 25 | */ 26 | public function actionIndex($message = 'hello world') 27 | { 28 | echo $message . "\n"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-manage-system", 3 | "version": "4.2.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "npm run serve", 7 | "serve": "vue-cli-service serve", 8 | "build": "vue-cli-service build" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.18.0", 12 | "babel-polyfill": "^6.26.0", 13 | "element-ui": "^2.11.0", 14 | "mavon-editor": "^2.6.17", 15 | "videojs-contrib-hls": "^5.15.0", 16 | "vue": "^2.6.10", 17 | "vue-cropperjs": "^3.0.0", 18 | "vue-i18n": "^8.10.0", 19 | "vue-quill-editor": "^3.0.6", 20 | "vue-router": "^3.0.3", 21 | "vue-schart": "^2.0.0", 22 | "vue-video-player": "^5.0.2", 23 | "vuedraggable": "^2.17.0" 24 | }, 25 | "devDependencies": { 26 | "@vue/cli-plugin-babel": "^3.9.0", 27 | "@vue/cli-service": "^3.9.0", 28 | "vue-template-compiler": "^2.6.10" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /web-api/app/common/components/ApiRequest.php: -------------------------------------------------------------------------------- 1 | 8 | * @date 2017-05-22 15:45:53 9 | */ 10 | 11 | namespace app\common\components; 12 | 13 | use Yii; 14 | use yii\web\Request; 15 | 16 | class ApiRequest extends Request 17 | { 18 | public $allowRequestMethods = []; 19 | 20 | public function init() 21 | { 22 | parent::init(); 23 | if (($language = strtolower($this->get('language'))) && in_array($language, Yii::$app->params['language'])) { 24 | Yii::$app->language = $language; 25 | } 26 | 27 | Yii::$app->language = strtolower(Yii::$app->language); 28 | } 29 | 30 | public function getTokenFromHeader($key) 31 | { 32 | return $this->getIsGet() ? $this->get($key) : $this->getHeaders()[$key]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # - 2 | 这是一个使用python Django框架进行后台搭建,数据库使用mysql,前端使用vue框架,使用element UI快速开发的web应用,通过对老人实时监控,分析老人的情感,是否摔倒,人脸检测判断是否有陌生人进入,义工交互,人员录入等功能 3 | 部分后端代码是PHP yii框架开发 4 | ![image](https://user-images.githubusercontent.com/73871936/191525542-fe92a5be-53b1-48e9-b3e4-367c1bd05ea0.png) 5 | ![image](https://user-images.githubusercontent.com/73871936/191525747-0e01a1bc-9b6b-478f-b3e3-44a15f47c16a.png) 6 | ![image](https://user-images.githubusercontent.com/73871936/191525795-063781ca-5ff9-45cb-905f-cbf114f1e53a.png) 7 | ![image](https://user-images.githubusercontent.com/73871936/191525980-7232881a-82d8-497e-aa49-2e741cb170a0.png) 8 | ![image](https://user-images.githubusercontent.com/73871936/191526034-22f0fc0a-ca18-4e1b-a5ff-bae8b852b67f.png) 9 | ![image](https://user-images.githubusercontent.com/73871936/191526081-a18664e7-e624-4a08-a291-199d4209d08b.png) 10 | ![image](https://user-images.githubusercontent.com/73871936/191526131-25d94e68-cb40-45b8-845f-a8035be4418d.png) 11 | -------------------------------------------------------------------------------- /project_xiaoxueqi/project_xiaoxueqi/urls.py: -------------------------------------------------------------------------------- 1 | """project_xiaoxueqi URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.2/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path('api/', include('users.urls')), 22 | path('video/', include('video.urls')), 23 | ] 24 | -------------------------------------------------------------------------------- /project_xiaoxueqi/users/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.2.5 on 2022-07-04 06:27 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='account', 16 | fields=[ 17 | ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('userid', models.CharField(max_length=128)), 19 | ('password', models.CharField(max_length=128)), 20 | ('email', models.EmailField(max_length=254, unique=True)), 21 | ('time_created', models.DateTimeField(auto_now_add=True)), 22 | ], 23 | options={ 24 | 'verbose_name': '用户', 25 | 'verbose_name_plural': '用户', 26 | 'ordering': ['time_created'], 27 | }, 28 | ), 29 | ] 30 | -------------------------------------------------------------------------------- /web-api/app/modules/user/models/Employee.php: -------------------------------------------------------------------------------- 1 | create_timestamp/1000); 34 | }; 35 | } 36 | return $fields; 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /web-api/app/modules/user/models/Volunter.php: -------------------------------------------------------------------------------- 1 | create_timestamp/1000); 34 | }; 35 | } 36 | return $fields; 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /web-api/app/modules/user/models/Oldperson.php: -------------------------------------------------------------------------------- 1 | create_timestamp/1000); 34 | }; 35 | } 36 | return $fields; 37 | } 38 | 39 | } 40 | 41 | -------------------------------------------------------------------------------- /web-api/app/modules/user/models/XiaoHua.php: -------------------------------------------------------------------------------- 1 | create_timestamp/1000); 41 | }; 42 | } 43 | return $fields; 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /web-api/app/modules/user/models/UserInfo.php: -------------------------------------------------------------------------------- 1 | create_timestamp/1000); 41 | }; 42 | } 43 | return $fields; 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /web-api/app/modules/user/models/Record.php: -------------------------------------------------------------------------------- 1 | create_timestamp/1000); 41 | }; 42 | } 43 | return $fields; 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /web-api/app/modules/user/service/RecordService.php: -------------------------------------------------------------------------------- 1 | model = new Record(); 17 | } 18 | 19 | public function addRecord($userId, $title, $content) 20 | { 21 | $createTimeStamp = DatetimeHelper::msectime(); 22 | 23 | $this->add([ 24 | 'userid' => $userId, 25 | 'title' => $title, 26 | 'content' => $content, 27 | 'create_timestamp' =>$createTimeStamp 28 | ]); 29 | 30 | return [ 31 | 'status' => true 32 | ]; 33 | } 34 | 35 | public function listRecord($userId) 36 | { 37 | $info = $this->lists([ 38 | 'condition' => [ 39 | 'userid' => $userId, 40 | 'status' => 1, 41 | ], 42 | ]); 43 | 44 | return $info; 45 | } 46 | 47 | } 48 | 49 | -------------------------------------------------------------------------------- /web-api/app/controllers/user/RecordController.php: -------------------------------------------------------------------------------- 1 | rules = [ 15 | ['userid', 'required'], 16 | [['userid', 'title', 'content'], 'string'], 17 | ['title', 'default', 'value' => ''], 18 | ['content', 'default', 'value' => ''], 19 | ]; 20 | 21 | //相关校验,生成token 22 | $inputs = $this->validate(); 23 | $info = self::callModuleService('user', 'RecordService', 'addRecord', $inputs['userid'], $inputs['title'], $inputs['content']); 24 | 25 | return $info; 26 | } 27 | 28 | public function actionRecordList() 29 | { 30 | 31 | $this->rules = [ 32 | ['userid', 'required'], 33 | ['userid', 'string'], 34 | ]; 35 | 36 | $inputs = $this->validate(); 37 | $info = self::callModuleService('user', 'RecordService', 'listRecord', $inputs['userid']); 38 | 39 | return $info; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /web/public/table.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [{ 3 | "id": 1, 4 | "name": "张三", 5 | "money": 123, 6 | "address": "广东省东莞市长安镇", 7 | "state": "成功", 8 | "date": "2019-11-1", 9 | "thumb": "https://lin-xin.gitee.io/images/post/wms.png" 10 | }, 11 | { 12 | "id": 2, 13 | "name": "李四", 14 | "money": 456, 15 | "address": "广东省广州市白云区", 16 | "state": "成功", 17 | "date": "2019-10-11", 18 | "thumb": "https://lin-xin.gitee.io/images/post/node3.png" 19 | }, 20 | { 21 | "id": 3, 22 | "name": "王五", 23 | "money": 789, 24 | "address": "湖南省长沙市", 25 | "state": "失败", 26 | "date": "2019-11-11", 27 | "thumb": "https://lin-xin.gitee.io/images/post/parcel.png" 28 | }, 29 | { 30 | "id": 4, 31 | "name": "赵六", 32 | "money": 1011, 33 | "address": "福建省厦门市鼓浪屿", 34 | "state": "成功", 35 | "date": "2019-10-20", 36 | "thumb": "https://lin-xin.gitee.io/images/post/notice.png" 37 | } 38 | ], 39 | "pageTotal": 4 40 | } -------------------------------------------------------------------------------- /web-api/app/common/base/ApiController.php: -------------------------------------------------------------------------------- 1 | 7 | * @date 2017-05-22 15:31:23 8 | */ 9 | 10 | namespace app\common\base; 11 | 12 | use Yii; 13 | use yii\web\Controller; 14 | use app\common\behaviors\ApiCommonBehavior; 15 | use app\common\behaviors\ApiControllerBehavior; 16 | 17 | class ApiController extends Controller 18 | { 19 | public $rules = []; 20 | public $timeNow; 21 | 22 | public function behaviors() 23 | { 24 | return \yii\helpers\ArrayHelper::merge(parent::behaviors(), [ 25 | 'corsFilter' => [ 26 | 'class' => \yii\filters\Cors::className(), 27 | 'actions' => [ 28 | '*' => Yii::$app->request->allowRequestMethods, 29 | ], 30 | ], 31 | 'commonBehavior' => [ 32 | 'class' => ApiCommonBehavior::className(), 33 | ], 34 | 'controllerBehavior' => [ 35 | 'class' => ApiControllerBehavior::className(), 36 | ], 37 | ]); 38 | } 39 | 40 | public function init() 41 | { 42 | parent::init(); 43 | $this->timeNow = Yii::$app->params['timeNow']; 44 | $this->enableCsrfValidation = false; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /web/src/components/common/i18n.js: -------------------------------------------------------------------------------- 1 | export const messages = { 2 | 'zh': { 3 | i18n: { 4 | breadcrumb: '国际化产品', 5 | tips: '通过切换语言按钮,来改变当前内容的语言。', 6 | btn: '切换英文', 7 | title1: '常用用法', 8 | p1: '要是你把你的秘密告诉了风,那就别怪风把它带给树。', 9 | p2: '没有什么比信念更能支撑我们度过艰难的时光了。', 10 | p3: '只要能把自己的事做好,并让自己快乐,你就领先于大多数人了。', 11 | title2: '组件插值', 12 | info: 'Element组件需要国际化,请参考 {action}。', 13 | value: '文档' 14 | } 15 | }, 16 | 'en': { 17 | i18n: { 18 | breadcrumb: 'International Products', 19 | tips: 'Click on the button to change the current language. ', 20 | btn: 'Switch Chinese', 21 | title1: 'Common usage', 22 | p1: "If you reveal your secrets to the wind you should not blame the wind for revealing them to the trees.", 23 | p2: "Nothing can help us endure dark times better than our faith. ", 24 | p3: "If you can do what you do best and be happy, you're further along in life than most people.", 25 | title2: 'Component interpolation', 26 | info: 'The default language of Element is Chinese. If you wish to use another language, please refer to the {action}.', 27 | value: 'documentation' 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /web-api/README.MD: -------------------------------------------------------------------------------- 1 | # Start 2 | 3 | ## Install with composer 4 | 5 | 没有安装 **composer** 的通过 [composer 中国镜像](http://www.phpcomposer.com/) 安装 6 | 7 | ``` bash 8 | cd app 9 | composer install 10 | ``` 11 | 12 | ## Configure 13 | 14 | ```bash 15 | bash ./setup.sh 16 | ``` 17 | 18 | ## Nginx server config 19 | 20 | ``` 21 | server { 22 | listen 8888; 23 | server_name localhost; 24 | 25 | error_page 500 502 /500.html; 26 | 27 | # change to your project directory 28 | root /Users/lch/work/mine/juzi/projects/august-api/api; 29 | 30 | if (!-e $request_filename) { 31 | rewrite ^(.*)$ /index.php/$1 last; 32 | } 33 | 34 | location ~ { 35 | set $path_info ""; 36 | set $real_script_name $fastcgi_script_name; 37 | if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { 38 | set $real_script_name $1; 39 | set $path_info $2; 40 | } 41 | 42 | fastcgi_buffers 8 128k; 43 | 44 | # use ip:port for php-fpm 45 | # fastcgi_pass 127.0.0.1:9000; 46 | fastcgi_pass unix:/usr/local/var/run/php-fpm.sock; 47 | fastcgi_index index.php; 48 | fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; 49 | fastcgi_param SCRIPT_NAME $real_script_name; 50 | fastcgi_param PATH_INFO $path_info; 51 | include fastcgi_params; 52 | } 53 | } 54 | ``` 55 | -------------------------------------------------------------------------------- /web/src/components/page/403.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 23 | 24 | 25 | 57 | -------------------------------------------------------------------------------- /web/src/components/page/404.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 23 | 24 | 25 | 57 | -------------------------------------------------------------------------------- /web-api/app/common/behaviors/ApiCommonBehavior.php: -------------------------------------------------------------------------------- 1 | 7 | * @date 2017-05-27 10:03:55 8 | */ 9 | 10 | namespace app\common\behaviors; 11 | 12 | use Yii; 13 | use yii\base\Behavior; 14 | use Exception; 15 | 16 | class ApiCommonBehavior extends Behavior 17 | { 18 | /** 19 | * 模块服务层调用方法 20 | * 21 | * @param $module string 模块名 22 | * @param $service string 业务服务类名 23 | * @param $method string 调用的方法名 24 | */ 25 | public static function callModuleService($module, $service, $method) 26 | { 27 | $args = array_slice(func_get_args(), 3); 28 | 29 | $serviceClass = vsprintf('\app\modules\%s\service\%s', array($module, $service)); 30 | $callable = array(new $serviceClass, $method); 31 | if (is_callable($callable)) { 32 | return call_user_func_array($callable, $args); 33 | } else { 34 | throw new Exception('unkown service call[module:' . $module . ', service:' . $service . ', method:' . $method . ']'); 35 | } 36 | } 37 | 38 | /** 39 | * 异常响应方法 40 | * 41 | * @param $codeKey string 配置文件异常 code 的键值 42 | * @param $message mixed 提示信息 43 | */ 44 | public static function error($codeKey, $message) 45 | { 46 | Yii::$app->response->error( 47 | Yii::$app->response->resCode[$codeKey], 48 | $message 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /web-api/app/modules/user/behaviors/TeacherBehavior.php: -------------------------------------------------------------------------------- 1 | 'afterInsert', 31 | Teacher::EVENT_AFTER_UPDATE => 'afterUpdate', 32 | // Teacher::EVENT_BEFORE_INSERT => 'beforeInsert', 33 | // Teacher::EVENT_BEFORE_UPDATE => 'beforeUpdate', 34 | ]); 35 | } 36 | 37 | public function afterInsert($event) 38 | { 39 | // 新增老师同时新增对应账户 40 | (new AccountService)->defaultInstructorAccount($event->sender->userid); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /web-api/app/common/components/Pdf.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2017-07-07 11:13:58 7 | */ 8 | 9 | namespace app\common\components; 10 | 11 | use Yii; 12 | use yii\base\Component; 13 | use Dompdf\Dompdf; 14 | 15 | class Pdf extends Component 16 | { 17 | public $dompdf; 18 | 19 | public function init() 20 | { 21 | parent::init(); 22 | $this->dompdf = new Dompdf(); 23 | $this->dompdf->set_option('defaultFont', 'arial'); 24 | $this->dompdf->set_option('isFontSubsettingEnabled', true); 25 | $this->dompdf->set_option('isRemoteEnabled', true); 26 | $this->dompdf->setPaper('A4', 'portrait'); 27 | } 28 | 29 | /** 30 | * 从 html 生成 pdf 31 | * 32 | * @param string $html 要生成 PDF 的 HTML 字符串 33 | * @param string $name 生成的 PDF 文件名 34 | * @param boolean $isAttachment 是否弹出文件提示下载(默认为 false,直接在浏览器显示 PDF 文件) 35 | * 36 | * @return null 37 | */ 38 | public function generateFromHtml($html, $name = 'default', $isAttachment = false) 39 | { 40 | header('Access-Control-Allow-Origin: ' . Yii::$app->response->accessOrigin); 41 | header('Access-Control-Allow-Headers: ' . Yii::$app->response->allowHeaders); 42 | header('Access-Control-Allow-Credentials: ' . Yii::$app->response->allowCredentials); 43 | 44 | $this->dompdf->loadHtml($html, 'UTF-8'); 45 | $this->dompdf->render(); 46 | $this->dompdf->stream($name, array('Attachment' => $isAttachment)); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /web/src/components/common/Home.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 52 | -------------------------------------------------------------------------------- /web-api/app/controllers/user/XiaoHuaController.php: -------------------------------------------------------------------------------- 1 | [ 19 | 'status' => 1, 20 | ], 21 | ]); 22 | 23 | return $info; 24 | 25 | } 26 | 27 | public function actionGetJson(){ 28 | $datajson = ' 29 | [ 30 | 31 | ]'; 32 | 33 | $jsons = json_decode($datajson, true); 34 | foreach($jsons as $item){ 35 | // print_r($item['content']); 36 | // print_r($item['unixtime']); 37 | self::callModuleService('user', 'CarStudyService', 'add', [ 38 | 'question' => $item['question'], 39 | 'answer' => $item['answer'], 40 | 'explains' => $item['explains'], 41 | 'url' => $item['url'], 42 | 'item1' => $item['item1'], 43 | 'item2' => $item['item2'], 44 | 'item3' => $item['item3'], 45 | 'item4' => $item['item4'], 46 | 'type' => 1, 47 | 'type_car' => 1, 48 | ]); 49 | } 50 | 51 | return[ 52 | 'status' => true 53 | ]; 54 | } 55 | } -------------------------------------------------------------------------------- /web-api/app/common/behaviors/ApiResponseBehavior.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2017-05-26 10:31:32 7 | */ 8 | 9 | namespace app\common\behaviors; 10 | 11 | use Yii; 12 | use yii\base\Behavior; 13 | use yii\web\Response; 14 | 15 | class ApiResponseBehavior extends Behavior 16 | { 17 | public function events() 18 | { 19 | return \yii\helpers\ArrayHelper::merge(parent::events(), [ 20 | Response::EVENT_BEFORE_SEND => 'beforeSend', 21 | ]); 22 | } 23 | 24 | /** 25 | * response->send()前置事件 26 | * 修正HTTP status code,统一设置为200 27 | * 屏蔽错误信息暴露的一些字段 28 | * 29 | */ 30 | public function beforeSend($event) 31 | { 32 | $response = $event->sender; 33 | 34 | if ($response->statusCode != 200) { 35 | $response->statusCode = 200; 36 | $data = $response->data; 37 | 38 | // TODO 重置错误信息,把异常信息写入log 39 | if (YII_ENV_PROD) { 40 | $data = [ 41 | 'code' => $data['code'], 42 | 'name' => $data['name'], 43 | ]; 44 | } 45 | $response->data = [ 46 | 'code' => $response->resCode['ERROR_HTTP_STATUS_NOT_200'], 47 | 'data' => $data, 48 | ]; 49 | } 50 | Yii::getLogger()->log(print_r(Yii::$app->request->post(),true),yii\log\Logger::LEVEL_INFO,'MyLog');//使用MyLog策略来记录info级别的日志 51 | Yii::getLogger()->log(print_r($response->data,true),yii\log\Logger::LEVEL_INFO,'MyLog');//使用MyLog策略来记录info级别的日志 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /project_xiaoxueqi/video/views.py: -------------------------------------------------------------------------------- 1 | import threading 2 | from django.shortcuts import render 3 | 4 | # Create your views here. 5 | from django.contrib.auth.hashers import make_password, check_password 6 | from django.shortcuts import render 7 | from django.http import HttpResponse, StreamingHttpResponse 8 | from django.template import loader 9 | import json 10 | from django.http import HttpResponse 11 | from django.views.decorators.csrf import csrf_exempt 12 | import cv2 13 | 14 | class VideoCamera(object): 15 | def __init__(self): 16 | self.video = cv2.VideoCapture(0) 17 | (self.grabbed, self.frame) = self.video.read() 18 | threading.Thread(target=self.update, args=()).start() 19 | 20 | def __del__(self): 21 | self.video.release() 22 | 23 | def get_frame(self): 24 | image = self.frame 25 | _, jpeg = cv2.imencode('.jpg', image) 26 | return jpeg.tobytes() 27 | 28 | def update(self): 29 | while True: 30 | (self.grabbed, self.frame) = self.video.read() 31 | 32 | 33 | def gen(camera): 34 | while True: 35 | frame = camera.get_frame() 36 | yield(b'--frame\r\n' 37 | b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n\r\n') 38 | 39 | 40 | @csrf_exempt 41 | def index(request): 42 | try: 43 | cam = VideoCamera() 44 | return StreamingHttpResponse(gen(cam), content_type="multipart/x-mixed-replace;boundary=frame") 45 | except: # This is bad! replace it with proper handling 46 | pass 47 | 48 | def data(request): 49 | list1 = ['physics', 'chemistry', 1997, 2000] 50 | return HttpResponse(111) 51 | 52 | -------------------------------------------------------------------------------- /web-api/app/common/components/SmsJob.php: -------------------------------------------------------------------------------- 1 | appid); 24 | print($this->templateCode); 25 | print($this->param); 26 | print($this->mobile); 27 | print($this->uid); 28 | $res = (new Ucpaas)->SendSms($this->appid, $this->templateCode, $this->param, $this->mobile, $this->uid); 29 | print('here'); 30 | $res = json_decode($res); 31 | print_r($res); 32 | $addData = [ 33 | 'userid' => (string)$this->userId, 34 | 'send_user_id' => (string)$this->sendUserId, 35 | 'phone' => (string)$this->mobile, 36 | 'type' => (string)$this->type, 37 | 'template_code' => (string)$this->templateCode, 38 | 'template_param' => (string)$this->param, 39 | 'out_id' => (string)$this->uid, 40 | 'res_message' => (string)$res->msg ?? '', 41 | 'response_code' => (string)$res->code ?? '', 42 | 'res_biz_id' => (string)$res->smsid ?? '', 43 | 'create_timestamp' => DatetimeHelper::msectime(), 44 | ]; 45 | print_r($addData); 46 | (new SmsService)->add($addData); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /web-api/app/config/console.php.sample: -------------------------------------------------------------------------------- 1 | 'basic-console', 8 | 'basePath' => dirname(__DIR__), 9 | 'bootstrap' => ['log'], 10 | 'controllerNamespace' => 'app\commands', 11 | 'components' => [ 12 | 'cache' => [ 13 | 'class' => 'yii\caching\FileCache', 14 | ], 15 | 'log' => [ 16 | 'targets' => [ 17 | [ 18 | 'class' => 'yii\log\FileTarget', 19 | 'levels' => ['error', 'warning'], 20 | ], 21 | ], 22 | ], 23 | 'db' => $db, 24 | 'qiniu' => [ 25 | 'class' => 'app\common\components\Qiniu', 26 | 'accessKey' => '', 27 | 'secretKey' => '', 28 | 'defaultBucket' => '', 29 | 'privateBucket' => '', 30 | 'cdnHost' => [ 31 | 'default' => '', 32 | 'private' => '', 33 | ], 34 | ], 35 | 'redis' => require(__DIR__ . '/redis.php'), 36 | 'word' => [ 37 | 'class' => 'app\common\components\Word', 38 | ], 39 | ], 40 | 'params' => $params, 41 | /* 42 | 'controllerMap' => [ 43 | 'fixture' => [ // Fixture generation command line. 44 | 'class' => 'yii\faker\FixtureController', 45 | ], 46 | ], 47 | */ 48 | ]; 49 | 50 | if (YII_ENV_DEV) { 51 | // configuration adjustments for 'dev' environment 52 | $config['bootstrap'][] = 'gii'; 53 | $config['modules']['gii'] = [ 54 | 'class' => 'yii\gii\Module', 55 | ]; 56 | } 57 | 58 | return $config; 59 | -------------------------------------------------------------------------------- /web-api/app/common/behaviors/ApiControllerBehavior.php: -------------------------------------------------------------------------------- 1 | 7 | * @date 2017-05-24 21:29:25 8 | */ 9 | 10 | namespace app\common\behaviors; 11 | 12 | use Yii; 13 | use yii\base\Behavior; 14 | use yii\web\Controller; 15 | use app\common\components\ApiValidator; 16 | 17 | use Exception; 18 | 19 | class ApiControllerBehavior extends Behavior 20 | { 21 | public $userInfo = ''; 22 | 23 | public function events() 24 | { 25 | return \yii\helpers\ArrayHelper::merge(parent::events(), [ 26 | Controller::EVENT_BEFORE_ACTION => 'beforeAction', 27 | Controller::EVENT_AFTER_ACTION => 'afterAction', 28 | ]); 29 | } 30 | 31 | /** 32 | * action请求前事件处理 33 | */ 34 | public function beforeAction($event) { 35 | // token 校验 36 | Yii::$app->jwt->checkToken($this->owner->id, $event->action->id); 37 | $payloadData = Yii::$app->jwt->payloadData; 38 | if (!empty($payloadData)) { 39 | $this->userInfo = $payloadData; 40 | } 41 | 42 | // TODO permission校验 43 | // TODO rate limit 44 | } 45 | 46 | /** 47 | * action请求完成之后事件处理 48 | * 49 | */ 50 | public function afterAction($event) { 51 | Yii::$app->response->success($event->result); 52 | } 53 | 54 | /** 55 | * 参数校验 56 | */ 57 | public function validate() { 58 | $rules = $this->owner->rules; 59 | if (!empty($rules) && is_array($rules)) { 60 | // 把上传文件内容合并到 request body 里面进行验证 61 | $validator = new ApiValidator(\yii\helpers\ArrayHelper::merge( 62 | Yii::$app->request->getBodyParams(), 63 | $_FILES 64 | ), $rules); 65 | return $validator->validData; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /web/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import App from './App.vue'; 3 | import router from './router'; 4 | import ElementUI from 'element-ui'; 5 | import VueI18n from 'vue-i18n'; 6 | import { messages } from './components/common/i18n'; 7 | import 'element-ui/lib/theme-chalk/index.css'; // 默认主题 8 | import './assets/css/icon.css'; 9 | import './components/common/directives'; 10 | import 'babel-polyfill'; 11 | 12 | import VueVideoPlayer from 'vue-video-player' 13 | import 'vue-video-player/src/custom-theme.css' 14 | import 'video.js/dist/video-js.css' 15 | Vue.use(VueVideoPlayer) 16 | 17 | // import axios from 'axios' 18 | // Vue.prototype.$axios = axios 19 | import 'axios'; 20 | //引入 hls,视频直播(m3u8)必须引入的 21 | // import 'videojs-contrib-hls' 22 | //播放rtmp视频 23 | import 'videojs-flash' 24 | 25 | Vue.config.productionTip = false; 26 | Vue.use(VueI18n); 27 | Vue.use(ElementUI, { 28 | size: 'small' 29 | }); 30 | const i18n = new VueI18n({ 31 | locale: 'zh', 32 | messages 33 | }); 34 | // document.title = `${to.meta.title} | 老人监护系统`; 35 | // 使用钩子函数对路由进行权限跳转 36 | // router.beforeEach((to, from, next) => { 37 | // document.title = `${to.meta.title} | 老人监护系统`; 38 | // // const role = localStorage.getItem('ms_username'); 39 | // if (to.path !== '/login') { 40 | // next('/login'); 41 | // } 42 | // // else if (to.meta.permission) { 43 | // // // 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已 44 | // // role === 'admin' ? next() : next('/403'); 45 | // // } else { 46 | // // // 简单的判断IE10及以下不进入富文本编辑器,该组件不兼容 47 | // // if (navigator.userAgent.indexOf('MSIE') > -1 && to.path === '/editor') { 48 | // // Vue.prototype.$alert('vue-quill-editor组件不兼容IE10及以下浏览器,请使用更高版本的浏览器查看', '浏览器不兼容通知', { 49 | // // confirmButtonText: '确定' 50 | // // }); 51 | // // } else { 52 | // // next(); 53 | // // } 54 | // // } 55 | // }); 56 | 57 | new Vue({ 58 | router, 59 | i18n, 60 | render: h => h(App) 61 | }).$mount('#app'); 62 | -------------------------------------------------------------------------------- /web-api/app/common/components/Redis.php: -------------------------------------------------------------------------------- 1 | chooseServer(); 28 | } 29 | 30 | /** 31 | * 根据当前环境选择一个 server 32 | */ 33 | private function chooseServer() 34 | { 35 | $server = $this->servers[0]; 36 | $this->hostname = $server['hostname']; 37 | $this->port = $server['port']; 38 | $this->database = $server['database']; 39 | $this->password = $server['password'] ?? null; 40 | } 41 | 42 | /** 43 | * 根据配置文件的生成一个 redis key 44 | * 45 | * @param string $index 索引 46 | * @param array $params 参数 47 | * 48 | * @return array 49 | */ 50 | public function genKey($index, $params = []) 51 | { 52 | $params[] = Yii::$app->language; 53 | $keyInfo = ArrayHelper::getValue($this->keySource, $index, false); 54 | if ($keyInfo) { 55 | $keyInfo['key'] = strtolower(vsprintf($keyInfo['key'], $params)); 56 | } 57 | return $keyInfo; 58 | } 59 | 60 | /** 61 | * 执行 redis 命令 62 | * 63 | * @param string $name 命令名 64 | * @param array $params 命令参数 65 | * @param array|false $keyInfo 缓存的 key 信息 66 | * 67 | * @return null 68 | */ 69 | public function execute($name, $params, $keyInfo = false) { 70 | $value = $this->executeCommand($name, $params); 71 | if (is_array($keyInfo) && $keyInfo['expire'] > 0) { 72 | $this->expire($keyInfo['key'], $keyInfo['expire']); 73 | } 74 | return $value; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /web-api/app/common/components/Gaode.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2021-01-07 20:34:27 7 | */ 8 | 9 | namespace app\common\components; 10 | 11 | use Yii; 12 | use yii\base\Component; 13 | 14 | class Gaode extends Component 15 | { 16 | // 账号 相关的信息 17 | public $key = ''; 18 | 19 | const IP_URL = 'https://restapi.amap.com/v3/ip'; // 根据ip获取地理位置信息: 20 | const WEATHER_INFO_URL = 'https://restapi.amap.com/v3/weather/weatherInfo'; // 根据城市编码获取天气信息: 21 | 22 | public function init() 23 | { 24 | parent::init(); 25 | } 26 | 27 | /** 28 | * 根据ip获取地理位置信息 29 | * 30 | * @param $ip 31 | * @return array 32 | */ 33 | public function getCityInfoByIp($ip) 34 | { 35 | $url = self::IP_URL.'?key='.$this->key.'&&ip='.$ip; 36 | 37 | $data = $this->get($url); 38 | 39 | return json_decode($data, true); 40 | } 41 | 42 | /** 43 | * 根据城市编码获取天气信息 44 | * 45 | * @param $cityCode 46 | * @return array 47 | */ 48 | public function getWeatherInfoByCityCode($cityCode) 49 | { 50 | $url = self::WEATHER_INFO_URL.'?key='.$this->key.'&&city='.$cityCode; 51 | 52 | $data = $this->get($url); 53 | 54 | return json_decode($data, true); 55 | } 56 | 57 | 58 | /** 59 | * curl get 60 | * 61 | * @param $url 62 | * @return bool|string 63 | */ 64 | public function get($url) 65 | { 66 | $curl = curl_init(); 67 | //设置抓取的url 68 | 69 | curl_setopt($curl, CURLOPT_URL, $url); 70 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//设置获取的信息以文件流的形式返回,而不是直接输出 71 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 72 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); 73 | $data = curl_exec($curl); //执行命令 74 | curl_close($curl); //关闭URL请求 75 | return ($data); //显示获得的数据 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /web-api/app/common/components/Curl.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2020-10-28 19:11:02 7 | */ 8 | 9 | namespace app\common\components; 10 | 11 | use Yii; 12 | use yii\base\Component; 13 | 14 | class Curl extends Component 15 | { 16 | public function init() 17 | { 18 | parent::init(); 19 | } 20 | 21 | /** 22 | * curl 23 | * 24 | * @param $url 25 | * @param string $postData 26 | * @param string $header 27 | * @return bool|string 28 | */ 29 | public function post($url, $postData = '', $header = '') 30 | { 31 | //初始化 32 | $curl = curl_init(); //用curl发送数据给api 33 | curl_setopt($curl, CURLOPT_POST, true); 34 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 35 | curl_setopt($curl, CURLOPT_URL, $url); 36 | 37 | if (!empty($header)) { 38 | curl_setopt($curl, CURLOPT_HTTPHEADER, $header); 39 | } 40 | 41 | if (!empty($postData)) { 42 | curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); 43 | } 44 | 45 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); 46 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); 47 | $response = curl_exec($curl); 48 | //关闭URL请求 49 | curl_close($curl); 50 | //显示获得的数据 51 | return $response; 52 | } 53 | 54 | /** 55 | * curl 56 | * 57 | * @param $url 58 | * @param string $header 59 | * @return bool|string 60 | */ 61 | public function get($url, $header = '') 62 | { 63 | $curl = curl_init(); 64 | //设置抓取的url 65 | 66 | curl_setopt($curl, CURLOPT_URL, $url); 67 | curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);//设置获取的信息以文件流的形式返回,而不是直接输出 68 | curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); 69 | curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); 70 | $data = curl_exec($curl); //执行命令 71 | curl_close($curl); //关闭URL请求 72 | return ($data); //显示获得的数据 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /web-api/app/common/components/ApiResponse.php: -------------------------------------------------------------------------------- 1 | 8 | * @date 2017-05-22 15:45:53 9 | */ 10 | 11 | namespace app\common\components; 12 | 13 | use Yii; 14 | use yii\web\Response; 15 | use app\common\behaviors\ApiResponseBehavior; 16 | 17 | class ApiResponse extends Response 18 | { 19 | public $resCode; 20 | public $accessOrigin; 21 | public $accessOriginList; 22 | public $allowHeaders; 23 | public $allowCredentials; 24 | 25 | public function behaviors() 26 | { 27 | return [ 28 | 'responseBehavior' => [ 29 | 'class' => ApiResponseBehavior::className(), 30 | ], 31 | ]; 32 | } 33 | 34 | public function init() 35 | { 36 | parent::init(); 37 | 38 | // 设置响应格式为JSON,否则不能使用 data 属性 39 | $this->format = Response::FORMAT_JSON; 40 | 41 | // 设置跨域请求 42 | $origin = isset($_SERVER['HTTP_ORIGIN']) ? strtolower($_SERVER['HTTP_ORIGIN']) : ''; 43 | if (in_array($origin, $this->accessOriginList)) { 44 | $this->headers->add('Access-Control-Allow-Origin', $origin); 45 | } else{ 46 | $this->headers->add('Access-Control-Allow-Origin', $this->accessOrigin); 47 | } 48 | $this->headers->add('Access-Control-Allow-Methods', strtoupper(implode(', ', Yii::$app->request->allowRequestMethods))); 49 | $this->headers->add('Access-Control-Allow-Headers', $this->allowHeaders . ', ' . Yii::$app->jwt->jwtHeaderKey); 50 | $this->headers->add('Access-Control-Allow-Credentials', $this->allowCredentials); 51 | } 52 | 53 | /** 54 | * 正常响应方法 55 | * 56 | * @param $data array 响应体数组 57 | */ 58 | public function success($data) 59 | { 60 | $this->data = [ 61 | 'code' => $this->resCode['NORMAL_SUCCESS'], 62 | 'data' => $data, 63 | ]; 64 | $this->send(); 65 | } 66 | 67 | /** 68 | * 异常响应方法 69 | * 70 | * @param $code integer 响应的 code 值 71 | * @param $message mixed (string or array) 响应的信息提示 72 | */ 73 | public function error($code, $message) 74 | { 75 | $this->data = [ 76 | 'code' => $code, 77 | 'message' => $message, 78 | ]; 79 | $this->send(); 80 | Yii::$app->end(); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /web-api/app/common/utils/Apcu.php: -------------------------------------------------------------------------------- 1 | $ttl)) { 25 | // print_r("cache $key found, but timeout ".($now - $updateTime)." out of ttl ",$ttl); 26 | return false; 27 | } 28 | return unserialize($data); 29 | } 30 | 31 | /** 32 | * @desc 设置缓存数据 33 | * @desc set ttl at put stage, has one benefit: cacher system can delete timeout entry automatically 34 | * 35 | * @param key 36 | * @param data 37 | * @param ttl 38 | * @ret bool 39 | */ 40 | public function set($key, $data, $ttl = 300) { 41 | if (null === $data) { 42 | // print_r("put $key to cache, found invalid param, null data"); 43 | return false; 44 | } 45 | return apcu_store ( 46 | $key, 47 | array(time(), $ttl, serialize($data)), 48 | $ttl 49 | ); 50 | } 51 | 52 | /** 53 | * @desc 删除缓存数据 54 | * 55 | * @param key 56 | */ 57 | public function del($key) { 58 | $delRet = apcu_delete($key); 59 | if( $delRet != false ){ 60 | return true; 61 | }else{ 62 | return false; 63 | } 64 | } 65 | 66 | /** 67 | * @desc 判断缓存是否存在 68 | * 69 | * @param key 70 | */ 71 | public function exists($key) { 72 | $existsStatus = apcu_exists($key); 73 | if( $existsStatus != false ){ 74 | return true; 75 | }else{ 76 | return false; 77 | } 78 | } 79 | 80 | /** 81 | * @desc 过去apcu内存使用情况 82 | * 83 | * @param key 84 | */ 85 | public function statistic($limited = true) { 86 | $smaInfo = apcu_sma_info($limited); 87 | if( $smaInfo != false ){ 88 | return $smaInfo; 89 | }else{ 90 | return false; 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /web-api/app/common/components/ApiValidator.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2017-05-25 13:50:43 7 | */ 8 | 9 | namespace app\common\components; 10 | 11 | use Yii; 12 | use yii\base\DynamicModel; 13 | 14 | class ApiValidator 15 | { 16 | public $data = []; // 需要验证的数据 17 | public $rules = []; // 验证规则 18 | public $allFields = []; // 所有的字段 19 | public $requiredFields = []; // 必须的字段 20 | public $validData = []; // 验证后的数据 21 | 22 | public function __construct($data, $rules) { 23 | $this->data = $data; 24 | $this->rules = $rules; 25 | 26 | if ($message = $this->doValidate()) { 27 | Yii::$app->response->error( 28 | Yii::$app->response->resCode['ERROR_REQUEST_PARAMS'], 29 | $message 30 | ); 31 | } 32 | } 33 | 34 | /** 35 | * 参数校验方法 36 | * 37 | * @return null 38 | */ 39 | public function doValidate() 40 | { 41 | list($this->allFields, $this->requiredFields) = self::parseFields($this->rules); 42 | 43 | // 过滤非接口定义范围内的字段 44 | $unexpectedFields = array_diff(array_keys($this->data), $this->allFields); 45 | if (!empty($unexpectedFields)) { 46 | return ucfirst(implode(',', $unexpectedFields) . ' are(is) not expected'); 47 | } 48 | 49 | // 把非必须参数映射到 $this->data 50 | foreach ($this->allFields as $field) { 51 | if (!isset($this->data[$field])) { 52 | $this->data[$field] = null; 53 | } 54 | } 55 | 56 | // 使用DynamicModel做其他规则校验 57 | $model = DynamicModel::validateData($this->data, $this->rules); 58 | if ($model->hasErrors()) { 59 | return $model->errors; 60 | } 61 | $this->validData = array_filter($model->attributes, function($val) { 62 | return $val !== null; 63 | }); 64 | return null; 65 | } 66 | 67 | /** 68 | * 解析验证规则里面所有的字段,以及必须验证的字段 69 | * 70 | * @param $rules array 验证规则 71 | * 72 | * @return array 73 | */ 74 | public static function parseFields($rules) 75 | { 76 | $allFields = $requiredFields = []; 77 | if (!empty($rules)) { 78 | foreach ($rules as $rule) { 79 | $field = is_array($rule[0]) ? $rule[0] : [$rule[0]]; 80 | $allFields = array_merge($allFields, $field); 81 | if (in_array('required', $rule, true)) { 82 | $requiredFields = array_merge($requiredFields, $field); 83 | } 84 | } 85 | } 86 | return [ 87 | array_unique($allFields), 88 | array_unique($requiredFields), 89 | ]; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /web-api/app/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yiisoft/yii2-app-basic", 3 | "description": "Yii 2 Basic Project Template", 4 | "keywords": ["yii2", "framework", "basic", "project template"], 5 | "homepage": "http://www.yiiframework.com/", 6 | "type": "project", 7 | "license": "BSD-3-Clause", 8 | "support": { 9 | "issues": "https://github.com/yiisoft/yii2/issues?state=open", 10 | "forum": "http://www.yiiframework.com/forum/", 11 | "wiki": "http://www.yiiframework.com/wiki/", 12 | "irc": "irc://irc.freenode.net/yii", 13 | "source": "https://github.com/yiisoft/yii2" 14 | }, 15 | "minimum-stability": "stable", 16 | "require": { 17 | "php": ">=7.4", 18 | "yiisoft/yii2": "~2.0.16", 19 | "yiisoft/yii2-bootstrap": "~2.0.0", 20 | "yiisoft/yii2-swiftmailer": "~2.0.0", 21 | "lcobucci/jwt": "^3.2", 22 | "qiniu/php-sdk": "^7.1", 23 | "dompdf/dompdf": "^0.8.0", 24 | "phpoffice/phpexcel": "^1.8", 25 | "rmccue/requests": "^1.7", 26 | "flc/dysms": "^1.0", 27 | "twilio/sdk": "^5.15", 28 | "gregwar/captcha": "^1.1", 29 | "overtrue/pinyin": "~3.0", 30 | "yiisoft/yii2-redis": "^2.0", 31 | "overtrue/wechat": "~3.1", 32 | "maxwen/yii2-easy-wechat": "^1.0", 33 | "phpoffice/phpword": "v0.14.*", 34 | "yiisoft/yii2-queue": "^2.3", 35 | "yiisoft/yii2-apidoc": "~2.1.0", 36 | "phpoffice/phpspreadsheet": "^1.14", 37 | "voku/simple_html_dom": "^4.7" 38 | }, 39 | "require-dev": { 40 | "yiisoft/yii2-debug": "~2.0.0", 41 | "yiisoft/yii2-gii": "~2.0.0", 42 | "yiisoft/yii2-faker": "~2.0.0", 43 | 44 | "codeception/base": "^2.2.3", 45 | "codeception/verify": "~0.3.1", 46 | "codeception/specify": "~0.4.3" 47 | }, 48 | "config": { 49 | "process-timeout": 1800, 50 | "fxp-asset" : { 51 | "installer-paths" : { 52 | "npm-asset-library": "vendor/npm", 53 | "bower-asset-library": "vendor/bower" 54 | } 55 | } 56 | }, 57 | "scripts": { 58 | "post-create-project-cmd": [ 59 | "yii\\composer\\Installer::postCreateProject" 60 | ] 61 | }, 62 | "extra": { 63 | "yii\\composer\\Installer::postCreateProject": { 64 | "setPermission": [ 65 | { 66 | "runtime": "0777", 67 | "web/assets": "0777", 68 | "yii": "0755" 69 | } 70 | ], 71 | "generateCookieValidationKey": [ 72 | "config/web.php" 73 | ] 74 | } 75 | }, 76 | "repositories": { 77 | "packagist": { 78 | "type": "composer", 79 | "url": "https://packagist.phpcomposer.com" 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /web-api/app/config/api_main.php.sample: -------------------------------------------------------------------------------- 1 | 'basic', 7 | 'basePath' => dirname(__DIR__), 8 | 'bootstrap' => ['log'], 9 | 'language' => 'zh-cn', 10 | 'components' => [ 11 | 'request' => [ 12 | 'class' => 'app\common\components\ApiRequest', 13 | 'allowRequestMethods' => ['post', 'get'], 14 | 'cookieValidationKey' => 'BhHuFbVVAmiu69MaL1pW2El96TWz-U2Y', 15 | ], 16 | 'response' => [ 17 | 'class' => 'app\common\components\ApiResponse', 18 | 'resCode' => require(__DIR__ . '/response_code.php'), 19 | ], 20 | 'cache' => [ 21 | 'class' => 'yii\caching\ApcCache', 22 | 'useApcu' => true, 23 | ], 24 | 'log' => [ 25 | 'traceLevel' => YII_DEBUG ? 3 : 0, 26 | 'targets' => [ 27 | [ 28 | 'logFile' => '@app/runtime/logs/Mylog/error/error.log', 29 | 'class' => 'yii\log\FileTarget', 30 | 'levels' => ['error'], 31 | 'maxFileSize' => 1024 * 4, 32 | 'maxLogFiles' => 50, 33 | ], 34 | [ 35 | //日志记录方式 36 | 'class' => 'yii\log\FileTarget', 37 | 'levels' => ['info'],//日志等级 38 | 'logFile' => '@app/runtime/logs/Mylog/info.log', 39 | 'logVars' => ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION','_SERVER'], // 加上额外数据 40 | //指定日志策略 41 | 'categories' => ['MyLog'], 42 | 'maxFileSize' => 1024 * 2, 43 | 'maxLogFiles' => 100, 44 | ], 45 | [ 46 | 'class' => 'yii\log\EmailTarget', 47 | 'levels' => ['error'], 48 | 'message' => [ 49 | 'from' => ['service_dx@bjtu.edu.cn'], 50 | 'to' => ['service_dx@bjtu.edu.cn'], 51 | 'subject' => '智慧学工严重错误报警', 52 | ], 53 | 'except' => [ 54 | 'yii\web\HeadersAlreadySentException', 55 | ], 56 | ], 57 | ], 58 | ], 59 | 'excel' => [ 60 | 'class' => 'app\common\components\Excel', 61 | ], 62 | 'word' => [ 63 | 'class' => 'app\common\components\Word', 64 | ], 65 | 'db' => require(__DIR__ . '/db.php'), 66 | 'redis' => require(__DIR__ . '/redis.php'), 67 | 'urlManager' => [ 68 | 'enablePrettyUrl' => true, 69 | 'showScriptName' => false, 70 | 'rules' => [], 71 | ], 72 | ], 73 | 'modules' => [ 74 | 'foo' => 'app\modules\foo\Foo', 75 | ], 76 | 'params' => $params, 77 | ]; 78 | 79 | return $config; 80 | -------------------------------------------------------------------------------- /web-api/app/common/components/AssignTeacherRoleJob.php: -------------------------------------------------------------------------------- 1 | teacherIdList); 22 | 23 | $roleCommonTeacherData = []; 24 | $roleCommonTeacherId = 6; 25 | foreach($this->teacherIdList as $k => $leaderId) 26 | { 27 | $roleCommonTeacherData[$k]['is_student'] = 0; 28 | $roleCommonTeacherData[$k]['user_id'] = $leaderId; 29 | $roleCommonTeacherData[$k]['assignRoleList'] = [$roleCommonTeacherId]; 30 | } 31 | (new UserRoleService)->assign($roleCommonTeacherData); 32 | 33 | 34 | $notDeleteRoleIdList = (new RoleService)::notDeleteRoleIdList; 35 | print_r($notDeleteRoleIdList); 36 | $groupIdList = ArrayHelper::getColumn((new GroupService)->lists([ 37 | 'condition' => [ 38 | 'and', 39 | ['in', 'role_id', $notDeleteRoleIdList], 40 | ['status' => 1], 41 | ], 42 | ]), 'id'); 43 | print_r($groupIdList); 44 | $data = []; 45 | $i = 0; 46 | foreach($this->teacherIdList as $teacherId) 47 | { 48 | foreach($groupIdList as $groupId) 49 | { 50 | $data[$i]['group_id'] = $groupId; 51 | $data[$i]['user_id'] = $teacherId; 52 | $data[$i]['status'] = 1; 53 | $i ++; 54 | } 55 | } 56 | print_r($data); 57 | print(date("Y-m-d H:i:s", time())); 58 | (new GroupRangeService)->saveMany($data, ['group_id', 'user_id']); 59 | 60 | $teacherList = (new CourseService)->lists([ 61 | 'fields' => ['teacherId'], 62 | 'condition' => ['and',['in', 'teacherId', $this->teacherIdList]], 63 | 'orderby' => ['teacherId' => SORT_ASC], 64 | 'groupby' => ['teacherId'], 65 | ]); 66 | print_r($teacherList); 67 | $assignList = []; 68 | foreach($teacherList as $i => $teacherInfo) 69 | { 70 | $assignList[$i]['is_student'] = 0; 71 | $assignList[$i]['user_id'] = $teacherInfo['teacherId']; 72 | $assignList[$i]['assignRoleList'] = [3]; 73 | } 74 | print_r($assignList); 75 | (new UserRoleService)->assign($assignList); 76 | 77 | print("end"); 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 69 | -------------------------------------------------------------------------------- /project_xiaoxueqi/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 69 | -------------------------------------------------------------------------------- /web-api/app/common/components/DataSync.php: -------------------------------------------------------------------------------- 1 | 'password', 38 | 'client_id' => $this->clientId, 39 | 'client_secret' => $this->clientSecret, 40 | 'username' => $this->username, 41 | 'password' => $this->password, 42 | ]; 43 | $response = Requests::post($this->getTokenUrl, [], $params, []); 44 | $body = json_decode($response->body, true); 45 | print_r("params:"); 46 | print_r($params); 47 | print_r("\nrequest url:"); 48 | print_r($this->getTokenUrl); 49 | print_r("\nresponse body:"); 50 | print_r($body); 51 | return $body; 52 | } 53 | 54 | // 获取全部学生列表 55 | public function getStudentList($token, $format = 'json', $offset = 0, $limit = 1) 56 | { 57 | $params = [ 58 | 'format' => $format, 59 | 'offset' => $offset, 60 | 'limit' => $limit, 61 | 'dqztm' => '01', 62 | ]; 63 | $getStudentListUrl = $this->getStudentListUrl . '?' . http_build_query($params); 64 | $headers = [ 65 | 'Authorization' => 'Bearer ' . $token 66 | ]; 67 | $response = Requests::get($getStudentListUrl, $headers, []); 68 | $body = json_decode($response->body, true); 69 | print_r("\nget student list header:"); 70 | print_r($headers); 71 | print_r("\nget student list params:"); 72 | print_r($params); 73 | print_r("\nrequest url:"); 74 | print_r($getStudentListUrl); 75 | print_r("\nresponse body:"); 76 | print_r($body); 77 | return $body; 78 | } 79 | 80 | // 获取学生个体信息 81 | public function getStudentDetail($studentId, $token, $format = 'json', $limit = 1) 82 | { 83 | $getStudentDetailUrl = sprintf($this->getStudentDetailUrl, $studentId); 84 | $params = [ 85 | 'format' => $format, 86 | //'limit' => $limit, 87 | ]; 88 | if ($params) { 89 | $getStudentDetailUrl .= '?' . http_build_query($params); 90 | } 91 | $headers = [ 92 | 'Authorization' => 'Bearer ' . $token 93 | ]; 94 | $response = Requests::get($getStudentDetailUrl, $headers, []); 95 | print_r($headers); 96 | $body = json_decode($response->body, true); 97 | print_r($response);exit(); 98 | return $body; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /web-api/app/modules/user/service/AccountService.php: -------------------------------------------------------------------------------- 1 | model = new Account(); 18 | } 19 | 20 | /** 21 | * 登录; 22 | * 返回的信息包括token,用来在不同模块间传递加密信息,识别身份; 23 | * 24 | * @param int $userId 用户名 25 | * @param string $password 密码 26 | */ 27 | public function login($email, $password) 28 | { 29 | $info = $this->info([ 30 | 'condition' => [ 31 | 'email' => $email, 32 | ], 33 | ]); 34 | if(empty($info)) { 35 | return self::error('ERROR_INVALID_USERID', '用户不存在'); 36 | } 37 | if($password != $info['password']) { 38 | return self::error('ERROR_INVALID_USERID', '密码不正确'); 39 | } 40 | return [ 41 | 'status' => true 42 | ]; 43 | } 44 | 45 | /** 46 | * 注册 47 | * @param int $userId 用户名 48 | * @param string $password 密码 49 | */ 50 | public function register($email, $password, $password_again) 51 | { 52 | $info = $this->info([ 53 | 'fields' => ['id', 'email'], 54 | 'condition' => [ 55 | 'email' => $email, 56 | ], 57 | ]); 58 | 59 | $createTimeStamp = DatetimeHelper::msectime(); 60 | 61 | if(!empty($info)) { 62 | return self::error('ERROR_INVALID_USERID', '用户已存在'); 63 | } 64 | 65 | if($password != $password_again){ 66 | return self::error('ERROR_INVALID_PASSWORD', '两次密码输入不一致'); 67 | }else { 68 | $this->add([ 69 | 'email' => $email, 70 | 'password' => $password, 71 | 72 | ]); 73 | // self::callModuleService('user', 'UserInfoService', 'add', [ 74 | // 'email' => $email, 75 | // 'create_timestamp' =>$createTimeStamp 76 | // ]); 77 | } 78 | 79 | return [ 80 | 'status' => true 81 | ]; 82 | } 83 | 84 | /** 85 | * 修改密码 86 | */ 87 | public function changePassword($accountInfo) 88 | { 89 | $info = $this->info([ 90 | 'condition' => [ 91 | 'email' => $accountInfo['email'], 92 | ], 93 | ]); 94 | if(empty($info)) { 95 | return self::error('ERROR_INVALID_USERID', '用户不存在'); 96 | } 97 | //更新密码 98 | $this->update(['password' => $accountInfo['again_pw']], ['email' => $accountInfo['email']]); 99 | } 100 | 101 | /** 102 | * 密码加密; 103 | * 104 | * @return string 加密后的密码 105 | */ 106 | public function buildPassword($password) 107 | { 108 | return base64_encode($password); 109 | } 110 | } 111 | 112 | -------------------------------------------------------------------------------- /web/src/components/common/directives.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | 3 | // v-dialogDrag: 弹窗拖拽属性 4 | Vue.directive('dialogDrag', { 5 | bind(el, binding, vnode, oldVnode) { 6 | const dialogHeaderEl = el.querySelector('.el-dialog__header'); 7 | const dragDom = el.querySelector('.el-dialog'); 8 | 9 | dialogHeaderEl.style.cssText += ';cursor:move;' 10 | dragDom.style.cssText += ';top:0px;' 11 | 12 | // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null); 13 | const sty = (() => { 14 | if (window.document.currentStyle) { 15 | return (dom, attr) => dom.currentStyle[attr]; 16 | } else { 17 | return (dom, attr) => getComputedStyle(dom, false)[attr]; 18 | } 19 | })() 20 | 21 | dialogHeaderEl.onmousedown = (e) => { 22 | // 鼠标按下,计算当前元素距离可视区的距离 23 | const disX = e.clientX - dialogHeaderEl.offsetLeft; 24 | const disY = e.clientY - dialogHeaderEl.offsetTop; 25 | 26 | const screenWidth = document.body.clientWidth; // body当前宽度 27 | const screenHeight = document.documentElement.clientHeight; // 可见区域高度(应为body高度,可某些环境下无法获取) 28 | 29 | const dragDomWidth = dragDom.offsetWidth; // 对话框宽度 30 | const dragDomheight = dragDom.offsetHeight; // 对话框高度 31 | 32 | const minDragDomLeft = dragDom.offsetLeft; 33 | const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth; 34 | 35 | const minDragDomTop = dragDom.offsetTop; 36 | const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight; 37 | 38 | 39 | // 获取到的值带px 正则匹配替换 40 | let styL = sty(dragDom, 'left'); 41 | let styT = sty(dragDom, 'top'); 42 | 43 | // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px 44 | if (styL.includes('%')) { 45 | styL = +document.body.clientWidth * (+styL.replace(/\%/g, '') / 100); 46 | styT = +document.body.clientHeight * (+styT.replace(/\%/g, '') / 100); 47 | } else { 48 | styL = +styL.replace(/\px/g, ''); 49 | styT = +styT.replace(/\px/g, ''); 50 | }; 51 | 52 | document.onmousemove = function (e) { 53 | // 通过事件委托,计算移动的距离 54 | let left = e.clientX - disX; 55 | let top = e.clientY - disY; 56 | 57 | // 边界处理 58 | if (-(left) > minDragDomLeft) { 59 | left = -(minDragDomLeft); 60 | } else if (left > maxDragDomLeft) { 61 | left = maxDragDomLeft; 62 | } 63 | 64 | if (-(top) > minDragDomTop) { 65 | top = -(minDragDomTop); 66 | } else if (top > maxDragDomTop) { 67 | top = maxDragDomTop; 68 | } 69 | 70 | // 移动当前元素 71 | dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`; 72 | }; 73 | 74 | document.onmouseup = function (e) { 75 | document.onmousemove = null; 76 | document.onmouseup = null; 77 | }; 78 | } 79 | } 80 | }) 81 | -------------------------------------------------------------------------------- /web/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Router from 'vue-router'; 3 | 4 | Vue.use(Router); 5 | 6 | export default new Router({ 7 | routes: [ 8 | // { 9 | // path: '/', 10 | // redirect: '/dashboard' 11 | // }, 12 | { 13 | path: '/dashboard', 14 | component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'), 15 | meta: { title: '自述文件' }, 16 | children: [ 17 | { 18 | path: '/dashboard', 19 | component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Dashboard.vue'), 20 | meta: { title: '系统首页' } 21 | }, 22 | { 23 | path: '/table', 24 | component: () => import(/* webpackChunkName: "table" */ '../components/page/BaseTable.vue'), 25 | meta: { title: '监护详情' } 26 | }, 27 | { 28 | path: '/notify', 29 | component: () => import(/* webpackChunkName: "tabs" */ '../components/page/Notify.vue'), 30 | meta: { title: '通知信息' } 31 | }, 32 | { 33 | path: '/changeInfo', 34 | component: () => import(/* webpackChunkName: "form" */ '../components/page/ChangInfo.vue'), 35 | meta: { title: '修改信息' } 36 | }, 37 | { 38 | // 富文本编辑器组件 39 | path: '/error404', 40 | component: () => import(/* webpackChunkName: "error404" */ '../components/page/404.vue'), 41 | meta: { title: 'error404' } 42 | }, 43 | { 44 | // 图片上传组件 45 | path: '/changePassword', 46 | component: () => import(/* webpackChunkName: "upload" */ '../components/page/ChangePassword.vue'), 47 | meta: { title: '修改密码' } 48 | }, 49 | { 50 | // vue-schart组件 51 | path: '/charts', 52 | component: () => import(/* webpackChunkName: "chart" */ '../components/page/BaseCharts.vue'), 53 | meta: { title: '人员录入' } 54 | }, 55 | { 56 | path: '/video', 57 | component: () => import(/* webpackChunkName: "i18n" */ '../components/page/Video.vue'), 58 | meta: { title: '实时监护' } 59 | }, 60 | { 61 | path: '/about', 62 | component: () => import(/* webpackChunkName: "donate" */ '../components/page/About.vue'), 63 | meta: { title: '关于我们' } 64 | } 65 | ] 66 | }, 67 | { 68 | path: '/', 69 | component: () => import(/* webpackChunkName: "login" */ '../components/page/Login.vue'), 70 | meta: { title: '登录' } 71 | }, 72 | { 73 | path: '/register', 74 | component: () => import(/* webpackChunkName: "login" */ '../components/page/Register.vue'), 75 | meta: { title: '注册' } 76 | }, 77 | { 78 | path: '*', 79 | redirect: '/404' 80 | } 81 | ] 82 | }); 83 | -------------------------------------------------------------------------------- /web/src/components/page/Login.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 63 | 64 | -------------------------------------------------------------------------------- /web/src/assets/css/main.css: -------------------------------------------------------------------------------- 1 | * { 2 | margin: 0; 3 | padding: 0; 4 | } 5 | 6 | html, 7 | body, 8 | #app, 9 | .wrapper { 10 | width: 100%; 11 | height: 100%; 12 | overflow: hidden; 13 | } 14 | 15 | body { 16 | font-family: 'PingFang SC', "Helvetica Neue", Helvetica, "microsoft yahei", arial, STHeiTi, sans-serif; 17 | } 18 | 19 | a { 20 | text-decoration: none 21 | } 22 | 23 | 24 | .content-box { 25 | position: absolute; 26 | left: 250px; 27 | right: 0; 28 | top: 70px; 29 | bottom: 0; 30 | padding-bottom: 30px; 31 | -webkit-transition: left .3s ease-in-out; 32 | transition: left .3s ease-in-out; 33 | background: #f0f0f0; 34 | } 35 | 36 | .content { 37 | width: auto; 38 | height: 100%; 39 | padding: 10px; 40 | overflow-y: scroll; 41 | box-sizing: border-box; 42 | } 43 | 44 | .content-collapse { 45 | left: 65px; 46 | } 47 | 48 | .container { 49 | padding: 30px; 50 | background: #fff; 51 | border: 1px solid #ddd; 52 | border-radius: 5px; 53 | } 54 | 55 | .crumbs { 56 | margin: 10px 0; 57 | } 58 | 59 | .el-table th { 60 | background-color: #f5f7fa !important; 61 | } 62 | 63 | .pagination { 64 | margin: 20px 0; 65 | text-align: right; 66 | } 67 | 68 | .plugins-tips { 69 | padding: 20px 10px; 70 | margin-bottom: 20px; 71 | } 72 | 73 | .el-button+.el-tooltip { 74 | margin-left: 10px; 75 | } 76 | 77 | .el-table tr:hover { 78 | background: #f6faff; 79 | } 80 | 81 | .mgb20 { 82 | margin-bottom: 20px; 83 | } 84 | 85 | .move-enter-active, 86 | .move-leave-active { 87 | transition: opacity .5s; 88 | } 89 | 90 | .move-enter, 91 | .move-leave { 92 | opacity: 0; 93 | } 94 | 95 | /*BaseForm*/ 96 | 97 | .form-box { 98 | width: 600px; 99 | } 100 | 101 | .form-box .line { 102 | text-align: center; 103 | } 104 | 105 | .el-time-panel__content::after, 106 | .el-time-panel__content::before { 107 | margin-top: -7px; 108 | } 109 | 110 | .el-time-spinner__wrapper .el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default) { 111 | padding-bottom: 0; 112 | } 113 | 114 | /*Upload*/ 115 | 116 | .pure-button { 117 | width: 150px; 118 | height: 40px; 119 | line-height: 40px; 120 | text-align: center; 121 | color: #fff; 122 | border-radius: 3px; 123 | } 124 | 125 | .g-core-image-corp-container .info-aside { 126 | height: 45px; 127 | } 128 | 129 | .el-upload--text { 130 | background-color: #fff; 131 | border: 1px dashed #d9d9d9; 132 | border-radius: 6px; 133 | box-sizing: border-box; 134 | width: 360px; 135 | height: 180px; 136 | text-align: center; 137 | cursor: pointer; 138 | position: relative; 139 | overflow: hidden; 140 | } 141 | 142 | .el-upload--text .el-icon-upload { 143 | font-size: 67px; 144 | color: #97a8be; 145 | margin: 40px 0 16px; 146 | line-height: 50px; 147 | } 148 | 149 | .el-upload--text { 150 | color: #97a8be; 151 | font-size: 14px; 152 | text-align: center; 153 | } 154 | 155 | .el-upload--text em { 156 | font-style: normal; 157 | } 158 | 159 | /*VueEditor*/ 160 | 161 | .ql-container { 162 | min-height: 400px; 163 | } 164 | 165 | .ql-snow .ql-tooltip { 166 | transform: translateX(117.5px) translateY(10px) !important; 167 | } 168 | 169 | .editor-btn { 170 | margin-top: 20px; 171 | } 172 | 173 | /*markdown*/ 174 | 175 | .v-note-wrapper .v-note-panel { 176 | min-height: 500px; 177 | } -------------------------------------------------------------------------------- /web-api/app/helpers/DatetimeHelper.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2017-08-25 17:11:30 7 | */ 8 | 9 | namespace app\helpers; 10 | 11 | use DateTime; 12 | use DateTimeZone; 13 | 14 | use yii\base\Component; 15 | 16 | class DatetimeHelper extends Component 17 | { 18 | public static function toTimezone($timestamp, $fromTimezone, $toTimezone = 'Asia/Shanghai', $format = 'Y-m-d H:i:s') 19 | { 20 | $datetime = new DateTime( 21 | date('Y-m-d H:i:s', $timestamp), 22 | new DateTimeZone($fromTimezone) 23 | ); 24 | $datetime->setTimezone(new DateTimeZone($toTimezone)); 25 | 26 | if ($format) { 27 | return $datetime->format($format); 28 | } else { 29 | return $datetime->getTimestamp(); 30 | } 31 | } 32 | 33 | public static function formatStudyTime($seconds) 34 | { 35 | $studyTime = ''; 36 | $hour = floor($seconds/3600); 37 | $minute = floor(($seconds-3600*$hour)/60); 38 | $second = floor((($seconds-3600*$hour)-60*$minute)%60); 39 | if($hour!=0){ 40 | $studyTime = $hour.'时'.$minute.'分'.$second.'秒'; 41 | } 42 | else{ 43 | $studyTime = $minute.'分'.$second.'秒'; 44 | } 45 | return $studyTime; 46 | } 47 | 48 | // 将不同格式的时间转成时间戳 49 | public static function formatToTimeStamp($time) 50 | { 51 | if ($time) { 52 | if (is_numeric($time)) { 53 | $timestamp = strtotime("1900-01-01") + ($time - 2) * 24 * 60 * 60; 54 | } else { 55 | // 将年月日的格式替换成- 56 | $time = str_replace("年", "-", $time); 57 | $time = str_replace("月", "-", $time); 58 | $time = str_replace(".", "-", $time); 59 | $time = str_replace("/", "-", $time); 60 | $time = str_replace("日", "", $time); 61 | // 检查最后一个字符是否为-, 若为- 补01作为日 62 | if (substr($time, -1) == '-') { 63 | $time .= '01'; 64 | } 65 | $timestamp = strtotime($time); 66 | } 67 | return $timestamp; 68 | } 69 | return 0; 70 | } 71 | 72 | /** 73 | * 返回当前毫秒时间戳 74 | * 75 | */ 76 | public static function msectime() 77 | { 78 | list($msec, $sec) = explode(' ', microtime()); 79 | $msectime = (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000); 80 | return $msectime; 81 | } 82 | 83 | /** 84 | * 返回上周末时间戳 85 | * 86 | */ 87 | public static function getLastSundayMsectime() 88 | { 89 | $time = time(); //随意指定的某一个时间 90 | //echo $time, "\n"; //1544007032 91 | $lastWeek = date("Y-m-d H:i:s", strtotime("-1 week", $time)); //先获取指定时间的上周同一时间 92 | //echo $lastWeek, "\n"; //2018-11-28 18:50:32 93 | 94 | $currMonday = strtotime("Monday this week", $time); 95 | //echo $currMonday, "\n"; //1543766400 96 | 97 | $lastMondayTime = strtotime(date("Y-m-d", $time) == date("Y-m-d", $currMonday) ? "Monday this week" : "last Monday", strtotime($lastWeek)); //然后获取指定时间上周周一的时间 98 | $lastSundayTime = $lastMondayTime + 604799; 99 | //echo $lastMondayTime, "\n"; //1543161600 100 | //echo date("Y-m-d H:i:s", $lastMondayTime), "\n"; 101 | return 1000*$lastSundayTime; 102 | } 103 | 104 | 105 | /** 106 | * 返回本月初毫秒时间戳 107 | * 108 | */ 109 | public static function getStartThisMonthMsectime() 110 | { 111 | return 1000*(strtotime(date("Y-m-01", time()))); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /web/src/components/page/Register.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 73 | 74 | -------------------------------------------------------------------------------- /web/src/components/page/ChangePassword.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 89 | 90 | -------------------------------------------------------------------------------- /web-api/app/config/api_dev.php.sample: -------------------------------------------------------------------------------- 1 | ['debug', 'gii'], 5 | 'modules' => [ 6 | 'debug' => [ 7 | 'class' => 'yii\debug\Module', 8 | // uncomment the following to add your IP if you are not connecting from localhost. 9 | //'allowedIPs' => ['127.0.0.1', '::1'], 10 | ], 11 | 'gii' => [ 12 | 'class' => 'yii\gii\Module', 13 | // uncomment the following to add your IP if you are not connecting from localhost. 14 | //'allowedIPs' => ['127.0.0.1', '::1'], 15 | ], 16 | ], 17 | 'components' => [ 18 | 'request' => [ 19 | 'parsers' => [ 20 | 'application/json' => 'yii\web\JsonParser', 21 | ], 22 | ], 23 | 'response' => [ 24 | 'accessOrigin' => '*', 25 | 'accessOriginList' => ['http://121.194.62.88:8082'], 26 | 'allowHeaders' => 'Origin, X-Requested-With, Content-Type, Accept, Connection, User-Agent, Cookie', 27 | 'allowCredentials' => 'true', 28 | ], 29 | 'jwt' => [ 30 | 'class' => 'app\common\components\Jwt', 31 | 'issuer' => 'http://dxxycy.bjtu.edu.cn', 32 | 'audience' => 'http://dxxycy.bjtu.edu.cn/admin', 33 | 'jwtId' => 'lab-jwt', 34 | 'signature' => 'lab-signature', 35 | 'payloadName' => 'payload', 36 | 'jwtHeaderKey' => 'token', 37 | 'expireTime' => 25920000, 38 | 'noTokenControllers' => [ 39 | 'site', 40 | 'foo', 41 | ], 42 | 'noTokenActions' => [ 43 | 'user/account/login', 44 | 'common/upload/file', 45 | 'user/manage/export-template', 46 | 'counseling/tag/export-template', 47 | 'counseling/question/export-template', 48 | ], 49 | ], 50 | 'qiniu' => [ 51 | 'class' => 'app\common\components\Qiniu', 52 | 'accessKey' => '', 53 | 'secretKey' => '', 54 | 'defaultBucket' => '', 55 | 'privateBucket' => '', 56 | 'cdnHost' => [ 57 | 'default' => '', 58 | 'private' => '', 59 | ], 60 | ], 61 | 'ucpaas' => [ 62 | 'class' => 'app\common\components\Ucpaas', 63 | 'accountsid' => 'c0fc74c847e2cd325493b3afb6536b0f', 64 | 'token' => '9f73b37554fa1eb729f05dcdf812cff4', 65 | ], 66 | 'mailer' => [ 67 | 'class' => 'yii\swiftmailer\Mailer', 68 | //'viewPath' => '@common/mail', // send all mails to a file by default. You have to set 69 | // 'useFileTransport' to false and configure a transport // for the mailer to send real emails. 70 | 'useFileTransport' => false, 71 | 'transport' => [ 72 | //这里如果你是qq的邮箱,可以参考qq客户端设置后再进行配置 http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256 73 | 'class' => 'Swift_SmtpTransport', 74 | 'host' => 'smtp.qq.com', 75 | // qq邮箱 76 | 'username' => '1779813868@qq.com', 77 | //授权码, 什么是授权码, http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256 78 | 'password' => 'qkskmkjexpncbcdj', 79 | 'port' => '465', 80 | 'encryption' => 'ssl', 81 | ], 82 | 'messageConfig'=>[ 83 | 'charset'=>'UTF-8', 84 | 'from'=>['1779813868@qq.com'=>'MAPE 2019'] 85 | ], 86 | ], 87 | 'dompdf' => [ 88 | 'class' => 'app\common\components\Pdf', 89 | ], 90 | 'qiniu' => [ 91 | 'class' => 'app\common\components\Xunfei', 92 | 'xunFeiAppId' => '', 93 | 'xunFeiSecretKey' => '', 94 | ], 95 | ], 96 | ]; 97 | -------------------------------------------------------------------------------- /web-api/app/common/components/Qiniu.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2017-06-23 10:47:43 7 | */ 8 | 9 | namespace app\common\components; 10 | 11 | use Yii; 12 | use yii\base\Component; 13 | use Qiniu\Auth; 14 | use Qiniu\Zone; 15 | use Qiniu\Config; 16 | use Qiniu\Storage\UploadManager; 17 | use Qiniu\Storage\BucketManager; 18 | 19 | class Qiniu extends Component 20 | { 21 | public $accessKey; 22 | public $secretKey; 23 | public $auth; 24 | public $defaultBucket; 25 | public $privateBucket; 26 | public $cdnHost; 27 | 28 | public function init() 29 | { 30 | parent::init(); 31 | $this->auth = new Auth($this->accessKey, $this->secretKey); 32 | } 33 | 34 | /** 35 | * 上传文件到七牛 36 | * 37 | * @param string $filePath 需要上传的文件路径 38 | * @param string $key 在七牛上存储的文件名 39 | * 40 | * @return string 上传后文件访问的地址 41 | */ 42 | public function upload($filePath, $key, $bucket = null) 43 | { 44 | $zone = Zone::zonez1(); //华北 45 | 46 | $config = new Config($zone); 47 | $uploadMgr = new UploadManager(); 48 | $bucket = empty($bucket) ? $this->defaultBucket : $bucket; 49 | $token = $this->auth->uploadToken($bucket); 50 | list($ret, $err) = $uploadMgr->putFile($token, $key, $filePath); 51 | if ($err !== null) { 52 | Yii::$app->response->error( 53 | Yii::$app->response->resCode['ERROR_QINIU_UPLOAD_FAILED'], 54 | 'Upload to qiniu failed.' 55 | ); 56 | } else { 57 | return $ret['key']; 58 | } 59 | } 60 | 61 | /** 62 | * 设置文件生存时间,$days=0代表取消生存时间; 63 | * @param integer $days 生存时间,单位:天 64 | * @param string $key 在七牛上存储的文件名 65 | * 66 | * @return null 67 | */ 68 | public function setSurviveDays($days, $key, $bucket = null) 69 | { 70 | $zone = Zone::zonez1(); //华北 71 | 72 | $config = new Config($zone); 73 | $bucket = empty($bucket) ? $this->defaultBucket : $bucket; 74 | $bucketManager = new BucketManager($this->auth, $config); 75 | $error = $bucketManager->deleteAfterDays($bucket, $key, $days); 76 | if($error !== null){ 77 | Yii::$app->response->error( 78 | Yii::$app->response->resCode['ERROR_QINIU_DELETE_AFTER_DAYS_FAILED'], 79 | '设置文件生命周期失败' 80 | ); 81 | } 82 | } 83 | 84 | /** 85 | * 删除文件; 86 | * @param string $key 在七牛上存储的文件名 87 | * 88 | * @return null 89 | */ 90 | public function removeFile($key, $bucket = null) 91 | { 92 | $zone = Zone::zonez1(); //华北 93 | 94 | $config = new Config($zone); 95 | $bucket = empty($bucket) ? $this->defaultBucket : $bucket; 96 | $bucketManager = new BucketManager($this->auth, $config); 97 | $error = $bucketManager->delete($bucket, $key); 98 | // if($error){ 99 | // Yii::$app->response->error( 100 | // Yii::$app->response->resCode['ERROR_QINIU_DELETE_FAILED'], 101 | // 'Delete files from qiniu failed.' 102 | // ); 103 | // } 104 | } 105 | 106 | /** 107 | * 生成七牛 CDN URL 108 | * 109 | * @param string $key 相对路径 110 | * 111 | * @return string 112 | */ 113 | public function generateUrl($key, $hostType = 'default') 114 | { 115 | return !empty($key) ? $this->cdnHost[$hostType] . trim($key, '/') : ''; 116 | } 117 | 118 | /** 119 | * 去掉上传连接前缀 120 | * 121 | * @param string $url 绝对路径 122 | * 123 | * @return string 124 | */ 125 | public function removeCdnHost($url) 126 | { 127 | $path = parse_url($url, PHP_URL_PATH); 128 | return $path ? substr($path, 1) : ''; 129 | } 130 | 131 | /** 132 | * 为私有文件生成下载地址 133 | * 134 | * @param string $url 绝对路径 135 | * 136 | * @return string 137 | */ 138 | public function generatePriDownloadUrl($url) 139 | { 140 | // 对链接进行签名 141 | $signedUrl = $this->auth->privateDownloadUrl($url); 142 | return $signedUrl ? : ''; 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /project_xiaoxueqi/project_xiaoxueqi/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for project_xiaoxueqi project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.2.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.2/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.2/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'django-insecure-ayspnw%37t7a_-0fwar8i%%6pa$kmwgg)^r^2#85c&%34)+oir' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'users', 41 | 'video' 42 | ] 43 | 44 | MIDDLEWARE = [ 45 | 'django.middleware.security.SecurityMiddleware', 46 | 'django.contrib.sessions.middleware.SessionMiddleware', 47 | 'django.middleware.common.CommonMiddleware', 48 | 'django.middleware.csrf.CsrfViewMiddleware', 49 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 50 | 'django.contrib.messages.middleware.MessageMiddleware', 51 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 52 | 'corsheaders.middleware.CorsMiddleware', 53 | ] 54 | 55 | ROOT_URLCONF = 'project_xiaoxueqi.urls' 56 | 57 | TEMPLATES = [ 58 | { 59 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 60 | 'DIRS': [], 61 | 'APP_DIRS': True, 62 | 'OPTIONS': { 63 | 'context_processors': [ 64 | 'django.template.context_processors.debug', 65 | 'django.template.context_processors.request', 66 | 'django.contrib.auth.context_processors.auth', 67 | 'django.contrib.messages.context_processors.messages', 68 | ], 69 | }, 70 | }, 71 | ] 72 | 73 | WSGI_APPLICATION = 'project_xiaoxueqi.wsgi.application' 74 | 75 | 76 | # Database 77 | # https://docs.djangoproject.com/en/3.2/ref/settings/#databases 78 | 79 | DATABASES = { 80 | 'default': { 81 | 'ENGINE': 'django.db.backends.mysql', 82 | 'NAME': 'xiaoxueqi_sql', 83 | 'USER': 'root', 84 | 'PASSWORD': '123456', 85 | 'HOST': 'localhost', 86 | 'PORT': '3306', 87 | } 88 | } 89 | 90 | 91 | # Password validation 92 | # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators 93 | 94 | AUTH_PASSWORD_VALIDATORS = [ 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 100 | }, 101 | { 102 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 103 | }, 104 | { 105 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 106 | }, 107 | ] 108 | 109 | 110 | # Internationalization 111 | # https://docs.djangoproject.com/en/3.2/topics/i18n/ 112 | 113 | LANGUAGE_CODE = 'zh-Hans' 114 | 115 | TIME_ZONE = 'Asia/Shanghai' 116 | 117 | USE_I18N = True 118 | 119 | USE_L10N = True 120 | 121 | USE_TZ = True 122 | 123 | CORS_ALLOW_CREDENTIALS = True 124 | CORS_ORIGIN_ALLOW_ALL = True 125 | 126 | # Static files (CSS, JavaScript, Images) 127 | # https://docs.djangoproject.com/en/3.2/howto/static-files/ 128 | 129 | STATIC_URL = '/static/' 130 | # 131 | # STATICFILES_DIRS = ( 132 | # os.path.join(BASE_DIR, 'static'), 133 | # ) 134 | # Default primary key field type 135 | # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field 136 | 137 | # MEDIA_URL = '/media/' 138 | # MEDIA_ROOT = os.path.join(BASE_DIR, 'media').replace('\\', '/') 139 | 140 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 141 | -------------------------------------------------------------------------------- /web/src/components/page/ChangInfo.vue: -------------------------------------------------------------------------------- 1 | 47 | 48 | -------------------------------------------------------------------------------- /web/src/components/common/Sidebar.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | 121 | 122 | 141 | -------------------------------------------------------------------------------- /web-api/app/common/utils/StringMatch.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2021-10-15 19:34 7 | */ 8 | 9 | namespace app\common\utils; 10 | 11 | use Yii; 12 | use yii\base\Component; 13 | 14 | class StringMatch extends Component 15 | { 16 | protected static $dict = []; 17 | protected static $suffix = ''; 18 | 19 | /** 20 | * @param $dict array 字典,['北京市'=>1,'天津市'=>1] 21 | * @param $query string query词 22 | * @param $suffix string 后缀 23 | * @return mixed 24 | */ 25 | public static function match(&$dict,$query,$suffix = ''){ 26 | self::$dict = $dict; 27 | self::$suffix = $suffix; 28 | $suffix?self::matchLabelWithSuffix($query,$matched):self::matchLabel($query,$matched); 29 | return $matched; 30 | } 31 | 32 | private static function matchLabel($str, &$matched, $matchAll=false) 33 | { 34 | $len = mb_strlen($str,'utf-8'); 35 | 36 | if($len < 2) { 37 | return; 38 | } 39 | 40 | while($len>1) { 41 | $substr = mb_substr($str, 0, $len, 'utf-8'); 42 | if(isset(self::$dict[$substr])) { 43 | $matched = $substr; 44 | return; 45 | } else { 46 | $len--; 47 | } 48 | } 49 | 50 | $str = mb_substr($str, 1, null, 'utf-8'); 51 | 52 | self::matchLabel($str, $matched, $matchAll); 53 | } 54 | 55 | private static function matchLabelWithSuffix($str, &$matched, $matchAll=false) 56 | { 57 | $len = mb_strlen($str,'utf-8'); 58 | 59 | if($len < 2) { 60 | return; 61 | } 62 | 63 | while($len>1) { 64 | $substr = mb_substr($str, 0, $len, 'utf-8'); 65 | if(isset(self::$dict[$substr])) { 66 | $matched = $substr; 67 | return; 68 | }elseif(isset(self::$dict[$substr.self::$suffix])){ 69 | $matched = $substr.self::$suffix; 70 | return; 71 | } else { 72 | $len--; 73 | } 74 | } 75 | 76 | $str = mb_substr($str, 1, null, 'utf-8'); 77 | 78 | self::matchLabel($str, $matched, $matchAll); 79 | } 80 | 81 | // 获取最长公共子串 82 | public static function getLongestCommonSubstr($str1, $str2) { 83 | $temp = array(); 84 | 85 | $length1 = mb_strlen($str1); 86 | $length2 = mb_strlen($str2); 87 | for ($i = 0; $i < $length1; $i ++) { 88 | for ($j = 0; $j < $length2; $j ++) { 89 | $n = ($i - 1 >= 0 && $j - 1 >= 0) ? $temp[$i - 1][$j - 1] : 0; // 赋值为截止到上一字符的子串长度 90 | $n = (mb_substr($str1, $i, 1) == mb_substr($str2, $j, 1)) ? $n + 1 : 0; // 如果该字符也相等,则子串长度+1 91 | $temp[$i][$j] = $n; 92 | } 93 | } 94 | 95 | foreach ($temp as $val) { 96 | $max = max($val); 97 | foreach ($val as $key1 => $val1) { 98 | if ($val1 == $max && $max > 0) { 99 | $cdStr[$max] = mb_substr($str2, $key1 - $max + 1, $max); // 存储截止到每一个字符的最长公共子串 100 | } 101 | } 102 | } 103 | 104 | if(!empty($cdStr)) { 105 | ksort($cdStr); // 找到最长公共子串并返回 106 | $longestCommonSubstr = end($cdStr); 107 | 108 | return $longestCommonSubstr; 109 | } 110 | 111 | return false; 112 | } 113 | 114 | public static function postCheck($post) { 115 | if (!get_magic_quotes_gpc()) { // 判断magic_quotes_gpc是否为打开 116 | $post = addslashes($post); // 进行magic_quotes_gpc没有打开的情况对提交数据的过滤 117 | } 118 | // $post = str_replace("_", "\_", $post); // 把 '_'过滤掉 119 | // $post = str_replace("%", "\%", $post); // 把 '%'过滤掉 120 | // $post = nl2br($post); // 回车转换 121 | // $post = htmlspecialchars($post); // html标记转换 122 | return $post; 123 | } 124 | 125 | //正则匹配获取img标签src内容-多个 126 | public static function getImgAllSrc($tag) { 127 | if(empty($tag)) { 128 | return []; 129 | } 130 | $matches = []; 131 | preg_match_all('/(src)=("[^"]*")/i', $tag, $matches); 132 | 133 | $ret = array(); 134 | foreach($matches[0] as $i => $v) { 135 | $ret[] = trim($matches[2][$i],'"'); 136 | } 137 | 138 | return $ret; 139 | } 140 | 141 | public static function extractStringFromHtml($htmlString) { 142 | if(empty($htmlString)) { 143 | return ''; 144 | } 145 | $htmlString = str_replace("
","\r\n", $htmlString); 146 | $htmlString = str_replace("

","\r\n", $htmlString); 147 | // 把一些预定义的 HTML 实体转换为字符 148 | // 预定义字符是指:<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用 149 | $htmlString = htmlspecialchars_decode($htmlString); 150 | 151 | // 将空格去除 152 | // $html_string = str_replace(" ", "", $html_string); 153 | 154 | // 去除字符串中的 HTML 标签 155 | $contents = strip_tags($htmlString); 156 | 157 | return $contents; 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /web-api/app/common/components/Jwt.php: -------------------------------------------------------------------------------- 1 | 6 | * @date 2017-05-22 17:26:27 7 | */ 8 | 9 | namespace app\common\components; 10 | 11 | use Yii; 12 | use yii\base\Component; 13 | use Lcobucci\JWT\Builder; 14 | use Lcobucci\JWT\Parser; 15 | use Lcobucci\JWT\ValidationData; 16 | use Lcobucci\JWT\Signer\Hmac\Sha256; 17 | 18 | use RuntimeException; 19 | use InvalidArgumentException; 20 | 21 | class Jwt extends Component 22 | { 23 | // token 相关的信息 24 | public $issuer = ''; 25 | public $audience = ''; 26 | public $jwtId = ''; 27 | public $signature = ''; 28 | public $payloadName = ''; 29 | public $jwtHeaderKey = ''; 30 | public $expireTime = 0; 31 | public $signer; 32 | 33 | // token 承载的数据 34 | public $payloadData = []; 35 | 36 | // 参与 token 验证的控制器和动作 37 | public $noTokenActions = []; 38 | public $noTokenControllers = []; 39 | 40 | public function init() 41 | { 42 | parent::init(); 43 | $this->signer = new Sha256(); 44 | } 45 | 46 | /** 47 | * 创建一个token 48 | * 49 | * @param array $payload 50 | */ 51 | public function createToken($payload = []) 52 | { 53 | $token = (new Builder())->setIssuer($this->issuer) 54 | ->setAudience($this->audience) 55 | ->setId($this->jwtId, true) 56 | ->setIssuedAt(time()) 57 | ->setExpiration(time() + $this->expireTime) 58 | ->set($this->payloadName, $payload) 59 | ->sign($this->signer, $this->signature) 60 | ->getToken(); 61 | return (string) $token; 62 | } 63 | 64 | /** 65 | * 是否是一个有效的token 66 | * 67 | * @param string $token 68 | * 69 | * @return boolean 70 | */ 71 | private function __isValidToken($token) { 72 | if ($token === null) { 73 | Yii::$app->response->error( 74 | Yii::$app->response->resCode['ERROR_TOKEN_NOT_EXISTS'], 75 | 'Token not exists.' 76 | ); 77 | return false; 78 | } 79 | // 解析 token 80 | try { 81 | $token = (new Parser())->parse((string) $token); 82 | } catch (InvalidArgumentException $e) { 83 | Yii::$app->response->error( 84 | Yii::$app->response->resCode['ERROR_TOKEN_FORMAT'], 85 | '自动登录已过期,请重新输入密码登录' 86 | ); 87 | return false; 88 | } catch (RuntimeException $e) { 89 | Yii::$app->response->error( 90 | Yii::$app->response->resCode['ERROR_TOKEN_PARSE_FAILED'], 91 | 'Token parses failed.' 92 | ); 93 | return false; 94 | } 95 | 96 | 97 | // 校验签名 98 | if (!$token->verify($this->signer, $this->signature)) { 99 | Yii::$app->response->error( 100 | Yii::$app->response->resCode['ERROR_TOKEN_SIGNATURE'], 101 | 'Error signature.' 102 | ); 103 | } 104 | 105 | // token 是否过期 106 | if ($token->isExpired()) { 107 | Yii::$app->response->error( 108 | Yii::$app->response->resCode['ERROR_TOKEN_EXPIRED'], 109 | '自动登录已过期,请重新输入密码登录' 110 | ); 111 | } 112 | // 校验基本信息 113 | $validator = new ValidationData(); 114 | $validator->setIssuer($this->issuer); 115 | $validator->setAudience($this->audience); 116 | $validator->setId($this->jwtId); 117 | $this->payloadData = $token->getClaim('payload'); 118 | return $token->validate($validator); 119 | } 120 | 121 | /** 122 | * 校验请求接口的token 123 | * 124 | * @param string $controllerId 接口所属控制器ID 125 | * @param string $actionId 接口对应的动作ID 126 | * 127 | * @return null 128 | */ 129 | public function checkToken($controllerId, $actionId) 130 | { 131 | if ($this->__needValidate($controllerId, $actionId)) { 132 | // 兼容通过get 方式传递token 133 | $token = Yii::$app->request->getTokenFromHeader($this->jwtHeaderKey) 134 | ? : (Yii::$app->request->get()['token'] ?? ''); 135 | if (!$this->__isValidToken($token)) { 136 | Yii::$app->response->error( 137 | Yii::$app->response->resCode['ERROR_TOKEN_VERIFY_FAILED'], 138 | 'Token was invalid.' 139 | ); 140 | } 141 | } 142 | return; 143 | } 144 | 145 | /** 146 | * 满足系统一定条件下需要验证请求接口的token 147 | * 148 | * @return null 149 | */ 150 | public function checkTokenInSomeCondition() 151 | { 152 | $token = Yii::$app->request->get()['token']; // 通过get获取的token 153 | if (!$this->__isValidToken($token)) { 154 | Yii::$app->response->error( 155 | Yii::$app->response->resCode['ERROR_TOKEN_VERIFY_FAILED'], 156 | 'Token was invalid.' 157 | ); 158 | } 159 | } 160 | 161 | /** 162 | * 接口是否需要验证 163 | * 164 | * @param $controllerId string 接口所属控制器ID 165 | * @param $actionId string 接口对应的动作ID 166 | * 167 | * @return boolean(true or false) 168 | */ 169 | private function __needValidate($controllerId, $actionId) 170 | { 171 | $controller = $controllerId; 172 | $action = $controllerId . '/' . $actionId; 173 | if (in_array($controller, $this->noTokenControllers) || 174 | in_array($action, $this->noTokenActions)) { 175 | return false; 176 | } 177 | return true; 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /web/src/api/index.js: -------------------------------------------------------------------------------- 1 | import request from '../utils/request'; 2 | import { ToFormData } from '@/utils/toformdata' 3 | 4 | export const fetchData = query => { 5 | return request({ 6 | url: './table.json', 7 | method: 'get', 8 | params: query 9 | }); 10 | }; 11 | /** 12 | * 删除通知 13 | * @param {*} data 14 | */ 15 | export function deleteNotify(data) { 16 | return request({ 17 | url: '/user/account/deletenotify', 18 | method: 'post', 19 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 20 | data, 21 | transformRequest: [ToFormData] 22 | }) 23 | } 24 | /** 25 | * 阅读通知 26 | * @param {*} data 27 | */ 28 | export function readNotify(data) { 29 | return request({ 30 | url: '/user/account/read-notify', 31 | method: 'post', 32 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 33 | data, 34 | transformRequest: [ToFormData] 35 | }) 36 | } 37 | 38 | /** 39 | * 恢复通知 40 | * @param {*} data 41 | */ 42 | export function recoryNotify(data) { 43 | return request({ 44 | url: '/user/account/recory-notify', 45 | method: 'post', 46 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 47 | data, 48 | transformRequest: [ToFormData] 49 | }) 50 | } 51 | 52 | /** 53 | * 阅读通知细节 54 | * @param {*} data 55 | */ 56 | export function detailNotify(data) { 57 | return request({ 58 | url: '/user/account/detail-notify', 59 | method: 'post', 60 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 61 | data, 62 | transformRequest: [ToFormData] 63 | }) 64 | } 65 | 66 | export function delOldPeople(data) { 67 | return request({ 68 | url: '/user/account/del-old-people', 69 | method: 'post', 70 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 71 | data, 72 | transformRequest: [ToFormData] 73 | }) 74 | } 75 | export function delVolunteer(data) { 76 | return request({ 77 | url: '/user/account/del-volunteer', 78 | method: 'post', 79 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 80 | data, 81 | transformRequest: [ToFormData] 82 | }) 83 | } 84 | export function delEmploy(data) { 85 | return request({ 86 | url: '/user/account/del-employ', 87 | method: 'post', 88 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 89 | data, 90 | transformRequest: [ToFormData] 91 | }) 92 | } 93 | export function changeUserInfo(data) { 94 | return request({ 95 | url: '/user/account/change-info', 96 | method: 'post', 97 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 98 | data, 99 | transformRequest: [ToFormData] 100 | }) 101 | } 102 | export function userInfo(data) { 103 | return request({ 104 | url: '/user/account/user-info', 105 | method: 'post', 106 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 107 | data, 108 | transformRequest: [ToFormData] 109 | }) 110 | } 111 | 112 | /** 113 | * 老人信息录入 114 | * @param {*} data 115 | */ 116 | export function oldPeopleManage(data) { 117 | return request({ 118 | url: '/user/account/old-people-manage', 119 | method: 'post', 120 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 121 | data, 122 | transformRequest: [ToFormData] 123 | }) 124 | } 125 | /** 126 | * 员工信息信息录入 127 | * @param {*} data 128 | */ 129 | export function peopleManage(data) { 130 | return request({ 131 | url: '/user/account/people-manage', 132 | method: 'post', 133 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 134 | data, 135 | transformRequest: [ToFormData] 136 | }) 137 | } 138 | 139 | /** 140 | * 获取老人信息 141 | * @param {*} data 142 | */ 143 | export function getOldPeopleInfo() { 144 | return request({ 145 | url: 'user/account/old-people-info', 146 | method: 'post', 147 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 148 | }) 149 | } 150 | 151 | /** 152 | * 获取volunteer信息 153 | * @param {*} data 154 | */ 155 | export function getVolunteerInfo() { 156 | return request({ 157 | url: 'user/account/volunteer-info', 158 | method: 'post', 159 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 160 | }) 161 | } 162 | /** 163 | * getEmployInfo 164 | * @param {*} data 165 | */ 166 | export function getEmployInfo() { 167 | return request({ 168 | url: 'user/account/employ-info', 169 | method: 'post', 170 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 171 | }) 172 | } 173 | 174 | 175 | export function getDataInfo() { 176 | return request({ 177 | url: '/user/account/notify', 178 | method: 'post', 179 | }) 180 | } 181 | 182 | export function ChangePassword(data) { 183 | return request({ 184 | url: '/user/account/changepw', 185 | method: 'post', 186 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 187 | data, 188 | transformRequest: [ToFormData] 189 | }) 190 | } 191 | 192 | export function login(data) { 193 | return request({ 194 | url: '/user/account/login', 195 | method: 'post', 196 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 197 | data, 198 | transformRequest: [ToFormData] 199 | }) 200 | } 201 | 202 | export function registerForm(data) { 203 | return request({ 204 | url: '/user/account/register', 205 | method: 'post', 206 | headers: { 'Content-Type': 'application/x-www-form-urlencoded '}, 207 | data, 208 | transformRequest: [ToFormData] 209 | }) 210 | } -------------------------------------------------------------------------------- /web/src/components/common/Tags.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 113 | 114 | 115 | 187 | -------------------------------------------------------------------------------- /web/src/components/common/Header.vue: -------------------------------------------------------------------------------- 1 | 51 | 116 | 192 | -------------------------------------------------------------------------------- /web-api/app/common/components/Encryption.php: -------------------------------------------------------------------------------- 1 | lockMethod) 34 | { 35 | case "method1": 36 | $result = $this->lockOne($txt, $key='str'); 37 | break; 38 | case "method2": 39 | $key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+"; 40 | $result = $this->authcode($txt, 'ENCODE',$key,0); 41 | } 42 | } else{ 43 | $result = "字符串为空"; 44 | } 45 | return $result; 46 | } 47 | 48 | /** 49 | * 解密 50 | * 51 | * @param string $txt 需要解密的字符串 52 | */ 53 | public function unlock($txt) 54 | { 55 | $result = ""; 56 | if($txt !== null){ 57 | switch ($this->unlockMethod) 58 | { 59 | case "method1": 60 | $result = $this->unlockOne($txt, $key='str'); 61 | break; 62 | case "method2": 63 | $key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+"; 64 | $result = $this->authcode($txt, 'DECODE',$key,0); 65 | } 66 | } else{ 67 | $result = "字符串为空"; 68 | } 69 | return $result; 70 | } 71 | 72 | /** 73 | * 第一种加密算法 74 | * 75 | * @param string $txt 需要加密的字符串 76 | */ 77 | private function lockOne($txt, $key='str'){ 78 | $txt = $txt.$key; 79 | $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+"; 80 | $nh = rand(0,64); 81 | $ch = $chars[$nh]; 82 | $mdKey = md5($key.$ch); 83 | $mdKey = substr($mdKey,$nh%8, $nh%8+7); 84 | $txt = base64_encode($txt); 85 | $tmp = ''; 86 | $i=0;$j=0;$k = 0; 87 | for ($i=0; $i 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) { 176 | return substr($result, 26); 177 | } else { 178 | return ''; 179 | } 180 | } else { 181 | // 把动态密匙保存在密文里,这也是为什么同样的明文,生产不同密文后能解密的原因 182 | // 因为加密后的密文可能是一些特殊字符,复制过程可能会丢失,所以用base64编码 183 | return $keyc.str_replace('=', '', base64_encode($result)); 184 | } 185 | } 186 | 187 | } 188 | --------------------------------------------------------------------------------