garyvv /
node-sharp
| 1 | const Response = require('../util/response') |
||
| 2 | const Validate = require('../util/validate') |
||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
| 3 | const General = require('../helpers/general') |
||
|
0 ignored issues
–
show
|
|||
| 4 | const ApiError = require('../util/api_error') |
||
| 5 | |||
| 6 | module.exports = { |
||
| 7 | |||
| 8 | detail: async function (ctx) { |
||
| 9 | let templateId = ctx.params.templateId |
||
| 10 | |||
| 11 | let templateInfo = { |
||
| 12 | 'id': templateId, |
||
| 13 | 'image': 'http://tools.miaoke.tech/images/card/bg' + templateId + '.png', |
||
| 14 | } |
||
| 15 | |||
| 16 | switch (templateId) { |
||
| 17 | case '1': |
||
| 18 | templateInfo.avatar = { |
||
| 19 | 'width': '6.6', |
||
| 20 | 'height': '6.6', |
||
| 21 | 'marginTop': '3.9' |
||
| 22 | } |
||
| 23 | templateInfo.textarea = { |
||
| 24 | 'marginTop': '2.8', |
||
| 25 | 'color': '#fff', |
||
| 26 | 'family': '' |
||
| 27 | } |
||
| 28 | break |
||
| 29 | case '2': |
||
| 30 | templateInfo.avatar = { |
||
| 31 | 'width': '6.6', |
||
| 32 | 'height': '6.6', |
||
| 33 | 'marginTop': '5' |
||
| 34 | } |
||
| 35 | templateInfo.textarea = { |
||
| 36 | 'marginTop': '2.8', |
||
| 37 | 'color': '#fff', |
||
| 38 | 'family': '' |
||
| 39 | } |
||
| 40 | break |
||
| 41 | case '3': |
||
| 42 | templateInfo.avatar = { |
||
| 43 | 'width': '7', |
||
| 44 | 'height': '7', |
||
| 45 | 'marginTop': '4.4' |
||
| 46 | } |
||
| 47 | templateInfo.textarea = { |
||
| 48 | 'marginTop': '2.8', |
||
| 49 | 'color': '#fff', |
||
| 50 | 'family': '' |
||
| 51 | } |
||
| 52 | break |
||
| 53 | default: |
||
| 54 | throw new ApiError('common.notExist', '模板ID') |
||
| 55 | break |
||
|
0 ignored issues
–
show
|
|||
| 56 | } |
||
| 57 | |||
| 58 | return Response.output(ctx, templateInfo) |
||
| 59 | }, |
||
| 60 | |||
| 61 | |||
| 62 | } |