Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/front-web/build/assets/fonts/controllers.tar
Назад
user-session.js 0000644 00000002613 15106663135 0007551 0 ustar 00 'use strict'; const requestIp = require('request-ip'); const {sanitizeEntity} = require('strapi-utils'); /** * Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers) * to customize this controller */ module.exports = { async create(ctx) { const {user} = ctx.state; //if user has 2 active session throw error const byUser = await strapi.services["user-session"].find({user: user.id, activeCode_null: false}); if (byUser && byUser.filter(x => x.isActive).length < 2) { const data = ctx.request.body; data.user = user.id; data.ip = requestIp.getClientIp(ctx.request.req); data.isActive = true; const entity = await strapi.services["user-session"].create(data); return ctx.send(entity.id); } else { return ctx.badRequest(null, "errors.moreThanNBrowser"); } }, async findOne(ctx) { try { const {id} = ctx.params; const {user} = ctx.state; const byId = await strapi.services["user-session"].findOne({user: user.id,activeCode: id}); if (byId === null) { return ctx.send(false); } //save last access await strapi.services["user-session"].update({id: byId.id}, {lastAccess: new Date(), playWithUser: user.id}); return sanitizeEntity(byId, {model: strapi.models["user-session"]}); } catch (ex) { return ctx.send(false); } } }; course-level.js 0000644 00000002071 15107565126 0007517 0 ustar 00 'use strict'; /** * Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers) * to customize this controller */ module.exports = { async find(ctx) { let entities; const {query} = ctx; const {user} = ctx.state; query["teacher_eq"] = user.id; if (query._q) { entities = await strapi.services["course-level"].search(query); } else { entities = await strapi.services["course-level"].find(query); } if (query.status_nin && query.status_nin.findIndex(s => s === "finish") > -1) { } else { } return ctx.send(entities); }, async isCourseLevelLive(ctx) { const {user} = ctx.state; const {id} = ctx.params; const response = { isAdobe: false, isLive: false, link: '', } const isBBBRun = await strapi.services.helpers.isBBBMeetingRunning(id); const isAdobeRun = await strapi.services.helpers.isAdobeRunning(id); response.isLive = isBBBRun || isAdobeRun; response.isAdobe = isAdobeRun; return ctx.send(response); } };
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка