This commit is contained in:
2021-11-16 18:04:26 +01:00
parent e089a23a04
commit da18f42efd

View File

@@ -41,11 +41,13 @@ export default class LinksController {
const exist = await Redis.get(`${link.code}:${ip}:tracked`)
if (!exist) {
console.log(request)
const getCountry = request.header('CF-IPCountry', '')
await Redis.set(`${link.code}:${ip}:tracked`, 'true', 'ex', '3600')
const click = await Click.create({
date: DateTime.now(),
ip,
country: ''
country: getCountry
})
await click.related('link').associate(link)
await link.related('clicks').save(click)