detail-notify-service.js
987 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
38
39
40
41
42
43
44
'use strict';
const api = require('./detail-notify-api');
const _ = require('lodash');
const add = api.addNotifyAsync;
const cancel = api.cancelNotifyAsync;
const show = (sku, uid) => {
return api.getNotifyStatusAsync(sku, uid).then((result) => {
if (result.code === 200) {
if (!_.isEmpty(result.data)) {
return {
code: 200,
data: {
status: 'Y'
},
message: '已添加通知'
};
} else {
return {
code: 200,
data: {
status: 'N'
},
message: '没有添加通知'
};
}
} else {
return {
code: 401,
message: '服务器错误'
};
}
});
};
module.exports = {
add,
show,
cancel
};