-
Notifications
You must be signed in to change notification settings - Fork 2
/
cat.js
73 lines (31 loc) · 949 Bytes
/
cat.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const express = require('express')
const app = express.Router()
const { Unix_timestamp, Is_number, knex, t_mail, is_Empty } = require('./funcs.js')
app.get("/", async(req, res) => {
res.status(200).send(`.....`)
res.end()
})
app.get("/:id", async(req, res) => {
let qz2211 = req.params.id
const rquid = Math.abs(parseInt(qz2211))
if (isNaN(rquid) === true || rquid == 0) {
return res.redirect('/')
}
let qz221a = await knex('category').where("cid",rquid).select('*').first()
if (!qz221a) {
return res.redirect('/')
}
let cmpnid = await knex('job').where("cat_id", rquid).orderByRaw('jid desc limit 25')
let cntpds2212 = await knex('job').where("cat_id", rquid).count({count: '*'})
//console.log(cmpnid)
let psrq = {
title:'Jobs by category',
user: tusert ? tdatausr : undefined,
data2: cmpnid,
cnt: cntpds2212
}
//console.log(psrq)
res.render("cat.html", psrq)
res.end()
})
module.exports = app