Showing
2 changed files
with
43 additions
and
1 deletions
1 | 'use strict'; | 1 | 'use strict'; |
2 | +const SeoIndexModel = require('./models/seo/index'); | ||
2 | 3 | ||
3 | const index = (req, res) => { | 4 | const index = (req, res) => { |
4 | - res.render('seo/index'); | 5 | + return req.ctx(SeoIndexModel).searchMipHandle(res.query).then(result => { |
6 | + res.render('seo/index', result); | ||
7 | + }); | ||
5 | }; | 8 | }; |
6 | 9 | ||
7 | module.exports = { | 10 | module.exports = { |
apps/models/seo/index.js
0 → 100644
1 | +'use strict'; | ||
2 | +const _ = require('lodash'); | ||
3 | + | ||
4 | +class SeoIndexModel extends global.yoho.BaseModel { | ||
5 | + constructor(ctx) { | ||
6 | + super(ctx); | ||
7 | + } | ||
8 | + | ||
9 | + searchMipHandle(params) { | ||
10 | + return Promise.all([ | ||
11 | + this.searchList(params), | ||
12 | + this.searchList(params), | ||
13 | + this.searchList(params) | ||
14 | + ]).then(rdata => { | ||
15 | + console.log(rdata, ' --- '); | ||
16 | + return rdata; | ||
17 | + }); | ||
18 | + } | ||
19 | + | ||
20 | + searchList(params) { | ||
21 | + params = _.assign({ | ||
22 | + limit: 60, | ||
23 | + status: 1, | ||
24 | + sales: 'Y', | ||
25 | + stocknumber: 1, | ||
26 | + method: 'app.search.li', | ||
27 | + attribute_not: 2 | ||
28 | + }, params); | ||
29 | + | ||
30 | + return this.get({ | ||
31 | + data: params, | ||
32 | + param: { | ||
33 | + cache: true | ||
34 | + } | ||
35 | + }); | ||
36 | + } | ||
37 | +} | ||
38 | + | ||
39 | +module.exports = SeoIndexModel; |
-
Please register or login to post a comment