4075-ticket_boxing #1070

Merged
alexm merged 22 commits from 4075-ticket_boxing into dev 2022-10-28 06:30:00 +00:00
4 changed files with 30 additions and 25 deletions
Showing only changes of commit 7d4dd7bb52 - Show all commits

View File

@ -7,7 +7,7 @@ CREATE TABLE `vn`.`packingSiteConfig` (
); );
INSERT INTO `vn`.`packingSiteConfig` SET INSERT INTO `vn`.`packingSiteConfig` SET
shinobiUrl = 'https://shinobi.verdnatura.es/', shinobiUrl = 'http://shinobi.verdnatura.es',
shinobiGroupKey = 'xVqft9LFXg', shinobiGroupKey = 'xVqft9LFXg',
avgBoxingTime = 30; avgBoxingTime = 30;

View File

@ -8,13 +8,13 @@ module.exports = Self => {
{ {
arg: 'id', arg: 'id',
type: 'number', type: 'number',
required: true, required: false,
description: 'Ticket id' description: 'Ticket id'
}, },
{ {
arg: 'time', arg: 'time',
type: 'number', type: 'number',
required: true, required: false,
description: 'Time to add' description: 'Time to add'
} }
], ],
@ -31,35 +31,37 @@ module.exports = Self => {
Self.getVideo = async(id, time, options) => { Self.getVideo = async(id, time, options) => {
const models = Self.app.models; const models = Self.app.models;
const myOptions = {}; const myOptions = {};
console.log('ENTRY');
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
const expedition = await models.Expedition.findById(id, null, myOptions); const expedition = await models.Expedition.findById(id, null, myOptions);
const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions); const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions);
const token = await Self.getToken(packingSiteConfig); const token = 'BW4o7FZyJ85she1hlRDe6QnwW3jwEP';
const monitorId = 'xVqft9LFXg'; const groupKey = 'xVqft9LFXg';
const monitorId = 'VbiUcajdaT';// 'xVqft9LFXg';
const start = new Date(expedition.created); const start = '2022-07-27T09:00:00';// new Date('2022-07-27'); // new Date(expedition.created);
const end = start.setTime(start.getTime() + (time ? time : packingSiteConfig.avgBoxingTime)); const end = '2022-07-27T09:15:00';// start.setTime(start.getTime() + (time ? time : packingSiteConfig.avgBoxingTime));
const videoUrl = `${token}/videos/${packingSiteConfig}/${monitorId}?start=${start}&end=${end}`; const videoUrl = `/${token}/videos/${groupKey}/${monitorId}?start=${start}&end=${end}`;
const videos = await axios.post(`${packingSiteConfig.shinobiUrl}${videoUrl}`, { const url = `${packingSiteConfig.shinobiUrl}${videoUrl}`;
mail: packingSiteConfig.mail, const data = await axios.post(url);
pass: packingSiteConfig.pass
});
console.log(videos); console.log(data.data.videos);
return videos.data; console.log('-----------------------');
}; console.log('-----------------------');
console.log('-----------------------');
Self.getToken = async function getToken(packingSiteConfig) { console.log('-----------------------');
const response = await axios.post(`${packingSiteConfig.shinobiUrl}?json=true`, {
machineID: 1,
ke: 'hola',
});
axios({
method: 'get',
url: `${packingSiteConfig.shinobiUrl}${data.data.videos[0].href}`,
responseType: 'stream'
})
.then(response => {
console.log(response); console.log(response);
return response.data; return response;
});
}; };
}; };

View File

@ -1,2 +1,5 @@
<vn-card> <vn-card>
<video id="videobcg" muted="muted" controls class="video">
<source src="http://localhost:5000/api/Boxings/getVideo?id=1" type="video/mp4" autoplay="autoplay" >
</video>
</vn-card> </vn-card>

View File

@ -7,7 +7,7 @@ class Controller extends Section {
} }
$onInit() { $onInit() {
window.location.href = this.lilium('dashboard'); // window.location.href = this.lilium('dashboard');
} }
lilium(route) { lilium(route) {