schoollist.js
881 Bytes
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
import { getUrlParams } from './utils';
export function schoolList(count) {
const list = [];
for (let i = 0; i < count; i += 1) {
list.push({
key: i,
id: `fake-list-${i}`,
name:`学校名字-${i}`,
corp:`企业号代码${i}`,
avatar:'XXX',
updatedAt: new Date(new Date().getTime() - (1000 * 60 * 60 * 2 * i)),
createdAt: new Date(new Date().getTime() - (1000 * 60 * 60 * 2 * i)),
});
}
return list;
}
export function getSchoolLists(req, res, u) {
let url = u;
if (!url || Object.prototype.toString.call(url) !== '[object String]') {
url = req.url; // eslint-disable-line
}
const params = getUrlParams(url);
const count = (params.pageSize * 1) || 20;
const result = schoolList(count);
if (res && res.json) {
res.json(result);
} else {
return result;
}
}