detail-notify-service.js
1.23 KB
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
45
46
'use strict';
const DetailNotifyApi = require('./detail-notify-api');
const _ = require('lodash');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
this.api = new DetailNotifyApi(ctx);
this.add = this.api.addNotifyAsync.bind(this.api);
this.cancel = this.api.cancelNotifyAsync.bind(this.api);
}
show(sku, uid) {
return this.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: '服务器错误'
};
}
});
}
};