zet-lib 1.2.89 → 1.2.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Util.js +1 -1
- package/lib/zAppRouter.js +0 -52
- package/package.json +1 -1
package/lib/Util.js
CHANGED
|
@@ -1007,7 +1007,7 @@ Util.regexCode = (lengthMin, lengthMax) => {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
|
|
1009
1009
|
Util.imageProfile = function (image = '') {
|
|
1010
|
-
return image ? (image.indexOf('http') > -1 ? image : '/uploads/
|
|
1010
|
+
return image ? (image.indexOf('http') > -1 ? image : '/uploads/zuser/' + image) : '/img/user.png'
|
|
1011
1011
|
}
|
|
1012
1012
|
|
|
1013
1013
|
/*
|
package/lib/zAppRouter.js
CHANGED
|
@@ -124,58 +124,6 @@ router.post('/profile-sign', access, async (req, res) => {
|
|
|
124
124
|
res.json(json)
|
|
125
125
|
})
|
|
126
126
|
|
|
127
|
-
router.get('/znotification/:token', async (req, res) => {
|
|
128
|
-
const MYMODELS = myCache.get('MYMODELS')
|
|
129
|
-
let MYMODEL = MYMODELS['zuser']
|
|
130
|
-
let token = req.params.token
|
|
131
|
-
let url = '/dashboard'
|
|
132
|
-
let results = await connection.results({ table: 'znotification', where: { token: token } })
|
|
133
|
-
if (results.length) {
|
|
134
|
-
let data = {
|
|
135
|
-
status: 2,
|
|
136
|
-
}
|
|
137
|
-
await connection.update({ table: 'znotification', data: data, where: { token: token } })
|
|
138
|
-
if (results[0].link) {
|
|
139
|
-
return res.redirect(results[0].link)
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return res.redirect(url)
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
router.post('/notification-data', csrfProtection, async (req, res) => {
|
|
146
|
-
let id = req.query.id
|
|
147
|
-
let rows = await connection.results({
|
|
148
|
-
table: 'znotification',
|
|
149
|
-
where: {
|
|
150
|
-
user_id: res.locals.userId,
|
|
151
|
-
//status: 1
|
|
152
|
-
},
|
|
153
|
-
limit: 10,
|
|
154
|
-
orderBy: ['id', 'desc'],
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
let rowsCount = await connection.result({
|
|
158
|
-
select: ' count(id) as count ',
|
|
159
|
-
table: 'znotification',
|
|
160
|
-
where: {
|
|
161
|
-
user_id: res.locals.userId,
|
|
162
|
-
},
|
|
163
|
-
})
|
|
164
|
-
let arr = []
|
|
165
|
-
rows.forEach(function (item) {
|
|
166
|
-
item.ago = moment(item.updated_at).fromNow()
|
|
167
|
-
item.avatar = res.locals.userAvatar
|
|
168
|
-
arr.push(item)
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
let data = {
|
|
172
|
-
count: rowsCount.count,
|
|
173
|
-
data: arr,
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
res.json(data)
|
|
177
|
-
})
|
|
178
|
-
|
|
179
127
|
//check status user login in session
|
|
180
128
|
router.put('/zuser-session', csrfProtection, async (req, res) => {
|
|
181
129
|
let json = Util.flashError('err')
|